1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-12-28 07:18:59 +00:00

fix foreign key errors

This commit is contained in:
Lynne Megido 2019-09-01 16:10:30 +10:00
parent d2fb6f341e
commit 4cab9b2f36

View file

@ -9,12 +9,18 @@ CREATE TABLE IF NOT EXISTS `contact_settings` (
`fetch` ENUM('always', 'once', 'never') DEFAULT 'once',
`submit` ENUM('always', 'once', 'never') DEFAULT 'once',
`generation` ENUM('always', 'once', 'never') DEFAULT 'once',
`reply` ENUM('always', 'once', 'never') DEFAULT 'once'
FOREIGN KEY (`user_id`) REFERENCES users(id) ON DELETE CASCADE,
`reply` ENUM('always', 'once', 'never') DEFAULT 'once',
FOREIGN KEY (`user_id`) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS `credentials` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`client_id` VARCHAR(128) NOT NULL,
`client_secret` VARCHAR(128) NOT NULL,
`secret` VARCHAR(128) NOT NULL
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS `bots` (
`id` BINARY(64) PRIMARY KEY,
`user_id` BINARY(64) PRIMARY KEY,
`user_id` BINARY(64) NOT NULL,
`credentials_id` INT NOT NULL,
`enabled` BOOLEAN DEFAULT 1,
`replies_enabled` BOOLEAN DEFAULT 1,
@ -31,12 +37,6 @@ CREATE TABLE IF NOT EXISTS `bots` (
FOREIGN KEY (`user_id`) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (`credentials_id`) REFERENCES credentials(id) ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS `credentials` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`client_id` VARCHAR(128) NOT NULL,
`client_secret` VARCHAR(128) NOT NULL,
`secret` VARCHAR(128) NOT NULL
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS `fedi_account` (
`handle` VARCHAR(128) NOT NULL PRIMARY KEY,
`outbox` VARCHAR(256),
@ -55,14 +55,14 @@ CREATE TABLE IF NOT EXISTS `word_blacklist` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`bot_id` BINARY(64) NOT NULL,
`phrase` VARCHAR(128) NOT NULL,
`whole_word` BOOLEAN NOT NULL
FOREIGN KEY (`bot_id`) REFERENCES bots(id) ON DELETE CASCADE,
`whole_word` BOOLEAN NOT NULL,
FOREIGN KEY (`bot_id`) REFERENCES bots(id) ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS `contact_history` (
`user_id` BINARY(64) NOT NULL,
`fetch` BOOLEAN DEFAULT 0,
`submit` BOOLEAN DEFAULT 0,
`generation` BOOLEAN DEFAULT 0,
`reply` BOOLEAN DEFAULT 0
FOREIGN KEY (`user_id`) REFERENCES users(id) ON DELETE CASCADE,
`reply` BOOLEAN DEFAULT 0,
FOREIGN KEY (`user_id`) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=INNODB;