-- Your SQL goes here

-- TODO: add constraints for editor (foreign key), find a way to get dynamic size array with this constraint.
-- This constraint is shown by "relations_editeurs".
-- Maybe same for "issns", if we need it.

CREATE TABLE title (
    id SERIAL PRIMARY KEY,
    mirabelid INTEGER NOT NULL,
    revueid INTEGER NOT NULL,
    obsoletepar INTEGER,
    titre VARCHAR NOT NULL,
    prefixe VARCHAR,
    datedebut VARCHAR,
    datefin VARCHAR,
    url VARCHAR,
    periodicite VARCHAR,
    editeurs TEXT[] NOT NULL,
    langues TEXT[] NOT NULL,
    liens TEXT[] NOT NULL,
    url_revue_mirabel VARCHAR
    -- "issns": [
    --     {
    --         "bnfark": "cb344022072",
    --         "issn": "0982-2321",
    --         "issnl": "0982-2321",
    --         "statut": "valide",
    --         "sudocnoholding": false,
    --         "sudocppn": "104192186",
    --         "support": "papier",
    --         "worldcatocn": 474295645
    --     }
    -- ],
    -- "relations_editeurs": [
    --     {
    --         "editeur": "Groupe de réflexion inter et transdisciplinaire",
    --         "editeur_id": 1345,
    --         "precedent": false
    --     }
    -- ]
)
