-- Minimal sablog-like schema for import regression (SQLite).
CREATE TABLE sablog_users (
    userid INTEGER PRIMARY KEY,
    username TEXT NOT NULL,
    password TEXT NOT NULL,
    url TEXT,
    logincount INTEGER DEFAULT 0,
    loginip TEXT,
    logintime INTEGER,
    regip TEXT,
    regdateline INTEGER
);

CREATE TABLE sablog_categories (
    cid INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    displayorder INTEGER DEFAULT 0,
    articles INTEGER DEFAULT 0
);

CREATE TABLE sablog_articles (
    articleid INTEGER PRIMARY KEY,
    cid INTEGER NOT NULL,
    uid INTEGER NOT NULL,
    title TEXT NOT NULL,
    content TEXT NOT NULL,
    description TEXT,
    keywords TEXT,
    dateline INTEGER,
    views INTEGER DEFAULT 0,
    comments INTEGER DEFAULT 0,
    stick INTEGER DEFAULT 0,
    visible INTEGER DEFAULT 1,
    closecomment INTEGER DEFAULT 0,
    readpassword TEXT,
    attachments TEXT
);

CREATE TABLE sablog_comments (
    commentid INTEGER PRIMARY KEY,
    articleid INTEGER NOT NULL,
    author TEXT NOT NULL,
    url TEXT,
    content TEXT NOT NULL,
    ipaddress TEXT,
    visible INTEGER DEFAULT 1,
    dateline INTEGER
);

CREATE TABLE sablog_tags (
    tagid INTEGER PRIMARY KEY,
    tag TEXT NOT NULL,
    usenum INTEGER DEFAULT 0,
    aids TEXT
);

CREATE TABLE sablog_links (
    linkid INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    url TEXT NOT NULL,
    note TEXT,
    displayorder INTEGER DEFAULT 0,
    visible INTEGER DEFAULT 1
);

CREATE TABLE sablog_stylevars (
    stylevarid INTEGER PRIMARY KEY,
    title TEXT NOT NULL,
    value TEXT,
    visible INTEGER DEFAULT 1
);

CREATE TABLE sablog_attachments (
    attachmentid INTEGER PRIMARY KEY,
    articleid INTEGER,
    filepath TEXT NOT NULL,
    filename TEXT,
    filetype TEXT,
    filesize INTEGER DEFAULT 0,
    downloads INTEGER DEFAULT 0,
    thumb_filepath TEXT
);

CREATE TABLE sablog_trackbacks (
    trackbackid INTEGER PRIMARY KEY,
    articleid INTEGER,
    title TEXT
);

CREATE TABLE sablog_trackbacklog (
    id INTEGER PRIMARY KEY,
    articleid INTEGER
);

CREATE TABLE sablog_searchindex (
    id INTEGER PRIMARY KEY,
    keywords TEXT
);

CREATE TABLE sablog_sessions (
    sid TEXT PRIMARY KEY,
    uid INTEGER
);
