Skip to content

Commit

Permalink
Set database to migrate in terms of BaseModel.database
Browse files Browse the repository at this point in the history
Not the other way round.
  • Loading branch information
akadusei committed Jul 22, 2024
1 parent b708a85 commit 54f3f03
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/database.cr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if LuckyEnv.test?
end

Avram.configure do |settings|
settings.database_to_migrate = AppDatabase
settings.database_to_migrate = BaseModel.database

# In production, allow lazy loading (N+1).
# In development and test, raise an error if you forget to preload associations
Expand Down
2 changes: 1 addition & 1 deletion spec/setup/database.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ end

Db::Migrate.new(quiet: true).call

Avram::SpecHelper.use_transactional_specs(Avram.settings.database_to_migrate)
Avram::SpecHelper.use_transactional_specs(BaseModel.database)
2 changes: 1 addition & 1 deletion src/actions/api__private/health/show.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# end

# private def verify_database_connection
# Avram.settings.database_to_migrate.exec("SELECT 1;")
# BaseModel.database.exec("SELECT 1;")
# end

# private def verify_redis_connection
Expand Down
2 changes: 1 addition & 1 deletion src/actions/health/show.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Health::Show < BrowserAction
end

private def verify_database_connection
Avram.settings.database_to_migrate.exec("SELECT 1;")
BaseModel.database.exec("SELECT 1;")
end

private def verify_redis_connection
Expand Down

0 comments on commit 54f3f03

Please sign in to comment.