bulk_update 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +5 -1
- data/bulk_update.gemspec +2 -0
- data/lib/bulk_update/version.rb +1 -1
- data/spec/support/active_record.rb +46 -3
- metadata +34 -2
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# BulkUpdate
|
2
2
|
|
3
3
|
Updates a large amount of Records in a highliy efficient way.
|
4
|
-
Enhances Active Record with a method for bulk inserts and a method for bulk updates. Both
|
4
|
+
Enhances Active Record with a method for bulk inserts and a method for bulk updates. Both methods are used for inserting or updating large amount of Records.
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
@@ -85,3 +85,7 @@ All new, changed and deleted records are handled by ActiveRecord. This ensures,
|
|
85
85
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
86
86
|
4. Push to the branch (`git push origin my-new-feature`)
|
87
87
|
5. Create new Pull Request
|
88
|
+
|
89
|
+
## Copyright
|
90
|
+
|
91
|
+
Copyright (c) 2012 - 2013 Philip Kurmann. See LICENSE for details.
|
data/bulk_update.gemspec
CHANGED
@@ -11,6 +11,8 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.add_dependency "activerecord"
|
12
12
|
gem.add_development_dependency "rspec"
|
13
13
|
gem.add_development_dependency "sqlite3"
|
14
|
+
gem.add_development_dependency "pg"
|
15
|
+
gem.add_development_dependency "mysql2"
|
14
16
|
gem.add_development_dependency "pry"
|
15
17
|
|
16
18
|
gem.files = `git ls-files`.split($\)
|
data/lib/bulk_update/version.rb
CHANGED
@@ -1,10 +1,53 @@
|
|
1
1
|
require 'active_record'
|
2
2
|
require 'active_record/version'
|
3
|
-
puts "Testing ActiveRecord #{ActiveRecord::VERSION::STRING}"
|
4
3
|
|
5
|
-
|
6
|
-
|
4
|
+
SQLITE3_SPEC = {
|
5
|
+
adapter: 'sqlite3',
|
6
|
+
database: ':memory:',
|
7
|
+
encoding: 'utf8'
|
8
|
+
}
|
7
9
|
|
10
|
+
MYSQL_SPEC = {
|
11
|
+
adapter: 'mysql2',
|
12
|
+
host: 'localhost',
|
13
|
+
database: 'bulk_update_test',
|
14
|
+
username: 'root',
|
15
|
+
password: '123456',
|
16
|
+
encoding: 'utf8'
|
17
|
+
}
|
18
|
+
|
19
|
+
PG_SPEC = {
|
20
|
+
adapter: 'postgresql',
|
21
|
+
host: 'localhost',
|
22
|
+
database: 'bulk_update_test',
|
23
|
+
username: 'pk',
|
24
|
+
password: '123456',
|
25
|
+
encoding: 'utf8'
|
26
|
+
}
|
27
|
+
|
28
|
+
DB_SPEC = SQLITE3_SPEC
|
29
|
+
# DB_SPEC = MYSQL_SPEC
|
30
|
+
# DB_SPEC = PG_SPEC
|
31
|
+
|
32
|
+
puts "Testing ActiveRecord #{ActiveRecord::VERSION::STRING} #{DB_SPEC[:adapter]}-adapter"
|
33
|
+
|
34
|
+
# Drop and create need to be performed with a connection to the system database
|
35
|
+
if DB_SPEC[:adapter] == 'mysql2'
|
36
|
+
ActiveRecord::Base.establish_connection(DB_SPEC.merge(database: nil))
|
37
|
+
elsif DB_SPEC[:adapter] == 'postgresql'
|
38
|
+
ActiveRecord::Base.establish_connection(DB_SPEC.merge(database: 'postgres', schema_search_path: 'public'))
|
39
|
+
end
|
40
|
+
|
41
|
+
# Drop old DB and create a new one
|
42
|
+
if DB_SPEC[:adapter] == 'mysql2' || DB_SPEC[:adapter] == 'postgresql'
|
43
|
+
ActiveRecord::Base.connection.drop_database DB_SPEC[:database] rescue nil
|
44
|
+
ActiveRecord::Base.connection.create_database(DB_SPEC[:database])
|
45
|
+
end
|
46
|
+
|
47
|
+
# Establish connection
|
48
|
+
ActiveRecord::Base.establish_connection(DB_SPEC)
|
49
|
+
# Migrate DB
|
50
|
+
ActiveRecord::Migrator.up 'db/migrate'
|
8
51
|
load 'spec/support/schema.rb'
|
9
52
|
|
10
53
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bulk_update
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -59,6 +59,38 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: pg
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: mysql2
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
62
94
|
- !ruby/object:Gem::Dependency
|
63
95
|
name: pry
|
64
96
|
requirement: !ruby/object:Gem::Requirement
|