From 7744177919526a97bda1c08bf46e7250ce156347 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Thu, 30 Jun 2011 12:50:05 +0530 Subject: Revert "Included w3c_validators gem and modified Migrations file" This reverts commit 1028226b00a3671a465b510880bd186ae26b2e3d. Reason: No code changes can be done in docrails. --- railties/guides/source/migrations.textile | 39 ++++++++++--------------------- 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'railties/guides/source/migrations.textile') diff --git a/railties/guides/source/migrations.textile b/railties/guides/source/migrations.textile index eae337b67b..dbbf8f3b51 100644 --- a/railties/guides/source/migrations.textile +++ b/railties/guides/source/migrations.textile @@ -117,33 +117,6 @@ Occasionally you will make a mistake when writing a migration. If you have alrea In general editing existing migrations is not a good idea: you will be creating extra work for yourself and your co-workers and cause major headaches if the existing version of the migration has already been run on production machines. Instead you should write a new migration that performs the changes you require. Editing a freshly generated migration that has not yet been committed to source control (or more generally which has not been propagated beyond your development machine) is relatively harmless. -h4. Supported Types - -Active Record supports the following types: - -* +:primary_key+ -* +:string+ -* +:text+ -* +:integer+ -* +:float+ -* +:decimal+ -* +:datetime+ -* +:timestamp+ -* +:time+ -* +:date+ -* +:binary+ -* +:boolean+ - -These will be mapped onto an appropriate underlying database type, for example with MySQL +:string+ is mapped to +VARCHAR(255)+. You can create columns of types not supported by Active Record when using the non-sexy syntax, for example - - -create_table :products do |t| - t.column :name, 'polygon', :null => false -end - - -This may however hinder portability to other databases. - h3. Creating a Migration h4. Creating a Model @@ -288,6 +261,18 @@ end will append +ENGINE=BLACKHOLE+ to the SQL statement used to create the table (when using MySQL the default is +ENGINE=InnoDB+). +The types supported by Active Record are +:primary_key+, +:string+, +:text+, +:integer+, +:float+, +:decimal+, +:datetime+, +:timestamp+, +:time+, +:date+, +:binary+, +:boolean+. + +These will be mapped onto an appropriate underlying database type, for example with MySQL +:string+ is mapped to +VARCHAR(255)+. You can create columns of types not supported by Active Record when using the non-sexy syntax, for example + + +create_table :products do |t| + t.column :name, 'polygon', :null => false +end + + +This may however hinder portability to other databases. + h4. Changing Tables A close cousin of +create_table+ is +change_table+, used for changing existing tables. It is used in a similar fashion to +create_table+ but the object yielded to the block knows more tricks. For example -- cgit v1.2.3