diff --git a/api.py b/api.py index 528cdaf..b83f60e 100644 --- a/api.py +++ b/api.py @@ -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`)); """