blob: ec1b446dab1d2f6c05edf33016523f9d204a169e (
plain) (
blame)
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
|
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)'
assert_equal :datetime, connection.columns(:strings).find { |c| c.name == 'somedate' }.type
end
end
end
end
|