-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow the "USING" statement to be specified on change column calls
- Loading branch information
1 parent
9f33e3d
commit fbef981
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
activerecord/test/cases/adapters/postgresql/change_schema_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'cases/helper' | ||
|
||
module ActiveRecord | ||
class Migration | ||
class PGChangeSchemaTest < ActiveRecord::TestCase | ||
attr_reader :connection | ||
|
||
def setup | ||
super | ||
@connection = ActiveRecord::Base.connection | ||
connection.create_table(:strings) do |t| | ||
t.string :somedate | ||
end | ||
end | ||
|
||
def teardown | ||
connection.drop_table :strings | ||
end | ||
|
||
def test_change_string_to_date | ||
connection.change_column :strings, :somedate, :timestamp, using: 'CAST("somedate" AS timestamp)' | ||
end | ||
end | ||
end | ||
end |