summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2016-08-09 12:07:20 -0500
committerKevin Harwell <kharwell@digium.com>2016-08-10 13:49:48 -0500
commitd4170df40a405442ba26dbaf0d8acfd1360533df (patch)
tree72bbf73c1af856be14682c3a9c46e127a03152ec /contrib
parent9042ad40f2a56d6cfd4117897cbc9943253d4e09 (diff)
alembic/sqlalchemy: auto increment only allowed on a single column
The extensions table defined two columns (id and priority) as primary key autoincrement columns. However only one is allowed when defining the primary key. This patch removes the autoincrement attribute from the priority column since it does not need to be as such and really should not have been on there in the first place. This patch also removes 'context', 'exten', and 'priority' from the primary key index and creates a new combined unique contraint index on them. ASTERISK-26183 #close Change-Id: Ib9c712c612a4d7ec1edb0dcb77f1bae0905a470b
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py b/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py
index ecee0e04e..415f5bc25 100755
--- a/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py
+++ b/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py
@@ -31,20 +31,18 @@ down_revision = '43956d550a44'
from alembic import op
import sqlalchemy as sa
-
def upgrade():
op.create_table(
'extensions',
sa.Column('id', sa.BigInteger, primary_key=True, nullable=False,
unique=True, autoincrement=True),
- sa.Column('context', sa.String(40), primary_key=True, nullable=False),
- sa.Column('exten', sa.String(40), primary_key=True, nullable=False),
- sa.Column('priority', sa.Integer, primary_key=True, nullable=False,
- autoincrement=True),
+ sa.Column('context', sa.String(40), nullable=False),
+ sa.Column('exten', sa.String(40), nullable=False),
+ sa.Column('priority', sa.Integer, nullable=False),
sa.Column('app', sa.String(40), nullable=False),
sa.Column('appdata', sa.String(256), nullable=False),
+ sa.UniqueConstraint('context', 'exten', 'priority')
)
-
def downgrade():
op.drop_table('extensions')