generated from admin/template
самостоятельное создание соединений
вместо того, чтобы потыкать мышкой по таблицам в выводе dbdiagram, я решил попробовать написать собственноручно эти связи. выявил кучу непонятного, связанного с ними
This commit is contained in:
@@ -38,6 +38,12 @@ Table attack_name {
|
|||||||
attack_name_title text [unique] // Пример: 'Hydro Pump', 'Slash'
|
attack_name_title text [unique] // Пример: 'Hydro Pump', 'Slash'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Что напечатано на самой картонке для игрока (визуальный интерфейс).
|
||||||
|
Table trainer_printed_type {
|
||||||
|
printed_type_id int [pk]
|
||||||
|
printed_type_name text [unique] // Пример: 'Item', 'Supporter'
|
||||||
|
}
|
||||||
|
|
||||||
// Скрытые правила для игрового движка.
|
// Скрытые правила для игрового движка.
|
||||||
Table game_mechanic {
|
Table game_mechanic {
|
||||||
mechanic_id int [pk]
|
mechanic_id int [pk]
|
||||||
@@ -58,7 +64,7 @@ Table pokemon_species {
|
|||||||
// Хранит все варианты художественных описаний покемонов из разных видеоигр.
|
// Хранит все варианты художественных описаний покемонов из разных видеоигр.
|
||||||
Table pokedex_entry {
|
Table pokedex_entry {
|
||||||
entry_id int [pk]
|
entry_id int [pk]
|
||||||
entry_pokedex_number int
|
entry_pokedex_number int [not null]
|
||||||
entry_source_game text // Видеоигра, откуда взят текст (Пример: 'Pokémon X')
|
entry_source_game text // Видеоигра, откуда взят текст (Пример: 'Pokémon X')
|
||||||
entry_description text // Художественное описание покемона
|
entry_description text // Художественное описание покемона
|
||||||
}
|
}
|
||||||
@@ -69,7 +75,7 @@ Table pokedex_entry {
|
|||||||
Table card {
|
Table card {
|
||||||
card_id int [pk]
|
card_id int [pk]
|
||||||
card_number text [unique] // Номер карты на картонке (Пример: '14/146', 'XY99')
|
card_number text [unique] // Номер карты на картонке (Пример: '14/146', 'XY99')
|
||||||
card_set_id int [unique]
|
card_set_id int [not null]
|
||||||
card_name text
|
card_name text
|
||||||
card_rarity text // Пример: 'Common', 'Ultra Rare'
|
card_rarity text // Пример: 'Common', 'Ultra Rare'
|
||||||
card_type text [check: `card_type == "Pokemon" OR card_type == "Trainer" OR card_type == "Energy"`] // Указывает, в какую дочернюю таблицу идти за деталями
|
card_type text [check: `card_type == "Pokemon" OR card_type == "Trainer" OR card_type == "Energy"`] // Указывает, в какую дочернюю таблицу идти за деталями
|
||||||
@@ -82,13 +88,13 @@ Table card {
|
|||||||
// Расширяет базовую карту боевыми характеристиками покемона
|
// Расширяет базовую карту боевыми характеристиками покемона
|
||||||
Table pokemon_card {
|
Table pokemon_card {
|
||||||
pokemon_card_id int [pk]
|
pokemon_card_id int [pk]
|
||||||
pokemon_pokedex_number int
|
pokemon_pokedex_number int [not null]
|
||||||
pokemon_pokedex_entry_id int // (Может быть NULL для карт класса EX/ex)
|
pokemon_pokedex_entry_id int // (Может быть NULL для карт класса EX/ex)
|
||||||
pokemon_hp int [check: `pokemon_hp % 10 == 0`] // Очки здоровья, всегда кратны 10 (например, 160)
|
pokemon_hp int [check: `pokemon_hp % 10 == 0`] // Очки здоровья, всегда кратны 10 (например, 160)
|
||||||
pokemon_stage text [not null] // (Пример: 'Basic', 'Stage 1', 'MEGA')
|
pokemon_stage text [not null] // (Пример: 'Basic', 'Stage 1', 'MEGA')
|
||||||
pokemon_evolves_from text // (Имя покемона; NULL для базовых карт)
|
pokemon_evolves_from text // (Имя покемона; NULL для базовых карт)
|
||||||
pokemon_retreat_cost int // Количество бесцветных энергий, необходимых для побега (от 0 до 4)
|
pokemon_retreat_cost int // Количество бесцветных энергий, необходимых для побега (от 0 до 4)
|
||||||
pokemon_sub_type_id int
|
pokemon_sub_type_id int [not null]
|
||||||
pokemon_category text // Декоративный текст (Пример: 'Пыльный мотылёк')
|
pokemon_category text // Декоративный текст (Пример: 'Пыльный мотылёк')
|
||||||
pokemon_printed_height text // Рост, как он написан на карте (Пример: '1,5 м' или '4'11"')
|
pokemon_printed_height text // Рост, как он написан на карте (Пример: '1,5 м' или '4'11"')
|
||||||
pokemon_printed_weight text // Вес, как он написан на карте (Пример: '90,0 кг' или '198.4 lbs')
|
pokemon_printed_weight text // Вес, как он написан на карте (Пример: '90,0 кг' или '198.4 lbs')
|
||||||
@@ -97,7 +103,7 @@ Table pokemon_card {
|
|||||||
// Расширяет базовую карту свойствами предметов и поддержки.
|
// Расширяет базовую карту свойствами предметов и поддержки.
|
||||||
Table trainer_card {
|
Table trainer_card {
|
||||||
trainer_card_id int [pk]
|
trainer_card_id int [pk]
|
||||||
trainer_printed_type_id int
|
trainer_printed_type_id int [not null]
|
||||||
trainer_effect_text text // Что карта делает при розыгрыше
|
trainer_effect_text text // Что карта делает при розыгрыше
|
||||||
trainer_is_ace_spec bool // Ограничение: максимум 1 карта класса ACE SPEC на колоду
|
trainer_is_ace_spec bool // Ограничение: максимум 1 карта класса ACE SPEC на колоду
|
||||||
}
|
}
|
||||||
@@ -114,7 +120,7 @@ Table energy_card {
|
|||||||
// Пассивные умения покемонов (Абилити). Связь 1-к-1 с карта_покемона (у покемона способность либо одна, либо ее нет).
|
// Пассивные умения покемонов (Абилити). Связь 1-к-1 с карта_покемона (у покемона способность либо одна, либо ее нет).
|
||||||
Table pokemon_ability {
|
Table pokemon_ability {
|
||||||
ability_pokemon_card_id int [pk]
|
ability_pokemon_card_id int [pk]
|
||||||
ability_type_id int
|
ability_type_id int [not null]
|
||||||
ability_name text // Пример: 'Колючая броня'
|
ability_name text // Пример: 'Колючая броня'
|
||||||
ability_effect_text text // Что делает пассивный навык
|
ability_effect_text text // Что делает пассивный навык
|
||||||
}
|
}
|
||||||
@@ -131,8 +137,8 @@ Table pokemon_attack_link {
|
|||||||
// Определяет, сколько и какой энергии нужно для активации конкретной атаки у конкретного покемона.
|
// Определяет, сколько и какой энергии нужно для активации конкретной атаки у конкретного покемона.
|
||||||
Table attack_energy_cost {
|
Table attack_energy_cost {
|
||||||
cost_id int [pk]
|
cost_id int [pk]
|
||||||
cost_link_id int // стоимость_энергии_атаки_связь_покемон_атака_ид
|
cost_link_id int [not null] // стоимость_энергии_атаки_связь_покемон_атака_ид
|
||||||
cost_energy_type_id int
|
cost_energy_type_id int [not null]
|
||||||
cost_quantity int [default: 1] // Количество энергии (например, 3 единицы Огня)
|
cost_quantity int [default: 1] // Количество энергии (например, 3 единицы Огня)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,35 +154,35 @@ Table pokemon_attribute {
|
|||||||
// trainer_mechanic_link: Промежуточная таблица (Многие-ко-Многому). Связывает карточку тренера с ее скрытыми игровыми правилами движка.
|
// trainer_mechanic_link: Промежуточная таблица (Многие-ко-Многому). Связывает карточку тренера с ее скрытыми игровыми правилами движка.
|
||||||
Table trainer_mechanic_link {
|
Table trainer_mechanic_link {
|
||||||
mechanic_link_trainer_card_id int [pk]
|
mechanic_link_trainer_card_id int [pk]
|
||||||
mechanic_link_mechanic_id int
|
mechanic_link_mechanic_id int [unique]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref: pokedex_entry.entry_pokedex_number > pokemon_species.species_pokedex_number
|
||||||
|
|
||||||
Ref: "pokedex_entry"."entry_pokedex_number" ?>? "pokemon_species"."species_pokedex_number"
|
Ref: card.card_set_id > card_set.set_id
|
||||||
|
|
||||||
Ref: "card"."card_set_id" -? "card_set"."set_id"
|
Ref: pokemon_card.pokemon_card_id - card.card_id
|
||||||
Ref: "card"."card_id" -? "pokemon_card"."pokemon_card_id"
|
Ref: pokemon_card.pokemon_pokedex_number > pokemon_species.species_pokedex_number
|
||||||
|
Ref: pokemon_card.pokemon_pokedex_entry_id >? pokedex_entry.entry_id // pokedex_entry_id = NULL для карт класса EX/ex
|
||||||
|
Ref: pokemon_card.pokemon_sub_type_id > pokemon_sub_type.sub_type_id
|
||||||
|
|
||||||
Ref: "pokemon_card"."pokemon_pokedex_number" ?>? "pokemon_species"."species_pokedex_number"
|
Ref: trainer_card.trainer_card_id - card.card_id
|
||||||
Ref: "pokemon_card"."pokemon_pokedex_entry_id" ?<>? "pokedex_entry"."entry_description"
|
Ref: trainer_card.trainer_printed_type_id > trainer_printed_type.printed_type_id
|
||||||
Ref: "pokemon_card"."pokemon_sub_type_id" ?>? "pokemon_sub_type"."sub_type_id"
|
|
||||||
|
|
||||||
Ref: "card"."card_id" -? "trainer_card"."trainer_card_id"
|
Ref: energy_card.energy_card_id - card.card_id
|
||||||
|
Ref: energy_card.energy_main_type_id >? energy_type.energy_type_id // energy_main_type_id = NULL для особых карт, дающих энергию любого типа
|
||||||
|
|
||||||
Ref: "card"."card_id" -? "energy_card"."energy_card_id"
|
Ref: pokemon_ability.ability_pokemon_card_id - pokemon_card.pokemon_card_id
|
||||||
Ref: "energy_card"."energy_main_type_id" ?>? "energy_type"."energy_type_id"
|
Ref: pokemon_ability.ability_type_id > ability_type.ability_type_id
|
||||||
Ref: "pokemon_ability"."ability_type_id" ?>? "ability_type"."ability_type_id"
|
|
||||||
|
|
||||||
Ref: "pokemon_card"."pokemon_card_id" -? "pokemon_ability"."ability_pokemon_card_id"
|
Ref: pokemon_attack_link.link_pokemon_card_id - card.card_id
|
||||||
|
Ref: pokemon_attack_link.link_attack_name_id - attack_name.attack_name_id
|
||||||
|
|
||||||
Ref: "pokemon_card"."pokemon_card_id" ?-? "pokemon_attack_link"."link_pokemon_card_id"
|
Ref: attack_energy_cost.cost_link_id > pokemon_attack_link.link_id
|
||||||
Ref: "attack_name"."attack_name_id" ?-? "pokemon_attack_link"."link_attack_name_id"
|
Ref: attack_energy_cost.cost_energy_type_id > energy_type.energy_type_id
|
||||||
Ref: "attack_energy_cost"."cost_link_id" ?>? "pokemon_attack_link"."link_id"
|
|
||||||
|
|
||||||
Ref: "attack_energy_cost"."cost_energy_type_id" ?>? "energy_type"."energy_type_id"
|
Ref: pokemon_attribute.attribute_pokemon_card_id - pokemon_card.pokemon_card_id
|
||||||
|
Ref: pokemon_attribute.attribute_energy_type_id - energy_type.energy_type_id
|
||||||
|
|
||||||
Ref: "pokemon_card"."pokemon_card_id" ?-? "pokemon_attribute"."attribute_pokemon_card_id"
|
Ref: trainer_mechanic_link.mechanic_link_trainer_card_id - trainer_card.trainer_card_id
|
||||||
Ref: "energy_type"."energy_type_id" ?-? "pokemon_attribute"."attribute_energy_type_id"
|
Ref: trainer_mechanic_link.mechanic_link_mechanic_id - game_mechanic.mechanic_id
|
||||||
|
|
||||||
Ref: "trainer_mechanic_link"."mechanic_link_mechanic_id" ?>? "game_mechanic"."mechanic_id"
|
|
||||||
Ref: "trainer_card"."trainer_card_id" -? "trainer_mechanic_link"."mechanic_link_trainer_card_id"
|
|
||||||
Reference in New Issue
Block a user