Module: Hanami::Model
- Defined in:
- gems/gems/hanami-model-1.3.2/lib/hanami/model/sql.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/error.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/types.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/mapping.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/plugins.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/version.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/migrator.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/migration.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/sql/types.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/association.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/entity_name.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/sql/console.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/configurator.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/configuration.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/relation_name.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/plugins/schema.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/mapped_relation.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/migrator/logger.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/plugins/mapping.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/associations/dsl.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/migrator/adapter.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/sql/entity/schema.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/plugins/timestamps.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/sql/consoles/mysql.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/migrator/connection.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/sql/consoles/sqlite.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/associations/has_one.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/associations/has_many.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/sql/consoles/abstract.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/migrator/mysql_adapter.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/associations/belongs_to.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/migrator/sqlite_adapter.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/sql/consoles/postgresql.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/associations/many_to_many.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/migrator/postgres_adapter.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model/sql/types/schema/coercions.rb,
gems/gems/hanami-model-1.3.2/lib/hanami/model.rb
Overview
Hanami persistence
Defined Under Namespace
Modules: Associations, Sql, Types Classes: CheckConstraintViolationError, Configuration, ConstraintViolationError, DatabaseError, Error, ForeignKeyConstraintViolationError, InvalidCommandError, MigrationError, Migrator, MissingPrimaryKeyError, NotNullConstraintViolationError, UniqueConstraintViolationError, UnknownAttributeError, UnknownDatabaseAdapterError, UnknownDatabaseTypeError
Constant Summary
- VERSION =
Defines the version
'1.3.2'.freeze
Class Method Summary collapse
-
.configuration ⇒ Object
Current configuration.
-
.configure(&block) ⇒ Object
Configure the framework.
-
.disconnect ⇒ Object
Disconnect from the database.
- .load!(&blk) ⇒ Object
-
.migration(&blk) ⇒ Object
Define a migration.
Class Method Details
.configuration ⇒ Object
Current configuration
Source: | on GitHub
def self.configuration @configuration ||= Configuration.new(config) end |
.configure(&block) ⇒ Object
Configure the framework
Source: | on GitHub
def self.configure(&block) @config = Configurator.build(&block) self end |
.disconnect ⇒ Object
Disconnect from the database
This is useful for rebooting applications in production and to ensure that the framework prunes stale connections.
Source: | on GitHub
def self.disconnect configuration.connection&.disconnect end |
.load!(&blk) ⇒ Object
Source: | on GitHub
def self.load!(&blk) @container = configuration.load!(repositories, &blk) @loaded = true end |
.migration(&blk) ⇒ Object
Define a migration
It must define an up/down strategy to write schema changes (up) and to rollback them (down).
We can use up
and down
blocks for custom strategies, or only one change
block that automatically implements “down” strategy.
Source: | on GitHub
def self.migration(&blk) Migration.new(configuration.gateways[:default], &blk) end |