Skip to content

Fix renumbering of motions in categories - #3903

Merged
vkrasnovyd merged 23 commits into
OpenSlides:mainfrom
vkrasnovyd:fix-motions-renumbering
Dec 2, 2026
Merged

vkrasnovyd merged 23 commits into
OpenSlides:mainfrom
vkrasnovyd:fix-motions-renumbering

Conversation

@vkrasnovyd

@vkrasnovyd vkrasnovyd commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Closes: OpenSlides/OpenSlides#7228
Needs OpenSlides/openslides-meta#651

This PR:

  1. Migrates the indexes and unique constraints to match Remove redundant indexes, make unique deferrable openslides-meta#651.

  2. Resolves naming inconsistency introduces by the initial implementation of migration 100: most of the indexes and unique constraints had names generated by PostgreSQL instead of the names from the schema. Structured examples:

    2.1 Unique constraint on regular table:
    "meeting_m_external_id_key" UNIQUE CONSTRAINT, btree (external_id) -> rename

    2.2 unique together:
    "meeting_mediafile_m_mediafile_id_meeting_id_key" UNIQUE CONSTRAINT, btree (mediafile_id, meeting_id)
    "mediafile_m_title_parent_id_owner_id_key" UNIQUE CONSTRAINT, btree (title, parent_id, owner_id) NULLS NOT DISTINCT

    2.3 sequence_scope
    "assignment_m_sequential_number_meeting_id_key" UNIQUE CONSTRAINT, btree (sequential_number, meeting_id)

    2.4 1-1 relation:
    "idx_meeting_t_default_group_id" btree (default_group_id)
    "meeting_m_default_group_id_idx" btree (default_group_id)
    "meeting_m_default_group_id_key" UNIQUE CONSTRAINT, btree (default_group_id)

    2.5 generic relation
    "list_of_speakers_t_pkey" PRIMARY KEY, btree (id)
    "idx_list_of_speakers_t_content_object_id_assignment_id" btree (content_object_id_assignment_id)
    "idx_list_of_speakers_t_content_object_id_meeting_mediafile_id" btree (content_object_id_meeting_mediafile_id)
    "idx_list_of_speakers_t_content_object_id_motion_block_id" btree (content_object_id_motion_block_id)
    "idx_list_of_speakers_t_content_object_id_motion_id" btree (content_object_id_motion_id)
    "idx_list_of_speakers_t_content_object_id_topic_id" btree (content_object_id_topic_id)
    "idx_list_of_speakers_t_meeting_id" btree (meeting_id)
    "unique_list_of_speakers_content_object_id_assignment_id" UNIQUE CONSTRAINT, btree (content_object_id_assignment_id)
    "unique_list_of_speakers_content_object_id_meeting_mediafile_id" UNIQUE CONSTRAINT, btree (content_object_id_meeting_mediafile_id)
    "unique_list_of_speakers_content_object_id_motion_block_id" UNIQUE CONSTRAINT, btree (content_object_id_motion_block_id)
    "unique_list_of_speakers_content_object_id_motion_id" UNIQUE CONSTRAINT, btree (content_object_id_motion_id)
    "unique_list_of_speakers_content_object_id_topic_id" UNIQUE CONSTRAINT, btree (content_object_id_topic_id)
    "unique_list_of_speakers_sequential_number_meeting_id" UNIQUE CONSTRAINT, btree (sequential_number, meeting_id)

    2.6 nm: drop + recreate (nm_chat_group_read_group_ids_group_t)
    "nm_chat_group_read_group_ids_group_m_pkey" PRIMARY KEY, btree (chat_group_id, group_id)
    "nm_chat_group_read_group_ids_group_m_chat_group_id_idx" btree (chat_group_id)
    "nm_chat_group_read_group_ids_group_m_group_id_idx" btree (group_id)

    2.7 gm: drop + recreate (gm_tag_tagged_ids_t)
    "gm_tag_tagged_ids_m_tag_id_idx" btree (tag_id)
    "gm_tag_tagged_ids_m_tag_id_tagged_id_key" UNIQUE CONSTRAINT, btree (tag_id, tagged_id)
    "gm_tag_tagged_ids_m_tagged_id_agenda_item_id_idx" btree (tagged_id_agenda_item_id)
    "gm_tag_tagged_ids_m_tagged_id_assignment_id_idx" btree (tagged_id_assignment_id)
    "gm_tag_tagged_ids_m_tagged_id_idx" btree (tagged_id)
    "gm_tag_tagged_ids_m_tagged_id_motion_id_idx" btree (tagged_id_motion_id)

openslides_backend/migrations/migrations/mig_0103_update_indexes/indexes.py is generated by code removed from migration.py in 1bb18dc

  1. Changes DatabaseWriter and defers unique constraint for MotionCategoryNumberMotions.

@vkrasnovyd
vkrasnovyd force-pushed the fix-motions-renumbering branch from 5055890 to 2f4fba4 Compare November 26, 2026 15:22
@vkrasnovyd vkrasnovyd assigned vkrasnovyd and unassigned hjanott Nov 26, 2026
@vkrasnovyd
vkrasnovyd requested review from luisa-beerboom and removed request for hjanott November 30, 2026 15:57
@m-schieder m-schieder added the migration Introduces a new migration label Nov 30, 2026
Comment thread openslides_backend/action/action.py Resolved
Co-authored-by: luisa-beerboom <101706784+luisa-beerboom@users.noreply.github.com>
vkrasnovyd and others added 2 commits December 1, 2026 15:00
…es/migration.py

Co-authored-by: luisa-beerboom <101706784+luisa-beerboom@users.noreply.github.com>

@luisa-beerboom luisa-beerboom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just minor things

Comment thread openslides_backend/action/action.py Resolved
@vkrasnovyd
vkrasnovyd merged commit ad966a8 into OpenSlides:main Dec 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug migration Introduces a new migration staging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix renumbering of motions in categories

4 participants