update db changed check

This commit is contained in:
j 2023-07-29 13:42:07 +02:00
parent 9d5222f0cc
commit a5c35d0f41

View file

@ -352,25 +352,15 @@ if __name__ == "__main__":
run('./manage.py', 'update_static') run('./manage.py', 'update_static')
run('./manage.py', 'compile_pyc', '-p', '.') run('./manage.py', 'compile_pyc', '-p', '.')
os.chdir(join(base, 'pandora')) os.chdir(join(base, 'pandora'))
diff = get('./manage.py', 'sqldiff', '-a').strip() diff = get('./manage.py', 'sqldiff', '-a').strip().split('\n')
for row in [ diff = [
'-- Model missing for table: djcelery_periodictasks\n', row for row in diff
'-- Model missing for table: celery_taskmeta\n', if not row.strip().startswith('ALTER "id" TYPE')
'-- Model missing for table: celery_tasksetmeta\n', and not row.startswith('--')
'-- Model missing for table: djcelery_crontabschedule\n', and not row.startswith('ALTER TABLE')
'-- Model missing for table: djcelery_periodictask\n', and row not in ['BEGIN;', 'COMMIT;']
'-- Model missing for table: djcelery_intervalschedule\n', ]
'-- Model missing for table: djcelery_workerstate\n', if diff:
'-- Model missing for table: djcelery_taskstate\n',
'-- Model missing for table: south_migrationhistory\n',
'-- Model missing for table: cache\n',
]:
if row in diff:
diff = diff.replace(row, '')
if diff not in [
'-- No differences',
'BEGIN;\nCOMMIT;'
]:
print('Database has changed, please make a backup and run %s db' % sys.argv[0]) print('Database has changed, please make a backup and run %s db' % sys.argv[0])
elif branch != 'master': elif branch != 'master':
print('pan.do/ra is at the latest release,\nyou can run "%s switch master" to switch to the development version' % sys.argv[0]) print('pan.do/ra is at the latest release,\nyou can run "%s switch master" to switch to the development version' % sys.argv[0])