Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9899 (closed enhancement: fixed)

Opened 1 year ago

Last modified 1 year ago

[PATCH] Move contents of mysql*.sql files in db_definitions into schema.rb file

Reported by: mikong Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: mysql schema sql unverified
Cc:

Description

As discussed in

http://groups.google.com/group/rubyonrails-core/browse_frm/thread/a02c9458a23db249

SQL files (*.sql and *.drop.sql) in test/fixtures/db_definitions should be moved to schema migration files. This is the implementation for MySQL. To limit the execution of migrations to MySQL adapter only, a temporary condition was added in schema.rb to check for the adapter name.

Attachments

mysql_move_to_schema_migration.diff (15.9 kB) - added by mikong on 10/17/07 02:35:30.
mysql_move_to_schema_migration2.diff (15.6 kB) - added by mikong on 10/17/07 13:26:05.
mysql_move_to_schema_migration3.diff (17.0 kB) - added by mikong on 10/17/07 17:43:21.

Change History

10/17/07 02:35:30 changed by mikong

  • attachment mysql_move_to_schema_migration.diff added.

10/17/07 02:42:18 changed by mikong

This is related to #9897 which removes *2.sql and *2.drop.sql files from test/fixtures/db_definitions for all DB adapters.

10/17/07 13:26:05 changed by mikong

  • attachment mysql_move_to_schema_migration2.diff added.

10/17/07 13:33:06 changed by mikong

Version 2 of the patch has the following changes (suggested by Lawrence Pit in the google groups thread):

  • removed :null => false, :default => ... in :tasks table
  • removed :options => 'TYPE=InnoDB DEFAULT CHARSET=utf8'
  • explicit :scale => 0 for :numeric_data world_population and my_house_application
  • sexy migrations
  • updated rakefile

10/17/07 17:43:21 changed by mikong

  • attachment mysql_move_to_schema_migration3.diff added.

10/18/07 02:59:10 changed by mikong

Version 3 of the patch simply includes mysql2* in the fix:

  • Removed mysql2.sql and mysql2.drop.sql
  • Updated rakefile to exclude execution of mysql2.sql
  • schema2.rb was created to create the courses table for activerecord_unittest2
  • aaa_create_tables_test.rb was updated to call schema2.rb

I'm not very sure if my approach to mysql2* is correct. Please comment on it. We could opt to ignore version 3 of the patch and just use version 2. As mentioned above, #9897 fixes the *2.sql (i.e. all DB adapters including mysql2*.sql).

10/18/07 05:14:56 changed by lawrence

+1 on v3

I've already got the patches lined up for SQLite and SQLServer support as well. ;)

10/18/07 16:59:10 changed by mikong

  • keywords changed from mysql schema sql to mysql schema sql unverified.
  • summary changed from Move contents of mysql*.sql files in db_definitions into schema.rb file to [PATCH] Move contents of mysql*.sql files in db_definitions into schema.rb file.

10/19/07 01:52:53 changed by nzkoz

  • status changed from new to closed.
  • resolution set to fixed.

(In [7972]) Move all Schema creation into schema.rb for Mysql. Closes #9899 [mikong, lawrence]

10/19/07 05:27:23 changed by mikong

For the continuation of this transition of moving sql files from db_definitions to schema.rb, see #9929. We are hoping to do this sequentially. Thanks.