25
migrations/versions/9395ba96f853_.py
Normal file
25
migrations/versions/9395ba96f853_.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 9395ba96f853
|
||||
Revises: dd17239f7144
|
||||
Create Date: 2023-10-31 17:39:27.957209
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '9395ba96f853'
|
||||
down_revision = 'dd17239f7144'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('oauth_client', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('created_at', sa.DateTime(), nullable=False))
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('oauth_client', schema=None) as batch_op:
|
||||
batch_op.drop_column('created_at')
|
||||
28
migrations/versions/dd17239f7144_.py
Normal file
28
migrations/versions/dd17239f7144_.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: dd17239f7144
|
||||
Revises: f0622f7671d5
|
||||
Create Date: 2023-10-31 16:29:08.892647
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'dd17239f7144'
|
||||
down_revision = 'f0622f7671d5'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('api_token', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('auth_code', sa.String(length=34), nullable=True))
|
||||
batch_op.create_unique_constraint(None, ['auth_code'])
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('api_token', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='unique')
|
||||
batch_op.drop_column('auth_code')
|
||||
41
migrations/versions/f0622f7671d5_.py
Normal file
41
migrations/versions/f0622f7671d5_.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: f0622f7671d5
|
||||
Revises: 49105d276908
|
||||
Create Date: 2023-10-31 16:04:57.708933
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'f0622f7671d5'
|
||||
down_revision = '49105d276908'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('oauth_client',
|
||||
sa.Column('id', sa.String(length=24), nullable=False),
|
||||
sa.Column('title', sa.String(length=64), nullable=True),
|
||||
sa.Column('secret', sa.String(length=32), nullable=True),
|
||||
sa.Column('redirect_url', sa.String(length=128), nullable=True),
|
||||
sa.Column('owner_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('title')
|
||||
)
|
||||
with op.batch_alter_table('api_token', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('client_id', sa.String(length=24), nullable=True))
|
||||
batch_op.create_foreign_key(None, 'oauth_client', ['client_id'], ['id'])
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('api_token', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_column('client_id')
|
||||
|
||||
op.drop_table('oauth_client')
|
||||
Reference in New Issue
Block a user