Add missing primary key declarations
This commit is contained in:
parent
06af4eaaea
commit
e8b9e17d06
1 changed files with 2 additions and 2 deletions
4
api.py
4
api.py
|
@ -19,9 +19,9 @@ class Database:
|
||||||
|
|
||||||
def create_tables(self):
|
def create_tables(self):
|
||||||
query = """
|
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 `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`));
|
CREATE TABLE IF NOT EXISTS `location` (`profile` VARCHAR(64), `timestamp` TIMESTAMP, `name` VARCHAR(128), `country` VARCHAR(64), FOREIGN KEY(`profile`) REFERENCES profile(`id`));
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue