File size: 1,249 Bytes
ffba157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-- Schema: spider__battle_death
CREATE SCHEMA IF NOT EXISTS "spider__battle_death";

-- Table: battle
CREATE TABLE "spider__battle_death"."battle" (
    "id" BIGINT NOT NULL,
    "name" TEXT,
    "date" TEXT,
    "bulgarian_commander" TEXT,
    "latin_commander" TEXT,
    "result" TEXT,
    CONSTRAINT "battle_pkey" PRIMARY KEY ("id")
);

-- Table: death
CREATE TABLE "spider__battle_death"."death" (
    "caused_by_ship_id" BIGINT,
    "id" BIGINT NOT NULL,
    "note" TEXT,
    "killed" BIGINT,
    "injured" BIGINT,
    CONSTRAINT "death_pkey" PRIMARY KEY ("id")
);

-- Table: ship
CREATE TABLE "spider__battle_death"."ship" (
    "lost_in_battle" BIGINT,
    "id" BIGINT NOT NULL,
    "name" TEXT,
    "tonnage" TEXT,
    "ship_type" TEXT,
    "location" TEXT,
    "disposition_of_ship" TEXT,
    CONSTRAINT "ship_pkey" PRIMARY KEY ("id")
);

-- Foreign Keys
ALTER TABLE "spider__battle_death"."death" ADD CONSTRAINT "fk_death_0" FOREIGN KEY ("caused_by_ship_id") REFERENCES "spider__battle_death"."ship" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "spider__battle_death"."ship" ADD CONSTRAINT "fk_ship_0" FOREIGN KEY ("lost_in_battle") REFERENCES "spider__battle_death"."battle" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;