-- 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;
