Projektowanie tabel

CREATE TABLE client_roles
(
  client_role_id bigint NOT NULL,
  client_role_description character varying(50),
  client_role_name character varying(50),
  CONSTRAINT client_roles_pkey PRIMARY KEY (client_role_id)
)

CREATE TABLE clients
(
  client_id bigint NOT NULL,
  client_address character varying(255),
  client_document character varying(255),
  client_phone character varying(255),
  client_username character varying(255),
  client_player_id bigint,
  client_role_id bigint,
  CONSTRAINT clients_pkey PRIMARY KEY (client_id),
  CONSTRAINT fk5e1711e851a4154 FOREIGN KEY (client_player_id)
      REFERENCES players (player_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fk5e1711e85438139f FOREIGN KEY (client_role_id)
      REFERENCES client_roles (client_role_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)

CREATE TABLE daysoff
(
  dayoff_id bigint NOT NULL,
  dayoff_date date,
  dayoff_name character varying(255),
  CONSTRAINT daysoff_pkey PRIMARY KEY (dayoff_id)
)

CREATE TABLE goals
(
  goal_id bigint NOT NULL,
  goal_minute integer,
  goal_match_id bigint,
  goal_player_id bigint,
  CONSTRAINT goals_pkey PRIMARY KEY (goal_id),
  CONSTRAINT fk40d6ba020936ed8 FOREIGN KEY (goal_match_id)
      REFERENCES matches (match_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fk40d6ba06358529c FOREIGN KEY (goal_player_id)
      REFERENCES players (player_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)

CREATE TABLE matches
(
  match_id bigint NOT NULL,
  match_date timestamp without time zone,
  match_first_team bigint,
  match_second_team bigint,
  CONSTRAINT matches_pkey PRIMARY KEY (match_id),
  CONSTRAINT fk5cea1513505d65d1 FOREIGN KEY (match_first_team)
      REFERENCES teams (team_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fk5cea1513fd430859 FOREIGN KEY (match_second_team)
      REFERENCES teams (team_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)

CREATE TABLE notifications
(
  notification_id bigint NOT NULL,
  notification_readiness boolean,
  notification_match_id bigint,
  notification_player_id bigint,
  CONSTRAINT notifications_pkey PRIMARY KEY (notification_id),
  CONSTRAINT fk594acc81d61ee74 FOREIGN KEY (notification_player_id)
      REFERENCES players (player_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fk594acc8c37af800 FOREIGN KEY (notification_match_id)
      REFERENCES matches (match_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)

CREATE TABLE penalties
(
  penalty_id bigint NOT NULL,
  penalty_description character varying(255),
  penalty_expiration_date date,
  penalty_match_id bigint,
  penalty_player_id bigint,
  CONSTRAINT penalties_pkey PRIMARY KEY (penalty_id),
  CONSTRAINT fke67b1ac717cefa22 FOREIGN KEY (penalty_match_id)
      REFERENCES matches (match_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fke67b1ac7538e3092 FOREIGN KEY (penalty_player_id)
      REFERENCES players (player_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)

CREATE TABLE players
(
  player_id bigint NOT NULL,
  player_email character varying(255),
  player_first_name character varying(255),
  player_last_name character varying(255),
  player_nationalid character varying(255),
  player_team_id bigint,
  CONSTRAINT players_pkey PRIMARY KEY (player_id),
  CONSTRAINT fkd604d92a56ff76a FOREIGN KEY (player_team_id)
      REFERENCES teams (team_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)

CREATE TABLE reservations
(
  reservation_id bigint NOT NULL,
  reservation_date timestamp without time zone,
  reservation_description character varying(255),
  reservation_client_id bigint,
  CONSTRAINT reservations_pkey PRIMARY KEY (reservation_id),
  CONSTRAINT fk41f21e27a308a3d5 FOREIGN KEY (reservation_client_id)
      REFERENCES clients (client_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)

CREATE TABLE team_groups
(
  team_group_id bigint NOT NULL,
  team_group_description character varying(255),
  team_group_name character varying(255),
  CONSTRAINT team_groups_pkey PRIMARY KEY (team_group_id)
)

CREATE TABLE teams
(
  team_id bigint NOT NULL,
  team_colour character varying(255),
  team_description character varying(255),
  team_name character varying(255),
  team_group_id bigint,
  CONSTRAINT teams_pkey PRIMARY KEY (team_id),
  CONSTRAINT fk4c01196d53b7331 FOREIGN KEY (team_group_id)
      REFERENCES team_groups (team_group_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)
pl/dydaktyka/ztb/2011/projekty/aurora/start/crtab.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0