rails_event_store_active_record 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/rails_event_store_active_record/event_repository.rb +3 -9
- data/lib/rails_event_store_active_record/generators/migration_generator.rb +1 -6
- data/lib/rails_event_store_active_record/version.rb +1 -1
- data/lib/rails_event_store_active_record.rb +0 -3
- metadata +20 -49
- data/CHANGELOG.md +0 -75
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -245
- data/Gemfile.rails_5_0 +0 -13
- data/Gemfile.rails_5_0.lock +0 -217
- data/Gemfile.rails_5_1 +0 -13
- data/Gemfile.rails_5_1.lock +0 -217
- data/Gemfile.rails_5_2 +0 -13
- data/Gemfile.rails_5_2.lock +0 -225
- data/Gemfile.rails_6_0 +0 -13
- data/Gemfile.rails_6_0.lock +0 -241
- data/Makefile +0 -21
- data/lib/rails_event_store_active_record/generators/add_valid_at_generator.rb +0 -31
- data/lib/rails_event_store_active_record/generators/created_at_precision_generator.rb +0 -31
- data/lib/rails_event_store_active_record/generators/no_global_stream_entries_generator.rb +0 -29
- data/lib/rails_event_store_active_record/generators/templates/add_valid_at_template.rb +0 -14
- data/lib/rails_event_store_active_record/generators/templates/created_at_precision_template.rb +0 -45
- data/lib/rails_event_store_active_record/generators/templates/no_global_stream_entries_template.rb +0 -59
- data/rails_event_store_active_record.gemspec +0 -30
data/Gemfile.rails_6_0.lock
DELETED
@@ -1,241 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ../ruby_event_store
|
3
|
-
specs:
|
4
|
-
ruby_event_store (2.0.1)
|
5
|
-
concurrent-ruby (~> 1.0, >= 1.1.6)
|
6
|
-
|
7
|
-
PATH
|
8
|
-
remote: .
|
9
|
-
specs:
|
10
|
-
rails_event_store_active_record (2.0.1)
|
11
|
-
activemodel (>= 3.0)
|
12
|
-
activerecord-import (>= 1.0.2)
|
13
|
-
activesupport (>= 3.0)
|
14
|
-
ruby_event_store (= 2.0.1)
|
15
|
-
|
16
|
-
GEM
|
17
|
-
remote: https://rubygems.org/
|
18
|
-
remote: https://oss:7AXfeZdAfCqL1PvHm2nvDJO6Zd9UW8IK@gem.mutant.dev/
|
19
|
-
specs:
|
20
|
-
abstract_type (0.0.7)
|
21
|
-
actioncable (6.0.3.4)
|
22
|
-
actionpack (= 6.0.3.4)
|
23
|
-
nio4r (~> 2.0)
|
24
|
-
websocket-driver (>= 0.6.1)
|
25
|
-
actionmailbox (6.0.3.4)
|
26
|
-
actionpack (= 6.0.3.4)
|
27
|
-
activejob (= 6.0.3.4)
|
28
|
-
activerecord (= 6.0.3.4)
|
29
|
-
activestorage (= 6.0.3.4)
|
30
|
-
activesupport (= 6.0.3.4)
|
31
|
-
mail (>= 2.7.1)
|
32
|
-
actionmailer (6.0.3.4)
|
33
|
-
actionpack (= 6.0.3.4)
|
34
|
-
actionview (= 6.0.3.4)
|
35
|
-
activejob (= 6.0.3.4)
|
36
|
-
mail (~> 2.5, >= 2.5.4)
|
37
|
-
rails-dom-testing (~> 2.0)
|
38
|
-
actionpack (6.0.3.4)
|
39
|
-
actionview (= 6.0.3.4)
|
40
|
-
activesupport (= 6.0.3.4)
|
41
|
-
rack (~> 2.0, >= 2.0.8)
|
42
|
-
rack-test (>= 0.6.3)
|
43
|
-
rails-dom-testing (~> 2.0)
|
44
|
-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
45
|
-
actiontext (6.0.3.4)
|
46
|
-
actionpack (= 6.0.3.4)
|
47
|
-
activerecord (= 6.0.3.4)
|
48
|
-
activestorage (= 6.0.3.4)
|
49
|
-
activesupport (= 6.0.3.4)
|
50
|
-
nokogiri (>= 1.8.5)
|
51
|
-
actionview (6.0.3.4)
|
52
|
-
activesupport (= 6.0.3.4)
|
53
|
-
builder (~> 3.1)
|
54
|
-
erubi (~> 1.4)
|
55
|
-
rails-dom-testing (~> 2.0)
|
56
|
-
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
57
|
-
activejob (6.0.3.4)
|
58
|
-
activesupport (= 6.0.3.4)
|
59
|
-
globalid (>= 0.3.6)
|
60
|
-
activemodel (6.0.3.4)
|
61
|
-
activesupport (= 6.0.3.4)
|
62
|
-
activerecord (6.0.3.4)
|
63
|
-
activemodel (= 6.0.3.4)
|
64
|
-
activesupport (= 6.0.3.4)
|
65
|
-
activerecord-import (1.0.7)
|
66
|
-
activerecord (>= 3.2)
|
67
|
-
activestorage (6.0.3.4)
|
68
|
-
actionpack (= 6.0.3.4)
|
69
|
-
activejob (= 6.0.3.4)
|
70
|
-
activerecord (= 6.0.3.4)
|
71
|
-
marcel (~> 0.3.1)
|
72
|
-
activesupport (6.0.3.4)
|
73
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
74
|
-
i18n (>= 0.7, < 2)
|
75
|
-
minitest (~> 5.1)
|
76
|
-
tzinfo (~> 1.1)
|
77
|
-
zeitwerk (~> 2.2, >= 2.2.2)
|
78
|
-
adamantium (0.2.0)
|
79
|
-
ice_nine (~> 0.11.0)
|
80
|
-
memoizable (~> 0.4.0)
|
81
|
-
anima (0.3.2)
|
82
|
-
abstract_type (~> 0.0.7)
|
83
|
-
adamantium (~> 0.2)
|
84
|
-
equalizer (~> 0.0.11)
|
85
|
-
ast (2.4.1)
|
86
|
-
builder (3.2.4)
|
87
|
-
childprocess (4.0.0)
|
88
|
-
concord (0.1.6)
|
89
|
-
adamantium (~> 0.2.0)
|
90
|
-
equalizer (~> 0.0.9)
|
91
|
-
concurrent-ruby (1.1.7)
|
92
|
-
crass (1.0.6)
|
93
|
-
diff-lcs (1.4.4)
|
94
|
-
equalizer (0.0.11)
|
95
|
-
erubi (1.10.0)
|
96
|
-
fakefs (1.3.0)
|
97
|
-
globalid (0.4.2)
|
98
|
-
activesupport (>= 4.2.0)
|
99
|
-
i18n (1.8.5)
|
100
|
-
concurrent-ruby (~> 1.0)
|
101
|
-
ice_nine (0.11.2)
|
102
|
-
loofah (2.8.0)
|
103
|
-
crass (~> 1.0.2)
|
104
|
-
nokogiri (>= 1.5.9)
|
105
|
-
mail (2.7.1)
|
106
|
-
mini_mime (>= 0.1.1)
|
107
|
-
marcel (0.3.3)
|
108
|
-
mimemagic (~> 0.3.2)
|
109
|
-
memoizable (0.4.2)
|
110
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
111
|
-
method_source (1.0.0)
|
112
|
-
mimemagic (0.3.5)
|
113
|
-
mini_mime (1.0.2)
|
114
|
-
mini_portile2 (2.4.0)
|
115
|
-
minitest (5.14.2)
|
116
|
-
mprelude (0.1.0)
|
117
|
-
abstract_type (~> 0.0.7)
|
118
|
-
adamantium (~> 0.2.0)
|
119
|
-
concord (~> 0.1.5)
|
120
|
-
equalizer (~> 0.0.9)
|
121
|
-
ice_nine (~> 0.11.1)
|
122
|
-
procto (~> 0.0.2)
|
123
|
-
mutant (0.10.22)
|
124
|
-
abstract_type (~> 0.0.7)
|
125
|
-
adamantium (~> 0.2.0)
|
126
|
-
anima (~> 0.3.1)
|
127
|
-
ast (~> 2.2)
|
128
|
-
concord (~> 0.1.5)
|
129
|
-
diff-lcs (~> 1.3)
|
130
|
-
equalizer (~> 0.0.9)
|
131
|
-
ice_nine (~> 0.11.1)
|
132
|
-
memoizable (~> 0.4.2)
|
133
|
-
mprelude (~> 0.1.0)
|
134
|
-
parser (~> 3.0.0)
|
135
|
-
procto (~> 0.0.2)
|
136
|
-
unparser (~> 0.5.6)
|
137
|
-
variable (~> 0.0.1)
|
138
|
-
mutant-license (0.1.1.2.1627430819213747598431630701693729869473.0)
|
139
|
-
mutant-rspec (0.10.22)
|
140
|
-
mutant (= 0.10.22)
|
141
|
-
rspec-core (>= 3.8.0, < 4.0.0)
|
142
|
-
mysql2 (0.5.3)
|
143
|
-
nio4r (2.5.4)
|
144
|
-
nokogiri (1.10.10)
|
145
|
-
mini_portile2 (~> 2.4.0)
|
146
|
-
parser (3.0.0.0)
|
147
|
-
ast (~> 2.4.1)
|
148
|
-
pg (1.2.3)
|
149
|
-
procto (0.0.3)
|
150
|
-
rack (2.2.3)
|
151
|
-
rack-test (1.1.0)
|
152
|
-
rack (>= 1.0, < 3)
|
153
|
-
rails (6.0.3.4)
|
154
|
-
actioncable (= 6.0.3.4)
|
155
|
-
actionmailbox (= 6.0.3.4)
|
156
|
-
actionmailer (= 6.0.3.4)
|
157
|
-
actionpack (= 6.0.3.4)
|
158
|
-
actiontext (= 6.0.3.4)
|
159
|
-
actionview (= 6.0.3.4)
|
160
|
-
activejob (= 6.0.3.4)
|
161
|
-
activemodel (= 6.0.3.4)
|
162
|
-
activerecord (= 6.0.3.4)
|
163
|
-
activestorage (= 6.0.3.4)
|
164
|
-
activesupport (= 6.0.3.4)
|
165
|
-
bundler (>= 1.3.0)
|
166
|
-
railties (= 6.0.3.4)
|
167
|
-
sprockets-rails (>= 2.0.0)
|
168
|
-
rails-dom-testing (2.0.3)
|
169
|
-
activesupport (>= 4.2.0)
|
170
|
-
nokogiri (>= 1.6)
|
171
|
-
rails-html-sanitizer (1.3.0)
|
172
|
-
loofah (~> 2.3)
|
173
|
-
railties (6.0.3.4)
|
174
|
-
actionpack (= 6.0.3.4)
|
175
|
-
activesupport (= 6.0.3.4)
|
176
|
-
method_source
|
177
|
-
rake (>= 0.8.7)
|
178
|
-
thor (>= 0.20.3, < 2.0)
|
179
|
-
rake (13.0.3)
|
180
|
-
rspec (3.10.0)
|
181
|
-
rspec-core (~> 3.10.0)
|
182
|
-
rspec-expectations (~> 3.10.0)
|
183
|
-
rspec-mocks (~> 3.10.0)
|
184
|
-
rspec-core (3.10.1)
|
185
|
-
rspec-support (~> 3.10.0)
|
186
|
-
rspec-expectations (3.10.1)
|
187
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
188
|
-
rspec-support (~> 3.10.0)
|
189
|
-
rspec-mocks (3.10.1)
|
190
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
191
|
-
rspec-support (~> 3.10.0)
|
192
|
-
rspec-support (3.10.1)
|
193
|
-
sprockets (4.0.2)
|
194
|
-
concurrent-ruby (~> 1.0)
|
195
|
-
rack (> 1, < 3)
|
196
|
-
sprockets-rails (3.2.2)
|
197
|
-
actionpack (>= 4.0)
|
198
|
-
activesupport (>= 4.0)
|
199
|
-
sprockets (>= 3.0.0)
|
200
|
-
sqlite3 (1.4.2)
|
201
|
-
thor (1.0.1)
|
202
|
-
thread_safe (0.3.6)
|
203
|
-
tzinfo (1.2.9)
|
204
|
-
thread_safe (~> 0.1)
|
205
|
-
unparser (0.5.6)
|
206
|
-
abstract_type (~> 0.0.7)
|
207
|
-
adamantium (~> 0.2.0)
|
208
|
-
anima (~> 0.3.1)
|
209
|
-
concord (~> 0.1.5)
|
210
|
-
diff-lcs (~> 1.3)
|
211
|
-
equalizer (~> 0.0.9)
|
212
|
-
mprelude (~> 0.1.0)
|
213
|
-
parser (>= 3.0.0)
|
214
|
-
procto (~> 0.0.2)
|
215
|
-
variable (0.0.1)
|
216
|
-
equalizer (~> 0.0.11)
|
217
|
-
websocket-driver (0.7.3)
|
218
|
-
websocket-extensions (>= 0.1.0)
|
219
|
-
websocket-extensions (0.1.5)
|
220
|
-
zeitwerk (2.4.2)
|
221
|
-
|
222
|
-
PLATFORMS
|
223
|
-
ruby
|
224
|
-
|
225
|
-
DEPENDENCIES
|
226
|
-
childprocess
|
227
|
-
fakefs (~> 1.3)
|
228
|
-
mutant (~> 0.10.21)
|
229
|
-
mutant-license!
|
230
|
-
mutant-rspec (~> 0.10.21)
|
231
|
-
mysql2 (= 0.5.3)
|
232
|
-
pg (= 1.2.3)
|
233
|
-
rails (= 6.0.3.4)
|
234
|
-
rails_event_store_active_record!
|
235
|
-
rake (>= 10.0)
|
236
|
-
rspec (~> 3.6)
|
237
|
-
ruby_event_store!
|
238
|
-
sqlite3 (= 1.4.2)
|
239
|
-
|
240
|
-
BUNDLED WITH
|
241
|
-
2.1.4
|
data/Makefile
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
GEM_VERSION = $(shell cat ../RES_VERSION)
|
2
|
-
GEM_NAME = rails_event_store_active_record
|
3
|
-
REQUIRE = $(GEM_NAME)
|
4
|
-
IGNORE = RailsEventStoreActiveRecord::IndexViolationDetector\#initialize \
|
5
|
-
RailsEventStoreActiveRecord::IndexViolationDetector\#detect \
|
6
|
-
RailsEventStoreActiveRecord::IndexViolationDetector\#detect_mysql \
|
7
|
-
RailsEventStoreActiveRecord::IndexViolationDetector\#detect_postgres \
|
8
|
-
RailsEventStoreActiveRecord::PgLinearizedEventRepository* \
|
9
|
-
RailsEventStoreActiveRecord::EventRepository\#update_messages \
|
10
|
-
RailsEventStoreActiveRecord::WithAbstractBaseClass\#build_event_klass \
|
11
|
-
RailsEventStoreActiveRecord::WithAbstractBaseClass\#build_stream_klass
|
12
|
-
|
13
|
-
SUBJECT ?= RailsEventStoreActiveRecord*
|
14
|
-
DATABASE_URL ?= sqlite3::memory:
|
15
|
-
|
16
|
-
include ../support/make/install.mk
|
17
|
-
include ../support/make/test.mk
|
18
|
-
include ../support/make/mutant.mk
|
19
|
-
include ../support/make/gem.mk
|
20
|
-
include ../support/make/help.mk
|
21
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'rails/generators'
|
5
|
-
rescue LoadError
|
6
|
-
end
|
7
|
-
|
8
|
-
module RailsEventStoreActiveRecord
|
9
|
-
class AddValidAtGenerator < Rails::Generators::Base
|
10
|
-
source_root File.expand_path(File.join(File.dirname(__FILE__), '../generators/templates'))
|
11
|
-
|
12
|
-
def create_migration
|
13
|
-
template "add_valid_at_template.rb", "db/migrate/#{timestamp}_add_valid_at.rb"
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def rails_version
|
19
|
-
Rails::VERSION::STRING
|
20
|
-
end
|
21
|
-
|
22
|
-
def migration_version
|
23
|
-
return nil if Gem::Version.new(rails_version) < Gem::Version.new("5.0.0")
|
24
|
-
"[4.2]"
|
25
|
-
end
|
26
|
-
|
27
|
-
def timestamp
|
28
|
-
Time.now.strftime("%Y%m%d%H%M%S")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end if defined?(Rails::Generators::Base)
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'rails/generators'
|
5
|
-
rescue LoadError
|
6
|
-
end
|
7
|
-
|
8
|
-
module RailsEventStoreActiveRecord
|
9
|
-
class CreatedAtPrecisionGenerator < Rails::Generators::Base
|
10
|
-
source_root File.expand_path(File.join(File.dirname(__FILE__), '../generators/templates'))
|
11
|
-
|
12
|
-
def create_migration
|
13
|
-
template "created_at_precision_template.rb", "db/migrate/#{timestamp}_created_at_precision.rb"
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def rails_version
|
19
|
-
Rails::VERSION::STRING
|
20
|
-
end
|
21
|
-
|
22
|
-
def migration_version
|
23
|
-
return nil if Gem::Version.new(rails_version) < Gem::Version.new("5.0.0")
|
24
|
-
"[4.2]"
|
25
|
-
end
|
26
|
-
|
27
|
-
def timestamp
|
28
|
-
Time.now.strftime("%Y%m%d%H%M%S")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end if defined?(Rails::Generators::Base)
|
@@ -1,29 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'rails/generators'
|
3
|
-
rescue LoadError
|
4
|
-
end
|
5
|
-
|
6
|
-
module RailsEventStoreActiveRecord
|
7
|
-
class NoGlobalStreamEntriesGenerator < Rails::Generators::Base
|
8
|
-
source_root File.expand_path(File.join(File.dirname(__FILE__), '../generators/templates'))
|
9
|
-
|
10
|
-
def create_migration
|
11
|
-
template "no_global_stream_entries_template.rb", "db/migrate/#{timestamp}_no_global_stream_entries.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)
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class AddValidAt < ActiveRecord::Migration<%= migration_version %>
|
4
|
-
def change
|
5
|
-
case ActiveRecord::Base.connection.adapter_name
|
6
|
-
when "PostgreSQL"
|
7
|
-
add_column :event_store_events, :valid_at, :datetime, null: true
|
8
|
-
else
|
9
|
-
add_column :event_store_events, :valid_at, :datetime, precision: 6, null: true
|
10
|
-
end
|
11
|
-
|
12
|
-
add_index :event_store_events, :valid_at
|
13
|
-
end
|
14
|
-
end
|
data/lib/rails_event_store_active_record/generators/templates/created_at_precision_template.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class CreatedAtPrecision < ActiveRecord::Migration<%= migration_version %>
|
4
|
-
def change
|
5
|
-
case ActiveRecord::Base.connection.adapter_name
|
6
|
-
when "SQLite"
|
7
|
-
rename_table :event_store_events, :old_event_store_events
|
8
|
-
create_table(:event_store_events, id: false, force: false) do |t|
|
9
|
-
t.string :id, limit: 36, primary_key: true, null: false
|
10
|
-
t.string :event_type, null: false
|
11
|
-
t.binary :metadata
|
12
|
-
t.binary :data, null: false
|
13
|
-
t.datetime :created_at, null: false, precision: 6
|
14
|
-
end
|
15
|
-
add_index :event_store_events, :created_at
|
16
|
-
add_index :event_store_events, :event_type
|
17
|
-
execute <<-SQL
|
18
|
-
INSERT INTO event_store_events(id, event_type, metadata, data, created_at)
|
19
|
-
SELECT id, event_type, metadata, data, created_at FROM old_event_store_events;
|
20
|
-
SQL
|
21
|
-
drop_table :old_event_store_events
|
22
|
-
|
23
|
-
rename_table :event_store_events_in_streams, :old_event_store_events_in_streams
|
24
|
-
create_table(:event_store_events_in_streams, force: false) do |t|
|
25
|
-
t.string :stream, null: false
|
26
|
-
t.integer :position, null: true
|
27
|
-
t.references :event, null: false, type: :string, limit: 36
|
28
|
-
t.datetime :created_at, null: false, precision: 6
|
29
|
-
end
|
30
|
-
add_index :event_store_events_in_streams, [:stream, :position], unique: true
|
31
|
-
add_index :event_store_events_in_streams, [:created_at]
|
32
|
-
add_index :event_store_events_in_streams, [:stream, :event_id], unique: true
|
33
|
-
|
34
|
-
execute <<-SQL
|
35
|
-
INSERT INTO event_store_events_in_streams(id, stream, position, event_id, created_at)
|
36
|
-
SELECT id, stream, position, event_id, created_at FROM old_event_store_events_in_streams;
|
37
|
-
SQL
|
38
|
-
drop_table :old_event_store_events_in_streams
|
39
|
-
when "PostgreSQL"
|
40
|
-
else
|
41
|
-
change_column :event_store_events, :created_at, :datetime, precision: 6
|
42
|
-
change_column :event_store_events_in_streams, :created_at, :datetime, precision: 6
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/rails_event_store_active_record/generators/templates/no_global_stream_entries_template.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
class NoGlobalStreamEntries < ActiveRecord::Migration<%= migration_version %>
|
2
|
-
def change
|
3
|
-
case ActiveRecord::Base.connection.adapter_name
|
4
|
-
when "SQLite"
|
5
|
-
rename_table :event_store_events, :old_event_store_events
|
6
|
-
create_table(:event_store_events, force: false) do |t|
|
7
|
-
t.references :event, null: false, type: :string, limit: 36
|
8
|
-
t.string :event_type, null: false
|
9
|
-
t.binary :metadata
|
10
|
-
t.binary :data, null: false
|
11
|
-
t.datetime :created_at, precision: 6, null: false
|
12
|
-
t.datetime :valid_at, precision: 6, null: true
|
13
|
-
end
|
14
|
-
add_index :event_store_events, :event_id, unique: true
|
15
|
-
add_index :event_store_events, :created_at
|
16
|
-
add_index :event_store_events, :valid_at
|
17
|
-
add_index :event_store_events, :event_type
|
18
|
-
|
19
|
-
execute <<-SQL
|
20
|
-
INSERT INTO event_store_events(event_id, event_type, metadata, data, created_at)
|
21
|
-
SELECT id, event_type, metadata, data, created_at FROM old_event_store_events;
|
22
|
-
SQL
|
23
|
-
drop_table :old_event_store_events
|
24
|
-
when "PostgreSQL"
|
25
|
-
rename_column :event_store_events, :id, :event_id
|
26
|
-
change_column_default :event_store_events, :event_id, nil
|
27
|
-
add_column :event_store_events, :id, :serial
|
28
|
-
|
29
|
-
execute <<~SQL
|
30
|
-
UPDATE event_store_events
|
31
|
-
SET id = event_store_events_in_streams.id
|
32
|
-
FROM event_store_events_in_streams
|
33
|
-
WHERE event_store_events.event_id = event_store_events_in_streams.event_id AND event_store_events_in_streams.stream = 'all';
|
34
|
-
UPDATE event_store_events
|
35
|
-
SET id = ese.new_id
|
36
|
-
FROM (SELECT id, row_number() OVER (ORDER BY id) AS new_id FROM event_store_events) ese
|
37
|
-
WHERE event_store_events.id = ese.id;
|
38
|
-
SELECT setval(pg_get_serial_sequence('event_store_events', 'id'), max(id)) FROM event_store_events;
|
39
|
-
ALTER TABLE event_store_events DROP CONSTRAINT event_store_events_pkey;
|
40
|
-
ALTER TABLE event_store_events ADD PRIMARY KEY (id);
|
41
|
-
SQL
|
42
|
-
add_index :event_store_events, :event_id, unique: true
|
43
|
-
else
|
44
|
-
rename_column :event_store_events, :id, :event_id
|
45
|
-
add_column :event_store_events, :id, :integer
|
46
|
-
|
47
|
-
execute <<-SQL
|
48
|
-
UPDATE event_store_events
|
49
|
-
INNER JOIN event_store_events_in_streams ON (event_store_events.event_id = event_store_events_in_streams.event_id)
|
50
|
-
SET event_store_events.id = event_store_events_in_streams.id
|
51
|
-
WHERE event_store_events_in_streams.stream = 'all';
|
52
|
-
SQL
|
53
|
-
execute "SET @row_number = 0"
|
54
|
-
execute "UPDATE event_store_events SET event_store_events.id = (@row_number:=@row_number + 1) ORDER BY id"
|
55
|
-
execute "ALTER TABLE event_store_events DROP PRIMARY KEY, ADD PRIMARY KEY (id), MODIFY id INT AUTO_INCREMENT"
|
56
|
-
add_index :event_store_events, :event_id, unique: true
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'rails_event_store_active_record/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'rails_event_store_active_record'
|
8
|
-
spec.version = RailsEventStoreActiveRecord::VERSION
|
9
|
-
spec.licenses = ['MIT']
|
10
|
-
spec.authors = ['Arkency']
|
11
|
-
spec.email = ['dev@arkency.com']
|
12
|
-
|
13
|
-
spec.summary = %q{Active Record events repository for Rails Event Store}
|
14
|
-
spec.description = %q{Implementation of events repository based on Rails Active Record for Rails Event Store}
|
15
|
-
spec.homepage = 'https://railseventstore.org'
|
16
|
-
spec.metadata = {
|
17
|
-
"homepage_uri" => "https://railseventstore.org/",
|
18
|
-
"changelog_uri" => "https://github.com/RailsEventStore/rails_event_store/releases",
|
19
|
-
"source_code_uri" => "https://github.com/RailsEventStore/rails_event_store",
|
20
|
-
"bug_tracker_uri" => "https://github.com/RailsEventStore/rails_event_store/issues",
|
21
|
-
}
|
22
|
-
|
23
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test/|spec/|features/|.mutant.yml)}) }
|
24
|
-
spec.require_paths = ['lib']
|
25
|
-
|
26
|
-
spec.add_dependency 'ruby_event_store', '= 2.0.2'
|
27
|
-
spec.add_dependency 'activesupport', '>= 3.0'
|
28
|
-
spec.add_dependency 'activemodel', '>= 3.0'
|
29
|
-
spec.add_dependency 'activerecord-import', '>= 1.0.2'
|
30
|
-
end
|