Skip to content

Commit d788cd5

Browse files
authored
fix(install): seed on a FRESH install, not only on upgrade (#496)
Nextcloud runs migrateSchemaOnly() on a first install: $previousVersion is '', so Installer::installAppLastSteps() skips BOTH pre-migration and post-migration, and <install> is the only unconditional hook. The upgrade path runs pre/post-migration and NOT install, so an app needs both blocks carrying the same baseline steps, each idempotent. Until now this app declared no <install> block at all, so the SoftwareCatalog register never arrived on a fresh instance. Only baseline-CREATING steps are added; migrations, backfills, renames and cross-app ingests stay upgrade-only so they never run against an empty database. <install> is placed after </post-migration> per the info.xsd sequence (pre-migration, post-migration, live-migration, install, uninstall), verified against the schema.
1 parent bbe8883 commit d788cd5

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

appinfo/info.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,24 @@ Vrij en open source onder de EUPL-licentie.
115115
-->
116116
<step>OCA\SoftwareCatalog\Repair\RenameDutchCatalogColumns</step>
117117
</post-migration>
118+
<!--
119+
FRESH INSTALL. Nextcloud does NOT run post-migration on a first install:
120+
`Installer::installAppLastSteps()` guards both the pre-migration and
121+
post-migration blocks with `if ($previousVersion !== '')`, and only
122+
`repair-steps/install` runs unconditionally afterwards. Until this block
123+
existed a brand-new SoftwareCatalog install ran NONE of the steps above,
124+
so InitializeSettings never fired and the register was never imported —
125+
despite that step's own docblock saying it initialises settings "on
126+
install/upgrade".
127+
128+
Only InitializeSettings belongs here. MigrateContactsToNc,
129+
BackfillContractApprovalState and RenameDutchCatalogColumns are all
130+
migrations or backfills over data a fresh install does not yet have, so
131+
they stay upgrade-only rather than running against an empty database.
132+
-->
133+
<install>
134+
<step>OCA\SoftwareCatalog\Repair\InitializeSettings</step>
135+
</install>
118136
</repair-steps>
119137

120138
<settings>

0 commit comments

Comments
 (0)