Skip to content

Commit b5a6ce0

Browse files
committed
Added migration file for goal table
1 parent 5a70f5a commit b5a6ce0

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 goals table if it exists
2+
DROP TABLE IF EXISTS goals;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CREATE TABLE goals (
2+
id INT AUTO_INCREMENT PRIMARY KEY,
3+
user_id VARCHAR(36) NOT NULL,
4+
complex_id INT NOT NULL,
5+
surface_goal VARCHAR(255) NOT NULL,
6+
underlying_goal VARCHAR(255) NOT NULL,
7+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
8+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
9+
INDEX idx_user_id_goal (user_id),
10+
INDEX idx_complex_id_goal (complex_id),
11+
FOREIGN KEY (complex_id) REFERENCES complexes(id) ON DELETE CASCADE
12+
);

0 commit comments

Comments
 (0)