forked from polka_billy/porridger
rating routes added
This commit is contained in:
@ -0,0 +1,48 @@
|
||||
"""points added to user model; owner_id -> user_id; added state(announcement table)
|
||||
|
||||
Revision ID: 4e4d30fd58fc
|
||||
Revises: 00529d20660b
|
||||
Create Date: 2023-08-05 09:38:03.284306
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4e4d30fd58fc'
|
||||
down_revision = '00529d20660b'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('announcements', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('user_id', sa.Integer(), nullable=True))
|
||||
batch_op.add_column(sa.Column('state', sa.Enum('published', 'taken', 'obsolete', name='state'), nullable=True))
|
||||
# batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('fk_users_id', 'users', ['user_id'], ['id'])
|
||||
batch_op.drop_column('owner_id')
|
||||
|
||||
with op.batch_alter_table('users', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('rating', sa.Integer(), nullable=True))
|
||||
batch_op.add_column(sa.Column('reg_date', sa.Date(), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('users', schema=None) as batch_op:
|
||||
batch_op.drop_column('reg_date')
|
||||
batch_op.drop_column('rating')
|
||||
|
||||
with op.batch_alter_table('announcements', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('owner_id', sa.INTEGER(), nullable=True))
|
||||
# batch_op.drop_constraint('fk_users_id', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'users', ['owner_id'], ['id'])
|
||||
batch_op.drop_column('state')
|
||||
batch_op.drop_column('user_id')
|
||||
|
||||
# ### end Alembic commands ###
|
@ -0,0 +1,34 @@
|
||||
"""state(enum) -> obsolete(Boolean)
|
||||
|
||||
Revision ID: faecbd04e5eb
|
||||
Revises: 4e4d30fd58fc
|
||||
Create Date: 2023-08-05 23:57:31.784676
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'faecbd04e5eb'
|
||||
down_revision = '4e4d30fd58fc'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('announcements', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('obsolete', sa.Boolean(), nullable=True))
|
||||
batch_op.drop_column('state')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('announcements', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('state', sa.VARCHAR(length=9), nullable=True))
|
||||
batch_op.drop_column('obsolete')
|
||||
|
||||
# ### end Alembic commands ###
|
Reference in New Issue
Block a user