diff --git a/server/alembic/env.py b/server/alembic/env.py index 687d8b62..d0786a16 100644 --- a/server/alembic/env.py +++ b/server/alembic/env.py @@ -46,7 +46,7 @@ def run_migrations_offline(): """ url = config.get_main_option("sqlalchemy.url") context.configure( - url=url, target_metadata=target_metadata, literal_binds=True + url=url, target_metadata=target_metadata, literal_binds=True, compare_type=True ) with context.begin_transaction(): @@ -68,7 +68,7 @@ def run_migrations_online(): with connectable.connect() as connection: context.configure( - connection=connection, target_metadata=target_metadata + connection=connection, target_metadata=target_metadata, compare_type=True ) with context.begin_transaction(): diff --git a/server/alembic/versions/777453724560_change_dataset_title_length.py b/server/alembic/versions/777453724560_change_dataset_title_length.py new file mode 100644 index 00000000..50bc9fbc --- /dev/null +++ b/server/alembic/versions/777453724560_change_dataset_title_length.py @@ -0,0 +1,34 @@ +"""change dataset title length + +Revision ID: 777453724560 +Revises: bad466dcd0cd +Create Date: 2021-01-29 04:06:38.055487 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + +# revision identifiers, used by Alembic. +revision = '777453724560' +down_revision = 'bad466dcd0cd' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('data_sets', 'title', + existing_type=mysql.VARCHAR(collation='utf8mb4_bin', length=32), + type_=sa.String(length=64), + existing_nullable=False) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('data_sets', 'title', + existing_type=sa.String(length=64), + type_=mysql.VARCHAR(collation='utf8mb4_bin', length=32), + existing_nullable=False) + # ### end Alembic commands ### diff --git a/server/dbcls/api/resources/data_set.py b/server/dbcls/api/resources/data_set.py index 0b3bacc1..7f9242eb 100644 --- a/server/dbcls/api/resources/data_set.py +++ b/server/dbcls/api/resources/data_set.py @@ -238,7 +238,7 @@ def patch(self, id): # DataSetæ›´æ–° if args.get('title') is not None: - data_set.title = args['title'][:32] + data_set.title = args['title'][:64] if args.get('is_public') is not None: data_set.is_public = args['is_public'] db.session.add(data_set) diff --git a/server/dbcls/models.py b/server/dbcls/models.py index 043a296a..fba038e0 100644 --- a/server/dbcls/models.py +++ b/server/dbcls/models.py @@ -16,7 +16,6 @@ class User(db.Model): firebase_uid = db.Column(db.String(255), unique=True, nullable=False) display_name = db.Column(db.String(30), default='', nullable=False) contact_uri = db.Column(db.String(255), default='', nullable=False) - def __repr__(self): return f'' @@ -60,7 +59,7 @@ class DataSet(db.Model): id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False) - title = db.Column(db.String(32), default='', nullable=False) + title = db.Column(db.String(64), default='', nullable=False) path = db.Column(db.String(255), unique=True, nullable=False) content = deferred(db.Column(db.JSON)) upload_at = db.Column(db.DateTime, nullable=False)