Simplify migrations automation
This commit is contained in:
parent
7eedd99ee1
commit
1e5a654987
@ -74,9 +74,9 @@ Migrations
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
Once all dependencies are installed it is necessary to run database migrations.
|
Once all dependencies are installed it is necessary to run database migrations.
|
||||||
Before that please edit [alembic.ini](alembic.ini) line #32
|
Before that it is necessary to set env variable:
|
||||||
|
|
||||||
sqlalchemy.url = mysql+pymysql://root:root@localhost/functions
|
export LAOS_MIGRATIONS_DB=mysql+pymysql://root:root@localhost/functions
|
||||||
|
|
||||||
In this section please specify connection URI to your own MySQL database.
|
In this section please specify connection URI to your own MySQL database.
|
||||||
Once the file is saved, just use alembic to apply the migrations:
|
Once the file is saved, just use alembic to apply the migrations:
|
||||||
|
@ -29,7 +29,7 @@ script_location = migrations
|
|||||||
# are written from script.py.mako
|
# are written from script.py.mako
|
||||||
# output_encoding = utf-8
|
# output_encoding = utf-8
|
||||||
|
|
||||||
sqlalchemy.url = mysql+pymysql://root:root@192.168.0.112/functions
|
sqlalchemy.url = ""
|
||||||
|
|
||||||
|
|
||||||
# Logging configuration
|
# Logging configuration
|
||||||
|
@ -3,6 +3,8 @@ from alembic import context
|
|||||||
from sqlalchemy import engine_from_config, pool
|
from sqlalchemy import engine_from_config, pool
|
||||||
from logging.config import fileConfig
|
from logging.config import fileConfig
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
# this is the Alembic Config object, which provides
|
# this is the Alembic Config object, which provides
|
||||||
# access to the values within the .ini file in use.
|
# access to the values within the .ini file in use.
|
||||||
config = context.config
|
config = context.config
|
||||||
@ -21,6 +23,7 @@ target_metadata = None
|
|||||||
# can be acquired:
|
# can be acquired:
|
||||||
# my_important_option = config.get_main_option("my_important_option")
|
# my_important_option = config.get_main_option("my_important_option")
|
||||||
# ... etc.
|
# ... etc.
|
||||||
|
config.set_main_option("sqlalchemy.url", os.getenv("LAOS_MIGRATIONS_DB"))
|
||||||
|
|
||||||
|
|
||||||
def run_migrations_offline():
|
def run_migrations_offline():
|
||||||
|
Loading…
Reference in New Issue
Block a user