mirror of
https://github.com/simon987/nyaa.git
synced 2025-12-16 00:09:05 +00:00
Add initial database state for Alembic, update existing migrations
Existing migrations will apply changes to both Nyaa and Sukebei (adjusted manually - in the future Alembic should be able to create operations for both, thanks to having both models loaded) Added a down_revision for previously-earliest revision.
This commit is contained in:
@@ -11,20 +11,19 @@ import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3001f79b7722'
|
||||
down_revision = None
|
||||
down_revision = '97ddefed1834'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
TABLE_PREFIXES = ('nyaa', 'sukebei')
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('nyaa_torrents', sa.Column('uploader_ip', sa.Binary(), nullable=True))
|
||||
op.add_column('sukebei_torrents', sa.Column('uploader_ip', sa.Binary(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
for prefix in TABLE_PREFIXES:
|
||||
op.add_column(prefix + '_torrents', sa.Column('uploader_ip', sa.Binary(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('nyaa_torrents', 'uploader_ip')
|
||||
op.drop_column('sukebei_torrents', 'uploader_ip')
|
||||
# ### end Alembic commands ###
|
||||
for prefix in TABLE_PREFIXES:
|
||||
op.drop_column(prefix + '_torrents', 'uploader_ip')
|
||||
|
||||
Reference in New Issue
Block a user