Skip to content

Commit

Permalink
Move all Schema creation into schema.rb for Mysql. Closes #9899 [miko…
Browse files Browse the repository at this point in the history
…ng, lawrence]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7972 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
NZKoz committed Oct 19, 2007
1 parent b1c3fc2 commit 210f7e2
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 283 deletions.
2 changes: 0 additions & 2 deletions activerecord/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ namespace :mysql do
%x( mysqladmin create activerecord_unittest2 )
%x( mysql -e "grant all on activerecord_unittest.* to rails@localhost" )
%x( mysql -e "grant all on activerecord_unittest2.* to rails@localhost" )
%x( mysql activerecord_unittest < #{File.join(SCHEMA_PATH, 'mysql.sql')} )
%x( mysql activerecord_unittest2 < #{File.join(SCHEMA_PATH, 'mysql2.sql')} )
end

desc 'Drop the MySQL test databases'
Expand Down
14 changes: 11 additions & 3 deletions activerecord/test/aaa_create_tables_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,22 @@ def test_load_schema
end

def test_drop_and_create_courses_table
recreate Course, '2' unless use_migrations?
if Course.connection.supports_migrations?
eval(File.read("#{File.dirname(__FILE__)}/fixtures/db_definitions/schema2.rb"))
end
recreate Course, '2' unless use_migrations_for_courses?
assert true
end

private
def use_migrations?
coursesSQL = ActiveRecord::Base.connection.adapter_name.downcase + "2.sql"
not File.exists? "#{@base_path}/#{coursesSQL}"
unittest_sql_filename = ActiveRecord::Base.connection.adapter_name.downcase + ".sql"
not File.exists? "#{@base_path}/#{unittest_sql_filename}"
end

def use_migrations_for_courses?
unittest2_sql_filename = ActiveRecord::Base.connection.adapter_name.downcase + "2.sql"
not File.exists? "#{@base_path}/#{unittest2_sql_filename}"
end

def recreate(base, suffix = nil)
Expand Down
33 changes: 0 additions & 33 deletions activerecord/test/fixtures/db_definitions/mysql.drop.sql

This file was deleted.

238 changes: 0 additions & 238 deletions activerecord/test/fixtures/db_definitions/mysql.sql

This file was deleted.

2 changes: 0 additions & 2 deletions activerecord/test/fixtures/db_definitions/mysql2.drop.sql

This file was deleted.

5 changes: 0 additions & 5 deletions activerecord/test/fixtures/db_definitions/mysql2.sql

This file was deleted.

Loading

0 comments on commit 210f7e2

Please sign in to comment.