-- drop tables here
DROP TABLE IF EXISTS FormEntries;
DROP TABLE IF EXISTS TacticInfo;
DROP TABLE IF EXISTS Team;
DROP TABLE IF EXISTS Member;
DROP TABLE IF EXISTS Participate;

CREATE TABLE FormEntries(name varchar, description varchar);

CREATE TABLE Team(
    id integer PRIMARY KEY AUTOINCREMENT,
    name varchar,
    picture varchar,
    mainColor numeric,
    secondColor numeric
);

CREATE TABLE Member(
    id integer PRIMARY KEY AUTOINCREMENT
);

CREATE TABLE Participate(
    idTeam integer,
    idMember integer,
    role char(1) CHECK (role IN ('C','P')),
    FOREIGN KEY (idTeam) REFERENCES Team(id),
    FOREIGN KEY (idMember) REFERENCES Member(id)
);

CREATE TABLE TacticInfo(
    id integer PRIMARY KEY AUTOINCREMENT,
    name varchar,
    creation_date timestamp DEFAULT CURRENT_TIMESTAMP
);
