Backup in Migration is realy needed?

I see in logs that sometimes ghostjs build a database backup before run migrations.

Its not make senses to me the application make database dump with selects, its very expensive, and ocasionaly, the machine will need a extra memory.

The down, phase of migration is responsible to restore database schema at your previous state, your data is responsibiligy from db, and the management o it, where exists ways much more performatics to do this.

And one question for now,
How can i disable this behavior ?

Many thanks to developers

Hi @luizamboni! As you mentioned down migrations are meant to serve as a way to restore the previous state, but in some cases, migrations are not backward compatible and the only way to ensure there is a way to restore data is to have a backup ready. Although we have a very rigorous approach towards reviewing migrations, we are all human and the Murphy’s law has no mercy… when things eventually go south having a backup can be a lifesaver!

:warning: I would not recommend disabling these backups to anybody. There is no easy (UI setting or a flag) to do it by intentionally! To reiterate, the savings of memory/time you are looking at are not worth a peaceful sleep. Please think again before disabling these backups :wink:

If you read this far and are 200% sure it’s the right thing to do, you could experiment removing this line on your own fork/copy of Ghost instance: Ghost/before.js at 0bb81bb3c421d715db30c2bf8cd33b01bf86d1b9 · TryGhost/Ghost · GitHub.

1 Like

thanks for information about code.

Only crearing the point here, i m not against backups, i only think that its not responsibility to migration, and database administration have better tools to do that.

And i think too that if ghosjs approach is care about this, have migrations that not care about this. In my case, i m adding a subtitle field.

Not have reason to make a backup to add a field that not exist before.
Can be a config property in migraction to inform the need of backup or not.

Thanks again !