Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/example-data.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"_migration_index": 101,
"_migration_index": 102,
"gender":{
"1":{
"id": 1,
Expand Down
2 changes: 1 addition & 1 deletion data/initial-data.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"_migration_index": 101,
"_migration_index": 102,
"gender":{
"1":{
"id": 1,
Expand Down
2 changes: 1 addition & 1 deletion openslides_backend/migrations/migration_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ def execute_migrations(self) -> None:
mig_class = MigrationHelper.get_migration_class(package_name)
self.logger.info("Executing migration: " + package_name)

stash = mig_class.data_preparation(self.migration_cursor)
self.apply_schema_diff(index)
# Execute user defined functions or super classes noop.
stash = mig_class.data_preparation(self.migration_cursor)
mig_class.data_definition(self.migration_cursor)
mig_class.data_manipulation(self.migration_cursor, stash)
mig_class.cleanup(self.migration_cursor)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
from psycopg import Cursor
from psycopg.rows import DictRow

from openslides_backend.migrations.base import BaseMigration


class Migration(BaseMigration):
"""
To mitigate the effects of the changes made to the trigger naming system a while back,
all triggers should be blanket thrown away and recreated.
This migration does that.
"""

ORIGIN_COLLECTIONS = [
"action_worker",
"agenda_item",
"assignment",
"assignment_candidate",
"chat_group",
"chat_message",
"committee",
"gender",
"group",
"history_entry",
"history_position",
"import_preview",
"list_of_speakers",
"mediafile",
"meeting",
"meeting_mediafile",
"meeting_user",
"motion",
"motion_block",
"motion_category",
"motion_change_recommendation",
"motion_comment",
"motion_comment_section",
"motion_editor",
"motion_state",
"motion_submitter",
"motion_supporter",
"motion_workflow",
"motion_working_group_speaker",
"option",
"organization",
"organization_tag",
"personal_note",
"point_of_order_category",
"poll",
"poll_candidate",
"poll_candidate_list",
"projection",
"projector",
"projector_countdown",
"projector_message",
"speaker",
"structure_level",
"structure_level_list_of_speakers",
"tag",
"theme",
"topic",
"user",
"vote",
]

@staticmethod
def data_preparation(curs: Cursor[DictRow]) -> None:
"""
Abuses the data preparation method a bit to delete all triggers.
"""
for trigger in curs.execute(
"SELECT event_object_table, trigger_name FROM information_schema.triggers GROUP BY event_object_table, trigger_name;"
).fetchall():
eot = trigger["event_object_table"]
tn = trigger["trigger_name"]
curs.execute(f"DROP TRIGGER {tn} ON {eot};\n")

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from openslides_backend.migrations.base import BaseMigration


class Migration(BaseMigration):
"""
Introduces the new meeting setting motions_enable_consultation_sequence.
Sets it to false on all old meetings.
"""

ORIGIN_COLLECTIONS = ["meeting"]
Loading
Loading