nederlandskie/sql/01_create_tables.sql

22 lines
616 B
MySQL
Raw Permalink Normal View History

2023-10-05 19:38:22 +01:00
CREATE TABLE IF NOT EXISTS Profile (
id INT GENERATED ALWAYS AS IDENTITY,
first_seen_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
did TEXT UNIQUE,
has_been_processed BOOLEAN DEFAULT FALSE,
likely_country_of_living varchar(2) NULL DEFAULT NULL
2023-10-05 19:38:22 +01:00
);
CREATE TABLE IF NOT EXISTS Post (
id INT GENERATED ALWAYS AS IDENTITY,
indexed_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
cid TEXT UNIQUE,
uri TEXT UNIQUE,
author_did TEXT REFERENCES Profile(did)
);
CREATE TABLE IF NOT EXISTS SubscriptionState (
id INT GENERATED ALWAYS AS IDENTITY,
service TEXT UNIQUE,
cursor INT
);