-
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
10 changed files
with
109 additions
and
71 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
securedrop/alembic/versions/523fff3f969c_add_versioned_instance_config.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,41 @@ | ||
"""add versioned instance config | ||
Revision ID: 523fff3f969c | ||
Revises: 3da3fcab826a | ||
Create Date: 2019-11-02 23:06:12.161868 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '523fff3f969c' | ||
down_revision = '3da3fcab826a' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('instance_config', | ||
sa.Column('version', sa.Integer(), nullable=False), | ||
sa.Column('valid_until', sa.DateTime(), nullable=True), | ||
sa.Column('allow_document_uploads', sa.Boolean(), nullable=True), | ||
|
||
sa.PrimaryKeyConstraint('version'), | ||
sa.UniqueConstraint('valid_until'), | ||
) | ||
# ### 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! ### | ||
op.drop_table('instance_config') | ||
# ### end Alembic commands ### |
32 changes: 0 additions & 32 deletions
32
securedrop/alembic/versions/fef03c1ec779_add_instance_config_key_value_store.py
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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