Skip to content

db-migrate-seed.sh skips knapsack engine migrations due to glob bug #136

Description

@ShanaLMoore

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

  • bundled_migrations detects knapsack engine migrations
  • db:migrate runs when knapsack-only migrations are pending
  • Fix contributed upstream to samvera-labs/hyku_knapsack

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions