Skip to content

Commit

Permalink
Merge pull request hotosm#6498 from hotosm/fix/partners-attributes-le…
Browse files Browse the repository at this point in the history
…ngth

Partners table atrributes lengths adjusted
  • Loading branch information
ramyaragupathy authored Jul 12, 2024
2 parents 4696687 + dd0bd5d commit 05877fb
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 8 deletions.
16 changes: 8 additions & 8 deletions backend/models/postgis/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ class Partner(db.Model):
__tablename__ = "partners"

id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(50), nullable=False, unique=True)
primary_hashtag = db.Column(db.String(50), nullable=False)
secondary_hashtag = db.Column(db.String(50))
logo_url = db.Column(db.String(100))
link_meta = db.Column(db.String(50))
link_x = db.Column(db.String(50))
link_instagram = db.Column(db.String(50))
name = db.Column(db.String(150), nullable=False, unique=True)
primary_hashtag = db.Column(db.String(200), nullable=False)
secondary_hashtag = db.Column(db.String(200))
logo_url = db.Column(db.String(500))
link_meta = db.Column(db.String(300))
link_x = db.Column(db.String(300))
link_instagram = db.Column(db.String(300))
current_projects = db.Column(db.String)
permalink = db.Column(db.String(250), unique=True)
permalink = db.Column(db.String(500), unique=True)
website_links = db.Column(db.String)

def create(self):
Expand Down
127 changes: 127 additions & 0 deletions migrations/versions/6276c258149c_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
"""empty message
Revision ID: 6276c258149c
Revises: e8ffa33a9c18
Create Date: 2024-07-04 06:02:17.622419
"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "6276c258149c"
down_revision = "e8ffa33a9c18"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("partners", schema=None) as batch_op:
batch_op.alter_column(
"name",
existing_type=sa.VARCHAR(length=50),
type_=sa.String(length=150),
existing_nullable=False,
)
batch_op.alter_column(
"primary_hashtag",
existing_type=sa.VARCHAR(length=50),
type_=sa.String(length=200),
existing_nullable=False,
)
batch_op.alter_column(
"secondary_hashtag",
existing_type=sa.VARCHAR(length=50),
type_=sa.String(length=200),
existing_nullable=True,
)
batch_op.alter_column(
"logo_url",
existing_type=sa.VARCHAR(length=100),
type_=sa.String(length=500),
existing_nullable=True,
)
batch_op.alter_column(
"link_meta",
existing_type=sa.VARCHAR(length=50),
type_=sa.String(length=300),
existing_nullable=True,
)
batch_op.alter_column(
"link_x",
existing_type=sa.VARCHAR(length=50),
type_=sa.String(length=300),
existing_nullable=True,
)
batch_op.alter_column(
"link_instagram",
existing_type=sa.VARCHAR(length=50),
type_=sa.String(length=300),
existing_nullable=True,
)
batch_op.alter_column(
"permalink",
existing_type=sa.VARCHAR(length=250),
type_=sa.String(length=500),
existing_nullable=True,
)

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("partners", schema=None) as batch_op:
batch_op.alter_column(
"permalink",
existing_type=sa.String(length=500),
type_=sa.VARCHAR(length=250),
existing_nullable=True,
)
batch_op.alter_column(
"link_instagram",
existing_type=sa.String(length=300),
type_=sa.VARCHAR(length=50),
existing_nullable=True,
)
batch_op.alter_column(
"link_x",
existing_type=sa.String(length=300),
type_=sa.VARCHAR(length=50),
existing_nullable=True,
)
batch_op.alter_column(
"link_meta",
existing_type=sa.String(length=300),
type_=sa.VARCHAR(length=50),
existing_nullable=True,
)
batch_op.alter_column(
"logo_url",
existing_type=sa.String(length=500),
type_=sa.VARCHAR(length=100),
existing_nullable=True,
)
batch_op.alter_column(
"secondary_hashtag",
existing_type=sa.String(length=200),
type_=sa.VARCHAR(length=50),
existing_nullable=True,
)
batch_op.alter_column(
"primary_hashtag",
existing_type=sa.String(length=200),
type_=sa.VARCHAR(length=50),
existing_nullable=False,
)
batch_op.alter_column(
"name",
existing_type=sa.String(length=150),
type_=sa.VARCHAR(length=50),
existing_nullable=False,
)

# ### end Alembic commands ###

0 comments on commit 05877fb

Please sign in to comment.