Initial commit
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
16
backend/migrations/002_create_training_sets.up.sql
Executable file
16
backend/migrations/002_create_training_sets.up.sql
Executable file
@@ -0,0 +1,16 @@
|
||||
CREATE TABLE training_sets (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL CHECK(length(name) >= 1 AND length(name) <= 100),
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at DATETIME
|
||||
);
|
||||
|
||||
CREATE TABLE set_exercises (
|
||||
set_id INTEGER NOT NULL REFERENCES training_sets(id) ON DELETE CASCADE,
|
||||
exercise_id INTEGER NOT NULL REFERENCES exercises(id),
|
||||
position INTEGER NOT NULL CHECK(position >= 0),
|
||||
PRIMARY KEY (set_id, exercise_id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_set_exercises_set_id ON set_exercises(set_id);
|
||||
Reference in New Issue
Block a user