diff options
-rw-r--r-- | app/__init__.py | 2 | ||||
-rw-r--r-- | migrations/env.py | 22 | ||||
-rw-r--r-- | migrations/versions/02e90d95b9e8_.py | 27 |
3 files changed, 25 insertions, 26 deletions
diff --git a/app/__init__.py b/app/__init__.py index da9ceff..d12f617 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -15,7 +15,7 @@ from authlib.integrations.flask_client import OAuth sentry_sdk.init( dsn=environ.get("SENTRY_DSN"), integrations=[FlaskIntegration()], - traces_sample_rate=1.0 + traces_sample_rate=1.0, ) app = Flask(__name__) diff --git a/migrations/env.py b/migrations/env.py index 68feded..0c6eddc 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -14,17 +14,17 @@ config = context.config # Interpret the config file for Python logging. # This line sets up loggers basically. fileConfig(config.config_file_name) -logger = logging.getLogger('alembic.env') +logger = logging.getLogger("alembic.env") # add your model's MetaData object here # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata config.set_main_option( - 'sqlalchemy.url', - str(current_app.extensions['migrate'].db.get_engine().url).replace( - '%', '%%')) -target_metadata = current_app.extensions['migrate'].db.metadata + "sqlalchemy.url", + str(current_app.extensions["migrate"].db.get_engine().url).replace("%", "%%"), +) +target_metadata = current_app.extensions["migrate"].db.metadata # other values from the config, defined by the needs of env.py, # can be acquired: @@ -45,9 +45,7 @@ def run_migrations_offline(): """ url = config.get_main_option("sqlalchemy.url") - context.configure( - url=url, target_metadata=target_metadata, literal_binds=True - ) + context.configure(url=url, target_metadata=target_metadata, literal_binds=True) with context.begin_transaction(): context.run_migrations() @@ -65,20 +63,20 @@ def run_migrations_online(): # when there are no changes to the schema # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html def process_revision_directives(context, revision, directives): - if getattr(config.cmd_opts, 'autogenerate', False): + if getattr(config.cmd_opts, "autogenerate", False): script = directives[0] if script.upgrade_ops.is_empty(): directives[:] = [] - logger.info('No changes in schema detected.') + logger.info("No changes in schema detected.") - connectable = current_app.extensions['migrate'].db.get_engine() + connectable = current_app.extensions["migrate"].db.get_engine() with connectable.connect() as connection: context.configure( connection=connection, target_metadata=target_metadata, process_revision_directives=process_revision_directives, - **current_app.extensions['migrate'].configure_args + **current_app.extensions["migrate"].configure_args ) with context.begin_transaction(): diff --git a/migrations/versions/02e90d95b9e8_.py b/migrations/versions/02e90d95b9e8_.py index c65e6ba..1c7d04c 100644 --- a/migrations/versions/02e90d95b9e8_.py +++ b/migrations/versions/02e90d95b9e8_.py @@ -10,7 +10,7 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. -revision = '02e90d95b9e8' +revision = "02e90d95b9e8" down_revision = None branch_labels = None depends_on = None @@ -18,22 +18,23 @@ depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.create_table('users', - sa.Column('first_name', sa.String(), nullable=True), - sa.Column('last_name', sa.String(), nullable=True), - sa.Column('email', sa.String(length=120), nullable=False), - sa.Column('confirmation', sa.Boolean(), nullable=True), - sa.Column('paid', sa.Boolean(), nullable=True), - sa.Column('role', sa.String(), nullable=True), - sa.Column('team', sa.String(), nullable=True), - sa.Column('login_type', sa.String(), nullable=True), - sa.Column('_password', sa.String(), nullable=True), - sa.PrimaryKeyConstraint('email') + op.create_table( + "users", + sa.Column("first_name", sa.String(), nullable=True), + sa.Column("last_name", sa.String(), nullable=True), + sa.Column("email", sa.String(length=120), nullable=False), + sa.Column("confirmation", sa.Boolean(), nullable=True), + sa.Column("paid", sa.Boolean(), nullable=True), + sa.Column("role", sa.String(), nullable=True), + sa.Column("team", sa.String(), nullable=True), + sa.Column("login_type", sa.String(), nullable=True), + sa.Column("_password", sa.String(), nullable=True), + sa.PrimaryKeyConstraint("email"), ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('users') + op.drop_table("users") # ### end Alembic commands ### |