mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-12-04 19:15:30 +00:00
Create DB default values during the first migration
This commit is contained in:
parent
dc8b6b2351
commit
d2a5adc027
@ -16,6 +16,53 @@ branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def seed_data():
|
||||
role_table = sa.sql.table('role',
|
||||
sa.sql.column('id', sa.Integer),
|
||||
sa.sql.column('name', sa.String),
|
||||
sa.sql.column('description', sa.String)
|
||||
)
|
||||
|
||||
setting_table = sa.sql.table('setting',
|
||||
sa.sql.column('id', sa.Integer),
|
||||
sa.sql.column('name', sa.String),
|
||||
sa.sql.column('value', sa.String)
|
||||
)
|
||||
|
||||
template_table = sa.sql.table('domain_template',
|
||||
sa.sql.column('id', sa.Integer),
|
||||
sa.sql.column('name', sa.String),
|
||||
sa.sql.column('description', sa.String)
|
||||
)
|
||||
|
||||
op.bulk_insert(role_table,
|
||||
[
|
||||
{'id': 1, 'name': 'Administrator', 'description': 'Administrator'},
|
||||
{'id': 2, 'name': 'User', 'description': 'User'}
|
||||
]
|
||||
)
|
||||
|
||||
op.bulk_insert(setting_table,
|
||||
[
|
||||
{'id': 1, 'name': 'maintenance', 'value': 'False'},
|
||||
{'id': 2, 'name': 'fullscreen_layout', 'value': 'True'},
|
||||
{'id': 3, 'name': 'record_helper', 'value': 'True'},
|
||||
{'id': 4, 'name': 'login_ldap_first', 'value': 'True'},
|
||||
{'id': 5, 'name': 'default_record_table_size', 'value': '15'},
|
||||
{'id': 6, 'name': 'default_domain_table_size', 'value': '10'},
|
||||
{'id': 7, 'name': 'auto_ptr', 'value': 'False'}
|
||||
]
|
||||
)
|
||||
|
||||
op.bulk_insert(template_table,
|
||||
[
|
||||
{id: 1, 'name': 'basic_template_1', 'description': 'Basic Template #1'},
|
||||
{id: 2, 'name': 'basic_template_2', 'description': 'Basic Template #2'},
|
||||
{id: 3, 'name': 'basic_template_3', 'description': 'Basic Template #3'}
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('account',
|
||||
@ -120,6 +167,9 @@ def upgrade():
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
# Insert default values to the database
|
||||
seed_data()
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
|
Loading…
Reference in New Issue
Block a user