server/func/tags: allow tags to have longer names
This commit is contained in:
parent
ed83e11552
commit
c60ec22b92
3 changed files with 45 additions and 2 deletions
|
@ -0,0 +1,43 @@
|
||||||
|
'''
|
||||||
|
Longer tag names
|
||||||
|
|
||||||
|
Revision ID: 1e280b5d5df1
|
||||||
|
Created at: 2020-03-15 18:57:12.901148
|
||||||
|
'''
|
||||||
|
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
|
||||||
|
revision = '1e280b5d5df1'
|
||||||
|
down_revision = '52d6ea6584b8'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.alter_column(
|
||||||
|
'tag_name', 'name',
|
||||||
|
type_=sa.Unicode(128),
|
||||||
|
existing_type=sa.Unicode(64),
|
||||||
|
existing_nullable=False)
|
||||||
|
|
||||||
|
op.alter_column(
|
||||||
|
'snapshot', 'resource_name',
|
||||||
|
type_=sa.Unicode(128),
|
||||||
|
existing_type=sa.Unicode(64),
|
||||||
|
existing_nullable=False)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.alter_column(
|
||||||
|
'tag_name', 'name',
|
||||||
|
type_=sa.Unicode(64),
|
||||||
|
existing_type=sa.Unicode(128),
|
||||||
|
existing_nullable=False)
|
||||||
|
|
||||||
|
op.alter_column(
|
||||||
|
'snapshot', 'resource_name',
|
||||||
|
type_=sa.Unicode(64),
|
||||||
|
existing_type=sa.Unicode(128),
|
||||||
|
existing_nullable=False)
|
|
@ -18,7 +18,7 @@ class Snapshot(Base):
|
||||||
resource_pkey = sa.Column(
|
resource_pkey = sa.Column(
|
||||||
'resource_pkey', sa.Integer, nullable=False, index=True)
|
'resource_pkey', sa.Integer, nullable=False, index=True)
|
||||||
resource_name = sa.Column(
|
resource_name = sa.Column(
|
||||||
'resource_name', sa.Unicode(64), nullable=False)
|
'resource_name', sa.Unicode(128), nullable=False)
|
||||||
user_id = sa.Column(
|
user_id = sa.Column(
|
||||||
'user_id',
|
'user_id',
|
||||||
sa.Integer,
|
sa.Integer,
|
||||||
|
|
|
@ -59,7 +59,7 @@ class TagName(Base):
|
||||||
sa.ForeignKey('tag.id'),
|
sa.ForeignKey('tag.id'),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
index=True)
|
index=True)
|
||||||
name = sa.Column('name', sa.Unicode(64), nullable=False, unique=True)
|
name = sa.Column('name', sa.Unicode(128), nullable=False, unique=True)
|
||||||
order = sa.Column('ord', sa.Integer, nullable=False, index=True)
|
order = sa.Column('ord', sa.Integer, nullable=False, index=True)
|
||||||
|
|
||||||
def __init__(self, name: str, order: int) -> None:
|
def __init__(self, name: str, order: int) -> None:
|
||||||
|
|
Loading…
Reference in a new issue