Columns
Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | |||
---|---|---|---|---|---|---|---|---|---|---|---|
id | bigserial | 19 | √ | nextval('ccbc_public.record_version_id_seq'::regclass) |
|
|
Primary key and unique identifier |
||||
record_id | uuid | 2147483647 | √ | null |
|
|
The id of the record the history record is associated with |
||||
old_record_id | uuid | 2147483647 | √ | null |
|
|
The id of the previous version of the record the history record is associated with |
||||
op | "audit"."operation" | 2147483647 | null |
|
|
The operation performed on the record (created, updated, deleted) |
|||||
ts | timestamptz | 35,6 | now() |
|
|
The timestamp of the history record |
|||||
table_oid | oid | 10 | null |
|
|
The oid of the table the record is associated with |
|||||
table_schema | name | 2147483647 | null |
|
|
The schema of the table the record is associated with |
|||||
table_name | name | 2147483647 | null |
|
|
The name of the table the record is associated with |
|||||
created_by | int4 | 10 | √ | null |
|
|
The user that created the record |
||||
created_at | timestamptz | 35,6 | null |
|
|
The timestamp of when the record was created |
|||||
record | jsonb | 2147483647 | √ | null |
|
|
The record in JSON format |
||||
old_record | jsonb | 2147483647 | √ | null |
|
|
The previous version of the record in JSON format |
Indexes
Constraint Name | Type | Sort | Column(s) |
---|---|---|---|
record_version_pkey | Primary key | Asc | id |
record_version_old_record_id | Performance | Asc | old_record_id |
record_version_record_id | Performance | Asc | record_id |
record_version_table_oid | Performance | Asc | table_oid |
record_version_ts | Performance | Asc | ts |
Check Constraints
Constraint Name | Constraint |
---|---|
record_version_check4 | (((op = ANY (ARRAY['UPDATE'::audit.operation, 'DELETE'::audit.operation])) = (old_record IS NOT NULL))) |
record_version_check | (((COALESCE(record_id, old_record_id) IS NOT NULL) OR (op = 'TRUNCATE'::audit.operation))) |
record_version_check1 | (((op = ANY (ARRAY['INSERT'::audit.operation, 'UPDATE'::audit.operation])) = (record_id IS NOT NULL))) |
record_version_check2 | (((op = ANY (ARRAY['INSERT'::audit.operation, 'UPDATE'::audit.operation])) = (record IS NOT NULL))) |
record_version_check3 | (((op = ANY (ARRAY['UPDATE'::audit.operation, 'DELETE'::audit.operation])) = (old_record_id IS NOT NULL))) |