diff options
Diffstat (limited to 'railties/fresh_rakefile')
-rwxr-xr-x | railties/fresh_rakefile | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/railties/fresh_rakefile b/railties/fresh_rakefile index 44d16b820e..5407e140f1 100755 --- a/railties/fresh_rakefile +++ b/railties/fresh_rakefile @@ -135,6 +135,8 @@ task :clone_structure_to_test => [ :db_structure_dump, :purge_test_database ] do `psql -U "#{abcs["test"]["username"]}" -f db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}` when "sqlite", "sqlite3" `#{abcs[RAILS_ENV]["adapter"]} #{abcs["test"]["dbfile"]} < db/#{RAILS_ENV}_structure.sql` + when "sqlserver" + `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql` else raise "Unknown database adapter '#{abcs["test"]["adapter"]}'" end @@ -154,6 +156,9 @@ task :db_structure_dump => :environment do `pg_dump -U "#{abcs[RAILS_ENV]["username"]}" -s -x -O -f db/#{RAILS_ENV}_structure.sql #{abcs[RAILS_ENV]["database"]}` when "sqlite", "sqlite3" `#{abcs[RAILS_ENV]["adapter"]} #{abcs[RAILS_ENV]["dbfile"]} .schema > db/#{RAILS_ENV}_structure.sql` + when "sqlserver" + `scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /f db\\#{RAILS_ENV}_structure.sql /q /A /r` + `scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /F db\ /q /A /r` else raise "Unknown database adapter '#{abcs["test"]["adapter"]}'" end @@ -174,6 +179,10 @@ task :purge_test_database => :environment do `createdb -T template0 -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}` when "sqlite","sqlite3" File.delete(abcs["test"]["dbfile"]) if File.exist?(abcs["test"]["dbfile"]) + when "sqlserver" + dropfkscript = "#{abcs["test"]["host"]}.#{abcs["test"]["database"]}.DP1".gsub(/\\/,'-') + `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{dropfkscript}` + `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql` else raise "Unknown database adapter '#{abcs["test"]["adapter"]}'" end |