fedilogue/tables.sql

44 lines
1.2 KiB
SQL

DROP TABLE IF EXISTS instances;
DROP TABLE IF EXISTS posts;
DROP TABLE IF EXISTS accounts;
CREATE TABLE accounts (
actor_type VARCHAR(1000) NOT NULL,
id VARCHAR(2083) NOT NULL PRIMARY KEY,
inbox VARCHAR(2083) NOT NULL,
outbox VARCHAR(2083) NOT NULL,
followers VARCHAR(2083) NOT NULL,
following VARCHAR(2083) NOT NULL,
url VARCHAR(2083) NOT NULL,
preferredusername VARCHAR(1000) NOT NULL,
name VARCHAR(1000) NOT NULL,
summary TEXT,
icon VARCHAR(2083),
image VARCHAR(2083),
publickey TEXT,
identifiedat TIMESTAMP with time zone DEFAULT now(),
instance VARCHAR(1000) NOT NULL
);
CREATE TABLE posts (
id VARCHAR(2083) NOT NULL,
inreplyto VARCHAR(2083),
published TIMESTAMP with time zone NOT NULL,
summary TEXT,
content TEXT,
normalized TEXT,
attributedto VARCHAR(2083) REFERENCES accounts,
posthash bytea,
received_at TIMESTAMP with time zone DEFAULT now(),
instance VARCHAR(1000) NOT NULL
);
CREATE TABLE instances (
endpoint VARCHAR(2083) NOT NULL,
autostart BOOLEAN,
state VARCHAR(16),
username VARCHAR(32),
password VARCHAR(32),
software VARCHAR(50)
);