17 lines
753 B
SQL
Executable File
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);
|