nyanoblog/migrations/20221205235226_create_notes.sql

16 lines
569 B
SQL

CREATE TABLE notes (
id BIGSERIAL PRIMARY KEY,
account_id BIGINT REFERENCES accounts (id),
iri VARCHAR,
content TEXT NOT NULL,
source TEXT DEFAULT NULL,
content_type VARCHAR DEFAULT NULL,
summary TEXT DEFAULT NULL,
sensitive BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMP NOT NULL DEFAULT now(),
updated_at TIMESTAMP NOT NULL DEFAULT now()
);
CREATE INDEX index_notes_on_account_id ON notes (account_id);
CREATE UNIQUE INDEX index_notes_on_iri ON notes (iri);
CREATE INDEX index_notes_on_created_at ON notes (created_at);