activerecord-jdbc-adapter 0.9.3-java
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +248 -0
- data/LICENSE.txt +21 -0
- data/Manifest.txt +125 -0
- data/README.txt +218 -0
- data/Rakefile +10 -0
- data/lib/active_record/connection_adapters/cachedb_adapter.rb +1 -0
- data/lib/active_record/connection_adapters/derby_adapter.rb +13 -0
- data/lib/active_record/connection_adapters/h2_adapter.rb +13 -0
- data/lib/active_record/connection_adapters/hsqldb_adapter.rb +13 -0
- data/lib/active_record/connection_adapters/informix_adapter.rb +1 -0
- data/lib/active_record/connection_adapters/jdbc_adapter.rb +640 -0
- data/lib/active_record/connection_adapters/jdbc_adapter_spec.rb +26 -0
- data/lib/active_record/connection_adapters/jndi_adapter.rb +1 -0
- data/lib/active_record/connection_adapters/mysql_adapter.rb +13 -0
- data/lib/active_record/connection_adapters/oracle_adapter.rb +1 -0
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +13 -0
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +13 -0
- data/lib/generators/jdbc/jdbc_generator.rb +9 -0
- data/lib/jdbc_adapter.rb +27 -0
- data/lib/jdbc_adapter/jdbc.rake +121 -0
- data/lib/jdbc_adapter/jdbc_adapter_internal.jar +0 -0
- data/lib/jdbc_adapter/jdbc_cachedb.rb +33 -0
- data/lib/jdbc_adapter/jdbc_db2.rb +203 -0
- data/lib/jdbc_adapter/jdbc_derby.rb +430 -0
- data/lib/jdbc_adapter/jdbc_firebird.rb +109 -0
- data/lib/jdbc_adapter/jdbc_hsqldb.rb +218 -0
- data/lib/jdbc_adapter/jdbc_informix.rb +147 -0
- data/lib/jdbc_adapter/jdbc_mimer.rb +141 -0
- data/lib/jdbc_adapter/jdbc_mssql.rb +337 -0
- data/lib/jdbc_adapter/jdbc_mysql.rb +236 -0
- data/lib/jdbc_adapter/jdbc_oracle.rb +377 -0
- data/lib/jdbc_adapter/jdbc_postgre.rb +498 -0
- data/lib/jdbc_adapter/jdbc_sqlite3.rb +384 -0
- data/lib/jdbc_adapter/jdbc_sybase.rb +50 -0
- data/lib/jdbc_adapter/missing_functionality_helper.rb +87 -0
- data/lib/jdbc_adapter/rake_tasks.rb +10 -0
- data/lib/jdbc_adapter/tsql_helper.rb +60 -0
- data/lib/jdbc_adapter/version.rb +5 -0
- data/lib/pg.rb +4 -0
- data/rails_generators/jdbc_generator.rb +15 -0
- data/rails_generators/templates/config/initializers/jdbc.rb +7 -0
- data/rails_generators/templates/lib/tasks/jdbc.rake +8 -0
- data/rakelib/compile.rake +23 -0
- data/rakelib/package.rake +90 -0
- data/rakelib/rails.rake +41 -0
- data/rakelib/test.rake +76 -0
- data/src/java/jdbc_adapter/JdbcAdapterInternalService.java +53 -0
- data/src/java/jdbc_adapter/JdbcConnectionFactory.java +36 -0
- data/src/java/jdbc_adapter/JdbcDerbySpec.java +293 -0
- data/src/java/jdbc_adapter/JdbcMySQLSpec.java +134 -0
- data/src/java/jdbc_adapter/MssqlRubyJdbcConnection.java +71 -0
- data/src/java/jdbc_adapter/PostgresRubyJdbcConnection.java +55 -0
- data/src/java/jdbc_adapter/RubyJdbcConnection.java +1162 -0
- data/src/java/jdbc_adapter/SQLBlock.java +27 -0
- data/src/java/jdbc_adapter/Sqlite3RubyJdbcConnection.java +41 -0
- data/test/abstract_db_create.rb +107 -0
- data/test/activerecord/connection_adapters/type_conversion_test.rb +31 -0
- data/test/activerecord/connections/native_jdbc_mysql/connection.rb +25 -0
- data/test/cachedb_simple_test.rb +6 -0
- data/test/db/cachedb.rb +9 -0
- data/test/db/db2.rb +9 -0
- data/test/db/derby.rb +14 -0
- data/test/db/h2.rb +11 -0
- data/test/db/hsqldb.rb +12 -0
- data/test/db/informix.rb +11 -0
- data/test/db/jdbc.rb +11 -0
- data/test/db/jndi_config.rb +30 -0
- data/test/db/logger.rb +3 -0
- data/test/db/mssql.rb +9 -0
- data/test/db/mysql.rb +10 -0
- data/test/db/oracle.rb +34 -0
- data/test/db/postgres.rb +9 -0
- data/test/db/sqlite3.rb +15 -0
- data/test/db2_simple_test.rb +10 -0
- data/test/derby_migration_test.rb +21 -0
- data/test/derby_multibyte_test.rb +12 -0
- data/test/derby_simple_test.rb +21 -0
- data/test/generic_jdbc_connection_test.rb +9 -0
- data/test/h2_simple_test.rb +6 -0
- data/test/has_many_through.rb +79 -0
- data/test/helper.rb +5 -0
- data/test/hsqldb_simple_test.rb +6 -0
- data/test/informix_simple_test.rb +48 -0
- data/test/jdbc_adapter/jdbc_db2_test.rb +26 -0
- data/test/jdbc_adapter/jdbc_sybase_test.rb +33 -0
- data/test/jdbc_common.rb +25 -0
- data/test/jndi_callbacks_test.rb +38 -0
- data/test/jndi_test.rb +35 -0
- data/test/manualTestDatabase.rb +191 -0
- data/test/minirunit.rb +109 -0
- data/test/minirunit/testConnect.rb +14 -0
- data/test/minirunit/testH2.rb +73 -0
- data/test/minirunit/testHsqldb.rb +73 -0
- data/test/minirunit/testLoadActiveRecord.rb +3 -0
- data/test/minirunit/testMysql.rb +83 -0
- data/test/minirunit/testRawSelect.rb +24 -0
- data/test/models/add_not_null_column_to_table.rb +12 -0
- data/test/models/auto_id.rb +18 -0
- data/test/models/data_types.rb +28 -0
- data/test/models/entry.rb +23 -0
- data/test/models/mixed_case.rb +20 -0
- data/test/models/reserved_word.rb +18 -0
- data/test/models/string_id.rb +18 -0
- data/test/models/validates_uniqueness_of_string.rb +19 -0
- data/test/mssql_simple_test.rb +6 -0
- data/test/mysql_db_create_test.rb +25 -0
- data/test/mysql_multibyte_test.rb +10 -0
- data/test/mysql_nonstandard_primary_key_test.rb +42 -0
- data/test/mysql_simple_test.rb +32 -0
- data/test/oracle_simple_test.rb +29 -0
- data/test/pick_rails_version.rb +3 -0
- data/test/postgres_db_create_test.rb +21 -0
- data/test/postgres_mixed_case_test.rb +19 -0
- data/test/postgres_nonseq_pkey_test.rb +40 -0
- data/test/postgres_reserved_test.rb +22 -0
- data/test/postgres_schema_search_path_test.rb +46 -0
- data/test/postgres_simple_test.rb +13 -0
- data/test/simple.rb +475 -0
- data/test/sqlite3_simple_test.rb +233 -0
- data/test/sybase_jtds_simple_test.rb +6 -0
- metadata +188 -0
data/test/minirunit.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
|
2
|
+
$silentTests = false
|
3
|
+
$testnum=0
|
4
|
+
$ntest=0
|
5
|
+
$failed = []
|
6
|
+
$curtestOK=true
|
7
|
+
|
8
|
+
module MiniRUnit
|
9
|
+
class Failure
|
10
|
+
def initialize(what, testnum, msg, where)
|
11
|
+
@what, @testnum, @msg, @where = what, testnum, msg, where
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
sprintf("FAILED %s %d %s-- %s\n", @what, @testnum, @msg, @where)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Error
|
20
|
+
def initialize(what, testnum, boom)
|
21
|
+
@what, @testnum, @boom = what, testnum, boom
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
sprintf("EXCEPTION raised %s %d -- \n\tException: %s\n\t%s",
|
26
|
+
@what, @testnum, @boom.to_s, @boom.backtrace.join("\n\t"))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def test_check(what)
|
33
|
+
printf "%s : ", what unless $silentTests
|
34
|
+
$what = what
|
35
|
+
$testnum = 0
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_ok(cond, msg="")
|
39
|
+
$testnum+=1
|
40
|
+
$ntest+=1
|
41
|
+
if cond
|
42
|
+
print "." unless $silentTests
|
43
|
+
else
|
44
|
+
where = caller.reject {|where| where =~ /minirunit/}[0]
|
45
|
+
$failed.push(MiniRUnit::Failure.new($what, $testnum, msg, where))
|
46
|
+
print "F" unless $silentTests
|
47
|
+
$curtestOK=false
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_fail(msg="")
|
52
|
+
test_ok(false, msg)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_equal(a,b)
|
56
|
+
test_ok(a == b, "expected #{a.inspect}, found #{b.inspect}")
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_no_exception(&proc)
|
60
|
+
raised = false
|
61
|
+
begin
|
62
|
+
proc.call
|
63
|
+
rescue exception
|
64
|
+
raised = x
|
65
|
+
end
|
66
|
+
test_ok(!raised, "unexpected exception #{raised}")
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_exception(type=Exception, &proc)
|
70
|
+
raised = false
|
71
|
+
begin
|
72
|
+
proc.call
|
73
|
+
rescue type=>e
|
74
|
+
raised = true
|
75
|
+
end
|
76
|
+
test_ok(raised, "#{type} expected")
|
77
|
+
e
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_get_last_failed
|
81
|
+
if $failed.empty?
|
82
|
+
return nil
|
83
|
+
end
|
84
|
+
return $failed.last
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_print_report
|
88
|
+
puts
|
89
|
+
puts "-" * 80
|
90
|
+
$failed.each { |error| puts error }
|
91
|
+
puts "-" * 80
|
92
|
+
puts "Tests: #$ntest. (Ok: #{$ntest - $failed.size}; Failed: #{$failed.size})"
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_load(test)
|
96
|
+
begin
|
97
|
+
$curtestOK=true
|
98
|
+
load(test)
|
99
|
+
rescue Exception => boom
|
100
|
+
puts 'ERROR' unless $silentTests
|
101
|
+
$failed.push(MiniRUnit::Error.new($what, $testnum, boom))
|
102
|
+
else
|
103
|
+
if $curtestOK
|
104
|
+
puts 'OK' unless $silentTests
|
105
|
+
else
|
106
|
+
puts 'FAILED' unless $silentTests
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test/minirunit'
|
2
|
+
RAILS_CONNECTION_ADAPTERS = ['abstract', 'jdbc']
|
3
|
+
require 'active_record'
|
4
|
+
|
5
|
+
connspec = ActiveRecord::Base.establish_connection(
|
6
|
+
:adapter => 'jdbc',
|
7
|
+
:driver => 'com.mysql.jdbc.Driver',
|
8
|
+
:url => 'jdbc:mysql://localhost:3306/test',
|
9
|
+
:username => 'rlsmgr',
|
10
|
+
:password => ''
|
11
|
+
)
|
12
|
+
|
13
|
+
puts "#{connspec}"
|
14
|
+
puts "#{ActiveRecord::Base.connection}"
|
@@ -0,0 +1,73 @@
|
|
1
|
+
|
2
|
+
require 'minirunit'
|
3
|
+
|
4
|
+
config = {
|
5
|
+
:adapter => 'jdbc',
|
6
|
+
:username => 'sa',
|
7
|
+
:password => '',
|
8
|
+
:driver => 'org.h2.Driver',
|
9
|
+
:url => 'jdbc:h2:test.db'
|
10
|
+
}
|
11
|
+
RAILS_CONNECTION_ADAPTERS = ['abstract', 'jdbc']
|
12
|
+
|
13
|
+
require 'active_record'
|
14
|
+
|
15
|
+
ActiveRecord::Base.establish_connection(config)
|
16
|
+
require 'logger'
|
17
|
+
ActiveRecord::Base.logger = Logger.new($stdout)
|
18
|
+
ActiveRecord::Base.logger.level = Logger::DEBUG
|
19
|
+
|
20
|
+
class CreateEntries < ActiveRecord::Migration
|
21
|
+
def self.up
|
22
|
+
create_table "entries", :force => true do |t|
|
23
|
+
t.column :title, :string, :limit => 100
|
24
|
+
t.column :updated_on, :datetime
|
25
|
+
t.column :content, :text
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.down
|
30
|
+
drop_table "entries"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
CreateEntries.up
|
35
|
+
|
36
|
+
test_ok ActiveRecord::Base.connection.tables.include?('entries')
|
37
|
+
|
38
|
+
class Entry < ActiveRecord::Base
|
39
|
+
end
|
40
|
+
|
41
|
+
Entry.delete_all
|
42
|
+
|
43
|
+
test_equal 0, Entry.count
|
44
|
+
|
45
|
+
TITLE = "First post!"
|
46
|
+
CONTENT = "Hello from JRuby on Rails!"
|
47
|
+
NEW_TITLE = "First post updated title"
|
48
|
+
|
49
|
+
post = Entry.new
|
50
|
+
post.title = TITLE
|
51
|
+
post.content = CONTENT
|
52
|
+
post.save
|
53
|
+
|
54
|
+
test_equal 1, Entry.count
|
55
|
+
|
56
|
+
post = Entry.find(:first)
|
57
|
+
test_equal TITLE, post.title
|
58
|
+
test_equal CONTENT, post.content
|
59
|
+
|
60
|
+
post.title = NEW_TITLE
|
61
|
+
post.save
|
62
|
+
|
63
|
+
post = Entry.find(:first)
|
64
|
+
test_equal NEW_TITLE, post.title
|
65
|
+
|
66
|
+
post.destroy
|
67
|
+
|
68
|
+
test_equal 0, Entry.count
|
69
|
+
|
70
|
+
CreateEntries.down
|
71
|
+
|
72
|
+
# Clean up hsqldb when done
|
73
|
+
Dir['test.db*'].each {|f| File.delete(f)}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
|
2
|
+
require 'minirunit'
|
3
|
+
|
4
|
+
config = {
|
5
|
+
:adapter => 'jdbc',
|
6
|
+
:username => 'sa',
|
7
|
+
:password => '',
|
8
|
+
:driver => 'org.hsqldb.jdbcDriver',
|
9
|
+
:url => 'jdbc:hsqldb:test.db'
|
10
|
+
}
|
11
|
+
RAILS_CONNECTION_ADAPTERS = ['abstract', 'jdbc']
|
12
|
+
|
13
|
+
require 'active_record'
|
14
|
+
|
15
|
+
ActiveRecord::Base.establish_connection(config)
|
16
|
+
require 'logger'
|
17
|
+
ActiveRecord::Base.logger = Logger.new($stdout)
|
18
|
+
ActiveRecord::Base.logger.level = Logger::DEBUG
|
19
|
+
|
20
|
+
class CreateEntries < ActiveRecord::Migration
|
21
|
+
def self.up
|
22
|
+
create_table "entries", :force => true do |t|
|
23
|
+
t.column :title, :string, :limit => 100
|
24
|
+
t.column :updated_on, :datetime
|
25
|
+
t.column :content, :text
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.down
|
30
|
+
drop_table "entries"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
CreateEntries.up
|
35
|
+
|
36
|
+
test_ok ActiveRecord::Base.connection.tables.include?('entries')
|
37
|
+
|
38
|
+
class Entry < ActiveRecord::Base
|
39
|
+
end
|
40
|
+
|
41
|
+
Entry.delete_all
|
42
|
+
|
43
|
+
test_equal 0, Entry.count
|
44
|
+
|
45
|
+
TITLE = "First post!"
|
46
|
+
CONTENT = "Hello from JRuby on Rails!"
|
47
|
+
NEW_TITLE = "First post updated title"
|
48
|
+
|
49
|
+
post = Entry.new
|
50
|
+
post.title = TITLE
|
51
|
+
post.content = CONTENT
|
52
|
+
post.save
|
53
|
+
|
54
|
+
test_equal 1, Entry.count
|
55
|
+
|
56
|
+
post = Entry.find(:first)
|
57
|
+
test_equal TITLE, post.title
|
58
|
+
test_equal CONTENT, post.content
|
59
|
+
|
60
|
+
post.title = NEW_TITLE
|
61
|
+
post.save
|
62
|
+
|
63
|
+
post = Entry.find(:first)
|
64
|
+
test_equal NEW_TITLE, post.title
|
65
|
+
|
66
|
+
post.destroy
|
67
|
+
|
68
|
+
test_equal 0, Entry.count
|
69
|
+
|
70
|
+
CreateEntries.down
|
71
|
+
|
72
|
+
# Clean up hsqldb when done
|
73
|
+
Dir['test.db*'].each {|f| File.delete(f)}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# To run this script, run the following in a mysql instance:
|
2
|
+
#
|
3
|
+
# drop database if exists weblog_development;
|
4
|
+
# create database weblog_development;
|
5
|
+
# grant all on weblog_development.* to blog@localhost;
|
6
|
+
|
7
|
+
require 'minirunit'
|
8
|
+
|
9
|
+
config = {
|
10
|
+
:username => 'blog',
|
11
|
+
:password => ''
|
12
|
+
}
|
13
|
+
|
14
|
+
if RUBY_PLATFORM =~ /java/
|
15
|
+
RAILS_CONNECTION_ADAPTERS = ['abstract', 'jdbc']
|
16
|
+
config.update({
|
17
|
+
:adapter => 'jdbc',
|
18
|
+
:driver => 'com.mysql.jdbc.Driver',
|
19
|
+
:url => 'jdbc:mysql://localhost:3306/weblog_development',
|
20
|
+
})
|
21
|
+
else
|
22
|
+
config.update({
|
23
|
+
:adapter => 'mysql',
|
24
|
+
:database => 'weblog_development',
|
25
|
+
:host => 'localhost'
|
26
|
+
})
|
27
|
+
end
|
28
|
+
|
29
|
+
require 'active_record'
|
30
|
+
|
31
|
+
ActiveRecord::Base.establish_connection(config)
|
32
|
+
|
33
|
+
class CreateEntries < ActiveRecord::Migration
|
34
|
+
def self.up
|
35
|
+
create_table "entries", :force => true do |t|
|
36
|
+
t.column :title, :string, :limit => 100
|
37
|
+
t.column :updated_on, :datetime
|
38
|
+
t.column :content, :text
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.down
|
43
|
+
drop_table "entries"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
CreateEntries.up
|
48
|
+
|
49
|
+
test_ok ActiveRecord::Base.connection.tables.include?('entries')
|
50
|
+
|
51
|
+
class Entry < ActiveRecord::Base
|
52
|
+
end
|
53
|
+
|
54
|
+
Entry.delete_all
|
55
|
+
|
56
|
+
test_equal 0, Entry.count
|
57
|
+
|
58
|
+
TITLE = "First post!"
|
59
|
+
CONTENT = "Hello from JRuby on Rails!"
|
60
|
+
NEW_TITLE = "First post updated title"
|
61
|
+
|
62
|
+
post = Entry.new
|
63
|
+
post.title = TITLE
|
64
|
+
post.content = CONTENT
|
65
|
+
post.save
|
66
|
+
|
67
|
+
test_equal 1, Entry.count
|
68
|
+
|
69
|
+
post = Entry.find(:first)
|
70
|
+
test_equal TITLE, post.title
|
71
|
+
test_equal CONTENT, post.content
|
72
|
+
|
73
|
+
post.title = NEW_TITLE
|
74
|
+
post.save
|
75
|
+
|
76
|
+
post = Entry.find(:first)
|
77
|
+
test_equal NEW_TITLE, post.title
|
78
|
+
|
79
|
+
post.destroy
|
80
|
+
|
81
|
+
test_equal 0, Entry.count
|
82
|
+
|
83
|
+
CreateEntries.down
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
require 'test/minirunit'
|
3
|
+
RAILS_CONNECTION_ADAPTERS = ['abstract', 'jdbc']
|
4
|
+
require 'active_record'
|
5
|
+
|
6
|
+
connspec = ActiveRecord::Base.establish_connection(
|
7
|
+
:adapter => 'jdbc',
|
8
|
+
:driver => 'com.mysql.jdbc.Driver',
|
9
|
+
:url => 'jdbc:mysql://localhost:3306/weblog_development',
|
10
|
+
:username => 'blog',
|
11
|
+
:password => ''
|
12
|
+
)
|
13
|
+
|
14
|
+
connection = ActiveRecord::Base.connection
|
15
|
+
|
16
|
+
results = connection.execute "select * from entries"
|
17
|
+
|
18
|
+
test_equal results.length, 1
|
19
|
+
|
20
|
+
row = results.first
|
21
|
+
test_equal 'First post', row['title']
|
22
|
+
test_equal 'First post d00d!', row['content']
|
23
|
+
|
24
|
+
puts row.inspect
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
class AddNotNullColumnToTable < ActiveRecord::Migration
|
5
|
+
def self.up
|
6
|
+
add_column :entries, :color, :string, :null => false, :default => "blue"
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.down
|
10
|
+
remove_column :entries, :color
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
class CreateAutoIds < ActiveRecord::Migration
|
5
|
+
def self.up
|
6
|
+
create_table "auto_ids", :force => true do |t|
|
7
|
+
t.column :value, :integer
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.down
|
12
|
+
drop_table "auto_ids"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class AutoId < ActiveRecord::Base
|
17
|
+
def self.table_name () "auto_ids" end
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
class DbTypeMigration < ActiveRecord::Migration
|
5
|
+
def self.up
|
6
|
+
create_table "db_types", :force => true do |t|
|
7
|
+
t.column :sample_timestamp, :timestamp
|
8
|
+
t.column :sample_datetime, :datetime
|
9
|
+
t.column :sample_date, :date
|
10
|
+
t.column :sample_time, :time
|
11
|
+
t.column :sample_decimal, :decimal, :precision => 15, :scale => 0
|
12
|
+
t.column :sample_small_decimal, :decimal, :precision => 3, :scale => 2
|
13
|
+
t.column :sample_float, :float
|
14
|
+
t.column :sample_binary, :binary
|
15
|
+
t.column :sample_boolean, :boolean
|
16
|
+
t.column :sample_string, :string, :default => ''
|
17
|
+
t.column :sample_integer, :integer, :limit => 5
|
18
|
+
t.column :sample_text, :text
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.down
|
23
|
+
drop_table "db_types"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class DbType < ActiveRecord::Base
|
28
|
+
end
|