module Prostore
Overview
prostore — declarative ORM for Crystal targeting SQLite and PostgreSQL.
See doc/adr/ for the architectural decisions.
Defined in:
prostore.crprostore/adapter/base.cr
prostore/adapter/live_state.cr
prostore/adapter/postgres/adapter.cr
prostore/adapter/postgres/ddl.cr
prostore/adapter/postgres/introspect.cr
prostore/adapter/postgres/types.cr
prostore/adapter/sqlite/adapter.cr
prostore/adapter/sqlite/ddl.cr
prostore/adapter/sqlite/introspect.cr
prostore/adapter/sqlite/rebuild.cr
prostore/adapter/sqlite/types.cr
prostore/backup.cr
prostore/connection.cr
prostore/diff/engine.cr
prostore/diff/operation.cr
prostore/diff/validator.cr
prostore/drift/detector.cr
prostore/drift/schema_table.cr
prostore/error.cr
prostore/migration/bookkeeping.cr
prostore/migration/cli.cr
prostore/migration/heartbeat.cr
prostore/migration/internal.cr
prostore/migration/lease.cr
prostore/migration/runner.cr
prostore/migration/state.cr
prostore/model.cr
prostore/query/analyzer.cr
prostore/query/ast.cr
prostore/query/builder.cr
prostore/query/predicates.cr
prostore/query/renderer.cr
prostore/records.cr
prostore/schema.cr
prostore/schema/enum_member.cr
prostore/schema/field.cr
prostore/schema/fingerprint.cr
prostore/schema/foreign_key.cr
prostore/schema/index.cr
prostore/schema/query.cr
prostore/sql_expr.cr
prostore/steps/codec.cr
prostore/steps/executor.cr
prostore/steps/planner.cr
prostore/steps/step.cr
prostore/tui/app.cr
prostore/tui/browser.cr
prostore/tui/column_types.cr
prostore/tui/style.cr
prostore/tui/widgets/record_detail.cr
prostore/tui/widgets/record_grid.cr
prostore/tui/widgets/table_list.cr
prostore/types.cr
prostore/version.cr
Constant Summary
-
Q =
Query::Q -
Convenience top-level constant.
-
VERSION =
"0.5.1"
Class Method Summary
-
.__reset_for_test
Reset the registry.
- .connect(url : String) : Connection
- .default_connection : Connection
- .default_connection=(conn : Connection | Nil)
- .default_connection? : Connection | Nil
-
.delete_all(models : Array(Prostore::Model.class) = Prostore.models, conn : Connection = Prostore.default_connection) : Nil
Delete all rows from
.modelsin reverse FK dependency order (children before parents). -
.migrate(url : String, models : Array(Prostore::Model.class) = Prostore.models) : Nil
High-level entry: bootstrap or migrate the database referenced by
url. -
.migrate(conn : Connection, models : Array(Prostore::Model.class) = Prostore.models) : Nil
Migrate using a pre-opened connection.
- .models : Array(Prostore::Model.class)
-
.setup(url : String, models : Array(Prostore::Model.class) = Prostore.models) : Connection
Open, migrate, and set as the default connection in one call.
-
.test_reset(models : Array(Prostore::Model.class) = Prostore.models, conn : Connection = Prostore.default_connection) : Nil
Convenience alias for test teardown — identical to
.delete_all.
Class Method Detail
Delete all rows from .models in reverse FK dependency order (children
before parents). Safe for test teardown when foreign_keys=ON.
High-level entry: bootstrap or migrate the database referenced by url.
Opens a temporary connection, migrates, then closes it. For in-memory
SQLite use Prostore.setup(url) instead, which reuses the connection.
Migrate using a pre-opened connection. The caller retains ownership of
conn and is responsible for closing it. Use this when migrate and the
subsequent app queries must share the same underlying database — most
importantly for sqlite3::memory: where each DB.open is a distinct,
empty database.
Open, migrate, and set as the default connection in one call.
Returns the connection so the caller can close it on shutdown.
Prefer this over separate migrate(url) + .connect(url) for
sqlite3::memory: databases.
Convenience alias for test teardown — identical to .delete_all.