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

no licenses in fresh install #1088

Open
kosarko opened this issue Nov 14, 2023 · 2 comments
Open

no licenses in fresh install #1088

kosarko opened this issue Nov 14, 2023 · 2 comments
Labels

Comments

@kosarko
Copy link
Member

kosarko commented Nov 14, 2023

Fresh install should contain at least the licenses available in open license selector

@kosarko kosarko added the v7 label Nov 14, 2023
@kosarko
Copy link
Member Author

kosarko commented Oct 10, 2024

tracked as dataquest-dev#592

@kosarko
Copy link
Member Author

kosarko commented Nov 5, 2024

an initial licenses creation sql can be created by using the upgraded database with something like:

# on "pump machine"
sudo -u postgres pg_dump -t license_label -t license_label_extended_mapping -t license_definition  --data-only --column-inserts dspace | sed -e '/public.license_label_extended_mapping/s#mapping_id,##;/public.license_label_extended_mapping/s#VALUES ([0-9]*,#VALUES (#' | grep -v "setval('public.license_label_extended_mapping_mapping_id_seq'" | awk 'BEGIN{print("BEGIN;");print("insert into user_registration(user_registration_id) select i from (values (4),(5),(20),(84)) as X(i);")} END{print("update public.license_definition set user_registration_id = 1;");print("DELETE FROM public.user_registration where user_registration_id >1;");print("COMMIT;")} {print}' | gzip > /tmp/license_labels.sql.gz
#scp
# on fresh machine
zcat /tmp/license_labels.sql.gz | sudo -u postgres psql dspace

what it does:

  • dump the relevant tables
  • remove the mapping_id (values) from the license_label_extended_mapping, so they get autogenerated
  • remove the sequence update
  • modify the sql so it runs inside a transaction
  • create temporary user registrations (we need the ids used in the dump)
  • update all the license definitions so they appear to be created by eperson with id 1 (should be admin)
  • delete all user registrations != 1 (ie. the temporary ones)

So it should be run in more or less empty system (because of the user registration inserts/deletes); I guess one might start from the dump and edit manually...

The process hasn't been tested in ~year

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

No branches or pull requests

1 participant