you are in: codestackercodes [RSS][rails] create_table methods

[rails] create_table methods Delicious Email

show/hide lines
   1    create_table :table do |t|
   2      t.column # adds an ordinary column. Ex: t.column(:name, :string)
   3      t.index # adds a new index.
   4      t.timestamps
   5      t.change # changes the column definition. Ex: t.change(:name, :string, :limit => 80)
   6      t.change_default # changes the column default value.
   7      t.rename # changes the name of the column.
   8      t.references
   9      t.belongs_to
  10      t.string
  11      t.text
  12      t.integer
  13      t.float
  14      t.decimal
  15      t.datetime
  16      t.timestamp
  17      t.time
  18      t.date
  19      t.binary
  20      t.boolean
  21      t.remove
  22      t.remove_references
  23      t.remove_belongs_to
  24      t.remove_index
  25      t.remove_timestamps
  26    end
created by leozera — 14 December 2008 — get a short url — tags: migrations rails embed

Comments

   1  Só uma observação.
   2  Algumas dessas opções não faz sentido no create_table e sim no change_table :table do |t|, como por exemplo:
   3  
   4     5      t.change # changes the column definition. Ex: t.change(:name, :string, :limit => 80)
   5     6      t.change_default # changes the column default value.
   6     7      t.rename # changes the name of the column.
   7    21      t.remove
   8    22      t.remove_references
   9    23      t.remove_belongs_to
  10    24      t.remove_index
  11    25      t.remove_timestamps
  12  

Thiago Antonius — 15 December / 10:55


We dont send spam :)

If checked, it's highlights your comment
simple_captcha.jpg
Are you a human? Type the code from the image