Skip to content

Commit 18be188

Browse files
Auto-run database migrations in generated spec_helper
Generated apps no longer need a manual AMBER_ENV=test migration step before running crystal spec — the spec helper now points Micrate at the configured database and runs pending migrations automatically. Carried forward from amberframework/amber#1382 by @renich (Renich Bon Ciric), who identified and fixed this in the v1 bundled CLI; the bundled CLI's templates moved here in V2, so the fix lands where new apps are actually generated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 0b8ea04 commit 18be188

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/amber_cli/templates/app/spec/spec_helper.cr.ecr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ require "micrate"
55

66
require "../config/application"
77

8-
# Micrate::DB.connection_url = ENV["DATABASE_URL"]? || Amber.settings.database_url
8+
Micrate::DB.connection_url = ENV["DATABASE_URL"]? || Amber.settings.database_url
99
# Automatically run migrations on the test database
10-
# Micrate::Cli.run_up
10+
Micrate::Cli.run_up

0 commit comments

Comments
 (0)