diff --git a/shema b/shema index f98cba0..b0f81cb 100644 --- a/shema +++ b/shema @@ -1,12 +1,15 @@ +drop table if exists card_set; + + create table card_set ( - CARD_SET_NAME VARCHAR(255) not null, - CARD_SET_ID VARCHAR(20) PRIMARY key, - CARD_SET_SERIES VARCHAR(50) not null, - CARD_SET_TOTAL_CARDS inteGER not null, - CARD_SET_data date not null + set_name VARCHAR(255) not null, + set_id VARCHAR(20) PRIMARY key, + set_series VARCHAR(20) not null, + set_total_cards INT not null, + set_release_date date not null ); -insert into card_set (CARD_SET_NAME, CARD_SET_ID, CARD_SET_SERIES, CARD_SET_TOTAL_CARDS, CARD_SET_data) values +insert into card_set (set_name,set_id,set_series,set_total_cards,set_release_date ) values ('XY Базовый набор', 'XY1', 'XY', 146, '2014-02-05'), ('XY Огненная вспышка', 'XY2', 'XY', 106, '2014-05-07'), ('XY Яростный кулак', 'XY3', 'XY', 111, '2014-08-13'), @@ -19,15 +22,14 @@ insert into card_set (CARD_SET_NAME, CARD_SET_ID, CARD_SET_SERIES, CARD_SET_TOTA ('XY Столкновение судеб', 'XY10', 'XY', 124, '2016-05-02'); create table card ( -card_id int primary key, -card_name VARCHAR(50) not null, -card_number VARCHAR(50) not null, -card_set_id int references card_set (card_set_id), -card_name text not null, -card_rarity text not null , -card_type text not null, -card_image_url text not null, -CONSTRAINT unique_set_number unique (card_set_id, card_number) + card_id int primary key, + card_name text not null, + card_number text not null, + card_set_id VARCHAR(20) references card_set(set_id), + card_rarity text not null, + card_type text not null, + card_image_url text not null, + unique (card_set_id, card_number) ); create table pokemon_card (