Phase 1 of migrating APPR-specific tables to tables with the Appr
prefix
Fixes https://jira.coreos.com/browse/QUAY-950
This commit is contained in:
parent
6622f27c93
commit
113bb96f29
28 changed files with 699 additions and 176 deletions
|
@ -1,4 +1,6 @@
|
|||
from data import model, appr_model
|
||||
from data import model
|
||||
from data.appr_model import blob
|
||||
from data.appr_model.models import OLD_MODELS
|
||||
|
||||
|
||||
def sync_database_with_config(config):
|
||||
|
@ -7,4 +9,4 @@ def sync_database_with_config(config):
|
|||
location_names = config.get('DISTRIBUTED_STORAGE_CONFIG', {}).keys()
|
||||
if location_names:
|
||||
model.image.ensure_image_locations(*location_names)
|
||||
appr_model.blob.ensure_blob_locations(*location_names)
|
||||
blob.ensure_blob_locations(OLD_MODELS, *location_names)
|
||||
|
|
|
@ -881,6 +881,13 @@ CONFIG_SCHEMA = {
|
|||
'x-example': False,
|
||||
},
|
||||
|
||||
# Feature Flag: Read only app registry.
|
||||
'FEATURE_READONLY_APP_REGISTRY': {
|
||||
'type': 'boolean',
|
||||
'description': 'Whether to App repositories are read-only. Defaults to False',
|
||||
'x-example': True,
|
||||
},
|
||||
|
||||
# Feature Flag: Public Reposiotires in _catalog Endpoint.
|
||||
'FEATURE_PUBLIC_CATALOG': {
|
||||
'type': 'boolean',
|
||||
|
|
11
util/migrate/table_ops.py
Normal file
11
util/migrate/table_ops.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
def copy_table_contents(source_table, destination_table, conn):
|
||||
if conn.engine.name == 'postgresql':
|
||||
conn.execute('INSERT INTO "%s" SELECT * FROM "%s"' % (destination_table, source_table))
|
||||
result = list(conn.execute('Select Max(id) from "%s"' % destination_table))[0]
|
||||
new_start_id = result[0] + 1
|
||||
conn.execute('ALTER SEQUENCE "%s_id_seq" RESTART WITH %s' % (destination_table, new_start_id))
|
||||
else:
|
||||
conn.execute("INSERT INTO `%s` SELECT * FROM `%s` WHERE 1" % (destination_table, source_table))
|
||||
result = list(conn.execute('Select Max(id) from `%s` WHERE 1' % destination_table))[0]
|
||||
new_start_id = result[0] + 1
|
||||
conn.execute("ALTER TABLE `%s` AUTO_INCREMENT = %s" % (destination_table, new_start_id))
|
Reference in a new issue