|
Revision 2817, 1.0 kB
(checked in by david, 3 years ago)
|
Added migration support for Oracle (closes #2647) [Michael Schoen]
|
| Line | |
|---|
| 1 |
require 'abstract_unit' |
|---|
| 2 |
require "#{File.dirname(__FILE__)}/../lib/active_record/schema" |
|---|
| 3 |
|
|---|
| 4 |
if ActiveRecord::Base.connection.supports_migrations? |
|---|
| 5 |
|
|---|
| 6 |
class ActiveRecordSchemaTest < Test::Unit::TestCase |
|---|
| 7 |
self.use_transactional_fixtures = false |
|---|
| 8 |
|
|---|
| 9 |
def setup |
|---|
| 10 |
@connection = ActiveRecord::Base.connection |
|---|
| 11 |
end |
|---|
| 12 |
|
|---|
| 13 |
def teardown |
|---|
| 14 |
@connection.drop_table :fruits rescue nil |
|---|
| 15 |
end |
|---|
| 16 |
|
|---|
| 17 |
def test_schema_define |
|---|
| 18 |
ActiveRecord::Schema.define(:version => 7) do |
|---|
| 19 |
create_table :fruits do |t| |
|---|
| 20 |
t.column :color, :string |
|---|
| 21 |
t.column :fruit_size, :string |
|---|
| 22 |
t.column :texture, :string |
|---|
| 23 |
t.column :flavor, :string |
|---|
| 24 |
end |
|---|
| 25 |
end |
|---|
| 26 |
|
|---|
| 27 |
assert_nothing_raised { @connection.select_all "SELECT * FROM fruits" } |
|---|
| 28 |
assert_nothing_raised { @connection.select_all "SELECT * FROM schema_info" } |
|---|
| 29 |
assert_equal 7, @connection.select_one("SELECT version FROM schema_info")['version'].to_i |
|---|
| 30 |
end |
|---|
| 31 |
end |
|---|
| 32 |
|
|---|
| 33 |
end |
|---|