Ephemeral/schema.sql

46 lines
1.7 KiB
SQL

-- Use Write-Ahead-Logging --
-- This speeds up queries by about 2x --
-- PRAGMA journal_mode=WAL;
-- PRAGMA synchronous = OFF; -- Disabled by default, can corrupt db if the computer suffers a catastrophic crash (or power failure)
-- This drops the existing files table, and re-creates it. --
DROP TABLE IF EXISTS 'files';
CREATE TABLE IF NOT EXISTS 'files' (
file TEXT NOT NULL,
mimetype TEXT NOT NULL,
expiry INTEGER NOT NULL,
expiry_override INTEGER,
views INTEGER DEFAULT '0',
isDeleted INTEGER DEFAULT '0',
adminkey TEXT NOT NULL,
accessed INTEGER NOT NULL,
filesize INTEGER NOT NULL,
IP TEXT NOT NULL,
domain TEXT NOT NULL);
-- This drops the existing qrscan table, and re-creates it. --
DROP TABLE IF EXISTS 'qrscan';
CREATE TABLE 'qrscan' (
scanid INTEGER PRIMARY KEY,
time INTEGER NOT NULL,
IP TEXT NOT NULL,
useragent TEXT NOT NULL,
version INTEGER NOT NULL
);
-- Admin API Key Table
CREATE TABLE IF NOT EXISTS 'apikeys' (
key TEXT NOT NULL,
server_admin INTEGER NOT NULL,
expiry_override INTEGER NOT NULL,
upload_permanent INTEGER NOT NULL,
default_name INTEGER NOT NULL,
bypass_mimetypes INTEGER NOT NULL,
comment TEXT
);
-- Dummy file to stop compile error, temporary fix --
-- This is some seriously wacked up formatting.
INSERT INTO files (
file, mimetype, expiry, adminkey, accessed, filesize, ip, domain)
VALUES ( 'dummy','text/plain','1', 'dummyadminkey','0', '0', '127.0.0.1','localhost');