From 9dc9761a1aebc9403ea4beabe95929a07b865083 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Mon, 22 Nov 2021 20:11:58 +0100 Subject: [PATCH] extend skill name to 50 chars #58 --- app.py | 2 +- ki/models.py | 2 +- ...977cbda_extend_skill_length_to_50_chars.py | 24 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 migrations/versions/b5023977cbda_extend_skill_length_to_50_chars.py diff --git a/app.py b/app.py index 818502f..b2cc263 100644 --- a/app.py +++ b/app.py @@ -38,7 +38,7 @@ app.config["KI_LDAP_BASE_DN"] = os.getenv("KI_LDAP_BASE_DN") CORS(app) db = SQLAlchemy(app) -migrate = Migrate(app, db) +migrate = Migrate(app, db, compare_type=True) logging.debug("Hello from KI") diff --git a/ki/models.py b/ki/models.py index 1347e8e..c4bac66 100644 --- a/ki/models.py +++ b/ki/models.py @@ -149,7 +149,7 @@ class Skill(db.Model): __tablename__ = "skill" id = Column(Integer, primary_key=True) - name = Column(String(25), unique=True, nullable=False) + name = Column(String(50), unique=True, nullable=False) profiles = relationship("ProfileSkill", back_populates="skill") searchtopics = relationship("ProfileSearchtopic", back_populates="skill") diff --git a/migrations/versions/b5023977cbda_extend_skill_length_to_50_chars.py b/migrations/versions/b5023977cbda_extend_skill_length_to_50_chars.py new file mode 100644 index 0000000..30e181b --- /dev/null +++ b/migrations/versions/b5023977cbda_extend_skill_length_to_50_chars.py @@ -0,0 +1,24 @@ +"""extend skill length to 50 chars + +Revision ID: b5023977cbda +Revises: 459520b01f34 +Create Date: 2021-11-22 20:07:19.188217 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'b5023977cbda' +down_revision = '459520b01f34' +branch_labels = None +depends_on = None + + +def upgrade(): + with op.batch_alter_table("skill") as batch_op: + batch_op.alter_column('name', + existing_type=sa.VARCHAR(length=25), + type_=sa.String(length=50), + existing_nullable=False)