generated from admin/template
Обновить works/28.09.finalDbRef(SQL)
This commit is contained in:
+101
-112
@@ -1,149 +1,138 @@
|
|||||||
CREATE TABLE card_type (
|
create table card_type (
|
||||||
type_id INTEGER PRIMARY KEY,
|
type_id int primary key,
|
||||||
type_name TEXT NOT NULL UNIQUE
|
type_name text not null unique
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE card_set (
|
create table card_set (
|
||||||
set_id INTEGER PRIMARY KEY,
|
set_id int primary key,
|
||||||
set_name TEXT NOT NULL,
|
set_name text not null,
|
||||||
set_code TEXT NOT NULL UNIQUE,
|
set_code text not null unique,
|
||||||
set_series TEXT,
|
set_series text,
|
||||||
set_total_cards INTEGER,
|
set_total_cards int,
|
||||||
set_release_date DATE,
|
set_release_date DATE,
|
||||||
set_logo_url TEXT,
|
set_logo_url text,
|
||||||
set_symbol_url TEXT
|
set_symbol_url text
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE energy_type (
|
create table energy_type (
|
||||||
energy_type_id INTEGER PRIMARY KEY,
|
energy_type_id int primary key,
|
||||||
energy_type_name TEXT,
|
energy_type_name text,
|
||||||
energy_type_icon_url TEXT
|
energy_type_icon_url text
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE pokemon_sub_type (
|
create table pokemon_sub_type (
|
||||||
sub_type_id INTEGER PRIMARY KEY,
|
sub_type_id int primary key,
|
||||||
sub_type_name TEXT,
|
sub_type_name text,
|
||||||
sub_type_default_prize_count INTEGER,
|
sub_type_default_prize_count int,
|
||||||
sub_type_global_rule_text TEXT
|
sub_type_global_rule_text text
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE ability_type (
|
create table ability_type (
|
||||||
ability_type_id INTEGER PRIMARY KEY,
|
ability_type_id int primary key,
|
||||||
ability_type_name TEXT
|
ability_type_name text
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE trainer_printed_type (
|
create table trainer_printed_type (
|
||||||
printed_type_id INTEGER PRIMARY KEY,
|
printed_type_id int primary key,
|
||||||
printed_type_name TEXT
|
printed_type_name text
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE game_mechanic (
|
create table game_mechanic (
|
||||||
mechanic_id INTEGER PRIMARY KEY,
|
mechanic_id int primary key,
|
||||||
mechanic_name TEXT
|
mechanic_name text
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE pokemon_species (
|
create table pokemon_species (
|
||||||
species_pokedex_number INTEGER PRIMARY KEY,
|
species_pokedex_number int primary key,
|
||||||
species_eng_name TEXT,
|
species_eng_name text,
|
||||||
species_generation INTEGER,
|
species_generation int,
|
||||||
species_height_m REAL,
|
species_height_m REAL,
|
||||||
species_weight_kg REAL
|
species_weight_kg REAL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE card (
|
create table card (
|
||||||
card_id INTEGER PRIMARY KEY,
|
card_id int primary key,
|
||||||
card_number TEXT NOT NULL,
|
card_number text not null,
|
||||||
card_set_id INTEGER REFERENCES card_set(set_id),
|
card_set_id int references card_set(set_id),
|
||||||
card_name TEXT,
|
card_name text,
|
||||||
card_rarity TEXT,
|
card_rarity text,
|
||||||
card_type_id INTEGER REFERENCES card_type(type_id),
|
card_type_id int references card_type(type_id),
|
||||||
card_image_url TEXT
|
card_image_url text
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table pokedex_entry (
|
||||||
CREATE TABLE pokedex_entry (
|
entry_id int primary key,
|
||||||
entry_id INTEGER PRIMARY KEY,
|
entry_pokedex_number int references pokemon_species(species_pokedex_number),
|
||||||
entry_pokedex_number INTEGER REFERENCES pokemon_species(species_pokedex_number),
|
entry_source_game text,
|
||||||
entry_source_game TEXT,
|
entry_description text
|
||||||
entry_description TEXT
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE trainer_card (
|
create table trainer_card (
|
||||||
trainer_card_id INTEGER PRIMARY KEY
|
trainer_card_id int primary key references card(card_id),
|
||||||
REFERENCES card(card_id),
|
trainer_printed_type_id int references trainer_printed_type(printed_type_id),
|
||||||
trainer_printed_type_id INTEGER REFERENCES trainer_printed_type(printed_type_id),
|
trainer_effect_text text,
|
||||||
trainer_effect_text TEXT,
|
trainer_is_ace_spec boolean
|
||||||
trainer_is_ace_spec BOOLEAN
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE energy_card (
|
create table energy_card (
|
||||||
energy_card_id INTEGER PRIMARY KEY
|
energy_card_id int primary key references card(card_id),
|
||||||
REFERENCES card(card_id),
|
energy_is_special boolean,
|
||||||
energy_is_special BOOLEAN,
|
energy_main_type_id int references energy_type(energy_type_id),
|
||||||
energy_main_type_id INTEGER REFERENCES energy_type(energy_type_id),
|
energy_effect_text text
|
||||||
energy_effect_text TEXT
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE pokemon_card (
|
create table pokemon_card (
|
||||||
pokemon_card_id INTEGER PRIMARY KEY
|
pokemon_card_id int primary key references card(card_id),
|
||||||
REFERENCES card(card_id),
|
pokemon_pokedex_entry_id int references pokedex_entry(entry_id),
|
||||||
pokemon_pokedex_entry_id INTEGER REFERENCES pokedex_entry(entry_id),
|
pokemon_hp int,
|
||||||
pokemon_hp INTEGER,
|
pokemon_stage text,
|
||||||
pokemon_stage TEXT,
|
pokemon_evolves_from text,
|
||||||
pokemon_evolves_from TEXT,
|
pokemon_retreat_cost int,
|
||||||
pokemon_retreat_cost INTEGER,
|
pokemon_sub_type_id int references pokemon_sub_type(sub_type_id),
|
||||||
pokemon_sub_type_id INTEGER REFERENCES pokemon_sub_type(sub_type_id),
|
pokemon_category text,
|
||||||
pokemon_category TEXT,
|
pokemon_printed_height text,
|
||||||
pokemon_printed_height TEXT,
|
pokemon_printed_weight text
|
||||||
pokemon_printed_weight TEXT
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table pokemon_ability (
|
||||||
CREATE TABLE pokemon_ability (
|
ability_id int primary key,
|
||||||
ability_id INTEGER PRIMARY KEY,
|
ability_pokemon_card_id int references pokemon_card(pokemon_card_id),
|
||||||
ability_pokemon_card_id INTEGER REFERENCES pokemon_card(pokemon_card_id),
|
ability_type_id int references ability_type(ability_type_id),
|
||||||
ability_type_id INTEGER REFERENCES ability_type(ability_type_id),
|
ability_name text not null,
|
||||||
ability_name TEXT,
|
ability_effect_text text,
|
||||||
ability_effect_text TEXT,
|
unique (ability_pokemon_card_id, ability_name)
|
||||||
|
|
||||||
CONSTRAINT uq_pokemon_ability_name
|
|
||||||
UNIQUE (ability_pokemon_card_id, ability_name)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE attack_name (
|
create table attack_name (
|
||||||
attack_name_id INTEGER PRIMARY KEY,
|
attack_name_id int primary key,
|
||||||
attack_name_title TEXT NOT NULL UNIQUE
|
attack_name_title text not null unique
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE pokemon_attack_link (
|
create table pokemon_attack_link (
|
||||||
link_id INTEGER PRIMARY KEY,
|
link_id int primary key,
|
||||||
link_pokemon_card_id INTEGER REFERENCES pokemon_card(pokemon_card_id),
|
link_pokemon_card_id int references pokemon_card(pokemon_card_id),
|
||||||
link_attack_name_id INTEGER REFERENCES attack_name(attack_name_id),
|
link_attack_name_id int references attack_name(attack_name_id),
|
||||||
link_damage_value TEXT,
|
link_damage_value text,
|
||||||
link_effect_text TEXT
|
link_effect_text text
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE attack_energy_cost (
|
create table attack_energy_cost (
|
||||||
cost_id INTEGER PRIMARY KEY,
|
cost_id int primary key,
|
||||||
cost_link_id INTEGER REFERENCES pokemon_attack_link(link_id),
|
cost_link_id int references pokemon_attack_link(link_id),
|
||||||
cost_energy_type_id INTEGER REFERENCES energy_type(energy_type_id),
|
cost_energy_type_id int references energy_type(energy_type_id),
|
||||||
cost_quantity INTEGER
|
cost_quantity int
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table pokemon_attribute (
|
||||||
CREATE TABLE pokemon_attribute (
|
attribute_id int primary key,
|
||||||
attribute_id INTEGER PRIMARY KEY,
|
attribute_pokemon_card_id int references pokemon_card(pokemon_card_id),
|
||||||
attribute_pokemon_card_id INTEGER REFERENCES pokemon_card(pokemon_card_id),
|
attribute_energy_type_id int references energy_type(energy_type_id),
|
||||||
attribute_energy_type_id INTEGER REFERENCES energy_type(energy_type_id),
|
attribute_kind text,
|
||||||
attribute_kind TEXT,
|
attribute_modifier_value text
|
||||||
attribute_modifier_value TEXT
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE trainer_mechanic_link (
|
create table trainer_mechanic_link (
|
||||||
mechanic_link_trainer_card_id INTEGER NOT NULL
|
mechanic_link_trainer_card_id int not null references trainer_card(trainer_card_id),
|
||||||
REFERENCES trainer_card(trainer_card_id),
|
mechanic_link_mechanic_id int not null references game_mechanic(mechanic_id),
|
||||||
mechanic_link_mechanic_id INTEGER NOT NULL
|
primary key(mechanic_link_trainer_card_id, mechanic_link_mechanic_id)
|
||||||
REFERENCES game_mechanic(mechanic_id),
|
|
||||||
|
|
||||||
PRIMARY KEY (mechanic_link_trainer_card_id, mechanic_link_mechanic_id)
|
|
||||||
);
|
);
|
||||||
Reference in New Issue
Block a user