Files
base-sql/works/lab-01/dbdiagram.txt
T

54 lines
1.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Table card_common {
card_id int [pk]
set_id int
card_type text [not null, check: `in ("pokemon", "trainer", "energy")`] // pokemon OR trainer OR energy
// общие данные (у pokemon И trainer И energy)
card_name text
card_year int [not null]
card_rarity int [not null] // 0 = Common, 1 = Uncommon, 2 = Rare, etc.
illustrator_id int // fk
}
Table card_pokemon {
card_id int [pk]
// pokemon
pokemon_name text [not null, check: `card_type == "pokemon"`]
// pokeinfo
pokemon_hp int [not null, check: `card_hp > 0`]
pokemon_type int [not null] // 0 = Normal, 1 = Fire, 2 = Water, etc.
pokemon_stage text [not null, check: `in ("basic", "s1", "s2")`]
pokemon_evolves_from text
pokemon_dex_no int [not null]
pokemon_description text [not null]
pokemon_height_m numeric [not null, check: `pkmn_height > 0`]
pokemon_weight_kg numeric [not null, check: `pkmn_weight > 0`]
pokemon_retreat_cost int [not null]
}
Table card_trainer {
card_id int [pk]
trainer_name text [not null]
trainer_type text [not null, check: `trainer_type in ("item", "helper", "stadium")`]
trainer_description text [not null]
trainer_ruleset text [not null] // заметки внизу
}
Table card_energy {
card_id int [pk]
energy_type text [not null]
energy_name text [not null]
}
Table illustrator {
illustrator_id int [pk]
illustrator_name text // бывает и пустым, см. Энергия (трава)
}
Ref: "card_common"."illustrator_id" > "illustrator"."illustrator_id"
Ref: "card_common"."card_id" -? "card_pokemon"."card_id"
Ref: "card_common"."card_id" -? "card_trainer"."card_id"
Ref: "card_common"."card_id" -? "card_energy"."card_id"