
CREATE TABLE IF NOT EXISTS ApplicationFrameworkSettings (
    MaxTaskTime     INT DEFAULT 60,
    MaxTasksRunning INT DEFAULT 2,
    LastTaskRunAt   DATETIME
);

CREATE TABLE IF NOT EXISTS TaskQueue (
    TaskId      INT NOT NULL AUTO_INCREMENT,
    Callback    TEXT,
    Parameters  TEXT,
    Priority    INT,
    Description TEXT,
    INDEX       (TaskId)
);

CREATE TABLE IF NOT EXISTS PeriodicEvents (
    Signature   TEXT,
    LastRunAt   DATETIME
);

ALTER TABLE PluginInfo CHANGE COLUMN Enabled Enabled SMALLINT DEFAULT 0;
ALTER TABLE PluginInfo ADD COLUMN Installed SMALLINT DEFAULT 0;

