Skip to content

Commit e27d382

Browse files
committed
Added migration file for actions table
1 parent 5bc5b8a commit e27d382

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- This migration will drop the actions table if it exists
2+
DROP TABLE IF EXISTS actions;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CREATE TABLE actions (
2+
id INT AUTO_INCREMENT PRIMARY KEY,
3+
user_id VARCHAR(36) NOT NULL,
4+
goal_id INT NOT NULL,
5+
content TEXT NOT NULL,
6+
completed_at TIMESTAMP NULL,
7+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
8+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
9+
INDEX idx_user_id_action (user_id),
10+
INDEX idx_goal_id_action (goal_id),
11+
FOREIGN KEY (goal_id) REFERENCES goals(id) ON DELETE CASCADE
12+
);

0 commit comments

Comments
 (0)