Module: Sequent
- Defined in:
- lib/sequent/migrations/migrate_events.rb,
lib/version.rb,
lib/sequent/sequent.rb,
lib/sequent/core/event.rb,
lib/sequent/rake/tasks.rb,
lib/sequent/util/timer.rb,
lib/sequent/core/command.rb,
lib/sequent/util/dry_run.rb,
lib/sequent/util/printer.rb,
lib/sequent/configuration.rb,
lib/sequent/core/workflow.rb,
lib/sequent/core/projector.rb,
lib/sequent/migrations/sql.rb,
lib/sequent/core/sequent_oj.rb,
lib/sequent/generator/event.rb,
lib/sequent/core/event_store.rb,
lib/sequent/support/database.rb,
lib/sequent/core/event_record.rb,
lib/sequent/core/value_object.rb,
lib/sequent/generator/command.rb,
lib/sequent/generator/project.rb,
lib/sequent/application_record.rb,
lib/sequent/core/current_event.rb,
lib/sequent/core/stream_record.rb,
lib/sequent/migrations/planner.rb,
lib/sequent/core/aggregate_root.rb,
lib/sequent/core/command_record.rb,
lib/sequent/core/helpers/secret.rb,
lib/sequent/generator/aggregate.rb,
lib/sequent/migrations/executor.rb,
lib/sequent/support/view_schema.rb,
lib/sequent/core/aggregate_roots.rb,
lib/sequent/core/command_service.rb,
lib/sequent/core/event_publisher.rb,
lib/sequent/migrations/functions.rb,
lib/sequent/rake/migration_tasks.rb,
lib/sequent/test/time_comparison.rb,
lib/sequent/core/helpers/copyable.rb,
lib/sequent/core/helpers/mergable.rb,
lib/sequent/migrations/migrations.rb,
lib/sequent/migrations/projectors.rb,
lib/sequent/migrations/view_schema.rb,
lib/sequent/support/view_projection.rb,
lib/sequent/core/helpers/uuid_helper.rb,
lib/sequent/core/aggregate_repository.rb,
lib/sequent/core/base_command_handler.rb,
lib/sequent/core/persistors/persistor.rb,
lib/sequent/test/event_stream_helpers.rb,
lib/sequent/core/aggregate_snapshotter.rb,
lib/sequent/core/helpers/equal_support.rb,
lib/sequent/core/helpers/param_support.rb,
lib/sequent/core/random_uuid_generator.rb,
lib/sequent/test/event_handler_helpers.rb,
lib/sequent/core/helpers/date_validator.rb,
lib/sequent/core/helpers/message_router.rb,
lib/sequent/core/helpers/string_support.rb,
lib/sequent/core/helpers/array_with_type.rb,
lib/sequent/core/helpers/message_handler.rb,
lib/sequent/test/command_handler_helpers.rb,
lib/sequent/core/helpers/string_validator.rb,
lib/sequent/core/helpers/value_validators.rb,
lib/sequent/core/helpers/attr_matchers/dsl.rb,
lib/sequent/core/helpers/attribute_support.rb,
lib/sequent/core/helpers/boolean_validator.rb,
lib/sequent/core/helpers/autoset_attributes.rb,
lib/sequent/core/helpers/default_validators.rb,
lib/sequent/core/helpers/message_dispatcher.rb,
lib/sequent/util/skip_if_already_processing.rb,
lib/sequent/core/helpers/date_time_validator.rb,
lib/sequent/core/helpers/attr_matchers/equals.rb,
lib/sequent/core/helpers/message_matchers/any.rb,
lib/sequent/core/helpers/message_matchers/dsl.rb,
lib/sequent/core/transactions/no_transactions.rb,
lib/sequent/core/helpers/association_validator.rb,
lib/sequent/core/helpers/message_matchers/is_a.rb,
lib/sequent/core/helpers/attr_matchers/less_than.rb,
lib/sequent/core/helpers/string_to_value_parsers.rb,
lib/sequent/core/helpers/type_conversion_support.rb,
lib/sequent/core/helpers/attr_matchers/not_equals.rb,
lib/sequent/core/helpers/attr_matchers/greater_than.rb,
lib/sequent/core/helpers/message_matchers/has_attrs.rb,
lib/sequent/core/persistors/active_record_persistor.rb,
lib/sequent/core/helpers/message_matchers/except_opt.rb,
lib/sequent/core/helpers/message_matchers/instance_of.rb,
lib/sequent/core/helpers/attr_matchers/less_than_equals.rb,
lib/sequent/core/helpers/message_handler_option_registry.rb,
lib/sequent/core/helpers/attr_matchers/argument_serializer.rb,
lib/sequent/core/helpers/attr_matchers/greater_than_equals.rb,
lib/sequent/core/helpers/message_matchers/argument_coercer.rb,
lib/sequent/core/helpers/message_matchers/argument_serializer.rb,
lib/sequent/core/persistors/replay_optimized_postgres_persistor.rb,
lib/sequent/core/transactions/active_record_transaction_provider.rb,
lib/sequent/core/transactions/read_only_active_record_transaction_provider.rb
Overview
When you need to upgrade the event store based on information of the previous schema version this is the place you need to implement a migration. Examples are: corrupt events (due to insufficient testing for instance…) or adding extra events to the event stream if a new concept is introduced.
To implement a migration you should create a class according to the following contract: module Database
class MigrateToVersionXXX
def initialize(env)
@env = env
end
def migrate
# your migration code here...
end
end
end
Defined Under Namespace
Modules: Core, Generator, Migrations, Rake, Support, Test, Util Classes: ApplicationRecord, Configuration
Constant Summary collapse
- VERSION =
'5.0.0'
- Event =
Shortcut classes for easy usage
Sequent::Core::Event
- Command =
Sequent::Core::Command
- CommandHandler =
Sequent::Core::BaseCommandHandler
- AggregateRoot =
Sequent::Core::AggregateRoot
- Projector =
Sequent::Core::Projector
- Workflow =
Sequent::Core::Workflow
- ValueObject =
Sequent::Core::ValueObject
- Secret =
Shortcut
Core::Helpers::Secret
Class Method Summary collapse
-
.aggregate_repository ⇒ Object
Short hand for Sequent.configuration.aggregate_repository.
-
.command_service ⇒ Object
Short hand for Sequent.configuration.command_service.
- .configuration ⇒ Object
-
.configure {|Configuration.instance| ... } ⇒ Object
Setup Sequent.
- .dry_run(*commands) ⇒ Object
-
.logger ⇒ Object
Short hand for Sequent.configuration.logger.
- .migration_class ⇒ Object
- .new_uuid ⇒ Object
- .new_version ⇒ Object
Class Method Details
.aggregate_repository ⇒ Object
Short hand for Sequent.configuration.aggregate_repository
65 66 67 |
# File 'lib/sequent/sequent.rb', line 65 def self.aggregate_repository configuration.aggregate_repository end |
.command_service ⇒ Object
Short hand for Sequent.configuration.command_service
47 48 49 |
# File 'lib/sequent/sequent.rb', line 47 def self.command_service configuration.command_service end |
.configuration ⇒ Object
42 43 44 |
# File 'lib/sequent/sequent.rb', line 42 def self.configuration Configuration.instance end |
.configure {|Configuration.instance| ... } ⇒ Object
Setup Sequent.
Setup is typically called in an initializer
or setup phase of your application. A minimal setup could look like this:
Sequent.configure do |config|
config.event_handlers = [
MyProjector.new,
AnotherProjector.new,
MyWorkflow.new,
]
config.command_handlers = [
MyCommandHandler.new,
]
end
38 39 40 |
# File 'lib/sequent/sequent.rb', line 38 def self.configure yield Configuration.instance end |
.dry_run(*commands) ⇒ Object
69 70 71 |
# File 'lib/sequent/sequent.rb', line 69 def self.dry_run(*commands) Sequent::Util::DryRun.these_commands(commands) end |
.logger ⇒ Object
Short hand for Sequent.configuration.logger
60 61 62 |
# File 'lib/sequent/sequent.rb', line 60 def self.logger configuration.logger end |
.migration_class ⇒ Object
55 56 57 |
# File 'lib/sequent/sequent.rb', line 55 def self.migration_class Class.const_get(configuration.migrations_class_name) end |
.new_uuid ⇒ Object
14 15 16 |
# File 'lib/sequent/sequent.rb', line 14 def self.new_uuid Sequent.configuration.uuid_generator.uuid end |
.new_version ⇒ Object
51 52 53 |
# File 'lib/sequent/sequent.rb', line 51 def self.new_version migration_class.version end |