mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-26 00:29:43 +02:00
Set up alembic migration usage (#954)
* Set up alembic migration usage * Fix import order, add isort as alembic hook * Only run migrations if needed * Include date as part of migration file name for better sorting * Skip initial migrations if tables already exist This eases the transition from a pre-alembic state * Fix deprecation warning in alembic revision * Add alembic test stubs
This commit is contained in:
parent
a897e180ed
commit
fdfb5b1a5e
14 changed files with 1197 additions and 25 deletions
26
alembic/script.py.mako
Normal file
26
alembic/script.py.mako
Normal file
|
@ -0,0 +1,26 @@
|
|||
"""${message}
|
||||
|
||||
Revision ID: ${up_revision}
|
||||
Revises: ${down_revision | comma,n}
|
||||
Create Date: ${create_date}
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
|
||||
import mealie.db.migration_types
|
||||
from alembic import op
|
||||
${imports if imports else ""}
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = ${repr(up_revision)}
|
||||
down_revision = ${repr(down_revision)}
|
||||
branch_labels = ${repr(branch_labels)}
|
||||
depends_on = ${repr(depends_on)}
|
||||
|
||||
|
||||
def upgrade():
|
||||
${upgrades if upgrades else "pass"}
|
||||
|
||||
|
||||
def downgrade():
|
||||
${downgrades if downgrades else "pass"}
|
Loading…
Add table
Add a link
Reference in a new issue