Restarted alembic

This commit is contained in:
Keith Edmunds 2023-01-06 20:45:16 +00:00
parent a25c6819ff
commit f034ef4f56
12 changed files with 39 additions and 287 deletions

View File

@ -4,11 +4,20 @@
# path to migration scripts
script_location = migrations
# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
# Uncomment the line below if you want the files to be prepended with date and time
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
# for all available tokens
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
# timezone to use when rendering the date
# within the migration file as well as the filename.
# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory.
prepend_sys_path = .
# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python-dateutil library that can be
# installed by adding `alembic[tz]` to the pip requirements
# string value is passed to dateutil.tz.gettz()
# leave blank for localtime
# timezone =
@ -26,10 +35,21 @@ script_location = migrations
# versions/ directory
# sourceless = false
# version location specification; this defaults
# version location specification; This defaults
# to migrations/versions. When using multiple version
# directories, initial revisions must be specified with --version-path
# version_locations = %(here)s/bar %(here)s/bat migrations/versions
# directories, initial revisions must be specified with --version-path.
# The path separator used here should be the separator specified by "version_path_separator" below.
# version_locations = %(here)s/bar:%(here)s/bat:migrations/versions
# version path separator; As mentioned above, this is the character used to split
# version_locations. The default within new alembic.ini files is "os", which uses os.pathsep.
# If this key is omitted entirely, it falls back to the legacy behavior of splitting on spaces and/or commas.
# Valid values for version_path_separator are:
#
# version_path_separator = :
# version_path_separator = ;
# version_path_separator = space
version_path_separator = os # Use os.pathsep. Default configuration used for new projects.
# the output encoding used when revision files
# are written from script.py.mako
@ -44,10 +64,10 @@ sqlalchemy.url = driver://user:pass@localhost/dbname
# detail and examples
# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks=black
# black.type=console_scripts
# black.entrypoint=black
# black.options=-l 79
# hooks = black
# black.type = console_scripts
# black.entrypoint = black
# black.options = -l 79 REVISION_SCRIPT_FILENAME
# Logging configuration
[loggers]

View File

@ -16,9 +16,9 @@ branch_labels = ${repr(branch_labels)}
depends_on = ${repr(depends_on)}
def upgrade():
def upgrade() -> None:
${upgrades if upgrades else "pass"}
def downgrade():
def downgrade() -> None:
${downgrades if downgrades else "pass"}

View File

@ -1,34 +0,0 @@
"""Fixing table relationships
Revision ID: 0d4c8f368e00
Revises: 5281c8c8059d
Create Date: 2023-01-02 14:28:57.905087
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '0d4c8f368e00'
down_revision = '5281c8c8059d'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('post_tags', sa.Column('post_id', sa.Integer(), nullable=False))
op.drop_constraint('post_tags_ibfk_2', 'post_tags', type_='foreignkey')
op.create_foreign_key(None, 'post_tags', 'posts', ['post_id'], ['id'])
op.drop_column('post_tags', 'posts_id')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('post_tags', sa.Column('posts_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
op.drop_constraint(None, 'post_tags', type_='foreignkey')
op.create_foreign_key('post_tags_ibfk_2', 'post_tags', 'posts', ['posts_id'], ['id'])
op.drop_column('post_tags', 'post_id')
# ### end Alembic commands ###

View File

@ -1,28 +0,0 @@
"""Fixing table relationships
Revision ID: 1132a20d56cb
Revises: 4a6731c9e71b
Create Date: 2023-01-02 13:13:07.084963
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1132a20d56cb'
down_revision = '4a6731c9e71b'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

View File

@ -1,28 +0,0 @@
"""Fixing table relationships
Revision ID: 28448b5f994f
Revises: 1132a20d56cb
Create Date: 2023-01-02 13:15:19.817927
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '28448b5f994f'
down_revision = '1132a20d56cb'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('attachments', 'followed')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('attachments', sa.Column('followed', mysql.TINYINT(display_width=1), autoincrement=False, nullable=False))
# ### end Alembic commands ###

View File

@ -1,28 +0,0 @@
"""Fixing table relationships
Revision ID: 354c25d6adac
Revises: 0d4c8f368e00
Create Date: 2023-01-02 14:37:16.192979
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '354c25d6adac'
down_revision = '0d4c8f368e00'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

View File

@ -1,34 +0,0 @@
"""Fixing table relationships
Revision ID: 4a6731c9e71b
Revises: 563253042f7e
Create Date: 2023-01-02 13:12:21.344294
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '4a6731c9e71b'
down_revision = '563253042f7e'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('posts', sa.Column('parent_id', sa.Integer(), nullable=True))
op.drop_constraint('posts_ibfk_2', 'posts', type_='foreignkey')
op.create_foreign_key(None, 'posts', 'posts', ['parent_id'], ['id'])
op.drop_column('posts', 'reblog_id')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('posts', sa.Column('reblog_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
op.drop_constraint(None, 'posts', type_='foreignkey')
op.create_foreign_key('posts_ibfk_2', 'posts', 'posts', ['reblog_id'], ['id'])
op.drop_column('posts', 'parent_id')
# ### end Alembic commands ###

View File

@ -1,28 +0,0 @@
"""Fixing table relationships
Revision ID: 5281c8c8059d
Revises: 28448b5f994f
Create Date: 2023-01-02 13:16:37.480999
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5281c8c8059d'
down_revision = '28448b5f994f'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

View File

@ -1,28 +0,0 @@
"""Fixing table relationships
Revision ID: 563253042f7e
Revises: 7c67a545533e
Create Date: 2023-01-02 13:00:44.136697
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '563253042f7e'
down_revision = '7c67a545533e'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

View File

@ -1,28 +0,0 @@
"""Fixing table relationships
Revision ID: 7672338beb90
Revises: 354c25d6adac
Create Date: 2023-01-02 14:39:26.283627
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7672338beb90'
down_revision = '354c25d6adac'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

View File

@ -1,32 +0,0 @@
"""Fixing table relationships
Revision ID: 7c67a545533e
Revises: 40a36c2e0e8d
Create Date: 2023-01-02 12:56:05.031475
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7c67a545533e'
down_revision = '40a36c2e0e8d'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('accounts', sa.Column('followed', sa.Boolean(), nullable=False))
op.add_column('attachments', sa.Column('followed', sa.Boolean(), nullable=False))
op.add_column('hashtags', sa.Column('followed', sa.Boolean(), nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('hashtags', 'followed')
op.drop_column('attachments', 'followed')
op.drop_column('accounts', 'followed')
# ### end Alembic commands ###

View File

@ -1,8 +1,8 @@
"""Initial Alembic configuration
"""Initial configuration
Revision ID: 40a36c2e0e8d
Revision ID: 9abe92907482
Revises:
Create Date: 2023-01-02 08:15:56.863042
Create Date: 2023-01-06 20:44:30.249858
"""
from alembic import op
@ -10,19 +10,19 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '40a36c2e0e8d'
revision = '9abe92907482'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade():
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###