Fix create_db.py, update_db.py
This commit is contained in:
GaMeNu 2023-10-20 01:34:57 +03:00
parent 1477003229
commit 54d1e08078
2 changed files with 2 additions and 4 deletions

View File

@ -81,7 +81,7 @@ CREATE TABLE IF NOT EXISTS `hfc_db`.`channels` (
`channel_id` BIGINT(8) UNSIGNED NOT NULL,
`server_id` BIGINT(8) UNSIGNED NULL,
`channel_lang` VARCHAR(15) NOT NULL,
`locations` JSON DEFAULT JSON_ARRAY(),
`locations` JSON NOT NULL DEFAULT ('[]'),
PRIMARY KEY (`channel_id`),
UNIQUE INDEX `channel_id_UNIQUE` (`channel_id` ASC) VISIBLE,
CONSTRAINT `server_id`

View File

@ -14,9 +14,7 @@ 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` '
'ADD COLUMN `locations` JSON '
'DEFAULT JSON_ARRAY();')
crsr.execute("ALTER TABLE `hfc_db`.`channels` ADD COLUMN `locations` JSON NOT NULL DEFAULT ('[]');")
crsr.close()
return '1.0.1'