From fec7fcdd716b956dcb89f52816e6c6907fefc7eb Mon Sep 17 00:00:00 2001 From: RealistikDash Date: Tue, 10 Sep 2024 23:38:38 +0100 Subject: [PATCH 1/2] Create 1726007727_commissions_table.up.sql --- .../migrations/1726007727_commissions_table.up.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 migrator/migrations/1726007727_commissions_table.up.sql diff --git a/migrator/migrations/1726007727_commissions_table.up.sql b/migrator/migrations/1726007727_commissions_table.up.sql new file mode 100644 index 0000000..f68701b --- /dev/null +++ b/migrator/migrations/1726007727_commissions_table.up.sql @@ -0,0 +1,14 @@ +CREATE TABLE CommissionAssignment ( + id INT AUTO_INCREMENT PRIMARY KEY, + user_id INT NOT NULL, + commission VARCHAR(255) NOT NULL, + reward INT NOT NULL, + created_at DATE NOT NULL, + completed BOOLEAN NOT NULL, + + -- Composite unique key for user_id, commission, and created_at + UNIQUE KEY (user_id, commission, created_at), + + -- Index on (user_id, created_at) + INDEX idx_user_created_at (user_id, created_at) +); From 13ef525bfe802bb334e5cce9209b4d665c35afee Mon Sep 17 00:00:00 2001 From: RealistikDash Date: Mon, 16 Sep 2024 14:06:07 +0100 Subject: [PATCH 2/2] case --- migrator/migrations/1726007727_commissions_table.up.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrator/migrations/1726007727_commissions_table.up.sql b/migrator/migrations/1726007727_commissions_table.up.sql index f68701b..a0573fc 100644 --- a/migrator/migrations/1726007727_commissions_table.up.sql +++ b/migrator/migrations/1726007727_commissions_table.up.sql @@ -1,4 +1,4 @@ -CREATE TABLE CommissionAssignment ( +CREATE TABLE commission_assignment ( id INT AUTO_INCREMENT PRIMARY KEY, user_id INT NOT NULL, commission VARCHAR(255) NOT NULL,