Skip to content

move of osparc.io: make db tables ready for merging #1867

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

Open
37 of 63 tasks
mrnicegyu11 opened this issue Mar 17, 2025 · 3 comments
Open
37 of 63 tasks

move of osparc.io: make db tables ready for merging #1867

mrnicegyu11 opened this issue Mar 17, 2025 · 3 comments
Assignees
Labels
High Priority a totally crucial bug/feature to be fixed asap
Milestone

Comments

@mrnicegyu11
Copy link
Member

mrnicegyu11 commented Mar 17, 2025

The plan is to insert / upsert the DB of osparc into the DB of sim4life. To do this, all osparc postgres tables will be audited and made ready for this procedure. Some tables might be empty (by design), some tables might not need to be moved and can be dropped, and some tables might need adjustments.

In order to avoid collisions in the DB, such as with tables that have monotonically increasing primary keys starting from 1, we have identified two ways to make the DB-tables of osparc.io "ready":

  1. Add a large integer (needs to be determined individually) to all primary keys of osparc.io OR sim4life.io, to avoid collisions. [Note: This doesnt always work, e.g. in the users DB mail adresses are presumably expected to be unique even though they are not enforced to be unique in postgres?
  2. Add the product as a second primary key and thereby make combinations of user-id & product etc. unique.

Likely, both ways would go via a PR with an alembic migration

@sanderegg
Copy link
Member

  • wallet_id is an INTeger and can likely not be changed

@matusdrobuliak66
Copy link
Contributor

matusdrobuliak66 commented Apr 9, 2025

🗃️ Increment INT index

UPDATE folders_v2 SET folder_id = folder_id + 2000000, parent_folder_id = parent_folder_id + 2000000;
select pg_get_serial_sequence('folders_v2', 'folder_id');
SELECT setval('folders_v2_folder_id_seq', (SELECT MAX(folder_id) FROM folders_v2));

To test the value generation after it was moved:

select nextval('folders_v2_folder_id_seq');

@matusdrobuliak66
Copy link
Contributor

Additional Simcore Tasks Before Migration

  • Support users being part of multiple products
    • Fix logout behavior: when a user logs out from one product, it should not log them out from all products
  • Add foreign keys to some tables (e.g., comp*)
  • Remove group 1 (EVERYONE) used for sharing
    • This might cause issues with anonymous users. Should we bind them to a specific product?
    • We want to avoid the "everyone" group so that users in Sim4Life don’t see templates from oSPARC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
High Priority a totally crucial bug/feature to be fixed asap
Projects
None yet
Development

No branches or pull requests

6 participants