Module: ActiveOutbox::AdapterHelper

Included in:
Generators::ModelGenerator
Defined in:
lib/active_outbox/adapter_helper.rb

Class Method Summary collapse

Class Method Details

.bigint_typeObject



19
20
21
22
23
# File 'lib/active_outbox/adapter_helper.rb', line 19

def self.bigint_type
  return 'bigint' if postgres? || mysql?

  'integer'
end

.json_typeObject



12
13
14
15
16
17
# File 'lib/active_outbox/adapter_helper.rb', line 12

def self.json_type
  return 'jsonb' if postgres?
  return 'json' if mysql?

  'string'
end

.mysql?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/active_outbox/adapter_helper.rb', line 29

def self.mysql?
  ActiveRecord::Base.connection.adapter_name.downcase == 'mysql2'
end

.postgres?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/active_outbox/adapter_helper.rb', line 25

def self.postgres?
  ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql'
end

.uuid_typeObject



5
6
7
8
9
10
# File 'lib/active_outbox/adapter_helper.rb', line 5

def self.uuid_type
  return 'uuid' if postgres?
  return 'string' if mysql?

  'string'
end