mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 17:32:38 +02:00
Fix sqlite only migration. (#579)
This commit is contained in:
parent
d6d084f26a
commit
6129191b26
4 changed files with 41 additions and 31 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -10,5 +10,5 @@ dist
|
||||||
build
|
build
|
||||||
.vscode
|
.vscode
|
||||||
.env
|
.env
|
||||||
.pytest_cache
|
.pytest_cache
|
||||||
|
ihatemoney/budget.db
|
||||||
|
|
|
@ -220,7 +220,7 @@ In order to prepare a new release, we are following the following steps:
|
||||||
make compress-assets
|
make compress-assets
|
||||||
|
|
||||||
- Build the translations::
|
- Build the translations::
|
||||||
|
|
||||||
make update-translations
|
make update-translations
|
||||||
make build-translations
|
make build-translations
|
||||||
|
|
||||||
|
|
|
@ -15,36 +15,46 @@ import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
alter_table_batches = [
|
bind = op.get_bind()
|
||||||
op.batch_alter_table(
|
if bind.engine.name == "sqlite":
|
||||||
"person", recreate="always", table_kwargs={"sqlite_autoincrement": True}
|
alter_table_batches = [
|
||||||
),
|
op.batch_alter_table(
|
||||||
op.batch_alter_table(
|
"person", recreate="always", table_kwargs={"sqlite_autoincrement": True}
|
||||||
"bill", recreate="always", table_kwargs={"sqlite_autoincrement": True}
|
),
|
||||||
),
|
op.batch_alter_table(
|
||||||
op.batch_alter_table(
|
"bill", recreate="always", table_kwargs={"sqlite_autoincrement": True}
|
||||||
"billowers", recreate="always", table_kwargs={"sqlite_autoincrement": True}
|
),
|
||||||
),
|
op.batch_alter_table(
|
||||||
]
|
"billowers",
|
||||||
|
recreate="always",
|
||||||
|
table_kwargs={"sqlite_autoincrement": True},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
for batch_op in alter_table_batches:
|
for batch_op in alter_table_batches:
|
||||||
with batch_op:
|
with batch_op:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
alter_table_batches = [
|
bind = op.get_bind()
|
||||||
op.batch_alter_table(
|
if bind.engine.name == "sqlite":
|
||||||
"person", recreate="always", table_kwargs={"sqlite_autoincrement": False}
|
alter_table_batches = [
|
||||||
),
|
op.batch_alter_table(
|
||||||
op.batch_alter_table(
|
"person",
|
||||||
"bill", recreate="always", table_kwargs={"sqlite_autoincrement": False}
|
recreate="always",
|
||||||
),
|
table_kwargs={"sqlite_autoincrement": False},
|
||||||
op.batch_alter_table(
|
),
|
||||||
"billowers", recreate="always", table_kwargs={"sqlite_autoincrement": False}
|
op.batch_alter_table(
|
||||||
),
|
"bill", recreate="always", table_kwargs={"sqlite_autoincrement": False}
|
||||||
]
|
),
|
||||||
|
op.batch_alter_table(
|
||||||
|
"billowers",
|
||||||
|
recreate="always",
|
||||||
|
table_kwargs={"sqlite_autoincrement": False},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
for batch_op in alter_table_batches:
|
for batch_op in alter_table_batches:
|
||||||
with batch_op:
|
with batch_op:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue