CREATE TABLE IF NOT EXISTS COURSE
(
    ID          INTEGER PRIMARY KEY                    NOT NULL,
    TITLE       VARCHAR(200)                           NOT NULL,
    DESCRIPTION VARCHAR(500) DEFAULT ''                NOT NULL,
    DURATION    INTEGER      DEFAULT 0                 NOT NULL,
    CREATED_AT  TIMESTAMP    DEFAULT CURRENT_TIMESTAMP NOT NULL,
    UPDATED_AT  TIMESTAMP    DEFAULT CURRENT_TIMESTAMP NOT NULL
);


CREATE TABLE IF NOT EXISTS COURSE_ATTACHMENT
(
    ID            INTEGER PRIMARY KEY                    NOT NULL,
    COURSE_ID     INTEGER      DEFAULT 0                 NOT NULL,
    CONTENT       VARCHAR(500) DEFAULT ''                NOT NULL,
    CATEGORY      VARCHAR(20)  DEFAULT ''                NOT NULL,
    "ORDER"       INTEGER      DEFAULT 0                 NOT NULL,
    ATTACHMENT_ID INTEGER      DEFAULT 0                 NOT NULL,
    DURATION      INTEGER      DEFAULT 0                 NOT NULL,
    URL           TEXT         DEFAULT ''                NOT NULL,
    MIME_TYPE     VARCHAR(20)  DEFAULT ''                NOT NULL,
    CREATED_AT    TIMESTAMP    DEFAULT CURRENT_TIMESTAMP NOT NULL,
    UPDATED_AT    TIMESTAMP    DEFAULT CURRENT_TIMESTAMP NOT NULL
);

CREATE TABLE IF NOT EXISTS JSON_DATA
(
    ID         INTEGER PRIMARY KEY                   NOT NULL,
    JSON  TEXT        DEFAULT ''                NOT NULL,
    "TYPE"       VARCHAR(20) DEFAULT ''                NOT NULL,
    REMARK     VARCHAR(200) DEFAULT ''               NOT NULL,
    CREATED_AT TIMESTAMP   DEFAULT CURRENT_TIMESTAMP NOT NULL,
    UPDATED_AT TIMESTAMP   DEFAULT CURRENT_TIMESTAMP NOT NULL
)