Story
As a developer deploying a Hyku Knapsack, I expect bin/db-migrate-seed.sh to detect and run all pending migrations, including those defined in the knapsack engine's own db/migrate/ directory.
Problem
Line 31 of bin/db-migrate-seed.sh uses File.exist? with a glob pattern:
if File.exist?("#{spec.full_gem_path}/lib/*/engine.rb")
File.exist? treats the * as a literal character, not a glob. It always returns false for the knapsack engine, so bundled_migrations never counts the knapsack's own migrations. The script concludes there are no pending migrations and skips db:migrate entirely.
Migrations installed into hyrax-webapp/db/migrate/ via railties:install:migrations (hyrax, bulkrax, etc.) are found by the separate Dir.glob('db/migrate/*.rb') on line 39. Only the knapsack's own migrations in /app/samvera/db/migrate/ are missed.
Fix
Replace File.exist? with Dir.glob(...).any?:
if Dir.glob("#{spec.full_gem_path}/lib/*/engine.rb").any?
This is a drop-in replacement that correctly expands the glob pattern.
Upstream
This bug exists in samvera-labs/hyku_knapsack and should be contributed back.
Acceptance Criteria
Story
As a developer deploying a Hyku Knapsack, I expect
bin/db-migrate-seed.shto detect and run all pending migrations, including those defined in the knapsack engine's owndb/migrate/directory.Problem
Line 31 of
bin/db-migrate-seed.shusesFile.exist?with a glob pattern:File.exist?treats the*as a literal character, not a glob. It always returnsfalsefor the knapsack engine, sobundled_migrationsnever counts the knapsack's own migrations. The script concludes there are no pending migrations and skipsdb:migrateentirely.Migrations installed into
hyrax-webapp/db/migrate/viarailties:install:migrations(hyrax, bulkrax, etc.) are found by the separateDir.glob('db/migrate/*.rb')on line 39. Only the knapsack's own migrations in/app/samvera/db/migrate/are missed.Fix
Replace
File.exist?withDir.glob(...).any?:This is a drop-in replacement that correctly expands the glob pattern.
Upstream
This bug exists in
samvera-labs/hyku_knapsackand should be contributed back.Acceptance Criteria
bundled_migrationsdetects knapsack engine migrationsdb:migrateruns when knapsack-only migrations are pendingsamvera-labs/hyku_knapsack