# File lib/sequel/adapters/shared/mysql.rb 528 def primary_key_from_schema(table) 529 schema(table).select{|a| a[1][:primary_key]}.map{|a| a[0]} 530 end
module Sequel::MySQL::DatabaseMethods
Constants
- CAST_TYPES
- COLUMN_DEFINITION_ORDER
- DATABASE_ERROR_REGEXPS
Attributes
Set the default charset used for CREATE TABLE. You can pass the :charset option to create_table to override this setting.
Set the default collation used for CREATE TABLE. You can pass the :collate option to create_table to override this setting.
Set the default engine used for CREATE TABLE. You can pass the :engine option to create_table to override this setting.
Public Instance Methods
MySQL’s cast rules are restrictive in that you can’t just cast to any possible database type.
# File lib/sequel/adapters/shared/mysql.rb 38 def cast_type_literal(type) 39 CAST_TYPES[type] || super 40 end
# File lib/sequel/adapters/shared/mysql.rb 42 def commit_prepared_transaction(transaction_id, opts=OPTS) 43 run("XA COMMIT #{literal(transaction_id)}", opts) 44 end
# File lib/sequel/adapters/shared/mysql.rb 46 def database_type 47 :mysql 48 end
Use the Information Schema’s KEY_COLUMN_USAGE table to get basic information on foreign key columns, but include the constraint name.
# File lib/sequel/adapters/shared/mysql.rb 53 def foreign_key_list(table, opts=OPTS) 54 m = output_identifier_meth 55 im = input_identifier_meth 56 ds = metadata_dataset. 57 from(Sequel[:INFORMATION_SCHEMA][:KEY_COLUMN_USAGE]). 58 where(:TABLE_NAME=>im.call(table), :TABLE_SCHEMA=>Sequel.function(:DATABASE)). 59 exclude(:CONSTRAINT_NAME=>'PRIMARY'). 60 exclude(:REFERENCED_TABLE_NAME=>nil). 61 order(:CONSTRAINT_NAME, :POSITION_IN_UNIQUE_CONSTRAINT). 62 select(Sequel[:CONSTRAINT_NAME].as(:name), Sequel[:COLUMN_NAME].as(:column), Sequel[:REFERENCED_TABLE_NAME].as(:table), Sequel[:REFERENCED_COLUMN_NAME].as(:key)) 63 64 h = {} 65 ds.each do |row| 66 if r = h[row[:name]] 67 r[:columns] << m.call(row[:column]) 68 r[:key] << m.call(row[:key]) 69 else 70 h[row[:name]] = {:name=>m.call(row[:name]), :columns=>[m.call(row[:column])], :table=>m.call(row[:table]), :key=>[m.call(row[:key])]} 71 end 72 end 73 h.values 74 end
# File lib/sequel/adapters/shared/mysql.rb 76 def freeze 77 server_version 78 mariadb? 79 supports_timestamp_usecs? 80 super 81 end
MySQL
namespaces indexes per table.
# File lib/sequel/adapters/shared/mysql.rb 84 def global_index_namespace? 85 false 86 end
Use SHOW INDEX FROM to get the index information for the table.
By default partial indexes are not included, you can use the option :partial to override this.
# File lib/sequel/adapters/shared/mysql.rb 93 def indexes(table, opts=OPTS) 94 indexes = {} 95 remove_indexes = [] 96 m = output_identifier_meth 97 schema, table = schema_and_table(table) 98 99 table = Sequel::SQL::Identifier.new(table) 100 sql = "SHOW INDEX FROM #{literal(table)}" 101 if schema 102 schema = Sequel::SQL::Identifier.new(schema) 103 sql += " FROM #{literal(schema)}" 104 end 105 106 metadata_dataset.with_sql(sql).each do |r| 107 name = r[:Key_name] 108 next if name == 'PRIMARY' 109 name = m.call(name) 110 remove_indexes << name if r[:Sub_part] && ! opts[:partial] 111 i = indexes[name] ||= {:columns=>[], :unique=>r[:Non_unique] != 1} 112 i[:columns] << m.call(r[:Column_name]) 113 end 114 indexes.reject{|k,v| remove_indexes.include?(k)} 115 end
Whether the database is MariaDB and not MySQL
# File lib/sequel/adapters/shared/mysql.rb 122 def mariadb? 123 return @is_mariadb if defined?(@is_mariadb) 124 @is_mariadb = !(fetch('SELECT version()').single_value! !~ /mariadb/i) 125 end
Renames multiple tables in a single call.
DB.rename_tables [:items, :old_items], [:other_items, :old_other_items] # RENAME TABLE items TO old_items, other_items TO old_other_items
# File lib/sequel/adapters/shared/mysql.rb 195 def rename_tables(*renames) 196 execute_ddl(rename_tables_sql(renames)) 197 renames.each{|from,| remove_cached_schema(from)} 198 end
# File lib/sequel/adapters/shared/mysql.rb 117 def rollback_prepared_transaction(transaction_id, opts=OPTS) 118 run("XA ROLLBACK #{literal(transaction_id)}", opts) 119 end
Get version of MySQL
server, used for determined capabilities.
# File lib/sequel/adapters/shared/mysql.rb 128 def server_version 129 @server_version ||= begin 130 m = /(\d+)\.(\d+)\.(\d+)/.match(fetch('SELECT version()').single_value!) 131 (m[1].to_i * 10000) + (m[2].to_i * 100) + m[3].to_i 132 end 133 end
MySQL
supports CREATE TABLE IF NOT EXISTS syntax.
# File lib/sequel/adapters/shared/mysql.rb 136 def supports_create_table_if_not_exists? 137 true 138 end
MySQL
5+ supports prepared transactions (two-phase commit) using XA
# File lib/sequel/adapters/shared/mysql.rb 146 def supports_prepared_transactions? 147 server_version >= 50000 148 end
MySQL
5+ supports savepoints
# File lib/sequel/adapters/shared/mysql.rb 151 def supports_savepoints? 152 server_version >= 50000 153 end
MySQL
doesn’t support savepoints inside prepared transactions in from 5.5.12 to 5.5.23, see bugs.mysql.com/bug.php?id=64374
# File lib/sequel/adapters/shared/mysql.rb 157 def supports_savepoints_in_prepared_transactions? 158 super && (server_version <= 50512 || server_version >= 50523) 159 end
Support fractional timestamps on MySQL
5.6.5+ if the :fractional_seconds Database
option is used. Technically, MySQL
5.6.4+ supports them, but automatic initialization of datetime values wasn’t supported to 5.6.5+, and this is related to that.
# File lib/sequel/adapters/shared/mysql.rb 165 def supports_timestamp_usecs? 166 return @supports_timestamp_usecs if defined?(@supports_timestamp_usecs) 167 @supports_timestamp_usecs = server_version >= 50605 && typecast_value_boolean(opts[:fractional_seconds]) 168 end
MySQL
supports transaction isolation levels
# File lib/sequel/adapters/shared/mysql.rb 171 def supports_transaction_isolation_levels? 172 true 173 end
Return an array of symbols specifying table names in the current database.
Options:
- :server
-
Set the server to use
# File lib/sequel/adapters/shared/mysql.rb 179 def tables(opts=OPTS) 180 full_tables('BASE TABLE', opts) 181 end
Return an array of symbols specifying view names in the current database.
Options:
- :server
-
Set the server to use
# File lib/sequel/adapters/shared/mysql.rb 187 def views(opts=OPTS) 188 full_tables('VIEW', opts) 189 end
Attempt to acquire an exclusive advisory lock with the given lock_id (which will be converted to a string). If successful, yield to the block, then release the advisory lock when the block exits. If unsuccessful, raise a Sequel::AdvisoryLockError.
DB.with_advisory_lock(1357){DB.get(1)} # SELECT GET_LOCK('1357', 0) LIMIT 1 # SELECT 1 AS v LIMIT 1 # SELECT RELEASE_LOCK('1357') LIMIT 1
Options:
- :wait
-
Do not raise an error, instead, wait until the advisory lock can be acquired.
# File lib/sequel/adapters/shared/mysql.rb 211 def with_advisory_lock(lock_id, opts=OPTS) 212 lock_id = lock_id.to_s 213 ds = dataset 214 if server = opts[:server] 215 ds = ds.server(server) 216 end 217 218 # MariaDB doesn't support negative values for infinite wait. A wait of 34 years 219 # should be reasonably similar to infinity for this case. 220 timeout = opts[:wait] ? 1073741823 : 0 221 222 synchronize(server) do |c| 223 begin 224 unless locked = ds.get{GET_LOCK(lock_id, timeout)} == 1 225 raise AdvisoryLockError, "unable to acquire advisory lock #{lock_id.inspect}" 226 end 227 228 yield 229 ensure 230 ds.get{RELEASE_LOCK(lock_id)} if locked 231 end 232 end 233 end
Private Instance Methods
# File lib/sequel/adapters/shared/mysql.rb 237 def alter_table_add_column_sql(table, op) 238 pos = if after_col = op[:after] 239 " AFTER #{quote_identifier(after_col)}" 240 elsif op[:first] 241 " FIRST" 242 end 243 244 sql = if related = op.delete(:table) 245 sql = super + "#{pos}, ADD " 246 op[:table] = related 247 op[:key] ||= primary_key_from_schema(related) 248 if constraint_name = op.delete(:foreign_key_constraint_name) 249 sql << "CONSTRAINT #{quote_identifier(constraint_name)} " 250 end 251 sql << "FOREIGN KEY (#{quote_identifier(op[:name])})#{column_references_sql(op)}" 252 else 253 "#{super}#{pos}" 254 end 255 end
# File lib/sequel/adapters/shared/mysql.rb 292 def alter_table_add_constraint_sql(table, op) 293 if op[:type] == :foreign_key 294 op[:key] ||= primary_key_from_schema(op[:table]) 295 end 296 super 297 end
# File lib/sequel/adapters/shared/mysql.rb 257 def alter_table_change_column_sql(table, op) 258 o = op[:op] 259 opts = schema(table).find{|x| x.first == op[:name]} 260 opts = opts ? opts.last.dup : {} 261 opts[:name] = o == :rename_column ? op[:new_name] : op[:name] 262 opts[:type] = o == :set_column_type ? op[:type] : opts[:db_type] 263 opts[:null] = o == :set_column_null ? op[:null] : opts[:allow_null] 264 opts[:default] = o == :set_column_default ? op[:default] : opts[:ruby_default] 265 opts.delete(:default) if opts[:default] == nil 266 opts.delete(:primary_key) 267 unless op[:type] || opts[:type] 268 raise Error, "cannot determine database type to use for CHANGE COLUMN operation" 269 end 270 opts = op.merge(opts) 271 if op.has_key?(:auto_increment) 272 opts[:auto_increment] = op[:auto_increment] 273 end 274 "CHANGE COLUMN #{quote_identifier(op[:name])} #{column_definition_sql(opts)}" 275 end
# File lib/sequel/adapters/shared/mysql.rb 299 def alter_table_drop_constraint_sql(table, op) 300 case op[:type] 301 when :primary_key 302 "DROP PRIMARY KEY" 303 when :foreign_key 304 name = op[:name] || foreign_key_name(table, op[:columns]) 305 "DROP FOREIGN KEY #{quote_identifier(name)}" 306 when :unique 307 "DROP INDEX #{quote_identifier(op[:name])}" 308 when :check, nil 309 if supports_check_constraints? 310 "DROP CONSTRAINT #{quote_identifier(op[:name])}" 311 end 312 end 313 end
# File lib/sequel/adapters/shared/mysql.rb 280 def alter_table_set_column_default_sql(table, op) 281 return super unless op[:default].nil? 282 283 opts = schema(table).find{|x| x[0] == op[:name]} 284 285 if opts && opts[1][:allow_null] == false 286 "ALTER COLUMN #{quote_identifier(op[:name])} DROP DEFAULT" 287 else 288 super 289 end 290 end
# File lib/sequel/adapters/shared/mysql.rb 315 def alter_table_sql(table, op) 316 case op[:op] 317 when :drop_index 318 "#{drop_index_sql(table, op)} ON #{quote_schema_table(table)}" 319 when :drop_constraint 320 if op[:type] == :primary_key 321 if (pk = primary_key_from_schema(table)).length == 1 322 return [alter_table_sql(table, {:op=>:rename_column, :name=>pk.first, :new_name=>pk.first, :auto_increment=>false}), super] 323 end 324 end 325 super 326 else 327 super 328 end 329 end
# File lib/sequel/adapters/shared/mysql.rb 380 def auto_increment_sql 381 'AUTO_INCREMENT' 382 end
MySQL
needs to set transaction isolation before begining a transaction
# File lib/sequel/adapters/shared/mysql.rb 385 def begin_new_transaction(conn, opts) 386 set_transaction_isolation(conn, opts) 387 log_connection_execute(conn, begin_transaction_sql) 388 end
Use XA START to start a new prepared transaction if the :prepare option is given.
# File lib/sequel/adapters/shared/mysql.rb 392 def begin_transaction(conn, opts=OPTS) 393 if (s = opts[:prepare]) && savepoint_level(conn) == 1 394 log_connection_execute(conn, "XA START #{literal(s)}") 395 else 396 super 397 end 398 end
Support :on_update_current_timestamp option.
# File lib/sequel/adapters/shared/mysql.rb 401 def column_definition_default_sql(sql, column) 402 super 403 sql << " ON UPDATE CURRENT_TIMESTAMP" if column[:on_update_current_timestamp] 404 end
Add generation clause SQL
fragment to column creation SQL
.
# File lib/sequel/adapters/shared/mysql.rb 407 def column_definition_generated_sql(sql, column) 408 if (generated_expression = column[:generated_always_as]) 409 sql << " GENERATED ALWAYS AS (#{literal(generated_expression)})" 410 case (type = column[:generated_type]) 411 when nil 412 # none, database default 413 when :virtual 414 sql << " VIRTUAL" 415 when :stored 416 sql << (mariadb? ? " PERSISTENT" : " STORED") 417 else 418 raise Error, "unsupported :generated_type option: #{type.inspect}" 419 end 420 end 421 end
# File lib/sequel/adapters/shared/mysql.rb 423 def column_definition_order 424 COLUMN_DEFINITION_ORDER 425 end
MySQL
doesn’t allow default values on text columns, so ignore if it the generic text type is used
# File lib/sequel/adapters/shared/mysql.rb 429 def column_definition_sql(column) 430 column.delete(:default) if column[:type] == File || (column[:type] == String && column[:text] == true) 431 super 432 end
Return nil if CHECK constraints are not supported, because versions that don’t support check constraints don’t raise errors for values outside of range.
# File lib/sequel/adapters/shared/mysql.rb 598 def column_schema_decimal_min_max_values(column) 599 super if supports_check_constraints? 600 end
Return nil if CHECK constraints are not supported, because versions that don’t support check constraints don’t raise errors for values outside of range.
# File lib/sequel/adapters/shared/mysql.rb 591 def column_schema_integer_min_max_values(column) 592 super if supports_check_constraints? 593 end
Handle MySQL
specific default format.
# File lib/sequel/adapters/shared/mysql.rb 332 def column_schema_normalize_default(default, type) 333 if column_schema_default_string_type?(type) 334 return if [:date, :datetime, :time].include?(type) && /\ACURRENT_(?:DATE|TIMESTAMP)?\z/.match(default) 335 default = "'#{default.gsub("'", "''").gsub('\\', '\\\\')}'" 336 end 337 super(default, type) 338 end
# File lib/sequel/adapters/shared/mysql.rb 340 def column_schema_to_ruby_default(default, type) 341 return Sequel::CURRENT_DATE if mariadb? && server_version >= 100200 && default == 'curdate()' 342 super 343 end
Don’t allow combining adding foreign key operations with other operations, since in some cases adding a foreign key constraint in the same query as other operations results in MySQL
error 150.
# File lib/sequel/adapters/shared/mysql.rb 348 def combinable_alter_table_op?(op) 349 super && !(op[:op] == :add_constraint && op[:type] == :foreign_key) && !(op[:op] == :drop_constraint && op[:type] == :primary_key) 350 end
Prepare the XA transaction for a two-phase commit if the :prepare option is given.
# File lib/sequel/adapters/shared/mysql.rb 436 def commit_transaction(conn, opts=OPTS) 437 if (s = opts[:prepare]) && savepoint_level(conn) <= 1 438 log_connection_execute(conn, "XA END #{literal(s)}") 439 log_connection_execute(conn, "XA PREPARE #{literal(s)}") 440 else 441 super 442 end 443 end
Use MySQL
specific syntax for engine type and character encoding
# File lib/sequel/adapters/shared/mysql.rb 446 def create_table_sql(name, generator, options = OPTS) 447 engine = options.fetch(:engine, default_engine) 448 charset = options.fetch(:charset, default_charset) 449 collate = options.fetch(:collate, default_collate) 450 generator.constraints.sort_by{|c| (c[:type] == :primary_key) ? -1 : 1} 451 452 # Proc for figuring out the primary key for a given table. 453 key_proc = lambda do |t| 454 if t == name 455 if pk = generator.primary_key_name 456 [pk] 457 elsif !(pkc = generator.constraints.select{|con| con[:type] == :primary_key}).empty? 458 pkc.first[:columns] 459 elsif !(pkc = generator.columns.select{|con| con[:primary_key] == true}).empty? 460 pkc.map{|c| c[:name]} 461 end 462 else 463 primary_key_from_schema(t) 464 end 465 end 466 467 # Manually set the keys, since MySQL requires one, it doesn't use the primary 468 # key if none are specified. 469 generator.constraints.each do |c| 470 if c[:type] == :foreign_key 471 c[:key] ||= key_proc.call(c[:table]) 472 end 473 end 474 475 # Split column constraints into table constraints in some cases: 476 # foreign key - Always 477 # unique, primary_key - Only if constraint has a name 478 generator.columns.each do |c| 479 if t = c.delete(:table) 480 same_table = t == name 481 key = c[:key] || key_proc.call(t) 482 483 if same_table && !key.nil? 484 generator.constraints.unshift(:type=>:unique, :columns=>Array(key)) 485 end 486 487 generator.foreign_key([c[:name]], t, c.merge(:name=>c[:foreign_key_constraint_name], :type=>:foreign_key, :key=>key)) 488 end 489 end 490 491 "#{super}#{" ENGINE=#{engine}" if engine}#{" DEFAULT CHARSET=#{charset}" if charset}#{" DEFAULT COLLATE=#{collate}" if collate}" 492 end
# File lib/sequel/adapters/shared/mysql.rb 502 def database_error_regexps 503 DATABASE_ERROR_REGEXPS 504 end
Backbone of the tables and views support using SHOW FULL TABLES.
# File lib/sequel/adapters/shared/mysql.rb 507 def full_tables(type, opts) 508 m = output_identifier_meth 509 metadata_dataset.with_sql('SHOW FULL TABLES').server(opts[:server]).map{|r| m.call(r.values.first) if r.delete(:Table_type) == type}.compact 510 end
# File lib/sequel/adapters/shared/mysql.rb 512 def index_definition_sql(table_name, index) 513 index_name = quote_identifier(index[:name] || default_index_name(table_name, index[:columns])) 514 raise Error, "Partial indexes are not supported for this database" if index[:where] && !supports_partial_indexes? 515 index_type = case index[:type] 516 when :full_text 517 "FULLTEXT " 518 when :spatial 519 "SPATIAL " 520 else 521 using = " USING #{index[:type]}" unless index[:type] == nil 522 "UNIQUE " if index[:unique] 523 end 524 "CREATE #{index_type}INDEX #{index_name}#{using} ON #{quote_schema_table(table_name)} #{literal(index[:columns])}" 525 end
The SQL
queries to execute on initial connection
# File lib/sequel/adapters/shared/mysql.rb 353 def mysql_connection_setting_sqls 354 sqls = [] 355 356 if wait_timeout = opts.fetch(:timeout, 2147483) 357 # Increase timeout so mysql server doesn't disconnect us 358 # Value used by default is maximum allowed value on Windows. 359 sqls << "SET @@wait_timeout = #{wait_timeout}" 360 end 361 362 # By default, MySQL 'where id is null' selects the last inserted id 363 sqls << "SET SQL_AUTO_IS_NULL=0" unless opts[:auto_is_null] 364 365 # If the user has specified one or more sql modes, enable them 366 if sql_mode = opts[:sql_mode] 367 sql_mode = Array(sql_mode).join(',').upcase 368 sqls << "SET sql_mode = '#{sql_mode}'" 369 end 370 371 # Disable the use of split_materialized in the optimizer. This is 372 # needed to pass association tests on MariaDB 10.5+. 373 if opts[:disable_split_materialized] && typecast_value_boolean(opts[:disable_split_materialized]) 374 sqls << "SET SESSION optimizer_switch='split_materialized=off'" 375 end 376 377 sqls 378 end
Parse the schema for the given table to get an array of primary key columns
SQL
statement for renaming multiple tables.
# File lib/sequel/adapters/shared/mysql.rb 533 def rename_tables_sql(renames) 534 rename_tos = renames.map do |from, to| 535 "#{quote_schema_table(from)} TO #{quote_schema_table(to)}" 536 end.join(', ') 537 "RENAME TABLE #{rename_tos}" 538 end
Rollback the currently open XA transaction
# File lib/sequel/adapters/shared/mysql.rb 541 def rollback_transaction(conn, opts=OPTS) 542 if (s = opts[:prepare]) && savepoint_level(conn) <= 1 543 log_connection_execute(conn, "XA END #{literal(s)}") 544 log_connection_execute(conn, "XA PREPARE #{literal(s)}") 545 log_connection_execute(conn, "XA ROLLBACK #{literal(s)}") 546 else 547 super 548 end 549 end
# File lib/sequel/adapters/shared/mysql.rb 551 def schema_column_type(db_type) 552 case db_type 553 when /\Aset/io 554 :set 555 when /\Amediumint/io 556 :integer 557 when /\Amediumtext/io 558 :string 559 else 560 super 561 end 562 end
Use the MySQL
specific DESCRIBE syntax to get a table description.
# File lib/sequel/adapters/shared/mysql.rb 565 def schema_parse_table(table_name, opts) 566 m = output_identifier_meth(opts[:dataset]) 567 im = input_identifier_meth(opts[:dataset]) 568 table = SQL::Identifier.new(im.call(table_name)) 569 table = SQL::QualifiedIdentifier.new(im.call(opts[:schema]), table) if opts[:schema] 570 metadata_dataset.with_sql("DESCRIBE ?", table).map do |row| 571 extra = row.delete(:Extra) 572 if row[:primary_key] = row.delete(:Key) == 'PRI' 573 row[:auto_increment] = !!(extra.to_s =~ /auto_increment/i) 574 end 575 if supports_generated_columns? 576 # Extra field contains VIRTUAL or PERSISTENT for generated columns 577 row[:generated] = !!(extra.to_s =~ /VIRTUAL|STORED|PERSISTENT/i) 578 end 579 row[:allow_null] = row.delete(:Null) == 'YES' 580 row[:default] = row.delete(:Default) 581 row[:db_type] = row.delete(:Type) 582 row[:type] = schema_column_type(row[:db_type]) 583 row[:extra] = extra 584 [m.call(row.delete(:Field)), row] 585 end 586 end
Split DROP INDEX ops on MySQL
5.6+, as dropping them in the same statement as dropping a related foreign key causes an error.
# File lib/sequel/adapters/shared/mysql.rb 604 def split_alter_table_op?(op) 605 server_version >= 50600 && (op[:op] == :drop_index || (op[:op] == :drop_constraint && op[:type] == :unique)) 606 end
MySQL
can combine multiple alter table ops into a single query.
# File lib/sequel/adapters/shared/mysql.rb 615 def supports_combining_alter_table_ops? 616 true 617 end
MySQL
supports CREATE OR REPLACE VIEW.
# File lib/sequel/adapters/shared/mysql.rb 620 def supports_create_or_replace_view? 621 true 622 end
MySQL
does not support named column constraints.
# File lib/sequel/adapters/shared/mysql.rb 625 def supports_named_column_constraints? 626 false 627 end
MySQL
has both datetime and timestamp classes, most people are going to want datetime
# File lib/sequel/adapters/shared/mysql.rb 647 def type_literal_generic_datetime(column) 648 if supports_timestamp_usecs? 649 :'datetime(6)' 650 elsif column[:default] == Sequel::CURRENT_TIMESTAMP 651 :timestamp 652 else 653 :datetime 654 end 655 end
Respect the :size option if given to produce tinyblob, mediumblob, and longblob if :tiny, :medium, or :long is given.
# File lib/sequel/adapters/shared/mysql.rb 632 def type_literal_generic_file(column) 633 case column[:size] 634 when :tiny # < 2^8 bytes 635 :tinyblob 636 when :medium # < 2^24 bytes 637 :mediumblob 638 when :long # < 2^32 bytes 639 :longblob 640 else # 2^16 bytes 641 :blob 642 end 643 end
MySQL
has both datetime and timestamp classes, most people are going to want datetime.
# File lib/sequel/adapters/shared/mysql.rb 659 def type_literal_generic_only_time(column) 660 if supports_timestamp_usecs? 661 :'time(6)' 662 else 663 :time 664 end 665 end
MySQL
doesn’t have a true boolean class, so it uses tinyint(1)
# File lib/sequel/adapters/shared/mysql.rb 668 def type_literal_generic_trueclass(column) 669 :'tinyint(1)' 670 end
MySQL
5.0.2+ supports views with check option.
# File lib/sequel/adapters/shared/mysql.rb 673 def view_with_check_option_support 674 :local if server_version >= 50002 675 end