-- Migration: 0002_trainings -- Description: Basic migration to initialize and create basic tarinings table -- Schemas for trainings -- Trainings table CREATE TABLE IF NOT EXISTS trainings ( id SERIAL PRIMARY KEY, date DATE NOT NULL, trainer VARCHAR(100) ); -- Exercies table CREATE TABLE IF NOT EXISTS exercises ( id SERIAL PRIMARY KEY, training_id INTEGER REFERENCES trainings(id) ON DELETE CASCADE, name VARCHAR(255) NOT NULL, splitted_weigh BOOLEAN DEFAULT FALSE ); -- Approaches table CREATE TABLE IF NOT EXISTS approaches ( id SERIAL PRIMARY KEY, approach_id INTEGER REFERENCES approaches(id) ON DELETE CASCADE, weight FLOAT NOT NULL, reps INTEGER NOT NULL ); INSERT INTO schema_migrations (version) VALUES ('0002_trainings');