[feat] add initial database schema with tables, triggers, and views

This commit is contained in:
2025-08-21 00:22:03 +02:00
parent 31af27f515
commit b8f33e252a
68 changed files with 882 additions and 0 deletions

25
database/main/trait.sql Normal file
View File

@@ -0,0 +1,25 @@
create table trait
(
id INTEGER
primary key,
optolith_key TEXT not null
unique,
name TEXT not null,
kind TEXT not null,
is_leveled INTEGER default 0 not null,
level_min INTEGER,
level_max INTEGER,
level_step INTEGER,
ap_cost_mode TEXT default 'FIXED' not null,
ap_wert INTEGER,
ap_per_level INTEGER,
ap_formula TEXT,
beschreibung TEXT,
check (ap_cost_mode IN ('FIXED', 'PER_LEVEL', 'TABLE', 'FORMULA')),
check (is_leveled IN (0, 1)),
check (kind IN ('VORTEIL', 'NACHTEIL'))
);
create index idx_trait_kind
on trait (kind);