forked from admin/template
Обновить lesson0.sql
This commit is contained in:
+38
-33
@@ -1,37 +1,42 @@
|
|||||||
create Table: card (
|
create table card (
|
||||||
card_id: int (primary key, NOT NULL, UNIQUE, CHECK(card_id > 0))
|
card_id int (primary key)
|
||||||
card_name: Text (NOT NULL)
|
card_name text (not null)
|
||||||
card hp: int (NOT NULL)
|
card_stage text (not null)
|
||||||
card_number: Text (NOT NULL, CHECK(card_number > 0))
|
card_hp int (not null, check) (card_hp > 0)
|
||||||
illustrator_id: int (NOT NULL)
|
card_pokidex_number int (not null, check) (card_pokidex_number > 0)
|
||||||
element_type_id: int (NOT NULL)
|
card_species next (not null)
|
||||||
card_set_id: int (NOT NULL)
|
card_height_m numeric (not null, check) ( card_height_m > 0)
|
||||||
)
|
card_weight_kg numeric (not null, check) (card_weight_kg > 0)
|
||||||
|
card_number_in_set text (not null)
|
||||||
Table: card_set {
|
card_retrat_cost int (not null, check) (card_retrat_cost > 0)
|
||||||
set_id: int (primary key, NOT NULL, UNIQUE, CHECK(set_id > 0))
|
card_release_year int (not null)
|
||||||
set_name: Text (NOT NULL, UNIQUE)
|
card_set_id int (not null)
|
||||||
set_code: Text (NOT NULL, UNIQUE)
|
card_ellement_type_id int (not null)
|
||||||
set_total_cards: int (NOT NULL, CHECK(set_total_cards > 0))
|
card_illustrator_id int (not null)
|
||||||
}
|
);
|
||||||
|
|
||||||
Table: attack {
|
|
||||||
attack_id: int (primary key, NOT NULL, CHECK (attack_id > 0))
|
|
||||||
attack_name: Text (NOT NULL)
|
|
||||||
attack_base_damage: int (NOT NULL, CHECK(attack_base_damage >= 0))
|
|
||||||
attack_damage_modifier: Text (CHECK(attack_dam_modifier in ["+", "x"])) attack_card_id: int (NOT NULL)
|
|
||||||
}
|
|
||||||
|
|
||||||
Table: element_type {
|
|
||||||
element_type_id: int (primary key, NOT NULL, UNIQUE, CHECK(element_type_id > 0))
|
|
||||||
element_type_name: Text (NOT NULL, UNIQUE)
|
|
||||||
}
|
|
||||||
|
|
||||||
Table: illustrator {
|
|
||||||
illustrator_id: int (primary key, NOT NULL, UNIQUE, CHECK(illustrator_id > 0))
|
|
||||||
illustrator_name: Text (NOT NULL, UNIQUE)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
create table card_set (
|
||||||
|
card_set_id int (primary key, foreign key)
|
||||||
|
card_set_name text (not null)
|
||||||
|
card_set_code text (not null)
|
||||||
|
set_total_cards int (not null, check) (set_total_cards > 0)
|
||||||
|
set_release_date date (not null)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table attack (
|
||||||
|
attack_id int (primary key, foreign key)
|
||||||
|
attack_name text (not null)
|
||||||
|
attack_base_damage text (not null, check) (attack_base_damage > 0)
|
||||||
|
attack_effect text
|
||||||
|
attack_card_id int (not null)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table element_type (
|
||||||
|
element_type_id int (primary key, foreign key)
|
||||||
|
element_type_name text (not null)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table illustrator (
|
||||||
|
illustrator_id int (primary key, foreign key)
|
||||||
|
illustrator_name text (not null)
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user