From 5a9a415966c00a71eeecf3088439c0710a596b64 Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Wed, 1 Oct 2014 10:19:16 +0200 Subject: [PATCH] Properly disable autoincrement in assoc table - for the chatroom_id FK it's already done automatically by SQLAlchemy - for event_id (not a FK yet) it should be specified in the model, too --- .../migrations/201409291524_1bd6c5129d29_create_tables.py | 3 +-- chat/indico_chat/models/chatrooms.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chat/indico_chat/migrations/201409291524_1bd6c5129d29_create_tables.py b/chat/indico_chat/migrations/201409291524_1bd6c5129d29_create_tables.py index 5d2338d..90f976f 100644 --- a/chat/indico_chat/migrations/201409291524_1bd6c5129d29_create_tables.py +++ b/chat/indico_chat/migrations/201409291524_1bd6c5129d29_create_tables.py @@ -35,8 +35,7 @@ def upgrade(): op.create_table('chatroom_events', sa.Column('event_id', sa.Integer(), nullable=False, primary_key=True, index=True, autoincrement=False), - sa.Column('chatroom_id', sa.Integer(), nullable=False, primary_key=True, index=True, - autoincrement=False), + sa.Column('chatroom_id', sa.Integer(), nullable=False, primary_key=True, index=True), sa.Column('hidden', sa.Boolean(), nullable=False), sa.Column('show_password', sa.Boolean(), nullable=False), sa.ForeignKeyConstraint(['chatroom_id'], ['plugin_chat.chatrooms.id']), diff --git a/chat/indico_chat/models/chatrooms.py b/chat/indico_chat/models/chatrooms.py index b6bf71d..809760c 100644 --- a/chat/indico_chat/models/chatrooms.py +++ b/chat/indico_chat/models/chatrooms.py @@ -114,7 +114,8 @@ class ChatroomEventAssociation(db.Model): event_id = db.Column( db.Integer, primary_key=True, - index=True + index=True, + autoincrement=False ) #: ID of the chatroom chatroom_id = db.Column(