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/printer.rb,
lib/sequent/configuration.rb,
lib/sequent/core/workflow.rb,
lib/sequent/core/projector.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/core/current_event.rb,
lib/sequent/core/stream_record.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/support/view_schema.rb,
lib/sequent/core/command_service.rb,
lib/sequent/core/event_publisher.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/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/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/util/skip_if_already_processing.rb,
lib/sequent/core/helpers/date_time_validator.rb,
lib/sequent/core/transactions/no_transactions.rb,
lib/sequent/core/helpers/association_validator.rb,
lib/sequent/core/helpers/string_to_value_parsers.rb,
lib/sequent/core/helpers/type_conversion_support.rb,
lib/sequent/core/persistors/active_record_persistor.rb,
lib/sequent/core/persistors/replay_optimized_postgres_persistor.rb,
lib/sequent/core/transactions/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: Configuration
Constant Summary collapse
- VERSION =
'3.2.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.
-
.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
63 64 65 |
# File 'lib/sequent/sequent.rb', line 63 def self.aggregate_repository configuration.aggregate_repository end |
.command_service ⇒ Object
Short hand for Sequent.configuration.command_service
45 46 47 |
# File 'lib/sequent/sequent.rb', line 45 def self.command_service configuration.command_service end |
.configuration ⇒ Object
40 41 42 |
# File 'lib/sequent/sequent.rb', line 40 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
36 37 38 |
# File 'lib/sequent/sequent.rb', line 36 def self.configure yield Configuration.instance end |
.logger ⇒ Object
Short hand for Sequent.configuration.logger
58 59 60 |
# File 'lib/sequent/sequent.rb', line 58 def self.logger configuration.logger end |
.migration_class ⇒ Object
53 54 55 |
# File 'lib/sequent/sequent.rb', line 53 def self.migration_class Class.const_get(configuration.migrations_class_name) end |
.new_uuid ⇒ Object
12 13 14 |
# File 'lib/sequent/sequent.rb', line 12 def self.new_uuid Sequent.configuration.uuid_generator.uuid end |
.new_version ⇒ Object
49 50 51 |
# File 'lib/sequent/sequent.rb', line 49 def self.new_version migration_class.version end |