2018-12-01 19:07:25 +01:00
|
|
|
--
|
|
|
|
-- Database: writefreely
|
|
|
|
--
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table accesstokens
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `accesstokens` (
|
2018-12-01 19:07:25 +01:00
|
|
|
token TEXT NOT NULL PRIMARY KEY,
|
|
|
|
user_id INTEGER NOT NULL,
|
|
|
|
sudo INTEGER NOT NULL DEFAULT '0',
|
|
|
|
one_time INTEGER NOT NULL DEFAULT '0',
|
|
|
|
created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
expires DATETIME DEFAULT NULL,
|
2018-12-10 06:26:54 +01:00
|
|
|
user_agent TEXT DEFAULT NULL
|
2018-12-01 19:07:25 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table appcontent
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `appcontent` (
|
2018-12-01 19:07:25 +01:00
|
|
|
id TEXT NOT NULL PRIMARY KEY,
|
|
|
|
content TEXT NOT NULL,
|
|
|
|
updated DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2019-01-24 23:08:08 +01:00
|
|
|
--
|
|
|
|
-- Table structure for table appmigrations
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE `appmigrations` (
|
|
|
|
`version` INT NOT NULL,
|
|
|
|
`migrated` DATETIME NOT NULL,
|
|
|
|
`result` TEXT NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2018-12-01 19:07:25 +01:00
|
|
|
--
|
|
|
|
-- Table structure for table collectionattributes
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `collectionattributes` (
|
2018-12-01 19:07:25 +01:00
|
|
|
collection_id INTEGER NOT NULL,
|
|
|
|
attribute TEXT NOT NULL,
|
|
|
|
value TEXT NOT NULL,
|
|
|
|
PRIMARY KEY (collection_id, attribute)
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table collectionkeys
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `collectionkeys` (
|
2018-12-01 19:07:25 +01:00
|
|
|
collection_id INTEGER PRIMARY KEY,
|
|
|
|
public_key blob NOT NULL,
|
|
|
|
private_key blob NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table collectionpasswords
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `collectionpasswords` (
|
2018-12-01 19:07:25 +01:00
|
|
|
collection_id INTEGER PRIMARY KEY,
|
|
|
|
password TEXT NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table collectionredirects
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `collectionredirects` (
|
2018-12-01 19:07:25 +01:00
|
|
|
prev_alias TEXT NOT NULL PRIMARY KEY,
|
|
|
|
new_alias TEXT NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table collections
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `collections` (
|
2018-12-01 19:07:25 +01:00
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
alias TEXT DEFAULT NULL UNIQUE,
|
|
|
|
title TEXT NOT NULL,
|
|
|
|
description TEXT NOT NULL,
|
|
|
|
style_sheet TEXT,
|
|
|
|
script TEXT,
|
|
|
|
format TEXT DEFAULT NULL,
|
|
|
|
privacy INTEGER NOT NULL,
|
|
|
|
owner_id INTEGER NOT NULL,
|
|
|
|
view_count INTEGER NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table posts
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `posts` (
|
2018-12-01 19:07:25 +01:00
|
|
|
id TEXT NOT NULL,
|
|
|
|
slug TEXT DEFAULT NULL,
|
|
|
|
modify_token TEXT DEFAULT NULL,
|
|
|
|
text_appearance TEXT NOT NULL DEFAULT 'norm',
|
|
|
|
language TEXT DEFAULT NULL,
|
|
|
|
rtl INTEGER DEFAULT NULL,
|
|
|
|
privacy INTEGER NOT NULL,
|
|
|
|
owner_id INTEGER DEFAULT NULL,
|
|
|
|
collection_id INTEGER DEFAULT NULL,
|
|
|
|
pinned_position INTEGER UNSIGNED DEFAULT NULL,
|
|
|
|
created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
updated DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
view_count INTEGER NOT NULL,
|
|
|
|
title TEXT NOT NULL,
|
|
|
|
content TEXT NOT NULL,
|
|
|
|
CONSTRAINT id_slug UNIQUE (collection_id, slug),
|
|
|
|
CONSTRAINT owner_id UNIQUE (owner_id, id),
|
|
|
|
CONSTRAINT privacy_id UNIQUE (privacy, id)
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table remotefollows
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `remotefollows` (
|
2018-12-01 19:07:25 +01:00
|
|
|
collection_id INTEGER NOT NULL,
|
|
|
|
remote_user_id INTEGER NOT NULL,
|
|
|
|
created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
PRIMARY KEY (collection_id,remote_user_id)
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table remoteuserkeys
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `remoteuserkeys` (
|
2018-12-01 19:07:25 +01:00
|
|
|
id TEXT NOT NULL,
|
|
|
|
remote_user_id INTEGER NOT NULL,
|
|
|
|
public_key blob NOT NULL,
|
|
|
|
CONSTRAINT follower_id UNIQUE (remote_user_id)
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table remoteusers
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `remoteusers` (
|
2018-12-01 19:07:25 +01:00
|
|
|
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
|
|
|
actor_id TEXT NOT NULL,
|
|
|
|
inbox TEXT NOT NULL,
|
|
|
|
shared_inbox TEXT NOT NULL,
|
|
|
|
CONSTRAINT collection_id UNIQUE (actor_id)
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table userattributes
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `userattributes` (
|
2018-12-01 19:07:25 +01:00
|
|
|
user_id INTEGER NOT NULL,
|
|
|
|
attribute TEXT NOT NULL,
|
|
|
|
value TEXT NOT NULL,
|
|
|
|
PRIMARY KEY (user_id, attribute)
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2019-01-18 06:05:50 +01:00
|
|
|
--
|
|
|
|
-- Table structure for table `userinvites`
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE `userinvites` (
|
|
|
|
`id` TEXT NOT NULL,
|
|
|
|
`owner_id` INTEGER NOT NULL,
|
|
|
|
`max_uses` INTEGER DEFAULT NULL,
|
|
|
|
`created` DATETIME NOT NULL,
|
|
|
|
`expires` DATETIME DEFAULT NULL,
|
|
|
|
`inactive` INTEGER NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
2018-12-01 19:07:25 +01:00
|
|
|
--
|
|
|
|
-- Table structure for table users
|
|
|
|
--
|
|
|
|
|
2018-12-02 22:24:44 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `users` (
|
2018-12-01 19:07:25 +01:00
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
username TEXT NOT NULL UNIQUE,
|
|
|
|
password TEXT NOT NULL,
|
|
|
|
email TEXT DEFAULT NULL,
|
|
|
|
created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
);
|
2019-01-18 06:05:50 +01:00
|
|
|
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Table structure for table `usersinvited`
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE TABLE `usersinvited` (
|
|
|
|
`invite_id` TEXT NOT NULL,
|
|
|
|
`user_id` INTEGER NOT NULL
|
|
|
|
);
|