rails_event_store_active_record 0.35.0 → 0.36.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36a5383474a79cf9cbc254f18f21d93042303fb02bcad2a055808c91fec35495
|
4
|
+
data.tar.gz: 99e12ab33094ea9873b2bd203d8d43976f5eb86ce968ea04f81dd1ad1b8fc895
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fe6b41a3bbdeb22692c0ab73c52afab4c9cb5da1dd34b5e9a40b9d38f79c9d987469c9e735503d13e4dee9a7c07c9d9b1ccc045d361e537c4ee48a096995e58
|
7
|
+
data.tar.gz: 63ec9fd3e10431d8cdfb7eef15101c76d7669a5b10cec837da0340f04592722e330476ce6d2b6c98af6df5cda19e5e9bd468e05891f90d5051c56c52badcdde5
|
data/Makefile
CHANGED
@@ -20,7 +20,9 @@ remove-lock: remove-lockfiles
|
|
20
20
|
install-gemfiles:
|
21
21
|
@BUNDLE_GEMFILE=../lib/Gemfile.0_33_0 bundle check || BUNDLE_GEMFILE=../lib/Gemfile.0_33_0 bundle install
|
22
22
|
@BUNDLE_GEMFILE=../lib/Gemfile.0_34_0 bundle check || BUNDLE_GEMFILE=../lib/Gemfile.0_34_0 bundle install
|
23
|
+
@BUNDLE_GEMFILE=../lib/Gemfile.0_35_0 bundle check || BUNDLE_GEMFILE=../lib/Gemfile.0_35_0 bundle install
|
23
24
|
|
24
25
|
remove-lockfiles:
|
25
26
|
-rm ../lib/Gemfile.0_33_0.lock
|
26
27
|
-rm ../lib/Gemfile.0_34_0.lock
|
28
|
+
-rm ../lib/Gemfile.0_35_0.lock
|
@@ -6,38 +6,60 @@ module RailsEventStoreActiveRecord
|
|
6
6
|
|
7
7
|
class CorrectSchemaVerifier
|
8
8
|
def verify
|
9
|
-
|
10
|
-
|
9
|
+
with_connection do
|
10
|
+
return if no_tables_yet? || correct_schema?
|
11
|
+
raise_invalid_db_schema
|
12
|
+
end
|
11
13
|
end
|
12
14
|
|
13
15
|
private
|
14
16
|
|
17
|
+
def with_connection(&block)
|
18
|
+
return unless connected?
|
19
|
+
block.call
|
20
|
+
end
|
21
|
+
|
15
22
|
def connected?
|
16
23
|
ActiveRecord::Base.connected?
|
17
24
|
end
|
18
25
|
|
19
|
-
def
|
20
|
-
|
26
|
+
def correct_schema?
|
27
|
+
correct_events_schema? && correct_streams_schema?
|
28
|
+
end
|
29
|
+
|
30
|
+
def correct_events_schema?
|
31
|
+
table_exists?(:event_store_events) &&
|
32
|
+
event_store_events_columns.eql?(current_columns(:event_store_events))
|
33
|
+
end
|
34
|
+
|
35
|
+
def correct_streams_schema?
|
36
|
+
table_exists?(:event_store_events_in_streams) &&
|
37
|
+
event_store_events_in_streams_columns.eql?(current_columns(:event_store_events_in_streams))
|
38
|
+
end
|
39
|
+
|
40
|
+
def table_exists?(table_name)
|
41
|
+
ActiveRecord::Base.connection.table_exists?(table_name)
|
21
42
|
end
|
22
43
|
|
23
44
|
def raise_invalid_db_schema
|
24
45
|
raise EventRepository::InvalidDatabaseSchema.new(incorrect_schema_message)
|
25
46
|
end
|
26
47
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
"data",
|
35
|
-
"created_at"
|
36
|
-
]
|
48
|
+
def no_tables_yet?
|
49
|
+
!table_exists?('event_store_events') &&
|
50
|
+
!table_exists?('event_store_events_in_streams')
|
51
|
+
end
|
52
|
+
|
53
|
+
def event_store_events_columns
|
54
|
+
%w(id event_type metadata data created_at)
|
37
55
|
end
|
38
56
|
|
39
|
-
def
|
40
|
-
|
57
|
+
def event_store_events_in_streams_columns
|
58
|
+
%w(id stream position event_id created_at)
|
59
|
+
end
|
60
|
+
|
61
|
+
def current_columns(table_name)
|
62
|
+
ActiveRecord::Base.connection.columns(table_name).map(&:name)
|
41
63
|
end
|
42
64
|
|
43
65
|
def incorrect_schema_message
|
@@ -45,30 +67,9 @@ module RailsEventStoreActiveRecord
|
|
45
67
|
Oh no!
|
46
68
|
|
47
69
|
It seems you're using RailsEventStoreActiveRecord::EventRepository
|
48
|
-
with
|
49
|
-
|
50
|
-
We've redesigned database structure in order to fix several concurrency-related
|
51
|
-
bugs. This repository is intended to work on that improved data layout.
|
52
|
-
|
53
|
-
We've prepared migration that would take you from old schema to new one.
|
54
|
-
This migration must be run offline -- take that into consideration:
|
55
|
-
|
56
|
-
rails g rails_event_store_active_record:v1_v2_migration
|
57
|
-
rake db:migrate
|
58
|
-
|
59
|
-
|
60
|
-
If you cannot migrate right now -- you can for some time continue using
|
61
|
-
old repository. In order to do so:
|
62
|
-
1. install 'rails_event_store_active_record-legacy' gem
|
63
|
-
2. change configuration accordingly:
|
64
|
-
|
65
|
-
require 'rails_event_store_active_record/legacy'
|
66
|
-
|
67
|
-
config.event_store = RailsEventStore::Client.new(
|
68
|
-
repository: RailsEventStoreActiveRecord::Legacy::EventRepository.new
|
69
|
-
)
|
70
|
-
|
70
|
+
with incompatible database schema.
|
71
71
|
|
72
|
+
See release notes how to migrate to current database schema.
|
72
73
|
MESSAGE
|
73
74
|
end
|
74
75
|
end
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ['lib']
|
27
27
|
|
28
|
-
spec.add_dependency 'ruby_event_store', '= 0.
|
28
|
+
spec.add_dependency 'ruby_event_store', '= 0.36.0'
|
29
29
|
spec.add_dependency 'activesupport', '>= 3.0'
|
30
30
|
spec.add_dependency 'activemodel', '>= 3.0'
|
31
31
|
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.36.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby_event_store
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.36.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.36.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
|
124
|
-
rubygems_version: 2.7.6
|
123
|
+
rubygems_version: 3.0.2
|
125
124
|
signing_key:
|
126
125
|
specification_version: 4
|
127
126
|
summary: Active Record events repository for Rails Event Store
|