What are some best practices people have around ve...
# orm-help
n
What are some best practices people have around versioning content? I was looking at Contentful's Graph API docs, and they're doing an interesting thing with how they serve "published" vs "draft" records, but I can't figure out how they're modeling it behind the scenes. Do y'all prefer record snapshots at discrete points in time? One single record with a "status" field? "Fat edges" with different versions of properties pointing to different types? (This is mostly coming from a CMS context, so I'm dealing with things like "published" vs "draft" records, and and reverting back to previous versions of records)
(One idea I had was that certain types (e.g.
Article
) have a
history
relation to
HistoryEvent
records. Each one of those would have some metadata along with a JSON representation of the
Article
at that moment. Makes for easy serving of / stepping through / reverting to versions, but it means you can't query / shape properties of the snapshot and it takes up a whole bunch of space)
from contentful's api: "preview" basically means "show me the latest draft version rather than the latest published version"
I'm trying to think of a data model that might lend itself to a query like
Copy code
query {
	article(id: "some-uuid", version: 1) {
		title
		author
	}
}
I feel like you'd have to have separate root and version types, e.g.
Copy code
type Article {
	id: ID!
	versions: [ArticleVersion]
}

type ArticleVersion {
	id: ID!
	title: String
	author: String
}
But then queries like this get weird:
Copy code
query {
	articles(where: {title_contains: "some text"}) {
		title
		author
	}
}