From c25952cc6ada50f41facb2fcfbb6d7e793213822 Mon Sep 17 00:00:00 2001 From: kovacspe Date: Sat, 23 Nov 2024 16:16:50 +0100 Subject: [PATCH] Add update sequence script --- data_migration/README.md | 2 +- data_migration/data_dump.py | 5 ++++- data_migration/update_sequences.sql | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 data_migration/update_sequences.sql diff --git a/data_migration/README.md b/data_migration/README.md index 9561567..286236a 100644 --- a/data_migration/README.md +++ b/data_migration/README.md @@ -15,4 +15,4 @@ Postup migrácie dát na web: 4. `problems.csv` - Do `competition_problems` 5. `events.csv` - Do `competition_event` 6. `publications.csv` - Do `competition_publication` -8. +8. Pustiť skript pre úpravu sekvencií `update_sequences.sql` diff --git a/data_migration/data_dump.py b/data_migration/data_dump.py index ae2364c..969fcc0 100644 --- a/data_migration/data_dump.py +++ b/data_migration/data_dump.py @@ -169,10 +169,13 @@ def build_grades_dictionary(): for grade in grades: grade_dict[grade['fields']['tag']] = { 'id': grade['pk'], - 'name': grade['name']['name'], + 'name': grade['fields']['name'], 'tag': grade['fields']['tag'], 'years_until_graduation': grade['fields']['years_until_graduation'] } + grade_dict['S5'] = grade_dict['S4'] + grade_dict[''] = {'id': '', 'name': '', + 'tag': '', 'years_until_graduation': ''} return grade_dict diff --git a/data_migration/update_sequences.sql b/data_migration/update_sequences.sql new file mode 100644 index 0000000..576578d --- /dev/null +++ b/data_migration/update_sequences.sql @@ -0,0 +1,4 @@ +SELECT setval('competition_event_id_seq', 160, true); +SELECT setval('competition_series_id_seq', 160, true); +SELECT setval('competition_problem_id_seq', 1000, true); +SELECT setval('competition_publication_id_seq', 350, true); \ No newline at end of file