Closed oldo closed 2 weeks ago
This is intended and there are several warnings in the documentation.
We can't add interactive messages to the terminal or it would break ci/cd and this type of schema migration is exactly what it should be doing in production.
You should NEVER connect any application to a prod database like that. Take a snapshot or a backup, pull it locally and connect with a local dev database.
Thanks for the response. I disagree that no safeguards could be put in place because of CI/CD. Perhaps prompts could be added if running dev server or a check for the presence of an env var (e.g. IS_CICD
) to determine whether it's appropriate to show warnings when data is going to be dropped from the database.
It's something we have discussed at length internally and decided against. For more information as to why we decided this see #1114
Bug report
Required System information
Describe the bug
We have a production instance of the project running in the cloud. Whilst developing, we had set local env var to the production database. Locally the codebase was checked out to an old commit that didn't include a number of new collection types that had been added. We ran the dev server locally and because the code didn't have the new collection types and db env vars were pointing to production, the corresponding tables related to the missing collection types were dropped. A lot of important data was lost and without any warning or notification.
Steps to reproduce the behavior
Expected behavior
I would expect that if data is going to be dropped that a notification is given something along the lines of "The following tables with data are going to be dropped: X, Y, Z. Do you want to continue Y/n".
I'm pretty shocked at how easy it was to lose data.