From 3597667e2d59262440b18354d03981f07252fcdf Mon Sep 17 00:00:00 2001 From: lza_menace Date: Mon, 10 Jan 2022 00:47:04 -0800 Subject: [PATCH] consolidate alembic migrations --- .../versions/40734564d415_init_suchwowx.py | 62 --------------- .../versions/53c117fcef3f_init_suchwowx.py | 75 +++++++++++++++++++ .../92b2ce4b6c87_add_remote_servers.py | 35 --------- ..._add_profile_metadata_ipfs_and_wow_addy.py | 54 ------------- .../versions/f15cd9fa0f06_meme_approval.py | 27 ------- .../f6f695a38339_add_meme_sync_flag.py | 27 ------- 6 files changed, 75 insertions(+), 205 deletions(-) delete mode 100644 alembic/versions/40734564d415_init_suchwowx.py create mode 100644 alembic/versions/53c117fcef3f_init_suchwowx.py delete mode 100644 alembic/versions/92b2ce4b6c87_add_remote_servers.py delete mode 100644 alembic/versions/c548cc54ee17_add_profile_metadata_ipfs_and_wow_addy.py delete mode 100644 alembic/versions/f15cd9fa0f06_meme_approval.py delete mode 100644 alembic/versions/f6f695a38339_add_meme_sync_flag.py diff --git a/alembic/versions/40734564d415_init_suchwowx.py b/alembic/versions/40734564d415_init_suchwowx.py deleted file mode 100644 index 8298ae9..0000000 --- a/alembic/versions/40734564d415_init_suchwowx.py +++ /dev/null @@ -1,62 +0,0 @@ -"""init suchwowx - -Revision ID: 40734564d415 -Revises: -Create Date: 2021-12-28 22:05:09.994215 - -""" -from uuid import uuid4 - -from alembic import op -import sqlalchemy as sa - -# revision identifiers, used by Alembic. -revision = '40734564d415' -down_revision = None -branch_labels = None -depends_on = None - - -def upgrade(): - mods_table = op.create_table('moderators', - sa.Column('id', sa.Integer, autoincrement=True, nullable=False, primary_key=True), - sa.Column('user_id', sa.Integer, nullable=False), - sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='moderators_user_id_fkey'), - ) - users_table = op.create_table('users', - sa.Column('id', sa.Integer, autoincrement=True, nullable=False), - sa.Column('register_date', sa.DateTime(), autoincrement=False, nullable=True), - sa.Column('last_login_date', sa.DateTime(), autoincrement=False, nullable=True), - sa.Column('verified', sa.Boolean, autoincrement=False, nullable=True), - sa.Column('public_address', sa.String(180), autoincrement=False, nullable=True), - sa.Column('nonce', sa.String(180), autoincrement=False, nullable=True), - sa.Column('nonce_date', sa.DateTime(), autoincrement=False, nullable=True), - sa.Column('handle', sa.String(40), autoincrement=False, nullable=True, ), - sa.Column('bio', sa.String(600), autoincrement=False, nullable=True), - sa.Column('profile_image', sa.String(300), autoincrement=False, nullable=True), - sa.Column('website_url', sa.String(120), autoincrement=False, nullable=True), - sa.Column('moderator_id', sa.Integer, nullable=True), - sa.PrimaryKeyConstraint('id', name='users_pkey'), - sa.UniqueConstraint('handle', name='users_handle_key'), - sa.ForeignKeyConstraint(['moderator_id'], ['moderators.id'], name='users_user_id_fkey'), - ) - memes_table = op.create_table('memes', - sa.Column('id', sa.String(80), server_default=uuid4().hex, autoincrement=False, nullable=False), - sa.Column('user_id', sa.Integer, autoincrement=False, nullable=True), - sa.Column('create_date', sa.DateTime(), autoincrement=False, nullable=True), - sa.Column('title', sa.String(80), autoincrement=False, nullable=True), - sa.Column('description', sa.String(300), autoincrement=False, nullable=True), - sa.Column('file_name', sa.String(300), autoincrement=False, nullable=True), - sa.Column('minted', sa.Boolean, autoincrement=False, nullable=True), - sa.Column('meta_ipfs_hash', sa.String(100), autoincrement=False, nullable=True), - sa.Column('meme_ipfs_hash', sa.String(100), autoincrement=False, nullable=True), - sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='artwork_user_id_fkey'), - sa.PrimaryKeyConstraint('id', name='artwork_pkey'), - sa.UniqueConstraint('meta_ipfs_hash', name='memes_meta_ipfs_hash_key'), - sa.UniqueConstraint('meme_ipfs_hash', name='memes_meme_ipfs_hash_key') - ) - -def downgrade(): - op.drop_table('moderators') - op.drop_table('users') - op.drop_table('memes') diff --git a/alembic/versions/53c117fcef3f_init_suchwowx.py b/alembic/versions/53c117fcef3f_init_suchwowx.py new file mode 100644 index 0000000..8c0a53b --- /dev/null +++ b/alembic/versions/53c117fcef3f_init_suchwowx.py @@ -0,0 +1,75 @@ +"""init suchwowx + +Revision ID: 53c117fcef3f +Revises: +Create Date: 2022-01-10 00:44:36.231037 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '53c117fcef3f' +down_revision = None +branch_labels = None +depends_on = None + + +def upgrade(): + op.create_table('remotes', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('create_date', sa.DateTime(), nullable=True), + sa.Column('last_sync_date', sa.DateTime(), nullable=True), + sa.Column('paused', sa.Boolean(), nullable=True), + sa.Column('endpoint', sa.String(length=120), nullable=True), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('users', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('register_date', sa.DateTime(), nullable=True), + sa.Column('last_login_date', sa.DateTime(), nullable=True), + sa.Column('verified', sa.Boolean(), nullable=True), + sa.Column('public_address', sa.String(length=180), nullable=True), + sa.Column('nonce', sa.String(length=180), nullable=True), + sa.Column('nonce_date', sa.DateTime(), nullable=True), + sa.Column('handle', sa.String(length=40), nullable=True), + sa.Column('bio', sa.String(length=600), nullable=True), + sa.Column('profile_image', sa.String(length=300), nullable=True), + sa.Column('ipfs_hash', sa.String(length=100), nullable=True), + sa.Column('wownero_address', sa.String(length=120), nullable=True), + sa.Column('website_url', sa.String(length=120), nullable=True), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('handle') + ) + op.create_table('memes', + sa.Column('id', sa.String(length=80), nullable=False), + sa.Column('create_date', sa.DateTime(), nullable=True), + sa.Column('file_name', sa.String(length=200), nullable=True), + sa.Column('meta_ipfs_hash', sa.String(length=100), nullable=True), + sa.Column('meme_ipfs_hash', sa.String(length=100), nullable=True), + sa.Column('title', sa.String(length=50), nullable=True), + sa.Column('description', sa.String(length=400), nullable=True), + sa.Column('minted', sa.Boolean(), nullable=True), + sa.Column('approved', sa.Boolean(), nullable=True), + sa.Column('synced', sa.Boolean(), nullable=True), + sa.Column('user_id', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('file_name'), + sa.UniqueConstraint('meme_ipfs_hash'), + sa.UniqueConstraint('meta_ipfs_hash') + ) + op.create_table('moderators', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('user_id', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), + sa.PrimaryKeyConstraint('id') + ) + + +def downgrade(): + op.drop_table('moderators') + op.drop_table('memes') + op.drop_table('users') + op.drop_table('remotes') diff --git a/alembic/versions/92b2ce4b6c87_add_remote_servers.py b/alembic/versions/92b2ce4b6c87_add_remote_servers.py deleted file mode 100644 index 655c388..0000000 --- a/alembic/versions/92b2ce4b6c87_add_remote_servers.py +++ /dev/null @@ -1,35 +0,0 @@ -"""add remote servers - -Revision ID: 92b2ce4b6c87 -Revises: f6f695a38339 -Create Date: 2022-01-03 01:20:39.066496 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '92b2ce4b6c87' -down_revision = 'f6f695a38339' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('remotes', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('create_date', sa.DateTime(), nullable=True), - sa.Column('last_sync_date', sa.DateTime(), nullable=True), - sa.Column('paused', sa.Boolean(), nullable=True), - sa.Column('endpoint', sa.String(length=120), nullable=True), - sa.PrimaryKeyConstraint('id') - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('remotes') - # ### end Alembic commands ### diff --git a/alembic/versions/c548cc54ee17_add_profile_metadata_ipfs_and_wow_addy.py b/alembic/versions/c548cc54ee17_add_profile_metadata_ipfs_and_wow_addy.py deleted file mode 100644 index 6cc8f9a..0000000 --- a/alembic/versions/c548cc54ee17_add_profile_metadata_ipfs_and_wow_addy.py +++ /dev/null @@ -1,54 +0,0 @@ -"""add profile metadata ipfs and wow addy - -Revision ID: c548cc54ee17 -Revises: 40734564d415 -Create Date: 2021-12-30 01:35:12.774067 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'c548cc54ee17' -down_revision = '40734564d415' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('memes', schema=None) as batch_op: - batch_op.create_unique_constraint('memes_file_name_uniq', ['file_name']) - - with op.batch_alter_table('moderators', schema=None) as batch_op: - batch_op.alter_column('user_id', - existing_type=sa.INTEGER(), - nullable=True) - - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('ipfs_hash', sa.String(length=100), nullable=True)) - batch_op.add_column(sa.Column('wownero_address', sa.String(length=120), nullable=True)) - batch_op.drop_constraint('users_user_id_fkey', type_='foreignkey') - batch_op.drop_column('moderator_id') - - # ### 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.add_column(sa.Column('moderator_id', sa.INTEGER(), nullable=True)) - batch_op.create_foreign_key('users_user_id_fkey', 'moderators', ['moderator_id'], ['id']) - batch_op.drop_column('wownero_address') - batch_op.drop_column('ipfs_hash') - - with op.batch_alter_table('moderators', schema=None) as batch_op: - batch_op.alter_column('user_id', - existing_type=sa.INTEGER(), - nullable=False) - - with op.batch_alter_table('memes', schema=None) as batch_op: - batch_op.drop_constraint('memes_file_name_uniq', type_='unique') - - # ### end Alembic commands ### diff --git a/alembic/versions/f15cd9fa0f06_meme_approval.py b/alembic/versions/f15cd9fa0f06_meme_approval.py deleted file mode 100644 index a36a0e7..0000000 --- a/alembic/versions/f15cd9fa0f06_meme_approval.py +++ /dev/null @@ -1,27 +0,0 @@ -"""meme approval - -Revision ID: f15cd9fa0f06 -Revises: c548cc54ee17 -Create Date: 2021-12-30 13:11:10.706513 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'f15cd9fa0f06' -down_revision = 'c548cc54ee17' -branch_labels = None -depends_on = None - - -def upgrade(): - with op.batch_alter_table('memes', schema=None) as batch_op: - batch_op.add_column(sa.Column('approved', sa.Boolean(), nullable=True)) - - - -def downgrade(): - with op.batch_alter_table('memes', schema=None) as batch_op: - batch_op.drop_column('approved') diff --git a/alembic/versions/f6f695a38339_add_meme_sync_flag.py b/alembic/versions/f6f695a38339_add_meme_sync_flag.py deleted file mode 100644 index 8edf8a6..0000000 --- a/alembic/versions/f6f695a38339_add_meme_sync_flag.py +++ /dev/null @@ -1,27 +0,0 @@ -"""add meme sync flag - -Revision ID: f6f695a38339 -Revises: f15cd9fa0f06 -Create Date: 2021-12-31 11:05:28.153450 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'f6f695a38339' -down_revision = 'f15cd9fa0f06' -branch_labels = None -depends_on = None - - -def upgrade(): - with op.batch_alter_table('memes', schema=None) as batch_op: - batch_op.add_column(sa.Column('synced', sa.Boolean(), nullable=True)) - - - -def downgrade(): - with op.batch_alter_table('memes', schema=None) as batch_op: - batch_op.drop_column('synced')