You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.4 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,
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
);
-- 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');