Type:
Class

Represents an SQL table in an abstract way for updating a table. Also see TableDefinition and ActiveRecord::ConnectionAdapters::SchemaStatements#create_table

Available transformations are:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
change_table :table do |t|
  t.column
  t.index
  t.rename_index
  t.timestamps
  t.change
  t.change_default
  t.rename
  t.references
  t.belongs_to
  t.string
  t.text
  t.integer
  t.float
  t.decimal
  t.datetime
  t.timestamp
  t.time
  t.date
  t.binary
  t.boolean
  t.remove
  t.remove_references
  t.remove_belongs_to
  t.remove_index
  t.remove_timestamps
end
rename
  • References/Ruby on Rails/Rails/Classes/ActiveRecord/ActiveRecord::ConnectionAdapters/ActiveRecord::ConnectionAdapters::Table

rename(column_name, new_column_name) Instance Public methods Renames a column

2025-01-10 15:47:30
remove_timestamps
  • References/Ruby on Rails/Rails/Classes/ActiveRecord/ActiveRecord::ConnectionAdapters/ActiveRecord::ConnectionAdapters::Table

remove_timestamps() Instance Public methods Removes the timestamp columns (

2025-01-10 15:47:30
remove_index
  • References/Ruby on Rails/Rails/Classes/ActiveRecord/ActiveRecord::ConnectionAdapters/ActiveRecord::ConnectionAdapters::Table

remove_index(options = {}) Instance Public methods Removes the given index from

2025-01-10 15:47:30
timestamps
  • References/Ruby on Rails/Rails/Classes/ActiveRecord/ActiveRecord::ConnectionAdapters/ActiveRecord::ConnectionAdapters::Table

timestamps(options = {}) Instance Public methods Adds timestamps (created_at

2025-01-10 15:47:30
column_exists?
  • References/Ruby on Rails/Rails/Classes/ActiveRecord/ActiveRecord::ConnectionAdapters/ActiveRecord::ConnectionAdapters::Table

column_exists?(column_name, type = nil, options = {}) Instance Public methods Checks

2025-01-10 15:47:30
rename_index
  • References/Ruby on Rails/Rails/Classes/ActiveRecord/ActiveRecord::ConnectionAdapters/ActiveRecord::ConnectionAdapters::Table

rename_index(index_name, new_index_name) Instance Public methods Renames the

2025-01-10 15:47:30
belongs_to
  • References/Ruby on Rails/Rails/Classes/ActiveRecord/ActiveRecord::ConnectionAdapters/ActiveRecord::ConnectionAdapters::Table

belongs_to(*args) Instance Public methods Alias for:

2025-01-10 15:47:30