摘要: TableDefinition 的对象,就是我们在写 migrate 的时候使用的对象 t如下class SomeMigration "ActiveRecord::ConnectionAdapters::TableDefinition" end end def down ... ... 阅读全文
posted @ 2014-09-21 17:59 LaoQuans 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 跟 column相关的常见的方法有:column_exists? (table_name, column_name, type = nil, options = {})add_column (table_name, column_name, type, options = {})remove_co... 阅读全文
posted @ 2014-09-21 17:04 LaoQuans 阅读(335) 评论(0) 推荐(0) 编辑
摘要: 常见的方法有 : create_table, drop_table, rename_table, change_table, table_exist?详细如下:最常见的创建表格: create_table(table_name, options={})table_name 参数可以是字符串或者是符号... 阅读全文
posted @ 2014-09-21 15:39 LaoQuans 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 创建 migration 需要继承自 ActiveRecord::Migration 类,常见如下:class SomeMigration < ActiveRecord::Migration def up end def down endendclass SomeMigration < ... 阅读全文
posted @ 2014-09-21 15:05 LaoQuans 阅读(175) 评论(0) 推荐(0) 编辑