Files
krafttrainer/backend/db/migrations/001_create_exercises.up.sql
Christoph K. dfd66e43c6 Initial commit
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 15:03:55 +01:00

17 lines
753 B
SQL
Executable File

CREATE TABLE exercises (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL CHECK(length(name) >= 1 AND length(name) <= 100),
description TEXT DEFAULT '',
muscle_group TEXT NOT NULL CHECK(muscle_group IN (
'brust', 'ruecken', 'schultern', 'bizeps', 'trizeps',
'beine', 'bauch', 'ganzkoerper', 'sonstiges'
)),
weight_step_kg REAL NOT NULL DEFAULT 2.5 CHECK(weight_step_kg > 0),
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME
);
CREATE INDEX idx_exercises_muscle_group ON exercises(muscle_group) WHERE deleted_at IS NULL;
CREATE INDEX idx_exercises_deleted_at ON exercises(deleted_at);