Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[frontend] add migration to enable mageia chroots
- Loading branch information
clime
committed
Sep 20, 2016
1 parent
e6ce903
commit 49909c4
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
frontend/coprs_frontend/alembic/versions/3341bf554454_add_mageia_chroots.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,43 @@ | ||
"""add mageia chroots | ||
Revision ID: 3341bf554454 | ||
Revises: 8de41eec1d1 | ||
Create Date: 2016-09-20 19:28:16.115630 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '3341bf554454' | ||
down_revision = '8de41eec1d1' | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
def upgrade(): | ||
bind = op.get_bind() | ||
connection = bind.connect() | ||
|
||
connection.execute( | ||
"INSERT INTO mock_chroot(os_release, os_version, arch, is_active) VALUES ('mageia', '6', 'x86_64', True)" | ||
) | ||
connection.execute( | ||
"INSERT INTO mock_chroot(os_release, os_version, arch, is_active) VALUES ('mageia', '6', 'i586', True)" | ||
) | ||
connection.execute( | ||
"INSERT INTO mock_chroot(os_release, os_version, arch, is_active) VALUES ('mageia', 'cauldron', 'x86_64', True)" | ||
) | ||
connection.execute( | ||
"INSERT INTO mock_chroot(os_release, os_version, arch, is_active) VALUES ('mageia', 'cauldron', 'i586', True)" | ||
) | ||
connection.close() | ||
|
||
|
||
def downgrade(): | ||
bind = op.get_bind() | ||
connection = bind.connect() | ||
|
||
connection.execute( # there might be already referencing records so just set is_active to False instead of removing | ||
"UPDATE mock_chroot SET is_active=False WHERE os_release = 'mageia'" | ||
) | ||
connection.close() |