Automatic database schema updates

Please state your opinion, and preferably reasoning. why you think NixOS modules should automatically run database schema updates or not.

Some relevant discussion points:

  • Some software doesn’t give you a choice and run schema updates automatically when the main binary starts.
  • Numerous modules in NixOS automatically run schema updates, while others do not.
  • At least several pieces of software in NixOS which don’t run schema updates automatically do not mention the need to run schema updates manually, sometimes resulting in failures which go unnoticed for a while.
  • Database schemas can take a while to run and often times can’t be backed out, leaving the unprepared sysadmin with a headache when things go wrong.

I don’t think we have an official stance on whether automatically running schema updates is the right thing to do or not so I would love to hear everyone’s thoughts and opinions.

Thanks!

Is it possible to perform a database schema update revert in case of a NixOS rollback?

1 Like

It feels situational to me. The impact and level of risk associated with schema updates varies greatly between applications.

I guess my stance would be “modules should perform database schema updates unless there is a compelling reason not to”

Why:

  • If manual intervention is required on updates, how do we notify of that and what happens in the case of unattended upgrades
  • Sometimes schema updates are required for the software to continue to function post-upgrade
  • Forcing schema updates puts everyone running the software in a consistent state. i.e. You shouldn’t get strange bug reports because someone forgot to do the schema update.

I suppose an alternative would be for it to somehow be optional