Changes to enable testing migrations.
This commit is contained in:
parent
c04caece8d
commit
7e0737a001
@ -1,10 +1,9 @@
|
|||||||
[DATABASE]
|
[database]
|
||||||
user = postgres
|
name=cic_notify_test
|
||||||
|
user=
|
||||||
password=
|
password=
|
||||||
host=localhost
|
host=localhost
|
||||||
port = 5432
|
port=
|
||||||
name = /tmp/cic-notify.db
|
|
||||||
#engine = postgresql
|
|
||||||
#driver = psycopg2
|
|
||||||
engine=sqlite
|
engine=sqlite
|
||||||
driver=pysqlite
|
driver=pysqlite
|
||||||
|
debug=0
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[alembic]
|
[alembic]
|
||||||
# path to migration scripts
|
# path to migration scripts
|
||||||
script_location = migrations
|
script_location = .
|
||||||
|
|
||||||
# template used to generate migration files
|
# template used to generate migration files
|
||||||
# file_template = %%(rev)s_%%(slug)s
|
# file_template = %%(rev)s_%%(slug)s
|
||||||
@ -27,28 +27,17 @@ script_location = migrations
|
|||||||
# sourceless = false
|
# sourceless = false
|
||||||
|
|
||||||
# version location specification; this defaults
|
# version location specification; this defaults
|
||||||
# to migrations/versions. When using multiple version
|
# to ./versions. When using multiple version
|
||||||
# directories, initial revisions must be specified with --version-path
|
# directories, initial revisions must be specified with --version-path
|
||||||
# version_locations = %(here)s/bar %(here)s/bat migrations/versions
|
# version_locations = %(here)s/bar %(here)s/bat ./versions
|
||||||
|
|
||||||
# the output encoding used when revision files
|
# the output encoding used when revision files
|
||||||
# are written from script.py.mako
|
# are written from script.py.mako
|
||||||
# output_encoding = utf-8
|
# output_encoding = utf-8
|
||||||
|
|
||||||
sqlalchemy.url = postgres+psycopg2://postgres@localhost/cic-notify
|
sqlalchemy.url = driver://user:pass@localhost/dbname
|
||||||
|
|
||||||
|
|
||||||
[post_write_hooks]
|
|
||||||
# post_write_hooks defines scripts or Python functions that are run
|
|
||||||
# on newly generated revision scripts. See the documentation for further
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# Logging configuration
|
# Logging configuration
|
||||||
[loggers]
|
[loggers]
|
||||||
keys = root,sqlalchemy,alembic
|
keys = root,sqlalchemy,alembic
|
||||||
|
@ -11,7 +11,7 @@ config = context.config
|
|||||||
|
|
||||||
# Interpret the config file for Python logging.
|
# Interpret the config file for Python logging.
|
||||||
# This line sets up loggers basically.
|
# This line sets up loggers basically.
|
||||||
fileConfig(config.config_file_name)
|
fileConfig(config.config_file_name, disable_existing_loggers=True)
|
||||||
|
|
||||||
# add your model's MetaData object here
|
# add your model's MetaData object here
|
||||||
# for 'autogenerate' support
|
# for 'autogenerate' support
|
||||||
@ -56,8 +56,11 @@ def run_migrations_online():
|
|||||||
and associate a connection with the context.
|
and associate a connection with the context.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
connectable = context.config.attributes.get("connection", None)
|
||||||
|
|
||||||
|
if connectable is None:
|
||||||
connectable = engine_from_config(
|
connectable = engine_from_config(
|
||||||
config.get_section(config.config_ini_section),
|
context.config.get_section(context.config.config_ini_section),
|
||||||
prefix="sqlalchemy.",
|
prefix="sqlalchemy.",
|
||||||
poolclass=pool.NullPool,
|
poolclass=pool.NullPool,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user