rails_event_store_active_record 0.33.0 → 0.34.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +2 -3
- data/lib/rails_event_store_active_record.rb +2 -0
- data/lib/rails_event_store_active_record/event_repository_reader.rb +2 -1
- data/lib/rails_event_store_active_record/generators/index_by_event_type_generator.rb +29 -0
- data/lib/rails_event_store_active_record/generators/limit_for_event_id_generator.rb +29 -0
- data/lib/rails_event_store_active_record/generators/migration_generator.rb +1 -1
- data/lib/rails_event_store_active_record/generators/templates/{migration_template.rb → create_event_store_events_template.rb} +2 -1
- data/lib/rails_event_store_active_record/generators/templates/index_by_event_type_template.rb +5 -0
- data/lib/rails_event_store_active_record/generators/templates/limit_for_event_id_template.rb +6 -0
- data/lib/rails_event_store_active_record/version.rb +1 -1
- data/rails_event_store_active_record.gemspec +2 -2
- metadata +12 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ecd9126ba4ac3a8c749122e76290b605152f25c177d12e06aa050910077bdfe
|
4
|
+
data.tar.gz: ed776c89a46e9a401ba28fcebfd584fd835bd06b0a1f72846b124771a2f027d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df85cbbcbeab5492145ae68dc031481058b5f2d0fa56d422f629d95808132aa5baf70d9081c5a8909ba92b7935d16155bc9fdfae81e51361559b23a821a38cb3
|
7
|
+
data.tar.gz: 7ded0302fa417f62365d91e6ad275a5003e77c372f813c35f23bf6979004831210b691518a2e18d2c5c0de8c6b97a6322da215c966be4df229bf20458af183c1
|
data/Makefile
CHANGED
@@ -10,16 +10,15 @@ DATABASE_URL ?= sqlite3::memory:
|
|
10
10
|
install: ## Install gem dependencies
|
11
11
|
@echo "Installing gem dependencies"
|
12
12
|
@bundle install
|
13
|
-
@BUNDLE_GEMFILE
|
13
|
+
@BUNDLE_GEMFILE=../lib/Gemfile.0_33_0 bundle install
|
14
14
|
|
15
15
|
remove-lock:
|
16
16
|
@echo "Removing resolved dependency versions"
|
17
17
|
-rm Gemfile.lock
|
18
|
-
-rm
|
18
|
+
-rm ../lib/Gemfile.0_33_0.lock
|
19
19
|
|
20
20
|
reinstall: remove-lock install ## Removing resolved dependency versions
|
21
21
|
|
22
|
-
|
23
22
|
test: ## Run unit tests
|
24
23
|
@echo "Running unit tests"
|
25
24
|
@BUNDLE_GEMFILE=Gemfile bundle exec rspec
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'rails_event_store_active_record/generators/migration_generator'
|
2
|
+
require 'rails_event_store_active_record/generators/index_by_event_type_generator'
|
3
|
+
require 'rails_event_store_active_record/generators/limit_for_event_id_generator'
|
2
4
|
require 'rails_event_store_active_record/event'
|
3
5
|
require 'rails_event_store_active_record/event_repository'
|
4
6
|
require 'rails_event_store_active_record/event_repository_reader'
|
@@ -15,6 +15,7 @@ module RailsEventStoreActiveRecord
|
|
15
15
|
|
16
16
|
stream = EventInStream.preload(:event).where(stream: normalize_stream_name(spec))
|
17
17
|
stream = stream.where(event_id: spec.with_ids) if spec.with_ids?
|
18
|
+
stream = stream.joins(:event).where(event_store_events: {event_type: spec.with_types}) if spec.with_types?
|
18
19
|
stream = stream.order(position: order(spec)) unless spec.stream.global?
|
19
20
|
stream = stream.limit(spec.limit) if spec.limit?
|
20
21
|
stream = stream.where(start_condition(spec)) unless spec.head?
|
@@ -43,7 +44,7 @@ module RailsEventStoreActiveRecord
|
|
43
44
|
def start_condition(specification)
|
44
45
|
event_record =
|
45
46
|
EventInStream.find_by!(event_id: specification.start, stream: normalize_stream_name(specification))
|
46
|
-
condition = specification.forward? ? 'id > ?' : 'id < ?'
|
47
|
+
condition = specification.forward? ? 'event_store_events_in_streams.id > ?' : 'event_store_events_in_streams.id < ?'
|
47
48
|
[condition, event_record]
|
48
49
|
end
|
49
50
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
begin
|
2
|
+
require 'rails/generators'
|
3
|
+
rescue LoadError
|
4
|
+
end
|
5
|
+
|
6
|
+
module RailsEventStoreActiveRecord
|
7
|
+
class IndexByEventTypeGenerator < Rails::Generators::Base
|
8
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), '../generators/templates'))
|
9
|
+
|
10
|
+
def create_migration
|
11
|
+
template "index_by_event_type_template.rb", "db/migrate/#{timestamp}_index_by_event_type.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def rails_version
|
17
|
+
Rails::VERSION::STRING
|
18
|
+
end
|
19
|
+
|
20
|
+
def migration_version
|
21
|
+
return nil if Gem::Version.new(rails_version) < Gem::Version.new("5.0.0")
|
22
|
+
"[4.2]"
|
23
|
+
end
|
24
|
+
|
25
|
+
def timestamp
|
26
|
+
Time.now.strftime("%Y%m%d%H%M%S")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end if defined?(Rails::Generators::Base)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
begin
|
2
|
+
require 'rails/generators'
|
3
|
+
rescue LoadError
|
4
|
+
end
|
5
|
+
|
6
|
+
module RailsEventStoreActiveRecord
|
7
|
+
class LimitForEventIdGenerator < Rails::Generators::Base
|
8
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), '../generators/templates'))
|
9
|
+
|
10
|
+
def create_migration
|
11
|
+
template "limit_for_event_id_template.rb", "db/migrate/#{timestamp}_limit_for_event_id.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def rails_version
|
17
|
+
Rails::VERSION::STRING
|
18
|
+
end
|
19
|
+
|
20
|
+
def migration_version
|
21
|
+
return nil if Gem::Version.new(rails_version) < Gem::Version.new("5.0.0")
|
22
|
+
"[4.2]"
|
23
|
+
end
|
24
|
+
|
25
|
+
def timestamp
|
26
|
+
Time.now.strftime("%Y%m%d%H%M%S")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end if defined?(Rails::Generators::Base)
|
@@ -8,7 +8,7 @@ module RailsEventStoreActiveRecord
|
|
8
8
|
source_root File.expand_path(File.join(File.dirname(__FILE__), '../generators/templates'))
|
9
9
|
|
10
10
|
def create_migration
|
11
|
-
template "
|
11
|
+
template "create_event_store_events_template.rb", "db/migrate/#{timestamp}_create_event_store_events.rb"
|
12
12
|
end
|
13
13
|
|
14
14
|
private
|
@@ -10,7 +10,7 @@ class CreateEventStoreEvents < ActiveRecord::Migration<%= migration_version %>
|
|
10
10
|
if postgres
|
11
11
|
t.references :event, null: false, type: :uuid
|
12
12
|
else
|
13
|
-
t.references :event, null: false, type: :string
|
13
|
+
t.references :event, null: false, type: :string, limit: 36
|
14
14
|
end
|
15
15
|
t.datetime :created_at, null: false
|
16
16
|
end
|
@@ -38,5 +38,6 @@ class CreateEventStoreEvents < ActiveRecord::Migration<%= migration_version %>
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
add_index :event_store_events, :created_at
|
41
|
+
add_index :event_store_events, :event_type
|
41
42
|
end
|
42
43
|
end
|
@@ -32,12 +32,12 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency 'sqlite3', '1.3.13'
|
33
33
|
spec.add_development_dependency 'pg', '0.21'
|
34
34
|
spec.add_development_dependency 'mysql2', '0.4.10'
|
35
|
-
spec.add_development_dependency 'mutant-rspec', '
|
35
|
+
spec.add_development_dependency 'mutant-rspec', '= 0.8.17'
|
36
36
|
spec.add_development_dependency 'fakefs', '~> 0.11.2'
|
37
37
|
spec.add_development_dependency 'childprocess'
|
38
38
|
spec.add_development_dependency 'google-protobuf', '~> 3.5.1.2'
|
39
39
|
|
40
|
-
spec.add_dependency 'ruby_event_store', '= 0.
|
40
|
+
spec.add_dependency 'ruby_event_store', '= 0.34.0'
|
41
41
|
spec.add_dependency 'activesupport', '>= 3.0'
|
42
42
|
spec.add_dependency 'activemodel', '>= 3.0'
|
43
43
|
spec.add_dependency 'activerecord-import', '~> 0.21'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_event_store_active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.34.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,14 +112,14 @@ dependencies:
|
|
112
112
|
name: mutant-rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 0.8.17
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.8.17
|
125
125
|
- !ruby/object:Gem::Dependency
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - '='
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.
|
173
|
+
version: 0.34.0
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - '='
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.
|
180
|
+
version: 0.34.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: activesupport
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -239,8 +239,12 @@ files:
|
|
239
239
|
- lib/rails_event_store_active_record/event.rb
|
240
240
|
- lib/rails_event_store_active_record/event_repository.rb
|
241
241
|
- lib/rails_event_store_active_record/event_repository_reader.rb
|
242
|
+
- lib/rails_event_store_active_record/generators/index_by_event_type_generator.rb
|
243
|
+
- lib/rails_event_store_active_record/generators/limit_for_event_id_generator.rb
|
242
244
|
- lib/rails_event_store_active_record/generators/migration_generator.rb
|
243
|
-
- lib/rails_event_store_active_record/generators/templates/
|
245
|
+
- lib/rails_event_store_active_record/generators/templates/create_event_store_events_template.rb
|
246
|
+
- lib/rails_event_store_active_record/generators/templates/index_by_event_type_template.rb
|
247
|
+
- lib/rails_event_store_active_record/generators/templates/limit_for_event_id_template.rb
|
244
248
|
- lib/rails_event_store_active_record/index_violation_detector.rb
|
245
249
|
- lib/rails_event_store_active_record/pg_linearized_event_repository.rb
|
246
250
|
- lib/rails_event_store_active_record/version.rb
|
@@ -269,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
273
|
version: '0'
|
270
274
|
requirements: []
|
271
275
|
rubyforge_project:
|
272
|
-
rubygems_version:
|
276
|
+
rubygems_version: 2.7.6
|
273
277
|
signing_key:
|
274
278
|
specification_version: 4
|
275
279
|
summary: Active Record events repository for Rails Event Store
|