Skip to content
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

add support for default_version in control file #153

Merged
merged 17 commits into from
Jan 3, 2024
Merged

Conversation

imor
Copy link
Contributor

@imor imor commented Dec 5, 2023

What kind of change does this PR introduce?

feature

What is the current behavior?

default_version key in the control file is not sent to the backend when a user runs dbdev publish. This results in TLE's default version being the first installed version which is usually the oldest version.

What is the new behavior?

The default_version is now tracked in the app.packages table in the default_version_struct and default_version columns. The dbdev CLI also sends the default_version from the control file to the backend when running dbdev publish command. The CLI also checks that the default_version in the control file is one of the valid versions of the package. The in-db client has been updated to fetch the default_version from the public.packages view and call the pgtle.set_default_version function.

Because old dbdev CLI versions are not aware of default_version, the default_version_struct and default_version columns in app.packages are nullable for backward compatibility with those older CLI versions.

Additional context

Fixes #147

Copy link

vercel bot commented Dec 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dbdev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2024 0:02am

@imor imor marked this pull request as ready for review December 5, 2023 15:57
@olirice olirice self-requested a review December 5, 2023 16:33
Copy link
Contributor

@olirice olirice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because old dbdev CLI versions are not aware of default_version, the default_version_struct and default_version columns in app.packages are nullable for backward compatibility with those older CLI versions.

The current user base is like 5 people and we're pre-1.0. I think it's worth taking a breaking change thats solvable with a CLI upgrade to avoid having to make the field nullable at this point. wdyt?

@imor
Copy link
Contributor Author

imor commented Jan 3, 2024

Because old dbdev CLI versions are not aware of default_version, the default_version_struct and default_version columns in app.packages are nullable for backward compatibility with those older CLI versions.

The current user base is like 5 people and we're pre-1.0. I think it's worth taking a breaking change thats solvable with a CLI upgrade to avoid having to make the field nullable at this point. wdyt?

default_version is important to be set so making it non-nullable definitely reduces chances of bugs with the added benefit of making the code in this PR a lot simpler. So let me make this change.

-- default_version column has a default value '0.0.0' only temporarily because the column is not null.
-- It will be removed below.
alter table app.packages
add column default_version_struct app.semver not null default app.text_to_semver('0.0.0'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default_version_struct is not longer nullable.

Comment on lines +70 to +72
if default_version is null then
raise exception 'default_version is required. If you are on `dbdev` CLI version 0.1.5 or older upgrade to the latest version.';
end if;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the client doesn't send default_version we hint in the error message for older clients to be upgraded to the latest.

@imor imor requested a review from olirice January 3, 2024 12:05
@olirice olirice merged commit 9319d71 into master Jan 3, 2024
6 checks passed
@olirice olirice deleted the add_default_version branch January 3, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use default_version information from control file
3 participants