class CreateAdministrator < ActiveRecord::Migration
def self.up
- # Do not use faux model here : the password must be encrypted
- u = User.new(:login => 'admin', :name => 'Administrator', :email => '', :password => 'admin', :password_confirmation => 'admin',
- :created_at => Time.now, :updated_at => Time.now)
- # Skip before_create as it populate dates columns with a long value (see migrations 752 to 754)
- u.send(:create_without_callbacks)
+ # Create the admin user with 'admin' password
+ ActiveRecord::Base.connection.execute("INSERT INTO USERS(LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) "+
+ "VALUES ('admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '#{Time.now}', '#{Time.now}', null, null);")
end
end