activerecord-jdbc-alt-adapter 71.0.0.alpha1-java → 71.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a773766cbb0e3ea279a04ab67b60c578382c604214c0a3dd5e54b7f419f4b96
4
- data.tar.gz: d0f347ef628b4b791d81ad46a34d20f8ea3acb75cee3a473b2dbd8784769e897
3
+ metadata.gz: 973f3cfa750c3424b5de9105f177584edea8ebe705d50b20e4b9f6d989a4919f
4
+ data.tar.gz: e7f86bfeb49f90f2767e3bdcc3e0101a58149e97421e8d7b96da8f59fc469959
5
5
  SHA512:
6
- metadata.gz: 7c08cd49b3245c655a4c51d5c0d327cf7f058a7c2c98cedf7a59f00f60d14e7d79b1d9c2eef614712cee71b684f717fd6edd7c122fd0349d775a7e4fb2a48150
7
- data.tar.gz: b1a059930367508754dc54ff2b8b76434991ac2897ea4ff4917a7ef540d25c28272c4c5cbe13f5b5215eded00940c9beece3f2415860a69b4621a7c62664fa02
6
+ metadata.gz: f276911281e38f162526b603959f5798fa5d09c73284a79078376126b5fade87add2e4a4345242029a4b4e39097b5a6964651483576f51ed8bee3ac7b6e586a3
7
+ data.tar.gz: 8e5d458add630631bfaa82605f20d28c80310e25787c9db2c94c1b8cc677ac8ff6e0730c97b6271a333cbfe919da8a35ad8deb7911aeedc89c3021629e0c5370
@@ -31,9 +31,12 @@ jobs:
31
31
  db: ['mssql']
32
32
  test_targets: ['test_mssql']
33
33
 
34
+ # NOTE: using a specific tag, it fails with 2019-latest.
35
+ # it seems the issue is related to some changes in mssql tools
36
+ # https://learn.microsoft.com/en-au/answers/questions/1853144/error-failed-to-initialize-container-mcr-microsoft
34
37
  services:
35
38
  mssql:
36
- image: mcr.microsoft.com/mssql/server:2019-latest
39
+ image: mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04
37
40
  env:
38
41
  ACCEPT_EULA: Y
39
42
  MSSQL_SA_PASSWORD: Password12!
@@ -112,7 +115,7 @@ jobs:
112
115
 
113
116
  services:
114
117
  postgres:
115
- image: postgres:10
118
+ image: postgres:11
116
119
  env:
117
120
  POSTGRES_PASSWORD: postgres
118
121
  POSTGRES_HOST_AUTH_METHOD: trust
@@ -157,7 +160,7 @@ jobs:
157
160
 
158
161
  services:
159
162
  mssql:
160
- image: mcr.microsoft.com/mssql/server:2019-latest
163
+ image: mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04
161
164
  env:
162
165
  ACCEPT_EULA: Y
163
166
  MSSQL_SA_PASSWORD: Password12!
@@ -243,7 +246,7 @@ jobs:
243
246
 
244
247
  services:
245
248
  postgres:
246
- image: postgres:10
249
+ image: postgres:11
247
250
  env:
248
251
  POSTGRES_PASSWORD: postgres
249
252
  POSTGRES_HOST_AUTH_METHOD: trust
@@ -27,7 +27,7 @@ jobs:
27
27
  ruby-version: ['jruby-head']
28
28
  db: ['mysql2']
29
29
  test_targets: ["rails:test_mysql2"]
30
- ar_version: ["7-1-stable"]
30
+ ar_version: ["7-2-stable"]
31
31
  prepared_statements: ['false', 'true']
32
32
  driver: ['MySQL']
33
33
 
@@ -42,7 +42,7 @@ jobs:
42
42
  AR_VERSION: ${{ matrix.ar_version }}
43
43
  PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
44
44
  DRIVER: ${{ matrix.driver }}
45
- JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
45
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
46
46
 
47
47
  steps:
48
48
  - uses: actions/checkout@v4
@@ -79,12 +79,12 @@ jobs:
79
79
  ruby-version: [ 'jruby-head' ]
80
80
  db: [ 'postgresql' ]
81
81
  test_targets: [ "rails:test_postgresql" ]
82
- ar_version: ["7-1-stable"]
82
+ ar_version: ["7-2-stable"]
83
83
  prepared_statements: [ 'false', 'true' ]
84
84
 
85
85
  services:
86
86
  postgres:
87
- image: postgres:10
87
+ image: postgres:11
88
88
  env:
89
89
  POSTGRES_PASSWORD: postgres
90
90
  POSTGRES_HOST_AUTH_METHOD: trust
@@ -95,7 +95,7 @@ jobs:
95
95
  env:
96
96
  DB: ${{ matrix.db }}
97
97
  AR_VERSION: ${{ matrix.ar_version }}
98
- JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
98
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
99
99
  PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
100
100
  PGHOST: localhost
101
101
  PGPORT: 5432
@@ -129,12 +129,12 @@ jobs:
129
129
  ruby-version: ['jruby-head']
130
130
  db: ['sqlite3']
131
131
  test_targets: ["rails:test_sqlite3"]
132
- ar_version: ["7-1-stable", "main"]
132
+ ar_version: ["7-2-stable"]
133
133
 
134
134
  env:
135
135
  DB: ${{ matrix.db }}
136
136
  AR_VERSION: ${{ matrix.ar_version }}
137
- JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
137
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
138
138
 
139
139
  steps:
140
140
  - uses: actions/checkout@v4
@@ -149,7 +149,7 @@ jobs:
149
149
  rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar
150
150
  - name: Run tests
151
151
  run: |
152
- bundle exec rake ${{ matrix.test_targets }}
152
+ bundle exec rake ${{ matrix.test_targets }} --trace
153
153
 
154
154
  test-arjdbc-mysql:
155
155
 
@@ -173,7 +173,7 @@ jobs:
173
173
  env:
174
174
  DB: ${{ matrix.db }}
175
175
  DRIVER: ${{ matrix.driver }}
176
- JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
176
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
177
177
  MY_USER: root
178
178
  MY_PASSWORD: root
179
179
  PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
@@ -211,7 +211,7 @@ jobs:
211
211
 
212
212
  services:
213
213
  postgres:
214
- image: postgres:10
214
+ image: postgres:11
215
215
  env:
216
216
  POSTGRES_PASSWORD: postgres
217
217
  POSTGRES_HOST_AUTH_METHOD: trust
@@ -222,7 +222,7 @@ jobs:
222
222
  env:
223
223
  DB: ${{ matrix.db }}
224
224
  DRIVER: ${{ matrix.driver }}
225
- JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
225
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
226
226
  PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
227
227
  INSERT_RETURNING: ${{ matrix.insert_returning }}
228
228
  PGHOST: localhost
data/.gitignore CHANGED
@@ -19,6 +19,8 @@ nbproject
19
19
  .project
20
20
  *.sqlite
21
21
  *.sqlite3
22
+ *.sqlite3-shm
23
+ *.sqlite3-wal
22
24
  *.derby
23
25
  derby.log
24
26
  test.hsqldb*
@@ -33,8 +35,9 @@ Gemfile.lock
33
35
  .settings
34
36
  activerecord-jdbc.iml
35
37
  lib/arjdbc/jdbc/adapter_java.jar
36
- .jrubyrc
37
38
  tags
38
- pik.sh
39
- .ruby-version
39
+ .jrubyrc
40
40
  .rubocop.yml
41
+ .solargraph.yml
42
+ pik.sh
43
+ .tool-versions
data/Gemfile CHANGED
@@ -62,13 +62,13 @@ group :test do
62
62
  gem 'mocha', '~> 1.2', require: false # Rails has '~> 0.14'
63
63
 
64
64
  gem 'bcrypt', '~> 3.1.11', require: false
65
- gem 'jdbc-mssql', '~> 12.2', require: nil
65
+ gem 'jdbc-mssql', '~> 12.6', require: nil
66
66
  # gem 'pry-debugger-jruby', platform: :jruby
67
67
  end
68
68
 
69
69
  group :rails do
70
70
  group :test do
71
- gem 'minitest', require: nil
71
+ gem 'minitest', '~> 5.24.0', require: nil
72
72
  gem 'minitest-excludes', require: nil
73
73
  gem 'minitest-rg', require: nil
74
74
 
data/README.md CHANGED
@@ -145,9 +145,10 @@ Versions are targeted at certain versions of Rails and live on their own branche
145
145
  | 60.x | 6.0.x | 60-stable | 9.2.7 | 8 |
146
146
  | 61.x | 6.1.x | 61-stable | 9.2.7 | 8 |
147
147
  | 70.x | 7.0.x | 70-stable | 9.3.0 | 8 |
148
- | 71.x | 7.1.x | master | 9.4.3 | 8 |
148
+ | 71.x | 7.1.x | 71-stable | 9.4.3 | 8 |
149
+ | 72.x | 7.2.x | master | 9.4.3 | 8 |
149
150
 
150
- Note: 71.x is still under development and not supported yet.
151
+ Note: 72.x is still under development and not supported yet.
151
152
 
152
153
  Note that JRuby 9.1.x and JRuby 9.2.x are at end-of-life. We recommend Java 8
153
154
  at a minimum for all versions.
@@ -41,7 +41,7 @@ Gem::Specification.new do |gem|
41
41
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
42
42
  gem.test_files = gem.files.grep(%r{^test/})
43
43
 
44
- gem.add_dependency 'activerecord', '~> 7.1.0'
44
+ gem.add_dependency 'activerecord', '~> 7.1.3'
45
45
 
46
46
  #gem.add_development_dependency 'test-unit', '2.5.4'
47
47
  #gem.add_development_dependency 'test-unit-context', '>= 0.3.0'
@@ -241,8 +241,21 @@ module Arel
241
241
 
242
242
  # column_name = schema_cache.primary_keys(t.name) || column_cache(t.name).first.try(:second).try(:name)
243
243
  # NOTE: for table name aliases columns_hash('table_alias') requires to return an empty hash.
244
- column_name = @connection.schema_cache.primary_keys(t.name) ||
245
- @connection.schema_cache.columns_hash(t.name).first.try(:second).try(:name)
244
+ primary_keys = @connection.schema_cache.primary_keys(t.name)
245
+ column_name = nil
246
+
247
+ case primary_keys
248
+ when NilClass
249
+ column_name = @connection.schema_cache.columns_hash(t.name).first.try(:second).try(:name)
250
+ when String
251
+ column_name = primary_keys
252
+ when Array
253
+ candidate_columns = @connection.schema_cache.columns_hash(t.name).slice(*primary_keys).values
254
+ candidate_column = candidate_columns.find(&:identity?)
255
+ candidate_column ||= candidate_columns.first
256
+ column_name = candidate_column.try(:name)
257
+ end
258
+
246
259
  column_name ? t[column_name] : nil
247
260
  end
248
261
 
@@ -36,20 +36,22 @@ module ArJdbc
36
36
  # end
37
37
  # end
38
38
 
39
+ private
40
+
39
41
  # DIFFERENCE: we delve into jdbc shared code and this does self.class.new_client.
40
42
  def connect
41
- @raw_connection = jdbc_connection_class(@config[:adapter_spec]).new(@config, self)
42
- @raw_connection.configure_connection
43
+ @raw_connection = self.class.new_client(@connection_parameters, self)
44
+ rescue ActiveRecord::ConnectionNotEstablished => ex
45
+ raise ex.set_pool(@pool)
43
46
  end
44
47
 
45
48
  def reconnect
46
- if active?
47
- @raw_connection.rollback rescue nil
48
- else
49
- connect
50
- end
51
- end
49
+ @raw_connection&.close
52
50
 
51
+ @raw_connection = nil
52
+
53
+ connect
54
+ end
53
55
  end
54
56
  end
55
57
  end
@@ -2,23 +2,17 @@
2
2
 
3
3
  module ArJdbc
4
4
  module Abstract
5
-
6
5
  # This is minimum amount of code needed from base JDBC Adapter class to make common adapters
7
6
  # work. This replaces using jdbc/adapter as a base class for all adapters.
8
7
  module Core
9
-
10
- attr_reader :config
11
-
12
- def initialize(config)
13
- @config = config
8
+ def initialize(...)
9
+ super
14
10
 
15
11
  if self.class.equal? ActiveRecord::ConnectionAdapters::JdbcAdapter
16
12
  spec = @config.key?(:adapter_spec) ? @config[:adapter_spec] :
17
13
  ( @config[:adapter_spec] = adapter_spec(@config) ) # due resolving visitor
18
14
  extend spec if spec
19
15
  end
20
-
21
- super(config) # AbstractAdapter
22
16
  end
23
17
 
24
18
  # Retrieve the raw `java.sql.Connection` object.
@@ -33,7 +33,7 @@ module ArJdbc
33
33
 
34
34
  # It appears that at this point (AR 5.0) "prepare" should only ever be true
35
35
  # if prepared statements are enabled
36
- def internal_exec_query(sql, name = nil, binds = NO_BINDS, prepare: false, async: false)
36
+ def internal_exec_query(sql, name = nil, binds = NO_BINDS, prepare: false, async: false, allow_retry: false, materialize_transactions: true)
37
37
  sql = transform_query(sql)
38
38
 
39
39
  if preventing_writes? && write_query?(sql)
@@ -78,18 +78,6 @@ module ArJdbc
78
78
  end
79
79
  alias :exec_delete :exec_update
80
80
 
81
- def execute(sql, name = nil, async: false, allow_retry: false, materialize_transactions: true)
82
- sql = transform_query(sql)
83
-
84
- if preventing_writes? && write_query?(sql)
85
- raise ActiveRecord::ReadOnlyError, "Write query attempted while in readonly mode: #{sql}"
86
- end
87
-
88
- mark_transaction_written_if_write(sql)
89
-
90
- raw_execute(sql, name, async: async, allow_retry: allow_retry, materialize_transactions: materialize_transactions)
91
- end
92
-
93
81
  # overridden to support legacy binds
94
82
  def select_all(arel, name = nil, binds = NO_BINDS, preparable: nil, async: false)
95
83
  binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
@@ -104,10 +92,12 @@ module ArJdbc
104
92
  end
105
93
  end
106
94
 
107
- def raw_execute(sql, name, async: false, allow_retry: false, materialize_transactions: false)
95
+ def raw_execute(sql, name, async: false, allow_retry: false, materialize_transactions: true)
108
96
  log(sql, name, async: async) do
109
97
  with_raw_connection(allow_retry: allow_retry, materialize_transactions: materialize_transactions) do |conn|
110
- conn.execute(sql)
98
+ result = conn.execute(sql)
99
+ verified!
100
+ result
111
101
  end
112
102
  end
113
103
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_model/attribute"
4
+
5
+ module ActiveRecord
6
+ # NOTE: improved implementation for hash methods that is used to
7
+ # compare objects. AR and arel commonly use `[a, b] - [b]` operations and
8
+ # JRuby internally uses the hash method to implement that operation,
9
+ # on the other hand, CRuby does not use the hash method
10
+ # for small arrays (length <= 16).
11
+ class Relation
12
+ # monkey patch
13
+ module RelationQueryAttributeMonkeyPatch
14
+ def hash
15
+ # [self.class, name, value_for_database, type].hash
16
+ [self.class, name, value_before_type_cast, type].hash
17
+ end
18
+ end
19
+
20
+ class QueryAttribute
21
+ prepend RelationQueryAttributeMonkeyPatch
22
+ end
23
+ end
24
+ end
@@ -24,7 +24,7 @@ module ArJdbc
24
24
 
25
25
  # Only say we support the statement cache if we are using prepared statements
26
26
  # and have a max number of statements defined
27
- statement_limit = self.class.type_cast_config_to_integer(config[:statement_limit])
27
+ statement_limit = self.class.type_cast_config_to_integer(@config[:statement_limit])
28
28
  @jdbc_statement_cache_enabled = prepared_statements && (statement_limit.nil? || statement_limit > 0)
29
29
 
30
30
  @statements = StatementPool.new(statement_limit) # AR (5.0) expects this to be stored as @statements
@@ -107,16 +107,3 @@ module ArJdbc
107
107
  end
108
108
  end
109
109
  end
110
-
111
- # patch to avoid the usage of WeakMap
112
- require 'active_record/connection_adapters/abstract/transaction'
113
- module ActiveRecord
114
- module ConnectionAdapters
115
- class Transaction
116
- def add_record(record, ensure_finalize = true)
117
- @records ||= []
118
- @records << record
119
- end
120
- end
121
- end
122
- end
Binary file
@@ -30,6 +30,8 @@ require 'arjdbc/mssql/errors'
30
30
  require 'arjdbc/mssql/schema_creation'
31
31
  require 'arjdbc/mssql/database_limits'
32
32
 
33
+ require "arjdbc/abstract/relation_query_attribute_monkey_patch"
34
+
33
35
  module ActiveRecord
34
36
  module ConnectionAdapters
35
37
  # MSSQL (SQLServer) adapter class definition
@@ -88,15 +90,20 @@ module ActiveRecord
88
90
 
89
91
  # @override
90
92
  def active?
91
- return false unless @raw_connection
93
+ @lock.synchronize do
94
+ return false unless @raw_connection
92
95
 
93
- @raw_connection.active?
96
+ @raw_connection.active?
97
+ end
94
98
  end
95
99
 
96
100
  # @override
97
101
  def disconnect!
98
- super # clear_cache! && reset_transaction
99
- @raw_connection&.disconnect!
102
+ @lock.synchronize do
103
+ super # clear_cache! && reset_transaction
104
+ @raw_connection&.disconnect!
105
+ @raw_connection = nil
106
+ end
100
107
  end
101
108
 
102
109
  # Returns the (JDBC) `ActiveRecord` column class for this adapter.
@@ -490,6 +497,10 @@ module ActiveRecord
490
497
  RangeError.new(message, sql: sql, binds: binds)
491
498
  when /Snapshot isolation transaction aborted due to update conflict. You cannot use snapshot isolation/
492
499
  StatementInvalid.new(message, sql: sql, binds: binds)
500
+ when /Incorrect syntax near the keyword .*/
501
+ StatementInvalid.new(message, sql: sql, binds: binds)
502
+ when /Could not find stored procedure .*/
503
+ StatementInvalid.new(message, sql: sql, binds: binds)
493
504
  else
494
505
  super
495
506
  end
@@ -174,9 +174,12 @@ module ActiveRecord
174
174
  end
175
175
  end
176
176
 
177
- def rename_table(table_name, new_table_name)
178
- execute "EXEC sp_rename '#{table_name}', '#{new_table_name}'"
179
- rename_table_indexes(table_name, new_table_name)
177
+ def rename_table(table_name, new_name, **options)
178
+ validate_table_length!(new_name) unless options[:_uses_legacy_table_name]
179
+ schema_cache.clear_data_source_cache!(table_name.to_s)
180
+ schema_cache.clear_data_source_cache!(new_name.to_s)
181
+ execute "EXEC sp_rename '#{table_name}', '#{new_name}'"
182
+ rename_table_indexes(table_name, new_name)
180
183
  end
181
184
 
182
185
  # This is the same as the abstract method
data/lib/arjdbc/mssql.rb CHANGED
@@ -6,4 +6,4 @@ module ArJdbc
6
6
  MsSQL = MSSQL # compatibility with 1.2
7
7
  end
8
8
 
9
- ArJdbc.warn_unsupported_adapter 'mssql', [7, 0] # warns on AR >= 4.2
9
+ ArJdbc.warn_unsupported_adapter 'mssql', [7, 1] # warns on AR >= 4.2
@@ -11,6 +11,8 @@ require 'arjdbc/abstract/database_statements'
11
11
  require 'arjdbc/abstract/statement_cache'
12
12
  require 'arjdbc/abstract/transaction_support'
13
13
 
14
+ require "arjdbc/abstract/relation_query_attribute_monkey_patch"
15
+
14
16
  module ActiveRecord
15
17
  module ConnectionAdapters
16
18
  AbstractMysqlAdapter.class_eval do
@@ -23,7 +25,7 @@ module ActiveRecord
23
25
  class Mysql2Adapter < AbstractMysqlAdapter
24
26
  ADAPTER_NAME = 'Mysql2'
25
27
 
26
- include Jdbc::ConnectionPoolCallbacks
28
+ # include Jdbc::ConnectionPoolCallbacks
27
29
 
28
30
  include ArJdbc::Abstract::ConnectionManagement
29
31
  include ArJdbc::Abstract::DatabaseStatements
@@ -33,6 +35,34 @@ module ActiveRecord
33
35
 
34
36
  include ArJdbc::MySQL
35
37
 
38
+ class << self
39
+ def jdbc_connection_class
40
+ ::ActiveRecord::ConnectionAdapters::MySQLJdbcConnection
41
+ end
42
+
43
+ def new_client(conn_params, adapter_instance)
44
+ jdbc_connection_class.new(conn_params, adapter_instance)
45
+ end
46
+
47
+ private
48
+ def initialize_type_map(m)
49
+ super
50
+
51
+ m.register_type(%r(char)i) do |sql_type|
52
+ limit = extract_limit(sql_type)
53
+ Type.lookup(:string, adapter: :mysql2, limit: limit)
54
+ end
55
+
56
+ m.register_type %r(^enum)i, Type.lookup(:string, adapter: :mysql2)
57
+ m.register_type %r(^set)i, Type.lookup(:string, adapter: :mysql2)
58
+ end
59
+ end
60
+
61
+ # NOTE: redefines constant defined in abstract class however this time
62
+ # will use methods defined in the mysql abstract class and map properly
63
+ # mysql types.
64
+ TYPE_MAP = Type::TypeMap.new.tap { |m| initialize_type_map(m) }
65
+
36
66
  def initialize(...)
37
67
  super
38
68
 
@@ -171,7 +201,7 @@ module ActiveRecord
171
201
  #++
172
202
 
173
203
  def active?
174
- !(@raw_connection.nil? || @raw_connection.closed?) && @lock.synchronize { @raw_connection&.execute_query("/* ping */ SELECT 1") } || false
204
+ !(@raw_connection.nil? || @raw_connection.closed?) && @lock.synchronize { @raw_connection&.ping } || false
175
205
  end
176
206
 
177
207
  alias :reset! :reconnect!
@@ -221,14 +251,21 @@ module ActiveRecord
221
251
  @full_version ||= any_raw_connection.full_version
222
252
  end
223
253
 
224
- def jdbc_connection_class(spec)
225
- ::ActiveRecord::ConnectionAdapters::MySQLJdbcConnection
226
- end
227
-
228
254
  def jdbc_column_class
229
255
  ::ActiveRecord::ConnectionAdapters::MySQL::Column
230
256
  end
231
257
 
258
+ def translate_exception(exception, message:, sql:, binds:)
259
+ case message
260
+ when /Table .* doesn't exist/i
261
+ StatementInvalid.new(message, sql: sql, binds: binds, connection_pool: @pool)
262
+ when /BLOB, TEXT, GEOMETRY or JSON column .* can't have a default value/i
263
+ StatementInvalid.new(message, sql: sql, binds: binds, connection_pool: @pool)
264
+ else
265
+ super
266
+ end
267
+ end
268
+
232
269
  # defined in MySQL::DatabaseStatements which is not included
233
270
  def default_insert_value(column)
234
271
  super unless column.auto_increment?