Working with /Migration files

Hello Community,

I moved the analytics app from database.xml to /Migrations and have a question on how to work with them during releases.

  • When I am enabling a feature with DB-changes, I create a migration file.
  • What is the approach when I implement further features for the same release? add the modifications to the existing migration file or create several files (same version but different dates)?

Last option would potentially lead to several migration files for one release but this would not matter if I understood the docu correctly as all of them are processed by their timestamp.

How to proceed?

thank you,

Pick the one you like :wink:


This assumption is correct. Nextcloud will always run the migrations that are yet unknown (check oc_migrations).

Personally I would say that migrations should only be touched if they cause database migration issues, e.g. if something later turns out to cause problems on a db you didn’t test. Anything else should be “fixed” with a subsequent migration. Then also dev setups will have the clean db schema.