From eafdd752212917c7cc23f3354c603b278e86d3aa Mon Sep 17 00:00:00 2001 From: zibthedog Date: Sun, 28 Jul 2024 12:41:48 -0400 Subject: [PATCH] add FF tables --- db/db.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/db/db.go b/db/db.go index 885c3b7..09c9bc8 100644 --- a/db/db.go +++ b/db/db.go @@ -103,6 +103,11 @@ func setupDb(tx *sql.Tx) error { `ALTER TABLE accounts ADD COLUMN IF NOT EXISTS discordId VARCHAR(32) UNIQUE DEFAULT NULL`, `ALTER TABLE accounts ADD COLUMN IF NOT EXISTS googleId VARCHAR(32) UNIQUE DEFAULT NULL`, + + // ---------------------------------- + // MIGRATION 004 + `CREATE TABLE IF NOT EXISTS featureFlags (id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(64) UNIQUE NOT NULL, enabled TINYINT(1) NOT NULL, percentage TINYINT(3) NOT NULL DEFAULT 0)` + `CREATE TABLE IF NOT EXISTS accountFeatureFlagOverrides (accountId BINARY(16) NOT_NULL, flagId INT(11) NOT NULL, PRIMARY KEY (accountId, flagId), FOREIGN KEY (accountId) REFERENCES accounts (uuid) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (flagId) REFERENCES featureFlags (id) ON DELETE CASCADE ON UPDATE CASCADE)` } for _, q := range queries {