Skip to content

Instantly share code, notes, and snippets.

@Breefield
Created November 16, 2020 21:44
Show Gist options
  • Save Breefield/e36a52056de4d24465c3e3dd19cddd9b to your computer and use it in GitHub Desktop.
Save Breefield/e36a52056de4d24465c3e3dd19cddd9b to your computer and use it in GitHub Desktop.
CREATE TABLE inventory_audit AS TABLE inventory WITH NO DATA;
ALTER TABLE inventory_audit ADD COLUMN _deleted BOOLEAN DEFAULT FALSE;
ALTER TABLE inventory_audit ADD COLUMN audit_id SERIAL PRIMARY KEY;
ALTER TABLE inventory_audit ADD COLUMN _created_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
CREATE INDEX idx_inventory_audit_id ON inventory_audit (id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment