diff --git a/setup.sql b/setup.sql index c2e7f1c..87c4873 100644 --- a/setup.sql +++ b/setup.sql @@ -34,7 +34,7 @@ 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 `fedi_account` ( +CREATE TABLE IF NOT EXISTS `fedi_accounts` ( `handle` VARCHAR(128) PRIMARY KEY, `outbox` VARCHAR(256), `credentials_id` INT NOT NULL, @@ -42,6 +42,12 @@ CREATE TABLE IF NOT EXISTS `fedi_account` ( `icon_update_time` DATETIME DEFAULT 0, FOREIGN KEY (`credentials_id`) REFERENCES credentials(id) ON DELETE CASCADE ) ENGINE=INNODB; +CREATE TABLE IF NOT EXISTS `bot_learned_accounts` ( + `bot_id` BINARY(64) NOT NULL, + `fedi_id` VARCHAR(128) NOT NULL, + FOREIGN KEY (`bot_id`) REFERENCES bots(id) ON DELETE CASCADE, + FOREIGN KEY (`fedi_id`) REFERENCES fedi_accounts(handle) ON DELETE CASCADE +) ENGINE=INNODB; CREATE TABLE IF NOT EXISTS `posts` ( `id` BIGINT AUTO_INCREMENT PRIMARY KEY, `fedi_id` VARCHAR(128),