Skip to content

Commit

Permalink
Add missing migration files
Browse files Browse the repository at this point in the history
  • Loading branch information
bgigous committed Sep 3, 2022
1 parent 861a791 commit b8f673e
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 0 deletions.
28 changes: 28 additions & 0 deletions migrations/versions/5f15cbadc711_unique_slugs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Unique slugs
Revision ID: 5f15cbadc711
Revises: f4bed1492264
Create Date: 2020-03-18 22:56:27.864403
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '5f15cbadc711'
down_revision = 'f4bed1492264'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_unique_constraint(None, 'compositions', ['slug'])
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'compositions', type_='unique')
# ### end Alembic commands ###
28 changes: 28 additions & 0 deletions migrations/versions/8b8adf6141a2_add_avatar_hash_to_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Add avatar_hash to User model
Revision ID: 8b8adf6141a2
Revises: 99dce89557a6
Create Date: 2020-03-15 17:44:33.668335
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '8b8adf6141a2'
down_revision = '99dce89557a6'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('avatar_hash', sa.String(length=32), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'avatar_hash')
# ### end Alembic commands ###
50 changes: 50 additions & 0 deletions migrations/versions/99dce89557a6_add_profile_drop_fans.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""add profile info to User model, drops fans
Revision ID: 99dce89557a6
Revises:
Create Date: 2020-03-15 13:27:21.421300
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '99dce89557a6'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index('ix_fans_email', table_name='fans')
op.drop_index('ix_fans_username', table_name='fans')
op.drop_table('fans')
op.add_column('users', sa.Column('bio', sa.Text(), nullable=True))
op.add_column('users', sa.Column('last_seen', sa.DateTime(), nullable=True))
op.add_column('users', sa.Column('location', sa.String(length=64), nullable=True))
op.add_column('users', sa.Column('name', sa.String(length=64), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'name')
op.drop_column('users', 'location')
op.drop_column('users', 'last_seen')
op.drop_column('users', 'bio')
op.create_table('fans',
sa.Column('id', sa.INTEGER(), nullable=False),
sa.Column('username', sa.VARCHAR(length=64), nullable=True),
sa.Column('role_id', sa.INTEGER(), nullable=True),
sa.Column('email', sa.VARCHAR(length=64), nullable=True),
sa.Column('password_hash', sa.VARCHAR(length=128), nullable=True),
sa.Column('confirmed', sa.BOOLEAN(), nullable=True),
sa.CheckConstraint('confirmed IN (0, 1)'),
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index('ix_fans_username', 'fans', ['username'], unique=1)
op.create_index('ix_fans_email', 'fans', ['email'], unique=1)
# ### end Alembic commands ###
28 changes: 28 additions & 0 deletions migrations/versions/f4bed1492264_add_slug_in_composition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Add slug in Composition
Revision ID: f4bed1492264
Revises: ff49bee8f46c
Create Date: 2020-03-18 21:12:02.783173
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'f4bed1492264'
down_revision = 'ff49bee8f46c'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('compositions', sa.Column('slug', sa.String(length=128), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('compositions', 'slug')
# ### end Alembic commands ###
40 changes: 40 additions & 0 deletions migrations/versions/ff49bee8f46c_add_composition_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""Add Composition Model
Revision ID: ff49bee8f46c
Revises: 8b8adf6141a2
Create Date: 2020-03-15 19:42:55.365366
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ff49bee8f46c'
down_revision = '8b8adf6141a2'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('compositions',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('release_type', sa.Integer(), nullable=True),
sa.Column('title', sa.String(length=64), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('description_html', sa.Text(), nullable=True),
sa.Column('timestamp', sa.DateTime(), nullable=True),
sa.Column('artist_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['artist_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_compositions_timestamp'), 'compositions', ['timestamp'], unique=False)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_compositions_timestamp'), table_name='compositions')
op.drop_table('compositions')
# ### end Alembic commands ###

0 comments on commit b8f673e

Please sign in to comment.