Skip to content

Postgres notes

Robin edited this page Sep 6, 2023 · 4 revisions

Using psql

docker compose exec postgres psql -U postgres

Creating table

CREATE TABLE connections (
  id SERIAL PRIMARY KEY,
  guild_id BIGINT UNIQUE NOT NULL,
  api_url TEXT NOT NULL,
  api_key TEXT NOT NULL, 
  last_use BIGINT NOT NULL,
  username_sync BOOLEAN NULL DEFAULT false,
  UNIQUE(api_url, api_key)
);

Reindexing

postgres=# REINDEX INDEX connections_api_url_key;
REINDEX
postgres=# REINDEX INDEX connections_guild_id_key;
REINDEX
postgres=# REINDEX INDEX connections_pkey;
REINDEX
Clone this wiki locally