BEGIN;

CREATE TABLE IF NOT EXISTS advertisement
(
    id               INTEGER PRIMARY KEY AUTO_INCREMENT,
    tenant_id        INTEGER      NOT NULL,
    title            VARCHAR(255) NULL,
    media_type       VARCHAR(32)  NOT NULL,
    file_name        VARCHAR(512) NOT NULL,
    content_type     VARCHAR(128) NOT NULL,
    storage_path     VARCHAR(1024) NOT NULL,
    sort_order       INTEGER      NOT NULL DEFAULT 0,
    active           BOOL         NOT NULL DEFAULT TRUE,
    duration_seconds INTEGER      NOT NULL DEFAULT 10,
    created_at       TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT FK_advertisement_tenant FOREIGN KEY (tenant_id) REFERENCES tenant (id)
);

COMMIT;
