activerecord-rdb-adapter 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93f60ce721782365089749c21271eee0ea9fee532ca54952b0cebc6f07e8e980
|
4
|
+
data.tar.gz: 3e49ca60c171d759964f2ad4cc11efc7fb709b543d05a2db3d80310eb95c1920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5036b2be9ea51e5de77c1212f460a6fbeac1ba9741b89845ce9f0ad54da579f1552dfb5a32c759a41b11a3b80abf58d94fcd6ec190562fc1131bb30b59b8e83c
|
7
|
+
data.tar.gz: c2c8340eaca31424bb34513910b62e07e06ab17be578f2e9035eb2ae7728f58a0b9b5866cc4f683b8f354fea34c02878bb937143ecfcf0739fcad13a44580806
|
@@ -74,7 +74,8 @@ module ActiveRecord
|
|
74
74
|
private
|
75
75
|
|
76
76
|
def id_value_for_database(value)
|
77
|
-
|
77
|
+
primary_key = value.class.primary_key
|
78
|
+
if primary_key
|
78
79
|
value.instance_variable_get(:@attributes)[primary_key].value_for_database
|
79
80
|
end
|
80
81
|
end
|
@@ -15,7 +15,7 @@ module ActiveRecord
|
|
15
15
|
def add_column_options!(sql, options)
|
16
16
|
sql << " DEFAULT #{quote_default_expression(options[:default], options[:column])}" if options_include_default?(options)
|
17
17
|
# must explicitly check for :null to allow change_column to work on migrations
|
18
|
-
|
18
|
+
unless options[:null]
|
19
19
|
sql << " NOT NULL"
|
20
20
|
end
|
21
21
|
if options[:auto_increment]
|
@@ -80,12 +80,14 @@ module ActiveRecord
|
|
80
80
|
|
81
81
|
def drop_table(name, options = {}) # :nodoc:
|
82
82
|
drop_sql = "DROP TABLE #{quote_table_name(name)}"
|
83
|
-
if options[:if_exists]
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
83
|
+
drop = if options[:if_exists]
|
84
|
+
!execute(squish_sql(<<-END_SQL))
|
85
|
+
select 1 from rdb$relations where rdb$relation_name = #{quote_table_name(name).tr('"', '\'')}
|
86
|
+
END_SQL
|
87
|
+
.empty?
|
88
|
+
else
|
89
|
+
false
|
90
|
+
end
|
89
91
|
|
90
92
|
trigger_name = "N$#{name.upcase}"
|
91
93
|
drop_trigger(trigger_name) if trigger_exists?(trigger_name)
|
@@ -269,7 +271,8 @@ module ActiveRecord
|
|
269
271
|
string_to_sql(limit)
|
270
272
|
else
|
271
273
|
type = type.to_sym if type
|
272
|
-
|
274
|
+
native = native_database_types[type]
|
275
|
+
if native
|
273
276
|
column_type_sql = (native.is_a?(Hash) ? native[:name] : native).dup
|
274
277
|
|
275
278
|
if type == :decimal # ignore limit, use precision and scale
|