added config option to disable automatic migrations

This commit is contained in:
Matt Zukowski 2011-02-08 14:52:19 -05:00
Родитель ea80f0b6bf
Коммит 31e3912f34
2 изменённых файлов: 15 добавлений и 7 удалений

Просмотреть файл

@ -251,13 +251,15 @@ module CASServer
#CASServer::Model::Base.establish_connection(config[:database])
ActiveRecord::Base.establish_connection(config[:database])
print_cli_message "Running migrations to make sure your database schema is up to date..."
prev_db_log = ActiveRecord::Base.logger
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Migration.verbose = true
ActiveRecord::Migrator.migrate(File.dirname(__FILE__) + "/../../db/migrate")
ActiveRecord::Base.logger = prev_db_log
print_cli_message "Your database is now up to date."
unless config[:disable_auto_migrations]
print_cli_message "Running migrations to make sure your database schema is up to date..."
prev_db_log = ActiveRecord::Base.logger
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Migration.verbose = true
ActiveRecord::Migrator.migrate(File.dirname(__FILE__) + "/../../db/migrate")
ActiveRecord::Base.logger = prev_db_log
print_cli_message "Your database is now up to date."
end
end
configure do

Просмотреть файл

@ -203,6 +203,12 @@ database:
# dbfile: /var/lib/casserver.db
# By default RubyCAS-Server will run migrations at every startup to ensure
# that its database schema is up-to-date. To disable this behaviour set
# the following option to true:
#disable_auto_migrations: true
##### AUTHENTICATION ###########################################################
# Configure how username/passwords are validated.