开发者

I'm storing code snippets in my database. How can I enable revisions/versions of them?

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.

Wha开发者_JAVA技巧t would be an ideal way of making it so that revisions per initial code snippet are supported?


Add a nullable parent_id so you can keep track of the original snippet?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜