问题
I have a pretty primitive table schema now ( in Postgres ):
CREATE TABLE "public"."sandbox_demo" (
"id" int4 DEFAULT nextval('sandbox_demo_id_seq'::regclass) NOT NULL,
"source" text DEFAULT NULL NOT NULL,
"created" timestamptz(6) DEFAULT NULL NOT NULL,
"modified" timestamptz(6) DEFAULT NULL NOT NULL
)
However, this table only supports plain entries and there's no parent child relationship or a mapping table so I could have revisions of the initial code snippet.
What would be an ideal way of making it so that revisions per initial code snippet are supported?
回答1:
Add a nullable parent_id
so you can keep track of the original snippet?
来源:https://stackoverflow.com/questions/3829348/im-storing-code-snippets-in-my-database-how-can-i-enable-revisions-versions-of