From e8b9e17d06a6bd7cff7b5a30c649454f7bf3edfc Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Thu, 14 Jan 2021 12:10:50 +0100 Subject: [PATCH] Add missing primary key declarations --- api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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`)); """