Migration for notes
This commit is contained in:
parent
5a446919e3
commit
ce393231d4
51
migrations/versions/e3b04db5506f_add_structure_for_notes.py
Normal file
51
migrations/versions/e3b04db5506f_add_structure_for_notes.py
Normal file
@ -0,0 +1,51 @@
|
||||
"""Add structure for notes
|
||||
|
||||
Revision ID: e3b04db5506f
|
||||
Revises: 269a002f989d
|
||||
Create Date: 2021-04-05 16:33:50.117747
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e3b04db5506f'
|
||||
down_revision = '269a002f989d'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('notes',
|
||||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
||||
sa.Column('playlist_id', sa.Integer(), nullable=True),
|
||||
sa.Column('row', sa.Integer(), nullable=False),
|
||||
sa.Column('note', sa.String(length=256), nullable=True),
|
||||
sa.ForeignKeyConstraint(['playlist_id'], ['playlists.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.add_column('playlisttracks', sa.Column('row', sa.Integer(), nullable=False))
|
||||
op.alter_column('playlisttracks', 'playlist_id',
|
||||
existing_type=mysql.INTEGER(display_width=11),
|
||||
nullable=False)
|
||||
op.alter_column('playlisttracks', 'track_id',
|
||||
existing_type=mysql.INTEGER(display_width=11),
|
||||
nullable=False)
|
||||
op.drop_column('playlisttracks', 'sort')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('playlisttracks', sa.Column('sort', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False))
|
||||
op.alter_column('playlisttracks', 'track_id',
|
||||
existing_type=mysql.INTEGER(display_width=11),
|
||||
nullable=True)
|
||||
op.alter_column('playlisttracks', 'playlist_id',
|
||||
existing_type=mysql.INTEGER(display_width=11),
|
||||
nullable=True)
|
||||
op.drop_column('playlisttracks', 'row')
|
||||
op.drop_table('notes')
|
||||
# ### end Alembic commands ###
|
||||
Loading…
Reference in New Issue
Block a user