class Ketsuban::Adapter::Mysql2Adapter

Public Instance Methods

fetch_next_id() click to toggle source

@override

# File lib/ketsuban/adapters/mysql2_adapter.rb, line 7
def fetch_next_id
  [max_id_now + 1, auto_incremental_id].max
end
increment_sequence(_now_id) click to toggle source

@override

# File lib/ketsuban/adapters/mysql2_adapter.rb, line 12
def increment_sequence(_now_id)
  # do nothing
  nil
end

Private Instance Methods

auto_incremental_id() click to toggle source
# File lib/ketsuban/adapters/mysql2_adapter.rb, line 19
def auto_incremental_id
  @model_class
    .connection
    .execute("select auto_increment from information_schema.tables where table_name = '#{@model_class.table_name}'")
    .first
    .first
end
max_id_now() click to toggle source
# File lib/ketsuban/adapters/mysql2_adapter.rb, line 27
def max_id_now
  @model_class.maximum(:id).presence || 0
end