Skip to content

Commit bcb20ba

Browse files
author
Matt Zukowski
committed
database migration is now automatically run on startup
1 parent 1c2ac7f commit bcb20ba

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/casserver/server.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ def self.init_logger!
228228
def self.init_database!
229229
#CASServer::Model::Base.establish_connection(config[:database])
230230
ActiveRecord::Base.establish_connection(config[:database])
231+
232+
print_cli_message "Running migrations to make sure your database schema is up to date..."
233+
ActiveRecord::Base.logger = Logger.new(STDOUT)
234+
ActiveRecord::Migration.verbose = true
235+
ActiveRecord::Migrator.migrate(File.dirname(__FILE__) + "/../../db/migrate")
236+
print_cli_message "Your database is now up to date."
231237
end
232238

233239
configure do

0 commit comments

Comments
 (0)