Code reverted to previous version

Made some changes to SQL code 2 weeks ago; these changes have disappeared yesterday and the version of the code that is live is from before the changes that were introduced. How does this happen and how do we prevent it from happening again?

"browser-info": {
"language": "en-GB",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36",
"vendor": "Google Inc."
"system-info": {
"file.encoding": "UTF-8",
"": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.10+9",
"java.vendor": "AdoptOpenJDK",
"java.vendor.url": "",
"java.version": "11.0.10",
"": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.10+9",
"": "Linux",
"os.version": "5.4.117-58.216.amzn2.x86_64",
"user.language": "en",
"user.timezone": "UTC"
"metabase-info": {
"databases": [
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "10.14"
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.2.18"
"run-mode": "prod",
"version": {
"date": "2021-04-08",
"tag": "v0.38.4",
"branch": "release-x.38.x",
"hash": "057b6bb"
"settings": {
"report-timezone": "UTC"

Hi @Myrte
Post "Diagnostic Info" from Admin > Troubleshooting.
Metabase does not revert your SQL. Either someone made a change, which you can see in the revision log (on a question, click the pencil-icon and Revision History). Or perhaps someone restored the Metabase application database back to a previous version.

We checked the revision history - nobody changed anything. Is there a log for the application database we could consult?

@Myrte No, contact the administrator who is managing the database.

updated the original question with diagnostic info

@Myrte Check the logs on the application database, which is Postgres 10.14. Perhaps someone has been manually editing entries on the database or perhaps the database was reverted to previous backup.
And latest release of Metabase is 0.40.2: