diff options
author | Marcel Molina <marcel@vernix.org> | 2005-11-20 07:45:04 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2005-11-20 07:45:04 +0000 |
commit | f18463f99e1237b31bfe5b6bcba327c97eede8c3 (patch) | |
tree | 7892d466698baf65a4748eeed46a0f64d99bb7b0 | |
parent | 991189b58d605f938200e8df1ef6e65583345067 (diff) | |
download | rails-f18463f99e1237b31bfe5b6bcba327c97eede8c3.tar.gz rails-f18463f99e1237b31bfe5b6bcba327c97eede8c3.tar.bz2 rails-f18463f99e1237b31bfe5b6bcba327c97eede8c3.zip |
Add tasks to create, drop and rebuild the MySQL and PostgreSQL test databases.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3105 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rwxr-xr-x | activerecord/Rakefile | 35 |
2 files changed, 37 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 17c829149d..041eafe65b 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Add tasks to create, drop and rebuild the MySQL and PostgreSQL test databases. [Marcel Molina Jr.] + * Correct boolean handling in generated reader methods. #2945 [don.park@gmail.com, Stefan Kaes] * Don't generate read methods for columns whose names are not valid ruby method names. #2946 [Stefan Kaes] diff --git a/activerecord/Rakefile b/activerecord/Rakefile index 60d4580451..aeb1ca9f79 100755 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -35,6 +35,41 @@ for adapter in %w( mysql postgresql sqlite sqlite3 firebird sqlserver sqlserver_ } end +SCHEMA_PATH = File.join(File.dirname(__FILE__), *%w(test fixtures db_definitions)) + +desc 'Build the MySQL test databases' +task :build_mysql_databases do + %x( mysqladmin create activerecord_unittest ) + %x( mysqladmin create activerecord_unittest2 ) + %x( mysql activerecord_unittest < #{File.join(SCHEMA_PATH, 'mysql.sql')} ) + %x( mysql activerecord_unittest < #{File.join(SCHEMA_PATH, 'mysql2.sql')} ) +end + +desc 'Drop the MySQL test databases' +task :drop_mysql_databases do + %x( mysqladmin -f drop activerecord_unittest ) + %x( mysqladmin -f drop activerecord_unittest2 ) +end + +desc 'Rebuild the MySQL test databases' +task :rebuild_mysql_databases => [:drop_mysql_databases, :build_mysql_databases] + +desc 'Build the PostgreSQL test databases' +task :build_postgresql_databases do + %x( createdb activerecord_unittest ) + %x( createdb activerecord_unittest2 ) + %x( psql activerecord_unittest -f #{File.join(SCHEMA_PATH, 'postgresql.sql')} ) + %x( psql activerecord_unittest -f #{File.join(SCHEMA_PATH, 'postgresql2.sql')} ) +end + +desc 'Drop the PostgreSQL test databases' +task :drop_postgresql_databases do + %x( dropdb activerecord_unittest ) + %x( dropdb activerecord_unittest2 ) +end + +desc 'Rebuild the PostgreSQL test databases' +task :rebuild_postgresql_databases => [:drop_postgresql_databases, :build_postgresql_databases] # Generate the RDoc documentation |