Files
base-sql/works/28.09.finalDbRef(SQL)

138 lines
3.5 KiB
Plaintext

create table card_type (
type_id int primary key,
type_name text not null unique
);
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
);
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 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 int primary key,
ability_type_name text
);
create table trainer_printed_type (
printed_type_id int primary key,
printed_type_name text
);
create table game_mechanic (
mechanic_id int primary key,
mechanic_name text
);
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 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 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 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 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 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 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 int primary key,
attack_name_title text not null unique
);
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 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 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 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)
);