-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: versioned instance_config, "one configuration option per co…
…lumn"
- Loading branch information
Showing
9 changed files
with
116 additions
and
46 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
40 changes: 40 additions & 0 deletions
40
securedrop/alembic/versions/e0719fbc39a0_add_instance_config_allow_document_.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,40 @@ | ||
"""add instance_config.allow_document_uploads | ||
Revision ID: e0719fbc39a0 | ||
Revises: 523fff3f969c | ||
Create Date: 2019-11-02 23:06:52.999672 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
import datetime | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'e0719fbc39a0' | ||
down_revision = '523fff3f969c' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('instance_config', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('allow_document_uploads', sa.Boolean(), nullable=True)) | ||
|
||
# ### end Alembic commands ### | ||
|
||
# Data migration: Since allow_document_uploads is the first | ||
# instance_config setting (column), all we have to do is insert a | ||
# row with its default value. | ||
conn = op.get_bind() | ||
conn.execute("""INSERT INTO instance_config (allow_document_uploads) VALUES (1)""") | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('instance_config', schema=None) as batch_op: | ||
batch_op.drop_column('allow_document_uploads') | ||
|
||
# ### end Alembic commands ### |
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
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
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
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
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
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
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