Closed ncrocfer closed 1 year ago
This PR switches to online mode in order to fix https://github.com/ovh/celery-director/issues/164
After merging it we'll be able to review & merge #170 and #162 (these PRs introduce new migrations).
POC:
$ cat director/migrations/versions/ea91724fbbb9_add_foo.py """add foo Revision ID: ea91724fbbb9 Revises: 46e4acde004e Create Date: 2022-11-22 16:38:13.759083 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'ea91724fbbb9' down_revision = '46e4acde004e' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('workflows', sa.Column('foo', sa.String(length=255), nullable=False)) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('workflows', 'foo') # ### end Alembic commands ### $ director db upgrade INFO [alembic.runtime.migration] Context impl SQLiteImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [alembic.runtime.migration] Running upgrade -> 30d6f6636351, Initial migration INFO [alembic.runtime.migration] Running upgrade 30d6f6636351 -> 05cf96d6fcae, Add task result INFO [alembic.runtime.migration] Running upgrade 05cf96d6fcae -> 3f8466b16023, Add users table INFO [alembic.runtime.migration] Running upgrade 3f8466b16023 -> 063ff371f2da, Add index on workflow_id in task table INFO [alembic.runtime.migration] Running upgrade 063ff371f2da -> 2ac615d6850b, Force varchar 255 INFO [alembic.runtime.migration] Running upgrade 2ac615d6850b -> 46e4acde004e, Add cascade in task model for workflow deletion INFO [alembic.runtime.migration] Running upgrade 46e4acde004e -> ea91724fbbb9, add foo $ director db upgrade 46e4acde004e:ea91724fbbb9 --sql INFO [alembic.runtime.migration] Context impl SQLiteImpl. INFO [alembic.runtime.migration] Generating static SQL INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [alembic.runtime.migration] Running upgrade 46e4acde004e -> ea91724fbbb9, add foo -- Running upgrade 46e4acde004e -> ea91724fbbb9 ALTER TABLE workflows ADD COLUMN foo VARCHAR(255) NOT NULL; UPDATE alembic_version SET version_num='ea91724fbbb9' WHERE alembic_version.version_num = '46e4acde004e';
Tested with SQLite & PostgreSQL.
This PR switches to online mode in order to fix https://github.com/ovh/celery-director/issues/164
After merging it we'll be able to review & merge #170 and #162 (these PRs introduce new migrations).
POC:
Tested with SQLite & PostgreSQL.