From c60ec22b92d9273183d076e630360ee63f6c0a1c Mon Sep 17 00:00:00 2001 From: neobooru <50623835+neobooru@users.noreply.github.com> Date: Sun, 15 Mar 2020 19:01:06 +0100 Subject: [PATCH] server/func/tags: allow tags to have longer names --- .../versions/1e280b5d5df1_longer_tag_names.py | 43 +++++++++++++++++++ server/szurubooru/model/snapshot.py | 2 +- server/szurubooru/model/tag.py | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 server/szurubooru/migrations/versions/1e280b5d5df1_longer_tag_names.py diff --git a/server/szurubooru/migrations/versions/1e280b5d5df1_longer_tag_names.py b/server/szurubooru/migrations/versions/1e280b5d5df1_longer_tag_names.py new file mode 100644 index 00000000..17702914 --- /dev/null +++ b/server/szurubooru/migrations/versions/1e280b5d5df1_longer_tag_names.py @@ -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) diff --git a/server/szurubooru/model/snapshot.py b/server/szurubooru/model/snapshot.py index 7f8bbdf0..7ee3ba6f 100644 --- a/server/szurubooru/model/snapshot.py +++ b/server/szurubooru/model/snapshot.py @@ -18,7 +18,7 @@ class Snapshot(Base): resource_pkey = sa.Column( 'resource_pkey', sa.Integer, nullable=False, index=True) 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.Integer, diff --git a/server/szurubooru/model/tag.py b/server/szurubooru/model/tag.py index 51059007..2af87e74 100644 --- a/server/szurubooru/model/tag.py +++ b/server/szurubooru/model/tag.py @@ -59,7 +59,7 @@ class TagName(Base): sa.ForeignKey('tag.id'), nullable=False, 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) def __init__(self, name: str, order: int) -> None: