Обновить works/28.09.finalDbRef(SQL)

This commit is contained in:
Arf
2026-09-28 23:19:15 +00:00
parent 9c3b5ca6e5
commit d1e651acc4
+98 -109
View File
@@ -1,149 +1,138 @@
CREATE TABLE card_type (
type_id INTEGER PRIMARY KEY,
type_name TEXT NOT NULL UNIQUE
create table card_type (
type_id int primary key,
type_name text not null unique
);
CREATE TABLE card_set (
set_id INTEGER PRIMARY KEY,
set_name TEXT NOT NULL,
set_code TEXT NOT NULL UNIQUE,
set_series TEXT,
set_total_cards INTEGER,
create table card_set (
set_id int primary key,
set_name text not null,
set_code text not null unique,
set_series text,
set_total_cards int,
set_release_date DATE,
set_logo_url TEXT,
set_symbol_url TEXT
set_logo_url text,
set_symbol_url text
);
CREATE TABLE energy_type (
energy_type_id INTEGER PRIMARY KEY,
energy_type_name TEXT,
energy_type_icon_url TEXT
create table energy_type (
energy_type_id int primary key,
energy_type_name text,
energy_type_icon_url text
);
CREATE TABLE pokemon_sub_type (
sub_type_id INTEGER PRIMARY KEY,
sub_type_name TEXT,
sub_type_default_prize_count INTEGER,
sub_type_global_rule_text TEXT
create table pokemon_sub_type (
sub_type_id int primary key,
sub_type_name text,
sub_type_default_prize_count int,
sub_type_global_rule_text text
);
CREATE TABLE ability_type (
ability_type_id INTEGER PRIMARY KEY,
ability_type_name TEXT
create table ability_type (
ability_type_id int primary key,
ability_type_name text
);
CREATE TABLE trainer_printed_type (
printed_type_id INTEGER PRIMARY KEY,
printed_type_name TEXT
create table trainer_printed_type (
printed_type_id int primary key,
printed_type_name text
);
CREATE TABLE game_mechanic (
mechanic_id INTEGER PRIMARY KEY,
mechanic_name TEXT
create table game_mechanic (
mechanic_id int primary key,
mechanic_name text
);
CREATE TABLE pokemon_species (
species_pokedex_number INTEGER PRIMARY KEY,
species_eng_name TEXT,
species_generation INTEGER,
create table pokemon_species (
species_pokedex_number int primary key,
species_eng_name text,
species_generation int,
species_height_m REAL,
species_weight_kg REAL
);
CREATE TABLE card (
card_id INTEGER PRIMARY KEY,
card_number TEXT NOT NULL,
card_set_id INTEGER REFERENCES card_set(set_id),
card_name TEXT,
card_rarity TEXT,
card_type_id INTEGER REFERENCES card_type(type_id),
card_image_url TEXT
create table card (
card_id int primary key,
card_number text not null,
card_set_id int references card_set(set_id),
card_name text,
card_rarity text,
card_type_id int references card_type(type_id),
card_image_url text
);
CREATE TABLE pokedex_entry (
entry_id INTEGER PRIMARY KEY,
entry_pokedex_number INTEGER REFERENCES pokemon_species(species_pokedex_number),
entry_source_game TEXT,
entry_description TEXT
create table pokedex_entry (
entry_id int primary key,
entry_pokedex_number int references pokemon_species(species_pokedex_number),
entry_source_game text,
entry_description text
);
CREATE TABLE trainer_card (
trainer_card_id INTEGER PRIMARY KEY
REFERENCES card(card_id),
trainer_printed_type_id INTEGER REFERENCES trainer_printed_type(printed_type_id),
trainer_effect_text TEXT,
trainer_is_ace_spec BOOLEAN
create table trainer_card (
trainer_card_id int primary key references card(card_id),
trainer_printed_type_id int references trainer_printed_type(printed_type_id),
trainer_effect_text text,
trainer_is_ace_spec boolean
);
CREATE TABLE energy_card (
energy_card_id INTEGER PRIMARY KEY
REFERENCES card(card_id),
energy_is_special BOOLEAN,
energy_main_type_id INTEGER REFERENCES energy_type(energy_type_id),
energy_effect_text TEXT
create table energy_card (
energy_card_id int primary key references card(card_id),
energy_is_special boolean,
energy_main_type_id int references energy_type(energy_type_id),
energy_effect_text text
);
CREATE TABLE pokemon_card (
pokemon_card_id INTEGER PRIMARY KEY
REFERENCES card(card_id),
pokemon_pokedex_entry_id INTEGER REFERENCES pokedex_entry(entry_id),
pokemon_hp INTEGER,
pokemon_stage TEXT,
pokemon_evolves_from TEXT,
pokemon_retreat_cost INTEGER,
pokemon_sub_type_id INTEGER REFERENCES pokemon_sub_type(sub_type_id),
pokemon_category TEXT,
pokemon_printed_height TEXT,
pokemon_printed_weight TEXT
create table pokemon_card (
pokemon_card_id int primary key references card(card_id),
pokemon_pokedex_entry_id int references pokedex_entry(entry_id),
pokemon_hp int,
pokemon_stage text,
pokemon_evolves_from text,
pokemon_retreat_cost int,
pokemon_sub_type_id int references pokemon_sub_type(sub_type_id),
pokemon_category text,
pokemon_printed_height text,
pokemon_printed_weight text
);
CREATE TABLE pokemon_ability (
ability_id INTEGER PRIMARY KEY,
ability_pokemon_card_id INTEGER REFERENCES pokemon_card(pokemon_card_id),
ability_type_id INTEGER REFERENCES ability_type(ability_type_id),
ability_name TEXT,
ability_effect_text TEXT,
CONSTRAINT uq_pokemon_ability_name
UNIQUE (ability_pokemon_card_id, ability_name)
create table pokemon_ability (
ability_id int primary key,
ability_pokemon_card_id int references pokemon_card(pokemon_card_id),
ability_type_id int references ability_type(ability_type_id),
ability_name text not null,
ability_effect_text text,
unique (ability_pokemon_card_id, ability_name)
);
CREATE TABLE attack_name (
attack_name_id INTEGER PRIMARY KEY,
attack_name_title TEXT NOT NULL UNIQUE
create table attack_name (
attack_name_id int primary key,
attack_name_title text not null unique
);
CREATE TABLE pokemon_attack_link (
link_id INTEGER PRIMARY KEY,
link_pokemon_card_id INTEGER REFERENCES pokemon_card(pokemon_card_id),
link_attack_name_id INTEGER REFERENCES attack_name(attack_name_id),
link_damage_value TEXT,
link_effect_text TEXT
create table pokemon_attack_link (
link_id int primary key,
link_pokemon_card_id int references pokemon_card(pokemon_card_id),
link_attack_name_id int references attack_name(attack_name_id),
link_damage_value text,
link_effect_text text
);
CREATE TABLE attack_energy_cost (
cost_id INTEGER PRIMARY KEY,
cost_link_id INTEGER REFERENCES pokemon_attack_link(link_id),
cost_energy_type_id INTEGER REFERENCES energy_type(energy_type_id),
cost_quantity INTEGER
create table attack_energy_cost (
cost_id int primary key,
cost_link_id int references pokemon_attack_link(link_id),
cost_energy_type_id int references energy_type(energy_type_id),
cost_quantity int
);
CREATE TABLE pokemon_attribute (
attribute_id INTEGER PRIMARY KEY,
attribute_pokemon_card_id INTEGER REFERENCES pokemon_card(pokemon_card_id),
attribute_energy_type_id INTEGER REFERENCES energy_type(energy_type_id),
attribute_kind TEXT,
attribute_modifier_value TEXT
create table pokemon_attribute (
attribute_id int primary key,
attribute_pokemon_card_id int references pokemon_card(pokemon_card_id),
attribute_energy_type_id int references energy_type(energy_type_id),
attribute_kind text,
attribute_modifier_value text
);
CREATE TABLE trainer_mechanic_link (
mechanic_link_trainer_card_id INTEGER NOT NULL
REFERENCES trainer_card(trainer_card_id),
mechanic_link_mechanic_id INTEGER NOT NULL
REFERENCES game_mechanic(mechanic_id),
PRIMARY KEY (mechanic_link_trainer_card_id, mechanic_link_mechanic_id)
create table trainer_mechanic_link (
mechanic_link_trainer_card_id int not null references trainer_card(trainer_card_id),
mechanic_link_mechanic_id int not null references game_mechanic(mechanic_id),
primary key(mechanic_link_trainer_card_id, mechanic_link_mechanic_id)
);