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

Upgrade path for Gramps 6.0/database schema version 21 #596

Open
DavidMStraub opened this issue Jan 1, 2025 · 7 comments
Open

Upgrade path for Gramps 6.0/database schema version 21 #596

DavidMStraub opened this issue Jan 1, 2025 · 7 comments

Comments

@DavidMStraub
Copy link
Member

DavidMStraub commented Jan 1, 2025

@Nick-Hall, @dsblank - I am worried about how to best ensure a smooth upgrade path for Gramps Web (API) users when we switch to JSON data.

So far, the only schema change that needed to be handled during the existence of Gramps Web API was the 5.1 → 5.2 migration, for which we added

  • the python -m gramps_webapi grampsdb --tree <sometreeid> migrate CLI command
  • the /api/trees/<sometreeid>/migrate endpoint

Under the hood, these two commands simply call the database load method with force_schema_upgrade set to True.

However, that schema change was only a change to the pickled data, not to the table schema, so it also played nicely with the SharedPostgreSQL addon, which uses a single table to host many trees.

As far as I can see, for SQLite this should work as well for the schema 21 migration. Can you confirm?

For the "normal" PostgreSQL addon, are you planning a JSON compatible version @dsblank?

For SharedPostgreSQL, it seems I will have to implement the changes analogous to the ones made in PR gramps-project/gramps#1786 to dbapi.py, e.g. write JSON instead of blobs and implement the upgrade_table_for_json_data method.

What is the timescale for 6.0 release, so we can plan the migrations for Gramps Web (API) accordingly?

@Nick-Hall
Copy link
Member

What is the timescale for 6.0 release

We haven't decided yet, but I have time available in the next couple of months.

@dsblank
Copy link
Member

dsblank commented Jan 2, 2025

For the "normal" PostgreSQL addon, are you planning a JSON compatible version @dsblank?

Looking over the code, I don't see anything that needs to be updated. We might need to make some changes if we use JSON extract (and other functions) for direct access to json_data but nothing in master requires that.

@dsblank
Copy link
Member

dsblank commented Jan 2, 2025

@DavidMStraub
Copy link
Member Author

Oh right, and the rest is handled by the DBAPI class. In SharedPostgreSQL, more changes will be needed because it has its own DBAPI class (https://github.com/gramps-project/addons-source/blob/maintenance/gramps52/SharedPostgreSQL/shareddbapi.py).

@DavidMStraub DavidMStraub changed the title Upgrade path for Gramps 6.0/database schema version 21? Upgrade path for Gramps 6.0/database schema version 21 Jan 12, 2025
@DavidMStraub DavidMStraub moved this to High Priority in Gramps Web Roadmap Jan 12, 2025
@DavidMStraub
Copy link
Member Author

Oh, we'll have to add a postgresql version for column_exists():

https://github.com/gramps-project/gramps/pull/1786/files#diff-cfacb207e7d622fcd6347dd49344d3542912b9524f4da789fdfcb16bfbf3be51R194

@dsblank are you planning to implement that? It would be good if we have the Postgres addon updated in time for the 6.0 release.

@dsblank
Copy link
Member

dsblank commented Jan 30, 2025

@DavidMStraub I don't really have a postgresql dev environment, and don't know postgresql. Probably better left into the hands of someone else. But I'd be glad to review.

@DavidMStraub
Copy link
Member Author

I thought because you're the original author of the plugin 😆 but I can give it a try as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: High Priority
Development

No branches or pull requests

3 participants