rails_event_store_active_record-legacy 0.34.0 → 0.35.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6a4b4cfcef98780421cb3ef00d00c651b683b0afa2d13b707cc93b413b87388
4
- data.tar.gz: c63b133f980e3c7b1cab67358b39569327f67fd23f9c5f0fcf435715f5c3c25f
3
+ metadata.gz: 3202ec32c29dce30cf9d93ce9fba1c644c2ce67d2d672fd94bb9daca9d086319
4
+ data.tar.gz: 165a2127a440a5b90bd76c903dbcdb119b217a49337ba1192775904121d59431
5
5
  SHA512:
6
- metadata.gz: ba3506c4355e379fe5eb4451dddb4b2e1e93b7b0b419b979e02fcee80f35ce049c777e384d55354d29ff9b717a703838696a9098562c0f2514a13b0d357a5e59
7
- data.tar.gz: edff9c15954735d46d5cf532930da0e39c2b7ed60051b29f088420fea82844035c55d7b909c4ec674159a82ba24e1d68fe26891b5c13205d57ec7bde0adec61c
6
+ metadata.gz: e56dc832258d613a65d75b6a310b71cd643e44cf1bbc6c32599e7047af4a81aff57c54d08651a3c38a600c8e5d3b614997600581d7c61544ca44c3bb1b34c8ce
7
+ data.tar.gz: 7a1d3a9cd0ed57897c38d7bccf2e7e547a378a663e4b711f9ce35da61a4e2ae117d6a1237a71235b40d9b2d33736d5fac7df09110bf77e6c4562ab2d1052a9a6
data/Gemfile CHANGED
@@ -1,9 +1,13 @@
1
1
  source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
+ eval_gemfile File.expand_path('../lib/Gemfile.shared', __dir__)
5
+
4
6
  gem 'ruby_event_store', path: '../ruby_event_store'
5
7
  gem 'rails_event_store_active_record', path: '../rails_event_store_active_record'
6
-
7
- if v = ENV['RAILS_VERSION']
8
- gem 'rails', v
9
- end
8
+ gem 'sqlite3', '1.3.13'
9
+ gem 'pg', '0.21'
10
+ gem 'mysql2', '0.4.10'
11
+ gem 'fakefs', '~> 0.11.2'
12
+ gem 'childprocess'
13
+ gem 'rails', ENV['RAILS_VERSION']
data/Makefile CHANGED
@@ -5,54 +5,18 @@ IGNORE =
5
5
  SUBJECT ?= RailsEventStoreActiveRecord::Legacy*
6
6
  DATABASE_URL ?= sqlite3::memory:
7
7
 
8
- install: ## Install gem dependencies
9
- @echo "Installing gem dependencies"
10
- @bundle install
11
- @BUNDLE_GEMFILE=../lib/Gemfile.0_18_2 bundle install
8
+ include ../lib/install.mk
9
+ include ../lib/test.mk
10
+ include ../lib/mutant.mk
11
+ include ../lib/gem.mk
12
+ include ../lib/help.mk
12
13
 
13
- remove-lock:
14
- @echo "Removing resolved dependency versions"
15
- -rm Gemfile.lock
16
- -rm ../lib/Gemfile.0_18_2.lock
17
-
18
- reinstall: remove-lock install ## Removing resolved dependency versions
19
-
20
- test: ## Run unit tests
21
- @echo "Running unit tests"
22
- @BUNDLE_GEMFILE=Gemfile bundle exec rspec
23
-
24
- mutate: test ## Run mutation tests
25
- @echo "Running mutation tests"
26
- @MUTATING=true BUNDLE_GEMFILE=Gemfile DATABASE_URL=$(DATABASE_URL) bundle exec mutant --include lib \
27
- $(addprefix --require ,$(REQUIRE)) \
28
- $(addprefix --ignore-subject ,$(IGNORE)) \
29
- --use rspec "$(SUBJECT)"
30
-
31
- mutate-fast: ## Run mutation tests with --fail-fast
32
- @echo "Running mutation tests with --fail-fast"
33
- @MUTATING=true BUNDLE_GEMFILE=Gemfile DATABASE_URL=$(DATABASE_URL) bundle exec mutant --include lib \
34
- $(addprefix --require ,$(REQUIRE)) \
35
- $(addprefix --ignore-subject ,$(IGNORE)) \
36
- --fail-fast \
37
- --use rspec "$(SUBJECT)"
14
+ install: install-gemfiles
38
15
 
39
- build:
40
- @echo "Building gem package"
41
- @gem build -V $(GEM_NAME).gemspec
42
- @mkdir -p pkg/
43
- @mv $(GEM_NAME)-$(GEM_VERSION).gem pkg/
16
+ remove-lock: remove-lockfiles
44
17
 
45
- push:
46
- @echo "Pushing package to RubyGems"
47
- @gem push -k dev_arkency pkg/$(GEM_NAME)-$(GEM_VERSION).gem
48
-
49
- clean:
50
- @echo "Removing previously built package"
51
- -rm pkg/$(GEM_NAME)-$(GEM_VERSION).gem
52
-
53
- help:
54
- @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
55
-
56
- .PHONY: help
57
- .DEFAULT_GOAL := help
18
+ install-gemfiles:
19
+ @BUNDLE_GEMFILE=../lib/Gemfile.0_18_2 bundle check || BUNDLE_GEMFILE=../lib/Gemfile.0_18_2 bundle install
58
20
 
21
+ remove-lockfiles:
22
+ -rm ../lib/Gemfile.0_18_2.lock
@@ -56,12 +56,7 @@ instead:
56
56
  end
57
57
 
58
58
  def read(spec)
59
- stream = LegacyEvent.order(id: order(spec))
60
- stream = stream.where(event_id: spec.with_ids) if spec.with_ids?
61
- stream = stream.where(event_type: spec.with_types) if spec.with_types?
62
- stream = stream.limit(spec.limit) if spec.limit?
63
- stream = stream.where(start_condition(spec)) unless spec.head?
64
- stream = stream.where(stream: spec.stream.name) unless spec.stream.global?
59
+ stream = read_scope(spec)
65
60
 
66
61
  if spec.batched?
67
62
  batch_reader = ->(offset, limit) { stream.offset(offset).limit(limit).map(&method(:build_event_entity)) }
@@ -75,6 +70,10 @@ instead:
75
70
  end
76
71
  end
77
72
 
73
+ def count(spec)
74
+ read_scope(spec).count
75
+ end
76
+
78
77
  def streams_of(event_id)
79
78
  LegacyEvent.where(event_id: event_id)
80
79
  .pluck(:stream)
@@ -83,6 +82,16 @@ instead:
83
82
 
84
83
  private
85
84
 
85
+ def read_scope(spec)
86
+ stream = LegacyEvent.order(id: order(spec))
87
+ stream = stream.where(event_id: spec.with_ids) if spec.with_ids?
88
+ stream = stream.where(event_type: spec.with_types) if spec.with_types?
89
+ stream = stream.limit(spec.limit) if spec.limit?
90
+ stream = stream.where(start_condition(spec)) unless spec.head?
91
+ stream = stream.where(stream: spec.stream.name) unless spec.stream.global?
92
+ stream
93
+ end
94
+
86
95
  def start_condition(specification)
87
96
  event_record =
88
97
  LegacyEvent.find_by!(event_id: specification.start)
@@ -64,8 +64,8 @@ class MigrateResSchemaV1ToV2 < ActiveRecord::Migration<%= migration_version %>
64
64
  create_table(:event_store_events, id: false, force: false) do |t|
65
65
  t.string :id, limit: 36, primary_key: true, null: false
66
66
  t.string :event_type, null: false
67
- t.text :metadata
68
- t.text :data, null: false
67
+ t.binary :metadata
68
+ t.binary :data, null: false
69
69
  t.datetime :created_at, null: false
70
70
  end
71
71
  add_index :event_store_events, :id, unique: true if rails_42
@@ -76,9 +76,18 @@ class MigrateResSchemaV1ToV2 < ActiveRecord::Migration<%= migration_version %>
76
76
  SELECT id, event_type, metadata, data, created_at FROM old_event_store_events;
77
77
  SQL
78
78
  drop_table :old_event_store_events
79
+ when "PostgreSQL"
80
+ execute "ALTER TABLE event_store_events ADD PRIMARY KEY (id);"
81
+ remove_index :event_store_events, name: :index_event_store_events_on_id
82
+ execute <<-SQL
83
+ ALTER TABLE event_store_events ALTER COLUMN data TYPE bytea USING convert_to(data, 'UTF8');
84
+ ALTER TABLE event_store_events ALTER COLUMN metadata TYPE bytea USING convert_to(metadata, 'UTF8');
85
+ SQL
79
86
  else
80
87
  execute "ALTER TABLE event_store_events ADD PRIMARY KEY (id);"
81
88
  remove_index :event_store_events, name: :index_event_store_events_on_id
89
+ change_column :event_store_events, :data, :binary
90
+ change_column :event_store_events, :metadata, :binary
82
91
  end
83
92
  end
84
93
 
@@ -1,5 +1,5 @@
1
1
  module RailsEventStoreActiveRecord
2
2
  module Legacy
3
- VERSION = "0.34.0"
3
+ VERSION = "0.35.0"
4
4
  end
5
5
  end
@@ -28,19 +28,8 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
30
 
31
- spec.add_development_dependency 'bundler', '~> 1.15'
32
- spec.add_development_dependency 'rake', '~> 10.0'
33
- spec.add_development_dependency 'rspec', '~> 3.6'
34
- spec.add_development_dependency 'rails', '~> 5.2'
35
- spec.add_development_dependency 'sqlite3', '1.3.13'
36
- spec.add_development_dependency 'pg', '0.21'
37
- spec.add_development_dependency 'mysql2', '0.4.10'
38
- spec.add_development_dependency 'fakefs', '~> 0.11.2'
39
- spec.add_development_dependency 'childprocess'
40
- spec.add_development_dependency 'mutant-rspec', '= 0.8.17'
41
-
42
- spec.add_dependency 'ruby_event_store', '= 0.34.0'
43
- spec.add_dependency 'rails_event_store_active_record', '= 0.34.0'
31
+ spec.add_dependency 'ruby_event_store', '= 0.35.0'
32
+ spec.add_dependency 'rails_event_store_active_record', '= 0.35.0'
44
33
  spec.add_dependency 'activesupport', '>= 3.0'
45
34
  spec.add_dependency 'activemodel', '>= 3.0'
46
35
  end
metadata CHANGED
@@ -1,183 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_event_store_active_record-legacy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.0
4
+ version: 0.35.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-23 00:00:00.000000000 Z
11
+ date: 2018-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.15'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.15'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.6'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.6'
55
- - !ruby/object:Gem::Dependency
56
- name: rails
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '5.2'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '5.2'
69
- - !ruby/object:Gem::Dependency
70
- name: sqlite3
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '='
74
- - !ruby/object:Gem::Version
75
- version: 1.3.13
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '='
81
- - !ruby/object:Gem::Version
82
- version: 1.3.13
83
- - !ruby/object:Gem::Dependency
84
- name: pg
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '='
88
- - !ruby/object:Gem::Version
89
- version: '0.21'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '='
95
- - !ruby/object:Gem::Version
96
- version: '0.21'
97
- - !ruby/object:Gem::Dependency
98
- name: mysql2
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '='
102
- - !ruby/object:Gem::Version
103
- version: 0.4.10
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '='
109
- - !ruby/object:Gem::Version
110
- version: 0.4.10
111
- - !ruby/object:Gem::Dependency
112
- name: fakefs
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 0.11.2
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.11.2
125
- - !ruby/object:Gem::Dependency
126
- name: childprocess
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: mutant-rspec
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - '='
144
- - !ruby/object:Gem::Version
145
- version: 0.8.17
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - '='
151
- - !ruby/object:Gem::Version
152
- version: 0.8.17
153
13
  - !ruby/object:Gem::Dependency
154
14
  name: ruby_event_store
155
15
  requirement: !ruby/object:Gem::Requirement
156
16
  requirements:
157
17
  - - '='
158
18
  - !ruby/object:Gem::Version
159
- version: 0.34.0
19
+ version: 0.35.0
160
20
  type: :runtime
161
21
  prerelease: false
162
22
  version_requirements: !ruby/object:Gem::Requirement
163
23
  requirements:
164
24
  - - '='
165
25
  - !ruby/object:Gem::Version
166
- version: 0.34.0
26
+ version: 0.35.0
167
27
  - !ruby/object:Gem::Dependency
168
28
  name: rails_event_store_active_record
169
29
  requirement: !ruby/object:Gem::Requirement
170
30
  requirements:
171
31
  - - '='
172
32
  - !ruby/object:Gem::Version
173
- version: 0.34.0
33
+ version: 0.35.0
174
34
  type: :runtime
175
35
  prerelease: false
176
36
  version_requirements: !ruby/object:Gem::Requirement
177
37
  requirements:
178
38
  - - '='
179
39
  - !ruby/object:Gem::Version
180
- version: 0.34.0
40
+ version: 0.35.0
181
41
  - !ruby/object:Gem::Dependency
182
42
  name: activesupport
183
43
  requirement: !ruby/object:Gem::Requirement