-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setting versions II: sqlalchemy strikes back (#46)
* documentation * in progress * . * ready for PR * lint * cr * ready for cr * cl fix
- Loading branch information
Showing
29 changed files
with
2,107 additions
and
1,845 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
alembic/versions/83f0f272313f_added_setting_versioning_default_is_now_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
""""added setting versioning + default is now required" | ||
Revision ID: 83f0f272313f | ||
Revises: 7713520cb02b | ||
Create Date: 2022-01-04 14:04:46.416415 | ||
""" | ||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '83f0f272313f' | ||
down_revision = '7713520cb02b' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column('conditions', 'rule', | ||
existing_type=sa.INTEGER(), | ||
nullable=False) | ||
op.alter_column('conditions', 'context_feature', | ||
existing_type=sa.VARCHAR(), | ||
nullable=False) | ||
op.alter_column('configurable', 'setting', | ||
existing_type=sa.VARCHAR(), | ||
nullable=False) | ||
op.alter_column('configurable', 'context_feature', | ||
existing_type=sa.VARCHAR(), | ||
nullable=False) | ||
op.alter_column('rule_metadata', 'rule', | ||
existing_type=sa.INTEGER(), | ||
nullable=False) | ||
op.alter_column('rules', 'setting', | ||
existing_type=sa.VARCHAR(), | ||
nullable=False) | ||
op.alter_column('setting_aliases', 'setting', | ||
existing_type=sa.VARCHAR(), | ||
nullable=False) | ||
op.alter_column('setting_metadata', 'setting', | ||
existing_type=sa.VARCHAR(), | ||
nullable=False) | ||
op.add_column('settings', sa.Column('version', sa.String(), nullable=True)) | ||
op.execute("UPDATE settings SET version = '1.0'") | ||
op.alter_column('settings', 'default_value', | ||
existing_type=sa.VARCHAR(), | ||
nullable=False) | ||
op.alter_column('settings', 'default_value', | ||
existing_type=sa.VARCHAR(), | ||
nullable=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column('settings', 'default_value', | ||
existing_type=sa.VARCHAR(), | ||
nullable=True) | ||
op.drop_column('settings', 'version') | ||
op.alter_column('setting_metadata', 'setting', | ||
existing_type=sa.VARCHAR(), | ||
nullable=True) | ||
op.alter_column('setting_aliases', 'setting', | ||
existing_type=sa.VARCHAR(), | ||
nullable=True) | ||
op.alter_column('rules', 'setting', | ||
existing_type=sa.VARCHAR(), | ||
nullable=True) | ||
op.alter_column('rule_metadata', 'rule', | ||
existing_type=sa.INTEGER(), | ||
nullable=True) | ||
op.alter_column('configurable', 'context_feature', | ||
existing_type=sa.VARCHAR(), | ||
nullable=True) | ||
op.alter_column('configurable', 'setting', | ||
existing_type=sa.VARCHAR(), | ||
nullable=True) | ||
op.alter_column('conditions', 'context_feature', | ||
existing_type=sa.VARCHAR(), | ||
nullable=True) | ||
op.alter_column('conditions', 'rule', | ||
existing_type=sa.INTEGER(), | ||
nullable=True) | ||
# ### end Alembic commands ### |
Oops, something went wrong.