I’m pretty new to developing backend and deploying projects.
I’m a bit confused how the whole thing works. I created a new Strapi Project, using PostgreSQL as DB (so didn’t use the --quickstart flag).
Locally i set up a database, and everything seems to work fine. When navigating the DB via CLI, i can see all data. I have chosen Heroku to deploy my project, and followed the tutorial Heroku Deployment
What i’m confused about:
How and at what step is the data that i create locally, transferred to the remote DB that Heroku creates?
Currently only the DB Scheme gets uploaded, but the data itself does not.
I have done a fair bit of googling, and most problems seems to stem from the fact that people use the --quickstart flag, which creates a SQLite DB locally. But since i created a PostgreSQL DB, i’m confused why it isn’t working.
I see. I was unaware of this fact.
Am i understanding this correctly then. Then work flow (pun intended) would be as follow:
Locally we only develop the structure that gets saved in json, so just the content-types.
We then deploy the “empty” project (as in, no content).
The content itself gets created on a productive environment, for example staging.
As mentioned in the opening, i’m pretty new to deploying and managing a CMS in general.
I’m assuming that in most cases, it’s not best practice to create the content directly on the production environment. Would this imply that the content would be created on a different environment that has the same setup as production, for example staging. From there, if everything is good, we need to manually export and import the content to the production environment?
Does that sound about right?
Thanks a lot for the link you posted. I really thought i was doing something wrong. I was under the impression, that the data would be deployed automatically when using postgres (or any DB except SQlite). This explains a lot.
Yep! That sounds right. You can actually use one Strapi instance and the save / publish feature so you can have a preview site showing the “saved” content and a production site showing the “published” content.
If you only want to retrieve your draft entries, you can combine the preview mode and the published_at field. GET /articles?_publicationState=preview&published_at_null=true
This is great. Surely this will make things a lot easier to preview before publishing.
Is there any documentation for these arguments? I was able to make it work with a normal rest query, but not with graphql. While the attribute “publicationState” exists (ENUM), “published_at_null” doesn’t seem to get exported to the graphql api.
Either way, thanks so much for all this information. I was a bit sceptical of how strapi works at first, but with these features that i wasn’t aware of, i think it’s much more practicable.
Edit:
By looking at the docs of the official GraphQL implementation in Strapi, it seems that currently it’s not possible to fetch just the unpublished content. I’m sure this could be added manually to the api somewhere, but i’m not deep enough into Strapi yet. Should the case where i need this come up, i will create a new forum post.