Add missing primary key declarations

This commit is contained in:
Kumi 2021-01-14 12:10:50 +01:00
parent 06af4eaaea
commit e8b9e17d06

4
api.py
View file

@ -19,9 +19,9 @@ class Database:
def create_tables(self):
query = """
CREATE TABLE IF NOT EXISTS `message` (`id` VARCHAR(64), `sender` VARCHAR(64), `recipient` VARCHAR(64), `date` TIMESTAMP, `text` TEXT);
CREATE TABLE IF NOT EXISTS `message` (`id` VARCHAR(64) PRIMARY KEY, `sender` VARCHAR(64), `recipient` VARCHAR(64), `date` TIMESTAMP, `text` TEXT);
CREATE TABLE IF NOT EXISTS `attachment` (`id` VARCHAR(64) PRIMARY KEY, `owner` VARCHAR(64), `token` VARCHAR(64), `message` VARCHAR(64), `content` BLOB, FOREIGN KEY(`message`) REFERENCES message(`id`));
CREATE TABLE IF NOT EXISTS `profile` (`id` VARCHAR(64), `name` VARCHAR(256));
CREATE TABLE IF NOT EXISTS `profile` (`id` VARCHAR(64) PRIMARY KEY, `name` VARCHAR(256));
CREATE TABLE IF NOT EXISTS `location` (`profile` VARCHAR(64), `timestamp` TIMESTAMP, `name` VARCHAR(128), `country` VARCHAR(64), FOREIGN KEY(`profile`) REFERENCES profile(`id`));
"""