-- 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 FOREIGN KEY REFERENCES Team(id),
    idMember integer FOREIGN KEY REFERENCES Member(id),
    role char CHECK (role IN ('C','P'))
);

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