[feat] extend database schema with new tables and indexes

This commit is contained in:
2025-08-21 00:29:14 +02:00
parent b8f33e252a
commit 49a9e08d38
32 changed files with 392 additions and 36 deletions

View File

@@ -0,0 +1,17 @@
create table alchemical_recipe
(
id INTEGER
primary key,
name TEXT not null
unique,
result_item_id INTEGER
references item,
herstellungs_talent_id INTEGER not null
references talent,
herstellungs_probe_mod INTEGER default 0,
labor_schwierigkeit TEXT,
rezept_kosten_heller INTEGER,
wirkungsbeschreibung TEXT,
wirkung_strukturiert TEXT
);

View File

@@ -0,0 +1,11 @@
create table ammunition
(
id INTEGER
primary key,
item_id INTEGER not null
unique
references item
on delete cascade,
passend_fuer_fk_waffe_typ TEXT
);

13
database/main/armor.sql Normal file
View File

@@ -0,0 +1,13 @@
create table armor
(
id INTEGER
primary key,
item_id INTEGER not null
unique
references item
on delete cascade,
ruestungsschutz INTEGER not null,
behaelinderung REAL not null,
zonen TEXT
);

View File

@@ -0,0 +1,9 @@
create table availability_level
(
id INTEGER
primary key,
stufe INTEGER not null
unique,
beschreibung TEXT
);

View File

@@ -0,0 +1,20 @@
create table crafting_recipe
(
id INTEGER
primary key,
result_item_id INTEGER not null
references item,
required_talent_id INTEGER not null
references talent,
required_fw INTEGER not null,
zeitaufwand_in_ze TEXT,
benoetigte_materialien TEXT,
anmerkung TEXT
);
create index idx_crafting_recipe_item
on crafting_recipe (result_item_id);
create index idx_crafting_recipe_talent
on crafting_recipe (required_talent_id);

View File

@@ -0,0 +1,27 @@
create table creature
(
id INTEGER
primary key,
optolith_key TEXT
unique,
name TEXT not null,
typ TEXT,
groessenkategorie TEXT,
attr_mu INTEGER,
attr_kl INTEGER,
attr_in INTEGER,
attr_ch INTEGER,
attr_ff INTEGER,
attr_ge INTEGER,
attr_ko INTEGER,
attr_kk INTEGER,
le_formel TEXT,
sk_wert INTEGER,
zk_wert INTEGER,
gs_wert INTEGER,
ini_formel TEXT,
rs_wert INTEGER,
beschreibung TEXT,
fluchtverhalten TEXT
);

View File

@@ -0,0 +1,15 @@
create table creature_attack
(
id INTEGER
primary key,
creature_id INTEGER not null
references creature
on delete cascade,
name TEXT not null,
at_wert INTEGER,
pa_wert INTEGER,
tp_formel TEXT,
reichweite TEXT,
eigenschaften TEXT
);

View File

@@ -0,0 +1,14 @@
create table creature_attack_has_property
(
attack_id INTEGER not null
references creature_attack
on delete cascade,
property_id INTEGER not null
references creature_attack_property
on delete restrict,
primary key (attack_id, property_id)
);
create index idx_creature_attack_has_prop_prop
on creature_attack_has_property (property_id);

View File

@@ -0,0 +1,9 @@
create table creature_attack_property
(
id INTEGER
primary key,
name TEXT not null
unique,
beschreibung TEXT
);

View File

@@ -0,0 +1,14 @@
create table creature_special_ability
(
creature_id INTEGER not null
references creature
on delete cascade,
special_ability_id INTEGER not null
references special_ability
on delete restrict,
primary key (creature_id, special_ability_id)
);
create index idx_creature_sa_sa
on creature_special_ability (special_ability_id);

View File

@@ -0,0 +1,15 @@
create table creature_talent
(
creature_id INTEGER not null
references creature
on delete cascade,
talent_id INTEGER not null
references talent
on delete restrict,
fertigkeitswert INTEGER not null,
primary key (creature_id, talent_id)
);
create index idx_creature_talent_talent
on creature_talent (talent_id);

View File

@@ -16,6 +16,3 @@ create table culture_trait
create index idx_culture_trait_trait
on culture_trait (trait_id);
create index idx_culture_trait_trait2
on culture_trait (trait_id);

11
database/main/deity.sql Normal file
View File

@@ -0,0 +1,11 @@
create table deity
(
id INTEGER
primary key,
name TEXT not null
unique,
aspekte TEXT,
herrschaftsbereich TEXT,
heiliges_tier TEXT
);

15
database/main/item.sql Normal file
View File

@@ -0,0 +1,15 @@
create table item
(
id INTEGER
primary key,
name TEXT not null,
typ TEXT not null,
gewicht_in_unzen INTEGER default 0,
preis_in_heller INTEGER default 0,
beschreibung TEXT,
verfuegbarkeit TEXT,
availability_id INTEGER
references availability_level,
check (typ IN ('WAFFE', 'RÜSTUNG', 'SCHILD', 'FERNKAMPFWAFFE', 'MUNITION', 'ALLGEMEIN', 'ALCHEMIKA'))
);

View File

@@ -1,17 +1,19 @@
create table kampftechnik
(
id INTEGER
id INTEGER
primary key,
optolith_key TEXT not null
optolith_key TEXT not null
unique,
name TEXT not null,
grundwert INTEGER default 6 not null,
probe_attr1_id INTEGER
name TEXT not null,
grundwert INTEGER default 6 not null,
probe_attr1_id INTEGER
references attribute,
probe_attr2_id INTEGER
probe_attr2_id INTEGER
references attribute,
probe_attr3_id INTEGER
probe_attr3_id INTEGER
references attribute,
beschreibung TEXT
beschreibung TEXT,
leiteigenschaft_id INTEGER
references attribute
);

View File

@@ -0,0 +1,17 @@
create table liturgy_modification
(
id INTEGER
primary key,
liturgy_id INTEGER not null
references liturgy
on delete cascade,
name TEXT not null,
wirkung TEXT not null,
voraussetzung TEXT,
kosten_modifikation TEXT,
unique (liturgy_id, name)
);
create index idx_liturgy_mod_liturgy
on liturgy_modification (liturgy_id);

View File

@@ -0,0 +1,16 @@
create table poison_disease
(
id INTEGER
primary key,
name TEXT not null
unique,
typ TEXT not null,
art TEXT,
resistenz_probe_attr TEXT not null,
stufe INTEGER,
wirkungsbeginn TEXT,
schaden_wirkung TEXT,
dauer TEXT,
check (typ IN ('GIFT', 'KRANKHEIT'))
);

View File

@@ -14,6 +14,3 @@ create table profession_trait
create index idx_profession_trait_trait
on profession_trait (trait_id);
create index idx_profession_trait_trait2
on profession_trait (trait_id);

View File

@@ -0,0 +1,18 @@
create table ranged_weapon
(
id INTEGER
primary key,
item_id INTEGER not null
unique
references item
on delete cascade,
kampftechnik_id INTEGER not null
references kampftechnik
on delete restrict,
schaden_tp_formel TEXT not null,
ladezeit_in_aktionen INTEGER,
reichweite_nah INTEGER,
reichweite_mittel INTEGER,
reichweite_fern INTEGER
);

View File

@@ -0,0 +1,11 @@
create table service_cost
(
id INTEGER
primary key,
name TEXT not null,
kategorie TEXT,
preis_in_heller INTEGER,
preis_bemerkung TEXT,
beschreibung TEXT
);

17
database/main/shield.sql Normal file
View File

@@ -0,0 +1,17 @@
create table shield
(
id INTEGER
primary key,
item_id INTEGER not null
unique
references item
on delete cascade,
kampftechnik_id INTEGER not null
references kampftechnik
on delete restrict,
at_mod INTEGER default 0,
pa_mod INTEGER default 0,
zusatz_rs INTEGER default 0,
zusatz_be REAL default 0
);

View File

@@ -0,0 +1,10 @@
create table social_status
(
id INTEGER
primary key,
name TEXT not null
unique,
ap_kosten INTEGER not null,
beschreibung TEXT
);

View File

@@ -1,14 +1,15 @@
create table special_ability
(
id INTEGER
id INTEGER
primary key,
optolith_key TEXT not null
optolith_key TEXT not null
unique,
name TEXT not null,
type_code TEXT
name TEXT not null,
type_code TEXT
references sa_type
on update cascade,
ap_kosten INTEGER,
beschreibung TEXT
ap_kosten INTEGER,
beschreibung TEXT,
benoetigt_parameter BOOLEAN default 0 not null
);

View File

@@ -16,6 +16,3 @@ create table species_trait
create index idx_species_trait_trait
on species_trait (trait_id);
create index idx_species_trait_trait2
on species_trait (trait_id);

View File

@@ -0,0 +1,17 @@
create table spell_modification
(
id INTEGER
primary key,
spell_id INTEGER not null
references spell
on delete cascade,
name TEXT not null,
wirkung TEXT not null,
voraussetzung TEXT,
kosten_modifikation TEXT,
unique (spell_id, name)
);
create index idx_spell_mod_spell
on spell_modification (spell_id);

View File

@@ -0,0 +1,10 @@
create table status_effect
(
id INTEGER
primary key,
name TEXT not null
unique,
max_stufen INTEGER,
regel_beschreibung TEXT
);

View File

@@ -0,0 +1,14 @@
create table tradition_has_deity
(
tradition_id INTEGER not null
references tradition
on delete cascade,
deity_id INTEGER not null
references deity
on delete restrict,
primary key (tradition_id, deity_id)
);
create index idx_trad_deity_deity
on tradition_has_deity (deity_id);

View File

@@ -1,20 +1,21 @@
create table trait
(
id INTEGER
id INTEGER
primary key,
optolith_key TEXT not null
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,
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,
benoetigt_parameter BOOLEAN default 0 not null,
check (ap_cost_mode IN ('FIXED', 'PER_LEVEL', 'TABLE', 'FORMULA')),
check (is_leveled IN (0, 1)),
check (kind IN ('VORTEIL', 'NACHTEIL'))

18
database/main/weapon.sql Normal file
View File

@@ -0,0 +1,18 @@
create table weapon
(
id INTEGER
primary key,
item_id INTEGER not null
unique
references item
on delete cascade,
kampftechnik_id INTEGER not null
references kampftechnik
on delete restrict,
schaden_tp_formel TEXT not null,
tp_kk_schwelle INTEGER,
tp_kk_schritt INTEGER,
at_mod INTEGER default 0,
pa_mod INTEGER default 0
);

View File

@@ -0,0 +1,14 @@
create table weapon_has_property
(
weapon_id INTEGER not null
references weapon
on delete cascade,
property_id INTEGER not null
references weapon_property
on delete restrict,
primary key (weapon_id, property_id)
);
create index idx_weapon_has_property_prop
on weapon_has_property (property_id);

View File

@@ -0,0 +1,9 @@
create table weapon_property
(
id INTEGER
primary key,
name TEXT not null
unique,
beschreibung TEXT
);

BIN
rules.db

Binary file not shown.