-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal for Pulsar Backend versioning system #64
Comments
@Digitalone1 This is beautiful! I sincerely appreciate the work and thought that went into this. And for this solution I am 100% on board. This looks fantastic, and while keeping things sane, allows us the most flexibility now and in the future. Everything here looks awesome, and would be happy to help out wherever possible to get this working properly. As for your last point about already published versions. Once we add the tag to the DB, I'd be more than happy to investigate manually into the published versions to find their actual publication date based on GitHub Tag creation date. I believe it was about 60 items that need this care, so ideally wouldn't take to much time. |
List of changes to make on the database. @confused-Techie mark this steps when you port the new db state on production.
ALTER TABLE versions ADD COLUMN created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE versions ADD COLUMN updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP;
CREATE TRIGGER trigger_now_on_updated_versions
BEFORE UPDATE ON versions
FOR EACH ROW
EXECUTE PROCEDURE now_on_updated_package();
ALTER TABLE versions ADD COLUMN deleted BOOLEAN NOT NULL DEFAULT FALSE; |
It would be awesome to have the real publication date of every version, also those imported by atom, but I don't think this is possible. Anyway I'd like to add an index on semver_vx generated columns and created timestamps. This is not mandatory, but can speed up the sorting stages. But at the moment this won't work because equal semver_vx triples will have the same created timestamps (default at column creation). If we want this, you will have to change manually the timestamps (even adding 1 only ms is enough). This would also help to retrieve the correct latest version for ones that have the same main tag. If there are too many, you can deleted the duplicated non-latest and sort only the latests. |
I can certainly try to update the duplicated non-latest versions. If it does become too much I'll look at either scripting it or (as long as you don't delete the branch) your previous script to do so. But first I'll add the DB changes tomorrow so we can begin that step. And ideally we could script up a one time task that will look through each package, contact the GitHub API and insert proper creation dates into everything. But that can always come later. |
So, after the merge of #62, #65 and #66, an issue came out. The issue
The problem
New versions table designAfter a talk on Discord, we agreed to add new columns to make it easy to construct the response objects sent out by the backend:
Besides, the |
Apply new columns to
|
Since lately there have been lots of discussions on how to resolve our issues regarding the management of the versions of packages, I make a proposal which I think is the best compromise about
A part of the following post is meant to be copied and pasted in a document as guidelines for publishers.
TLDR: Almost the same system as now plus the created timestamp and a few changes which require a refactoring on database queries.
Main guidelines
MAJOR.MINOR.PATCH
format (which from now on we call "main tag") of the semver specification.MAJOR.MINOR.PATCH
format is respected prior to the publication, therefore any version not following the above point is considered bad and it's rejected.MAJOR.MINOR.PATCH-extension
to support alpha/beta/pre-release alternatives.Publishing guidelines
MAJOR.MINOR.PATCH
as long as they differs with the extensions. I.e., publishing1.0.0
,1.0.0-1
and1.0.0-2
is possible.Determining the latest release
0.10.0
is higher than0.9.0
.0.1.2-1
published today and0.1.2
published tomorrow means that0.1.2
will be considered higher than0.1.2-1
. Publishers have to know that and, taken into account that the publication of multiple versions with the same main tag is still discouraged, the dev team won't accept any complaining on this behavior.How to migrate to the new versioning system
versions
table refactoringpackage
,semver
) rather than (package
,semver_vx
, ...). This is because we will support different extensions for the same main tag, so we need to ensure all tags are different for a single package.semver_vx
are kept as they are since we need them to sort the main tags.created
andupdated
columns for versions the same way they were added to the packages table.created
timestamp will be considered so that two versions with the same main tag can be sorted and the latest released is the highest of them.Drop
versions
.status
columnstatus
column of the versions table. This column will be dropped along with its enum type. The reason is quite simple: we sort the versions on the database, so we don't need to signal thelatest
. It's also misleading when channels will be deployed because there will by multiple latest, one for each channel.published
anddeteled
status are redundant and will be replaced by the following point. Optionally a new status column could be used in the future to signal the state of the version (no issues, bugged, unsecure, etc...)deleted
in versions table. Its meaning is self explanatory: true if the version is deleted. Initialize it setting to true if status is deleted; false is its default.versions
.status
column so that it can be definitely dropped. We know how to sort and get the latest version properly.Drop redundant package metadata
data
in packages table. At first sight this might be a disruptive change, but it's not.packages
.data
is redundant data because it's just the package of the latest version, which we already have in versions table. Besides with the introduction of the channels, it's misleading having the package of the latest versions inpackages
table (which channel does it belong?). If we want it, we can join the versions table and we can do it for any channel.Manage the duplicated versions for already published packages
created
column in the versions table, it is initialized with the timestamp of the creation of the column, so it won't contain the effective time of the publication of the version. But we can workaround this issue adding an interval to the versions that are marked aslatest
before dropping the status column, so those versions keep resulting as the latest in case there are other duplicate main tags.If you have some doubts or thoughts, feel free to point them out.
The text was updated successfully, but these errors were encountered: