Skip to content

Commit

Permalink
Add bigint support (#19)
Browse files Browse the repository at this point in the history
* Generator aggregate_identifier now uses bigint instead of integer

* Bump version to 0.1.3
  • Loading branch information
guillermoap authored Nov 10, 2023
1 parent 92db1ce commit f10a88e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
active_outbox (0.1.2)
active_outbox (0.1.3)
dry-configurable (~> 1.0)
rails (>= 6.1)

Expand Down
2 changes: 1 addition & 1 deletion active_outbox.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
6 changes: 6 additions & 0 deletions lib/active_outbox/adapter_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/active_outbox/model/model_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/active_outbox/generators/model_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f10a88e

Please sign in to comment.