Skip to content

Commit b8f5122

Browse files
authored
Merge pull request #158 from RailsEventStore/failing_migration_by_default
Raise an exception by default in a migration
2 parents d23640e + 769f4f3 commit b8f5122

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

rails_event_store_active_record/lib/rails_event_store_active_record/generators/templates/v1_v2_migration_template.rb

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
# This migration is not intended for live migration
2-
# It assumes no data is added at that time.
1+
# This migration is not intended for live data migration
2+
# It assumes no data is added at when it is running.
3+
# So stop your application servers from accepting new requests
4+
# and processing background jobs before running
5+
36
# Make sure you have a backup before running on production
47

58
# 10_000_000 distinct stream names
6-
# can cause around 2GB of usage
9+
# can cause around 2GB of RAM usage
710
# make sure you can run this migration on your production system
811
class MigrateResSchemaV1ToV2 < ActiveRecord::Migration<%= migration_version %>
912
def up
@@ -81,11 +84,14 @@ def preserve_positions?(stream_name)
8184
# http://railseventstore.org/docs/expected_version/
8285
#
8386
# return true if you use given stream for event sourcing
87+
# (especially with AggregateRoot gem)
8488
# return true if you use an Integer or :none as
8589
# expected_version when publishing in this stream
8690
#
8791
# return false if use use :any (the default) as expected_version
8892
# when publishing to this stream
89-
false
93+
94+
raise NotImplementedError
95+
# false
9096
end
9197
end

0 commit comments

Comments
 (0)