Script 14d5bf9ab362_enable_rawhide_py
[hide private]
[frames] | no frames]

Source Code for Script script-14d5bf9ab362_enable_rawhide_py

 1  """enable_rawhide 
 2   
 3  Revision ID: 14d5bf9ab362 
 4  Revises: 419a626c25e6 
 5  Create Date: 2017-02-27 10:10:37.158399 
 6   
 7  """ 
 8   
 9  # revision identifiers, used by Alembic. 
10  revision = '14d5bf9ab362' 
11  down_revision = '419a626c25e6' 
12   
13  from alembic import op 
14   
15   
16 -def upgrade():
17 bind = op.get_bind() 18 connection = bind.connect() 19 20 connection.execute( 21 "INSERT INTO mock_chroot (\"os_release\", \"os_version\", \"arch\", \"is_active\") VALUES('fedora', 'rawhide', 'x86_64', True) ON CONFLICT ON CONSTRAINT mock_chroot_uniq DO UPDATE SET is_active=True;" 22 ) 23 connection.execute( 24 "INSERT INTO mock_chroot (\"os_release\", \"os_version\", \"arch\", \"is_active\") VALUES('fedora', 'rawhide', 'i386', True) ON CONFLICT ON CONSTRAINT mock_chroot_uniq DO UPDATE SET is_active=True;" 25 ) 26 connection.execute( 27 "INSERT INTO mock_chroot (\"os_release\", \"os_version\", \"arch\", \"is_active\") VALUES('fedora', 'rawhide', 'ppc64le', True) ON CONFLICT ON CONSTRAINT mock_chroot_uniq DO UPDATE SET is_active=True;" 28 ) 29 connection.close()
30 31
32 -def downgrade():
33 bind = op.get_bind() 34 connection = bind.connect() 35 36 connection.execute( # there might be already referencing records so just set is_active to False instead of removing 37 "UPDATE mock_chroot SET is_active=False WHERE os_release = 'fedora' AND os_version = 'rawhide'" 38 ) 39 connection.close()
40