diff --git a/Gemfile.lock b/Gemfile.lock index df085b4..fdc9f91 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - active_outbox (0.1.2) + active_outbox (0.1.3) dry-configurable (~> 1.0) rails (>= 6.1) diff --git a/active_outbox.gemspec b/active_outbox.gemspec index c27a1d0..53a7927 100644 --- a/active_outbox.gemspec +++ b/active_outbox.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |spec| spec.files = Dir['LICENSE.txt', 'README.md', 'lib/**/*', 'lib/active_outbox.rb'] spec.name = 'active_outbox' spec.summary = 'A Transactional Outbox implementation for ActiveRecord' - spec.version = '0.1.2' + spec.version = '0.1.3' spec.email = 'guillermoaguirre1@gmail.com' spec.executables = ['outbox'] diff --git a/lib/active_outbox/adapter_helper.rb b/lib/active_outbox/adapter_helper.rb index a24c8e1..0a873e5 100644 --- a/lib/active_outbox/adapter_helper.rb +++ b/lib/active_outbox/adapter_helper.rb @@ -16,6 +16,12 @@ def self.json_type 'string' end + def self.bigint_type + return 'bigint' if postgres? || mysql? + + 'integer' + end + def self.postgres? ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql' end diff --git a/lib/generators/active_outbox/model/model_generator.rb b/lib/generators/active_outbox/model/model_generator.rb index d6d5c37..833e999 100644 --- a/lib/generators/active_outbox/model/model_generator.rb +++ b/lib/generators/active_outbox/model/model_generator.rb @@ -50,7 +50,7 @@ def table_name end def aggregate_identifier_type - options['uuid'].present? ? ActiveOutbox::AdapterHelper.uuid_type : 'integer' + options['uuid'].present? ? ActiveOutbox::AdapterHelper.uuid_type : ActiveOutbox::AdapterHelper.bigint_type end end end diff --git a/spec/lib/active_outbox/generators/model_generator_spec.rb b/spec/lib/active_outbox/generators/model_generator_spec.rb index e706f84..74d0b21 100644 --- a/spec/lib/active_outbox/generators/model_generator_spec.rb +++ b/spec/lib/active_outbox/generators/model_generator_spec.rb @@ -145,7 +145,7 @@ def change context 'with id aggregate_identifier' do subject(:generate) { run_generator(["--component_path=#{destination_root}"]) } - let(:aggregate_identifier_types) { %w[integer integer integer] } + let(:aggregate_identifier_types) { %w[bigint integer bigint] } include_examples 'creates the correct migrations for supported adapters' end @@ -188,7 +188,7 @@ def change context 'with id aggregate_identifier' do subject(:generate) { run_generator([table_name, "--component_path=#{destination_root}"]) } - let(:aggregate_identifier_types) { %w[integer integer integer] } + let(:aggregate_identifier_types) { %w[bigint integer bigint] } include_examples 'creates the correct migrations for supported adapters' end