post_revisions table
The post_revisions table in the Blog Database Schema schema has 8 columns, keyed by id, with 2 foreign keys to posts and users.
Append-only history. posts carries the live version; every prior state including unpublished drafts lives here.
Columns (8)
Columns of the post_revisions table| Column | Type | Constraints | Description |
|---|
| id | uuid | primary key | |
|---|
| post_id | uuid | not null, references posts.id | |
|---|
| editor_id | uuid | references users.id | |
|---|
| revision_number | integer | not null | |
|---|
| title | varchar(255) | not null | |
|---|
| body | text | | |
|---|
| change_summary | varchar(255) | | |
|---|
| created_at | timestamptz | not null | |
|---|
Indexes (2)
(post_id, revision_number) unique(post_id, created_at)
Relationships
post_revisions.post_id references posts.idpost_revisions.editor_id references users.id