mirror of
https://github.com/GaMeNu/HFCNotificator.git
synced 2024-11-16 15:24:51 +02:00
v2.2.0 RELEASE!
Small bugfix 2.2
This commit is contained in:
parent
f6c54ec9c2
commit
b6dfa42592
@ -13,10 +13,22 @@ DB_PASSWORD = os.getenv('DB_PASSWORD')
|
||||
|
||||
|
||||
def updater_1_0_0(connection: mysql.connection.MySQLConnection) -> str:
|
||||
crsr = connection.cursor()
|
||||
crsr.execute("ALTER TABLE `hfc_db`.`channels` DROP COLUMN IF EXISTS locations")
|
||||
with connection.cursor() as crsr:
|
||||
crsr.execute("SELECT COLUMN_NAME "
|
||||
"FROM INFORMATION_SCHEMA.COLUMNS "
|
||||
"WHERE TABLE_SCHEMA = 'hfc_db' "
|
||||
"AND TABLE_NAME = 'channels' "
|
||||
"AND COLUMN_NAME = 'locations';")
|
||||
|
||||
exists = (crsr.fetchone() is not None)
|
||||
|
||||
crsr.nextset()
|
||||
|
||||
if exists:
|
||||
crsr.execute("ALTER TABLE `hfc_db`.`channels` DROP COLUMN `locations`;")
|
||||
|
||||
crsr.execute("ALTER TABLE `hfc_db`.`channels` ADD COLUMN `locations` JSON NOT NULL DEFAULT ('[]');")
|
||||
crsr.close()
|
||||
|
||||
return '1.0.1'
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user