Class: StrongMigrations::Adapters::MariaDBAdapter

Inherits:
MySQLAdapter show all
Defined in:
lib/strong_migrations/adapters/mariadb_adapter.rb

Instance Method Summary collapse

Methods inherited from MySQLAdapter

#analyze_table, #change_type_safe?, #check_lock_timeout, #rewrite_blocks, #set_lock_timeout, #strict_mode?

Methods inherited from AbstractAdapter

#auto_incrementing_types, #change_type_safe?, #check_lock_timeout, #initialize, #rewrite_blocks, #set_lock_timeout

Constructor Details

This class inherits a constructor from StrongMigrations::Adapters::AbstractAdapter

Instance Method Details

#add_column_default_safe?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/strong_migrations/adapters/mariadb_adapter.rb', line 27

def add_column_default_safe?
  true
end

#min_versionObject



8
9
10
# File 'lib/strong_migrations/adapters/mariadb_adapter.rb', line 8

def min_version
  "10.5"
end

#nameObject



4
5
6
# File 'lib/strong_migrations/adapters/mariadb_adapter.rb', line 4

def name
  "MariaDB"
end

#server_versionObject



12
13
14
15
16
17
18
# File 'lib/strong_migrations/adapters/mariadb_adapter.rb', line 12

def server_version
  @server_version ||= begin
    target_version(StrongMigrations.target_mariadb_version) do
      select_all("SELECT VERSION()").first["VERSION()"].split("-").first
    end
  end
end

#set_statement_timeout(timeout) ⇒ Object



20
21
22
23
24
25
# File 'lib/strong_migrations/adapters/mariadb_adapter.rb', line 20

def set_statement_timeout(timeout)
  # fix deprecation warning with Active Record 7.1
  timeout = timeout.value if timeout.is_a?(ActiveSupport::Duration)

  select_all("SET max_statement_time = #{connection.quote(timeout)}")
end