active_record_upsert 0.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +4 -0
  6. data/README.md +44 -0
  7. data/Rakefile +6 -0
  8. data/active_record_upsert.gemspec +35 -0
  9. data/bin/console +18 -0
  10. data/bin/setup +8 -0
  11. data/lib/active_record_upsert.rb +16 -0
  12. data/lib/active_record_upsert/active_record.rb +5 -0
  13. data/lib/active_record_upsert/active_record/connection_adapters/abstract/database_statements.rb +25 -0
  14. data/lib/active_record_upsert/active_record/connection_adapters/postgresql/database_statements.rb +20 -0
  15. data/lib/active_record_upsert/active_record/persistence.rb +39 -0
  16. data/lib/active_record_upsert/active_record/relation.rb +41 -0
  17. data/lib/active_record_upsert/active_record/timestamp.rb +22 -0
  18. data/lib/active_record_upsert/arel.rb +6 -0
  19. data/lib/active_record_upsert/arel/crud.rb +18 -0
  20. data/lib/active_record_upsert/arel/insert_manager.rb +18 -0
  21. data/lib/active_record_upsert/arel/nodes.rb +1 -0
  22. data/lib/active_record_upsert/arel/nodes/do_nothing.rb +5 -0
  23. data/lib/active_record_upsert/arel/nodes/do_update_set.rb +33 -0
  24. data/lib/active_record_upsert/arel/nodes/excluded_column.rb +10 -0
  25. data/lib/active_record_upsert/arel/nodes/insert_statement.rb +59 -0
  26. data/lib/active_record_upsert/arel/nodes/on_conflict.rb +23 -0
  27. data/lib/active_record_upsert/arel/nodes/on_conflict_action.rb +6 -0
  28. data/lib/active_record_upsert/arel/on_conflict_do_update_manager.rb +47 -0
  29. data/lib/active_record_upsert/arel/visitors/to_sql.rb +54 -0
  30. data/lib/active_record_upsert/version.rb +3 -0
  31. metadata +184 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 33fda4d6b0483e92f75a5fac3fa909e69402a2d8
4
+ data.tar.gz: 5883d2dfb77533208d1515f298a09fedde100678
5
+ SHA512:
6
+ metadata.gz: bd0a5a6f839557ff1f091e78ba0225905d488264026998da0bc374d213250207f4360a02bdcd1f06a7a67714ed03658b34cc7d6b7312794a288e701f20468653
7
+ data.tar.gz: 0b7950b7f37325a6be8a4681b4df1e3248b8e515c2373361467dbf51b72469bd3bc88b6295d95d90cb62bce6e4cfc1edeac0af4dcb2741e6bd5530a06f782378
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in active_record_upsert.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # ActiveRecordUpsert
2
+
3
+ Real upsert for PostgreSQL 9.5+ and ActiveRecord. Uses ON CONFLICT DO UPDATE.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'active_record_upsert'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install active_record_upsert
20
+
21
+ ## Usage
22
+ Just use `ActiveRecord.upsert` or `ActiveRecord#upsert`.
23
+ *ActiveRecordUpsert* respects timestamps.
24
+
25
+ ```
26
+ class MyRecord < ActiveRecord::Base
27
+ end
28
+
29
+ MyRecord.create(name: 'foo', wisdom: 1)
30
+ => #<MyRecord id: 1, name: "foo", created_at: "2016-02-20 14:15:55", updated_at: "2016-02-20 14:15:55", wisdom: 1>
31
+
32
+ MyRecord.upsert(id: 1, wisdom: 3)
33
+ => #<MyRecord id: 2, name: "foo", created_at: "2016-02-20 14:15:55", updated_at: "2016-02-20 14:18:15", wisdom: 3>
34
+
35
+ r = MyRecord.new(id: 1)
36
+ r.name = 'bar'
37
+ r.upsert
38
+ => #<MyRecord id: 2, name: "bar", created_at: "2016-02-20 14:17:50", updated_at: "2016-02-20 14:18:49", wisdom: 3>
39
+ ```
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jesjos/active_record_upsert.
44
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'active_record_upsert/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "active_record_upsert"
8
+ spec.version = ActiveRecordUpsert::VERSION
9
+ spec.authors = ["Jesper Josefsson"]
10
+ spec.email = ["jesper.josefsson@gmail.com"]
11
+
12
+ spec.summary = %q{Real PostgreSQL upserts using ON CONFLICT for ActiveRecord}
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
+ spec.bindir = "exe"
16
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_runtime_dependency "activerecord", "~> 5.0.0.beta2"
20
+ spec.add_runtime_dependency "arel", "~>7.0"
21
+
22
+ if defined?(JRUBY_VERSION)
23
+ spec.platform = 'java'
24
+ spec.add_runtime_dependency 'activerecord-jdbcpostgresql-adapter', '> 0'
25
+ else
26
+ spec.platform = Gem::Platform::RUBY
27
+ spec.add_runtime_dependency 'pg', '> 0'
28
+ end
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.11"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rspec", "~> 3.0"
33
+ spec.add_development_dependency "pry", "> 0"
34
+ spec.add_development_dependency "database_cleaner", "~> 1.5.1"
35
+ end
data/bin/console ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require 'active_record'
5
+ require 'active_record/connection_adapters/postgresql_adapter'
6
+ require "active_record_upsert"
7
+ require File.join(__dir__, '../spec/setup')
8
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
9
+
10
+ # You can add fixtures and/or initialization code here to make experimenting
11
+ # with your gem easier. You can also use a different console, if you like.
12
+
13
+ # (If you use this, don't forget to add pry to your Gemfile!)
14
+ # require "pry"
15
+ # Pry.start
16
+
17
+ require "irb"
18
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,16 @@
1
+ require 'active_record_upsert/version'
2
+
3
+ unless defined?(Arel)
4
+ raise 'ActiveRecordUpsert has to be required after ActiveRecord/Arel'
5
+ end
6
+
7
+ unless defined?(ActiveRecord)
8
+ raise 'ActiveRecordUpsert has to be required after ActiveRecord'
9
+ end
10
+
11
+ require 'active_record_upsert/arel'
12
+ require 'active_record_upsert/active_record'
13
+
14
+ module ActiveRecordUpsert
15
+ # Your code goes here...
16
+ end
@@ -0,0 +1,5 @@
1
+ require 'active_record/connection_adapters/postgresql_adapter'
2
+
3
+ Dir.glob(File.join(__dir__, 'active_record/**/*.rb')) do |f|
4
+ require f
5
+ end
@@ -0,0 +1,25 @@
1
+ module ActiveRecordUpsert
2
+ module ActiveRecord
3
+ module ConnectionAdapters
4
+ module Abstract
5
+ module DatabaseStatementsExtensions
6
+ def exec_upsert(_sql, _name, _binds, _pk)
7
+ raise NotImplementedError
8
+ end
9
+
10
+ def upsert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])
11
+ sql, binds, pk, _sequence_name = sql_for_upsert(to_sql(arel, binds), pk, id_value, sequence_name, binds)
12
+ exec_upsert(sql, name, binds, pk)
13
+ end
14
+
15
+ def sql_for_upsert(sql, pk, id_value, sequence_name, binds)
16
+ [sql, binds, pk, sequence_name]
17
+ end
18
+ end
19
+
20
+ # ::ActiveRecord::ConnectionAdapters::DatabaseStatements.include(DatabaseStatementsExtensions)
21
+ ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include(DatabaseStatementsExtensions)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ module ActiveRecordUpsert
2
+ module ActiveRecord
3
+ module ConnectionAdapters
4
+ module Postgresql
5
+ module DatabaseStatementsExtensions
6
+ def sql_for_upsert(sql, pk, id_value, sequence_name, binds)
7
+ sql = "#{sql} RETURNING *"
8
+ super
9
+ end
10
+
11
+ def exec_upsert(sql, name, binds, pk)
12
+ exec_query(sql, name, binds)
13
+ end
14
+ end
15
+
16
+ ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include(DatabaseStatementsExtensions)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,39 @@
1
+ module ActiveRecordUpsert
2
+ module ActiveRecord
3
+ module PersistenceExtensions
4
+
5
+ def upsert
6
+ raise ReadOnlyRecord, "#{self.class} is marked as readonly" if readonly?
7
+ values = run_callbacks(:save) {
8
+ run_callbacks(:create) {
9
+ _upsert_record
10
+ }
11
+ }
12
+ assign_attributes(values.first.to_h)
13
+ self
14
+ rescue ::ActiveRecord::RecordInvalid
15
+ false
16
+ end
17
+
18
+ def _upsert_record(attribute_names = changed)
19
+ attributes_values = arel_attributes_with_values_for_create(attribute_names)
20
+ values = self.class.unscoped.upsert attributes_values
21
+ @new_record = false
22
+ values
23
+ end
24
+
25
+ module ClassMethods
26
+ def upsert(attributes, &block)
27
+ if attributes.is_a?(Array)
28
+ attributes.collect { |hash| upsert(hash, &block) }
29
+ else
30
+ new(attributes, &block).upsert
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ ::ActiveRecord::Base.prepend(PersistenceExtensions)
37
+ ::ActiveRecord::Base.extend(PersistenceExtensions::ClassMethods)
38
+ end
39
+ end
@@ -0,0 +1,41 @@
1
+ module ActiveRecordUpsert
2
+ module ActiveRecord
3
+ module RelationExtensions
4
+ def upsert(values) # :nodoc:
5
+ primary_key_value = nil
6
+
7
+ if primary_key && Hash === values
8
+ primary_key_value = values[values.keys.find { |k|
9
+ k.name == primary_key
10
+ }]
11
+ end
12
+
13
+ im = arel_table.create_insert
14
+ im.into arel_table
15
+
16
+ substitutes, binds = substitute_values values
17
+
18
+ cm = arel_table.create_on_conflict_do_update
19
+ cm.target = arel_table[primary_key]
20
+
21
+ filter = ->(o) { [primary_key, 'created_at'].include?(o.name) }
22
+ cm.set(substitutes.reject { |s| filter.call(s.first) })
23
+ on_conflict_binds = binds.reject(&filter)
24
+
25
+ im.on_conflict = cm.to_node
26
+
27
+ im.insert substitutes
28
+
29
+ @klass.connection.upsert(
30
+ im,
31
+ 'SQL',
32
+ primary_key,
33
+ primary_key_value,
34
+ nil,
35
+ binds + on_conflict_binds)
36
+ end
37
+ end
38
+
39
+ ::ActiveRecord::Relation.include(RelationExtensions)
40
+ end
41
+ end
@@ -0,0 +1,22 @@
1
+ module ActiveRecordUpsert
2
+ module ActiveRecord
3
+ module TimestampExtensions
4
+ def _upsert_record(*args)
5
+ if self.record_timestamps
6
+ current_time = current_time_from_proper_timezone
7
+
8
+ all_timestamp_attributes.each do |column|
9
+ column = column.to_s
10
+ if has_attribute?(column) && !attribute_present?(column)
11
+ write_attribute(column, current_time)
12
+ end
13
+ end
14
+ end
15
+
16
+ super
17
+ end
18
+ end
19
+
20
+ ::ActiveRecord::Base.prepend(TimestampExtensions)
21
+ end
22
+ end
@@ -0,0 +1,6 @@
1
+ require 'active_record_upsert/arel/nodes/on_conflict_action'
2
+ require 'active_record_upsert/arel/nodes/insert_statement'
3
+
4
+ Dir.glob(File.join(__dir__, 'arel/**/*.rb')) do |f|
5
+ require f
6
+ end
@@ -0,0 +1,18 @@
1
+ # module ActiveRecordUpsert
2
+ # module Arel
3
+ # module CrudExtensions
4
+ # def create_on_conflict_do_update
5
+ # OnConflictDoUpdateManager.new
6
+ # end
7
+ # end
8
+ #
9
+ # ::Arel::Crud.prepend(CrudExtensions)
10
+ # end
11
+ # end
12
+ module Arel
13
+ class Table
14
+ def create_on_conflict_do_update
15
+ OnConflictDoUpdateManager.new
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module ActiveRecordUpsert
2
+ module Arel
3
+ module InsertManagerExtensions
4
+ def on_conflict= node
5
+ @ast.on_conflict = node
6
+ end
7
+
8
+ def do_nothing_on_conflict(target)
9
+ @ast.on_conflict = Nodes::OnConflict.new.tap do |on_conflict|
10
+ on_conflict.target = target
11
+ on_conflict.action = Nodes::DoNothing.new
12
+ end
13
+ end
14
+ end
15
+
16
+ ::Arel::InsertManager.include(InsertManagerExtensions)
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module Arel
2
+ module Nodes
3
+ DoNothing = Class.new(OnConflictAction)
4
+ end
5
+ end
@@ -0,0 +1,33 @@
1
+ module Arel
2
+ module Nodes
3
+ class DoUpdateSet < OnConflictAction
4
+ attr_accessor :wheres, :values
5
+ attr_accessor :key
6
+
7
+ def initialize
8
+ @wheres = []
9
+ @values = []
10
+ @key = nil
11
+ end
12
+
13
+ def initialize_copy other
14
+ super
15
+ @wheres = @wheres.clone
16
+ @values = @values.clone
17
+ end
18
+
19
+ def hash
20
+ [@relation, @wheres, @values, @key].hash
21
+ end
22
+
23
+ def eql? other
24
+ self.class == other.class &&
25
+ self.relation == other.relation &&
26
+ self.wheres == other.wheres &&
27
+ self.values == other.values &&
28
+ self.key == other.key
29
+ end
30
+ alias :== :eql?
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,10 @@
1
+ module Arel
2
+ module Nodes
3
+ class ExcludedColumn < Arel::Nodes::Node
4
+ attr_reader :column
5
+ def initialize(column)
6
+ @column = column
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,59 @@
1
+ # module ActiveRecordUpsert
2
+ # module Arel
3
+ # module Nodes
4
+ # module InsertStatementExtensions
5
+ # attr_accessor :on_conflict
6
+ #
7
+ # def initialize
8
+ # @on_conflict = nil
9
+ # super()
10
+ # end
11
+ #
12
+ # def hash
13
+ # [@relation, @columns, @values, @select, @on_conflict].hash
14
+ # end
15
+ #
16
+ # def eql? other
17
+ # self.class == other.class &&
18
+ # self.relation == other.relation &&
19
+ # self.columns == other.columns &&
20
+ # self.select == other.select &&
21
+ # self.values == other.values &&
22
+ # self.on_conflict == other.on_conflict
23
+ # end
24
+ # end
25
+ #
26
+ # ::Arel::Nodes::InsertStatement.prepend(InsertStatementExtensions)
27
+ # end
28
+ # end
29
+ # end
30
+
31
+ module Arel
32
+ module Nodes
33
+ class InsertStatement
34
+ attr_accessor :on_conflict
35
+
36
+ def initialize
37
+ super()
38
+ @relation = nil
39
+ @columns = []
40
+ @values = nil
41
+ @select = nil
42
+ @on_conflict = nil
43
+ end
44
+
45
+ def hash
46
+ [@relation, @columns, @values, @select, @on_conflict].hash
47
+ end
48
+
49
+ def eql? other
50
+ self.class == other.class &&
51
+ self.relation == other.relation &&
52
+ self.columns == other.columns &&
53
+ self.select == other.select &&
54
+ self.values == other.values &&
55
+ self.on_conflict == other.on_conflict
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,23 @@
1
+ module Arel
2
+ module Nodes
3
+ class OnConflict < Node
4
+ attr_accessor :target, :action
5
+
6
+ def initialize
7
+ super
8
+ @target = nil
9
+ @action = nil
10
+ end
11
+
12
+ def hash
13
+ [@target, @action].hash
14
+ end
15
+
16
+ def eql? other
17
+ self.class == other.class &&
18
+ self.target == other.target &&
19
+ self.update_statement == other.update_statement
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,6 @@
1
+ module Arel
2
+ module Nodes
3
+ class OnConflictAction < Node
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,47 @@
1
+ module Arel
2
+ class OnConflictDoUpdateManager < Arel::TreeManager
3
+ def initialize
4
+ super
5
+ @ast = Nodes::OnConflict.new
6
+ @action = Nodes::DoUpdateSet.new
7
+ @ast.action = @action
8
+ @ctx = @ast
9
+ end
10
+
11
+ def target= column
12
+ @ast.target = column
13
+ end
14
+
15
+ def target(column)
16
+ @ast.target = column
17
+ self
18
+ end
19
+
20
+ def wheres= exprs
21
+ @action.wheres = exprs
22
+ end
23
+
24
+ def where expr
25
+ @action.wheres << expr
26
+ self
27
+ end
28
+
29
+ def to_node
30
+ @ast
31
+ end
32
+
33
+ def set values
34
+ if String === values
35
+ @action.values = [values]
36
+ else
37
+ @action.values = values.map { |column,value|
38
+ Nodes::Assignment.new(
39
+ Nodes::UnqualifiedColumn.new(column),
40
+ value
41
+ )
42
+ }
43
+ end
44
+ self
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,54 @@
1
+ module ActiveRecordUpsert
2
+ module Arel
3
+ module Visitors
4
+ module ToSqlExtensions
5
+ def visit_Arel_Nodes_InsertStatement(o, collector)
6
+ collector = super
7
+ if o.on_conflict
8
+ maybe_visit o.on_conflict, collector
9
+ else
10
+ collector
11
+ end
12
+ end
13
+
14
+ def visit_Arel_Nodes_OnConflict o, collector
15
+ collector << "ON CONFLICT "
16
+ collector << " (#{quote_column_name o.target.name}) "
17
+ maybe_visit o.action, collector
18
+ end
19
+
20
+ def visit_Arel_Nodes_DoNothing _o, collector
21
+ collector << "DO NOTHING"
22
+ end
23
+
24
+ def visit_Arel_Nodes_DoUpdateSet o, collector
25
+ wheres = o.wheres
26
+
27
+ collector << "DO UPDATE "
28
+ unless o.values.empty?
29
+ collector << " SET "
30
+ collector = inject_join o.values, collector, ", "
31
+ end
32
+
33
+ unless wheres.empty?
34
+ collector << " WHERE "
35
+ collector = inject_join wheres, collector, " AND "
36
+ end
37
+
38
+ collector
39
+ end
40
+
41
+ def visit_Arel_Nodes_ExcludedColumn o, collector
42
+ collector << "EXCLUDED.#{quote_column_name o.column}"
43
+ collector
44
+ end
45
+
46
+ def table_exists?(name)
47
+ schema_cache.data_source_exists?(name)
48
+ end
49
+ end
50
+
51
+ ::Arel::Visitors::ToSql.prepend(ToSqlExtensions)
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveRecordUpsert
2
+ VERSION = "0.2.0"
3
+ end
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_record_upsert
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: java
6
+ authors:
7
+ - Jesper Josefsson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-02-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.0.0.beta2
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - "~>"
23
+ - !ruby/object:Gem::Version
24
+ version: 5.0.0.beta2
25
+ prerelease: false
26
+ type: :runtime
27
+ - !ruby/object:Gem::Dependency
28
+ name: arel
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '7.0'
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - "~>"
37
+ - !ruby/object:Gem::Version
38
+ version: '7.0'
39
+ prerelease: false
40
+ type: :runtime
41
+ - !ruby/object:Gem::Dependency
42
+ name: activerecord-jdbcpostgresql-adapter
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">"
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">"
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ prerelease: false
54
+ type: :runtime
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.11'
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '1.11'
67
+ prerelease: false
68
+ type: :development
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '10.0'
81
+ prerelease: false
82
+ type: :development
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '3.0'
95
+ prerelease: false
96
+ type: :development
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">"
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">"
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ prerelease: false
110
+ type: :development
111
+ - !ruby/object:Gem::Dependency
112
+ name: database_cleaner
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.5.1
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: 1.5.1
123
+ prerelease: false
124
+ type: :development
125
+ description:
126
+ email:
127
+ - jesper.josefsson@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".rspec"
134
+ - ".travis.yml"
135
+ - Gemfile
136
+ - README.md
137
+ - Rakefile
138
+ - active_record_upsert.gemspec
139
+ - bin/console
140
+ - bin/setup
141
+ - lib/active_record_upsert.rb
142
+ - lib/active_record_upsert/active_record.rb
143
+ - lib/active_record_upsert/active_record/connection_adapters/abstract/database_statements.rb
144
+ - lib/active_record_upsert/active_record/connection_adapters/postgresql/database_statements.rb
145
+ - lib/active_record_upsert/active_record/persistence.rb
146
+ - lib/active_record_upsert/active_record/relation.rb
147
+ - lib/active_record_upsert/active_record/timestamp.rb
148
+ - lib/active_record_upsert/arel.rb
149
+ - lib/active_record_upsert/arel/crud.rb
150
+ - lib/active_record_upsert/arel/insert_manager.rb
151
+ - lib/active_record_upsert/arel/nodes.rb
152
+ - lib/active_record_upsert/arel/nodes/do_nothing.rb
153
+ - lib/active_record_upsert/arel/nodes/do_update_set.rb
154
+ - lib/active_record_upsert/arel/nodes/excluded_column.rb
155
+ - lib/active_record_upsert/arel/nodes/insert_statement.rb
156
+ - lib/active_record_upsert/arel/nodes/on_conflict.rb
157
+ - lib/active_record_upsert/arel/nodes/on_conflict_action.rb
158
+ - lib/active_record_upsert/arel/on_conflict_do_update_manager.rb
159
+ - lib/active_record_upsert/arel/visitors/to_sql.rb
160
+ - lib/active_record_upsert/version.rb
161
+ homepage:
162
+ licenses: []
163
+ metadata: {}
164
+ post_install_message:
165
+ rdoc_options: []
166
+ require_paths:
167
+ - lib
168
+ required_ruby_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ requirements: []
179
+ rubyforge_project:
180
+ rubygems_version: 2.4.8
181
+ signing_key:
182
+ specification_version: 4
183
+ summary: Real PostgreSQL upserts using ON CONFLICT for ActiveRecord
184
+ test_files: []