-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Improve documentation about TLE upgrades #164
Comments
Hi @point-source, We are still working on improving the docs, but to get you unblocked I will try to answer your questions here.
Yes, users may have any previous version already installed when they upgrade to a new one.
In general yes, if you don't then the upgrade will fail with errors like
You don't need to write an upgrade from every lower version to current version. For example, let's say you published
create table greetings (name text); Your users have created this extension with
alter table greetings add column kind text; Then your users will be able to do an Now when you are ready to publish version
You write any code to migrate the data in the new version file. The data will stay in the tables unless the new version code deletes them or the extension is dropped. Do you have any specific example in mind which you think will be hard to migrate?
In general you treat a new version as a normal database migration and use similar techniques e.g. by copying data into temp tables etc. Again do you have a specific example in mind that you can share?
Users can upgrade directly from
The objects created by a previous version of the extension will not be dropped during an upgrade unless the upgrade sql file explicitly does so or the extension is dropped by the user. TLEs are not different from normal Postgres extensions when it comes to updates. So you can more read about how Postgres handles updates in the docs. Hope this answers all of your questions. |
@imor thank you so much! I actually didn't realize that TLEs were built on top of existing (and already documented) extension infrastructure. Supabase was my intro to postgres and as such, supabase and database.dev are my intro to TLEs, which I now realize are built on native postregres extensions. So because of this, I didn't know about update scripts at all. I didn't know you could add the from and to versions in the file name like that. As I have already released at least one update, my files are currently called Asked another way, are files with only a single version in the name (not update scripts) only useful for initial installs or are they ever going to be used during the upgrade process as well? |
TLEs are like normal extensions in many ways and most of the information in the docs applies to them as much as to normal extensions. A few differences worth noting are:
If there is no upgrade file then a user can't run an
They are only useful only during the initial installs. During an upgrade only upgrade files are used, although these can also be used during an initial install if the version file is missing. E.g. if there are |
Perfect. Thanks, that all makes sense. Would you recommend I hold off on releasing updates then until the pg_tle tool is fixed? And shall I leave this ticket open awaiting improved docs or close it now that my questions are answered? |
If you published the upgrade files the users wouldn't be able make use of them due to the bug so It's best to wait. Yes, please leave the ticket open as it contains a lot of useful information and we still need to document all this. I'll close other tickets requesting the same information redirecting them here instead. |
Improve documentation
I do not see a page which addresses or explains how TLE updates are supposed to be written and applied
Describe the problem
As a developer, I cannot figure out how to safely write a new version:
As a user, I cannot tell how to upgrade a TLE or what to expect when I do. For example:
Describe the improvement
I would like extensive documentation and examples of how devs are expecting to write and provide TLE updates. I would also like a list of best practices, warnings, errors, and dangers that could result from not following the guidelines. Overall this system currently feels opaque and risky for both devs and users.
Additional context
I was asked if I could provide my package as a TLE, which I did but I am now unsure how to update it. I asked a while ago but didn't get a response and now my users are asking me. I also have an update I'd like to push. This also overlaps the user-focused issue here.
The text was updated successfully, but these errors were encountered: