librepages/migrations/20220921122103_librepages_sites.sql
Aravinth Manivannan 3594d4e23b
feat: tombstone deployments instead of deleting them.
It is probably worthwhile storing deleted deployment('s events) for a
bit, before completely wiping them clean. Tombstone allows us to do
that.
2022-12-06 06:29:56 +05:30

13 lines
538 B
SQL

CREATE TABLE IF NOT EXISTS librepages_sites (
site_secret VARCHAR(32) NOT NULL UNIQUE,
repo_url VARCHAR(3000) NOT NULL,
branch TEXT NOT NULL,
hostname VARCHAR(3000) NOT NULL UNIQUE,
pub_id uuid NOT NULL UNIQUE,
ID SERIAL PRIMARY KEY NOT NULL,
deleted BOOLEAN DEFAULT FALSE,
owned_by INTEGER NOT NULL references librepages_users(ID) ON DELETE CASCADE
);
CREATE UNIQUE INDEX librepages_sites_site_secret ON librepages_sites(site_secret);
CREATE UNIQUE INDEX librepages_sites_site_pub_id ON librepages_sites(pub_id);