nyanoblog/migrations/20221205235226_create_notes.sql
2022-12-18 17:38:19 +01:00

15 lines
530 B
SQL

CREATE TABLE notes (
id BIGSERIAL PRIMARY KEY,
account_id BIGINT REFERENCES accounts (id),
uri VARCHAR,
content TEXT NOT NULL,
source TEXT 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_uri ON notes (uri);
CREATE INDEX index_notes_on_created_at ON notes (created_at);