Repository navigation
[vote][dammi] Migration for the new Vote Service - #3737
vkrasnovyd wants to merge 140 commits into
Conversation
* apply sql diff * change base test * cleanup get_stats/count method * improve exception stats output * handle listdir patching in migrate_previous * fix create_schema * implement new directory structure for migration module and schema_diff * add migration_number to basemigtestcase * remove finalization states and add migration finished state * decuple BaseMigration and BaseMigrationRouteTestCase * remove finalize command * use only empty values within replace tables * fix followup errors due to failing tests and continuing migration thread * deactivate notify triggers during migration and reactivate on reset * Move copy table to migration helper. * improve exception handling
… into feature/dammi
* improve file handling * generate whole new collections * more constraint cases and new function for altered fields * Handle remove and rename tree * safely access GenerateCodeBlocks variables
* centralize models variables * collect alter_views conditionally and recreate in the end * extract get_view_field_state_write_fields * debug main functions with make test-file * improve variable names and reuse code in cli util * centralize and restructure RENAME --------- Co-authored-by: Viktoriia Krasnovyd <114735598+vkrasnovyd@users.noreply.github.com>
…ides#3711) * generate from CodeBlocks call * centralize code block information * implement rename inline constraints and other constraints and triggers * move rename code to RenameHelper
16910e8 to
c768043
Compare
| fail_under = 95 | ||
| omit = | ||
| tests/* | ||
| migrations/* |
There was a problem hiding this comment.
Directory does not exist since rel-db.
| if table == "public.truncate_tables": | ||
| continue | ||
|
|
There was a problem hiding this comment.
store_table_names() inserts into public.truncate_tables.
Attempt to run action/presenter tests right after the migration tests in the dev-setup triggered recursive writing into truncate_tables which led to the database error. This check fixes this problem.
luisa-beerboom
left a comment
There was a problem hiding this comment.
Will finish reviewing next week
| poll.content_object_id LIKE 'motion/%%' | ||
| OR ( | ||
| poll.content_object_id LIKE 'assignment/%%' | ||
| AND ( | ||
| option.content_object_id LIKE 'poll_candidate_list/%%' | ||
| OR ( | ||
| option.content_object_id LIKE 'user/%%' |
There was a problem hiding this comment.
Since % stands for 0 or more characters, %% would also stand for 0 or more characters.
Were these supposed to be _%?
There was a problem hiding this comment.
There are also a bunch more places like it below
There was a problem hiding this comment.
In short, I'm using the first % as an escape sign for the second % in a query built as sql.SQL().format().
Because of using the format, single % is interpreted as a broken placeholder, while %% is interpreted as %. So filter poll.content_object_id LIKE 'motion/%%' is interpreted as poll.content_object_id LIKE 'motion/%' and the query is executed correctly.
Needs OpenSlides/openslides-meta#584
How the collections should be migrated is described in Migration.md
schema_diff.sqlfor this migration is not fully generated: it contains multiple manual edits.PR includes changes to the migration framework:
Cursor (along with the logger) is passed to the migration class on init. Both cursor and logger are used in the new method
execute_querythat also logs the executed query witht the arguments for the debugging purposes.Introduces 2 new generated files (both used in the new migration):
Still WIP: tests for the new migration route pre-check.