Skip to content

Instantly share code, notes, and snippets.

View sihar's full-sized avatar

Sihar Simbolon sihar

  • Indonesia
View GitHub Profile
@kendru
kendru / soft_delete_postgres.sql
Created September 16, 2025 20:19
Example of transparent soft-deletes in Postgres
create table widget_history (
id bigint generated always as identity,
name text not null,
created_at timestamp not null default current_timestamp,
deleted_at timestamp
);
create index widget_by_name on widget_history(name) where deleted_at is null;
create view widget as