xtr-orm 5.0.1__tar.gz → 5.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/PKG-INFO +16 -11
  2. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/README.md +15 -10
  3. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/pyproject.toml +1 -1
  4. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/pyproject.toml.orig +1 -1
  5. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/.agents/skills/xtr-orm/SKILL.md +6 -6
  6. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/.agents/skills/xtr-orm/references/messenger.md +1 -1
  7. xtr_orm-5.2.0/src/xtr_orm/recipe/manifest.toml +66 -0
  8. xtr_orm-5.0.1/src/xtr_orm/recipe/manifest.toml +0 -32
  9. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/LICENSE +0 -0
  10. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/.agents/skills/xtr-orm/references/commands.md +0 -0
  11. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/.agents/skills/xtr-orm/references/connections.md +0 -0
  12. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/.agents/skills/xtr-orm/references/migrations.md +0 -0
  13. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/__init__.py +0 -0
  14. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/bundle/__init__.py +0 -0
  15. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/bundle/connection_config.py +0 -0
  16. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/bundle/orm_bundle.py +0 -0
  17. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/bundle/orm_config.py +0 -0
  18. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/bundle/orm_mappings_pass.py +0 -0
  19. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/__init__.py +0 -0
  20. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/_reporting.py +0 -0
  21. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/connection_command.py +0 -0
  22. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/database_create_command.py +0 -0
  23. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/database_drop_command.py +0 -0
  24. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_current_command.py +0 -0
  25. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_diff_command.py +0 -0
  26. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_dump_schema_command.py +0 -0
  27. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_execute_command.py +0 -0
  28. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_generate_command.py +0 -0
  29. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_latest_command.py +0 -0
  30. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_list_command.py +0 -0
  31. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_migrate_command.py +0 -0
  32. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_rollup_command.py +0 -0
  33. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_status_command.py +0 -0
  34. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_up_to_date_command.py +0 -0
  35. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/migrations_version_command.py +0 -0
  36. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/command/run_sql_command.py +0 -0
  37. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/connection_registry.py +0 -0
  38. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/database/__init__.py +0 -0
  39. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/database/database_manager.py +0 -0
  40. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/exception/__init__.py +0 -0
  41. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/exception/invalid_argument_error.py +0 -0
  42. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/exception/migration_error.py +0 -0
  43. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/exception/missing_database_error.py +0 -0
  44. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/exception/orm_error.py +0 -0
  45. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/exception/session_unavailable_error.py +0 -0
  46. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/exception/unknown_connection_error.py +0 -0
  47. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/exception/unsupported_database_error.py +0 -0
  48. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/mapping_driver_interface.py +0 -0
  49. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/messenger/__init__.py +0 -0
  50. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/messenger/close_connection_middleware.py +0 -0
  51. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/messenger/open_transaction_logger_middleware.py +0 -0
  52. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/messenger/transaction_middleware.py +0 -0
  53. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/__init__.py +0 -0
  54. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/_environment.py +0 -0
  55. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/_history.py +0 -0
  56. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/_revisions.py +0 -0
  57. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/_schema.py +0 -0
  58. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/available_migration.py +0 -0
  59. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/direction.py +0 -0
  60. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/executed_migration.py +0 -0
  61. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/execution_result.py +0 -0
  62. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/migration_plan.py +0 -0
  63. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/migration_status.py +0 -0
  64. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/migrations_config.py +0 -0
  65. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/migrator.py +0 -0
  66. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/migrations/template/script.py.mako +0 -0
  67. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/py.typed +0 -0
  68. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/recipe/__init__.py +0 -0
  69. {xtr_orm-5.0.1 → xtr_orm-5.2.0}/src/xtr_orm/recipe/files/config/orm.py.tmpl +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xtr-orm
3
- Version: 5.0.1
3
+ Version: 5.2.0
4
4
  Summary: Databases for async applications: engines, sessions and versioned schema migrations, configured once per connection.
5
5
  Keywords: orm,database,migrations,sqlalchemy,alembic,asyncio
6
6
  Author: Xterr
@@ -203,25 +203,30 @@ removing it undoes.
203
203
  those databases. Install xtr-console beside it for the `orm:*` commands, and xtr-messenger for
204
204
  the [message bus middleware](#message-bus-middleware).
205
205
  - **Recipe** — `uv run xtr-recipes recipes:sync` does the *Activate*, *Configure* and
206
- *Environment* steps below: it lists `OrmBundle`, writes a starting `<app>/config/orm.py` with the
207
- `default` connection, and `DATABASE_URL` in `.env`. It prints the middleware step, which a recipe
208
- cannot make for you.
209
- - **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/bundles.py`, imported from
206
+ *Environment* steps below: it lists `OrmBundle`, writes a starting `<app>/config/packages/orm.py` with the
207
+ `default` connection, and `DATABASE_URL` in `.env`, and adds a PostgreSQL `database` service to
208
+ `compose.yaml`, published on `5432` in `compose.override.yaml`. It prints the middleware step,
209
+ which a recipe cannot make for you.
210
+ - **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/config/bundles.py`, imported from
210
211
  `xtr_orm.bundle`.
211
212
  - **Brings along** — the logging and console bundles, when those packages are installed.
212
213
  With the messenger bundle active too, the [middleware](#message-bus-middleware) are
213
214
  registered for a bus to list.
214
- - **Configure** — the recipe writes a starting `<app>/config/orm.py` with the `default`
215
+ - **Configure** — the recipe writes a starting `<app>/config/packages/orm.py` with the `default`
215
216
  connection reading `DATABASE_URL`, its revisions in `migrations` in the project directory and
216
217
  diffs against the models advanced-alchemy registers. Add connections, replicas and table
217
218
  definitions to that `@configure` function returning `OrmConfig` — see
218
219
  [Kernel / bundle](#kernel--bundle).
219
220
  - **Environment** — `DATABASE_URL`, read when a connection is first used — engine, session,
220
221
  migrator or command — not when the application boots. Its query may carry options; see
221
- [Options in the URL](#options-in-the-url).
222
+ [Options in the URL](#options-in-the-url). The recipe's value reaches the `database` service
223
+ `docker compose up -d database` starts; the `POSTGRES_*` variables that service reads, set in
224
+ the shell or `.env`, change its version, database, user and password — keep `DATABASE_URL` in
225
+ step with them.
222
226
  - **Ignore** — nothing: commit `migrations/`.
223
227
  - **Remove** — take the `orm_*` entries out of every bus's `middleware`, drop the `BUNDLES`
224
- entry, delete `<app>/config/orm.py`, then `uv remove xtr-orm`.
228
+ entry, delete `<app>/config/packages/orm.py` and the `xtr-orm` blocks in `compose.yaml` and
229
+ `compose.override.yaml`, then `uv remove xtr-orm`.
225
230
  - **Check** — `debug:bundles` shows `orm` as `listed` and `active`, and
226
231
  `orm:migrations:status` reaches the database.
227
232
 
@@ -232,14 +237,14 @@ not a dependency, and nothing outside `xtr_orm.bundle` needs it — list the bun
232
237
  connections:
233
238
 
234
239
  ```python
235
- # app/bundles.py
240
+ # app/config/bundles.py
236
241
  from xtr_orm.bundle import OrmBundle
237
242
 
238
243
  BUNDLES = {OrmBundle: {"all": True}}
239
244
  ```
240
245
 
241
246
  ```python
242
- # app/config/orm.py
247
+ # app/config/packages/orm.py
243
248
  from xtr_dependency_injection import configure, env
244
249
  from xtr_orm.bundle import ConnectionConfig, OrmConfig
245
250
 
@@ -479,7 +484,7 @@ class NotifyAccounting:
479
484
  ```
480
485
 
481
486
  ```python
482
- # app/config/messenger.py
487
+ # app/config/packages/messenger.py
483
488
  MessageBusConfig(
484
489
  middleware=[
485
490
  "orm_close_connection",
@@ -171,25 +171,30 @@ removing it undoes.
171
171
  those databases. Install xtr-console beside it for the `orm:*` commands, and xtr-messenger for
172
172
  the [message bus middleware](#message-bus-middleware).
173
173
  - **Recipe** — `uv run xtr-recipes recipes:sync` does the *Activate*, *Configure* and
174
- *Environment* steps below: it lists `OrmBundle`, writes a starting `<app>/config/orm.py` with the
175
- `default` connection, and `DATABASE_URL` in `.env`. It prints the middleware step, which a recipe
176
- cannot make for you.
177
- - **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/bundles.py`, imported from
174
+ *Environment* steps below: it lists `OrmBundle`, writes a starting `<app>/config/packages/orm.py` with the
175
+ `default` connection, and `DATABASE_URL` in `.env`, and adds a PostgreSQL `database` service to
176
+ `compose.yaml`, published on `5432` in `compose.override.yaml`. It prints the middleware step,
177
+ which a recipe cannot make for you.
178
+ - **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/config/bundles.py`, imported from
178
179
  `xtr_orm.bundle`.
179
180
  - **Brings along** — the logging and console bundles, when those packages are installed.
180
181
  With the messenger bundle active too, the [middleware](#message-bus-middleware) are
181
182
  registered for a bus to list.
182
- - **Configure** — the recipe writes a starting `<app>/config/orm.py` with the `default`
183
+ - **Configure** — the recipe writes a starting `<app>/config/packages/orm.py` with the `default`
183
184
  connection reading `DATABASE_URL`, its revisions in `migrations` in the project directory and
184
185
  diffs against the models advanced-alchemy registers. Add connections, replicas and table
185
186
  definitions to that `@configure` function returning `OrmConfig` — see
186
187
  [Kernel / bundle](#kernel--bundle).
187
188
  - **Environment** — `DATABASE_URL`, read when a connection is first used — engine, session,
188
189
  migrator or command — not when the application boots. Its query may carry options; see
189
- [Options in the URL](#options-in-the-url).
190
+ [Options in the URL](#options-in-the-url). The recipe's value reaches the `database` service
191
+ `docker compose up -d database` starts; the `POSTGRES_*` variables that service reads, set in
192
+ the shell or `.env`, change its version, database, user and password — keep `DATABASE_URL` in
193
+ step with them.
190
194
  - **Ignore** — nothing: commit `migrations/`.
191
195
  - **Remove** — take the `orm_*` entries out of every bus's `middleware`, drop the `BUNDLES`
192
- entry, delete `<app>/config/orm.py`, then `uv remove xtr-orm`.
196
+ entry, delete `<app>/config/packages/orm.py` and the `xtr-orm` blocks in `compose.yaml` and
197
+ `compose.override.yaml`, then `uv remove xtr-orm`.
193
198
  - **Check** — `debug:bundles` shows `orm` as `listed` and `active`, and
194
199
  `orm:migrations:status` reaches the database.
195
200
 
@@ -200,14 +205,14 @@ not a dependency, and nothing outside `xtr_orm.bundle` needs it — list the bun
200
205
  connections:
201
206
 
202
207
  ```python
203
- # app/bundles.py
208
+ # app/config/bundles.py
204
209
  from xtr_orm.bundle import OrmBundle
205
210
 
206
211
  BUNDLES = {OrmBundle: {"all": True}}
207
212
  ```
208
213
 
209
214
  ```python
210
- # app/config/orm.py
215
+ # app/config/packages/orm.py
211
216
  from xtr_dependency_injection import configure, env
212
217
  from xtr_orm.bundle import ConnectionConfig, OrmConfig
213
218
 
@@ -447,7 +452,7 @@ class NotifyAccounting:
447
452
  ```
448
453
 
449
454
  ```python
450
- # app/config/messenger.py
455
+ # app/config/packages/messenger.py
451
456
  MessageBusConfig(
452
457
  middleware=[
453
458
  "orm_close_connection",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xtr-orm"
3
- version = "5.0.1"
3
+ version = "5.2.0"
4
4
  description = "Databases for async applications: engines, sessions and versioned schema migrations, configured once per connection."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xtr-orm"
3
- version = "5.0.1"
3
+ version = "5.2.0"
4
4
  description = "Databases for async applications: engines, sessions and versioned schema migrations, configured once per connection."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -14,7 +14,7 @@ connection's name. Everything is async; there is no sync counterpart.
14
14
 
15
15
  - Inject `Injected[AsyncSession]` for the default connection;
16
16
  `Annotated[AsyncSession, Target("reports")]` for another. Never build a session yourself.
17
- - Name databases in `<app>/config/orm.py` with a `@configure` function returning `OrmConfig`.
17
+ - Name databases in `<app>/config/packages/orm.py` with a `@configure` function returning `OrmConfig`.
18
18
  - Set `DATABASE_URL` with an async driver: `postgresql+asyncpg://`, `mysql+asyncmy://`,
19
19
  `sqlite+aiosqlite:///`. Engine and session options may ride on its query.
20
20
  - Write a revision from your models: `orm:migrations:diff --message "add invoices"`. Apply:
@@ -225,14 +225,14 @@ migrate = MigrationsMigrateCommand(registry)
225
225
  ## Use in an application
226
226
 
227
227
  `uv run xtr-recipes recipes:sync` applies the recipe shipped with this package: it lists `OrmBundle`,
228
- writes a starting `config/orm.py` with the `default` connection, and `DATABASE_URL` in `.env`. That
228
+ writes a starting `config/packages/orm.py` with the `default` connection, and `DATABASE_URL` in `.env`. That
229
229
  is the steps below a recipe can do; the middleware it prints for you to add.
230
230
 
231
231
  1. **Install** — `uv add "xtr-orm[postgres]" xtr-dependency-injection`: the bundle needs the
232
232
  container installed beside it, never as an extra; `mysql` or `sqlite` instead of `postgres`.
233
233
  Install xtr-console beside it for the `orm:*` commands, and xtr-messenger for the bus
234
234
  middleware.
235
- 2. **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/bundles.py`
235
+ 2. **Activate** — `OrmBundle: {"all": True}` in `BUNDLES` in `<app>/config/bundles.py`
236
236
  (`from xtr_orm.bundle import OrmBundle`).
237
237
  3. **Brings along** — the logging and console bundles when those packages are installed, each
238
238
  optional. With the logging bundle active an `orm` channel is added and every migrator logs the
@@ -242,7 +242,7 @@ is the steps below a recipe can do; the middleware it prints for you to add.
242
242
  advanced-alchemy registers.
243
243
 
244
244
  ```python
245
- # <app>/config/orm.py
245
+ # <app>/config/packages/orm.py
246
246
  from xtr_dependency_injection import configure, env
247
247
  from xtr_orm.bundle import ConnectionConfig, MigrationsConfig, OrmConfig
248
248
 
@@ -274,7 +274,7 @@ is the steps below a recipe can do; the middleware it prints for you to add.
274
274
  8. **Check** — `debug:bundles` shows `orm` as `listed` and `active`, and
275
275
  `orm:migrations:status` reaches the database.
276
276
  9. **Remove** — take the `orm_*` entries out of every bus's `middleware`, drop the `BUNDLES`
277
- entry, delete `<app>/config/orm.py`, then `uv remove xtr-orm`.
277
+ entry, delete `<app>/config/packages/orm.py`, then `uv remove xtr-orm`.
278
278
 
279
279
  `OrmConfig` has two fields: `default_connection` (`"default"`) and `connections`
280
280
  (`{"default": ConnectionConfig()}`). Two connections may not keep their revisions in one
@@ -287,7 +287,7 @@ With xtr-messenger installed beside it and both bundles active, three middleware
287
287
  by name. Nothing is added to a bus by itself — the bus lists what it wants, and order matters.
288
288
 
289
289
  ```python
290
- # <app>/config/messenger.py
290
+ # <app>/config/packages/messenger.py
291
291
  MessageBusConfig(
292
292
  middleware=[
293
293
  "orm_close_connection", # outermost: closes after the transaction ended
@@ -16,7 +16,7 @@ configuration, so an untouched connection is left alone.
16
16
  ## Order
17
17
 
18
18
  ```python
19
- # <app>/config/messenger.py
19
+ # <app>/config/packages/messenger.py
20
20
  MessageBusConfig(
21
21
  middleware=[
22
22
  "orm_close_connection",
@@ -0,0 +1,66 @@
1
+ # The recipe for xtr-orm: what *Use in an application* in the README takes, as
2
+ # data. Keep the two in step — the README is the source.
3
+
4
+ [bundles]
5
+ # "<module>:<class>" = the environments it is listed with, exactly as in BUNDLES.
6
+ "xtr_orm.bundle:OrmBundle" = { all = true }
7
+
8
+ [files]
9
+ # Destination under the application package = template under this recipe.
10
+ # The default connection on DATABASE_URL, written out so the application has
11
+ # one place to add replicas, connections and its models' metadata.
12
+ "config/packages/orm.py" = "files/config/orm.py.tmpl"
13
+
14
+ [env]
15
+ # Read when a connection is first used — engine, session, migrator or command —
16
+ # not when the application boots. The PostgreSQL compose.yaml runs, for the
17
+ # postgres extra the README installs; change it, or put the real one in
18
+ # .env.local.
19
+ DATABASE_URL = "postgresql+asyncpg://app:!ChangeMe!@127.0.0.1:5432/app"
20
+
21
+ [gitignore]
22
+ # Nothing: migrations/ is committed.
23
+ lines = []
24
+
25
+ # A PostgreSQL for DATABASE_URL to reach: `docker compose up -d database`.
26
+ # Kept verbatim: ${...} is Compose's own interpolation, read from the shell or .env.
27
+ [compose."compose.yaml"]
28
+ services = '''
29
+ database:
30
+ image: postgres:${POSTGRES_VERSION:-16}-alpine
31
+ environment:
32
+ POSTGRES_DB: ${POSTGRES_DB:-app}
33
+ # You should definitely change the password in production
34
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
35
+ POSTGRES_USER: ${POSTGRES_USER:-app}
36
+ healthcheck:
37
+ test: ["CMD", "pg_isready", "-d", "${POSTGRES_DB:-app}", "-U", "${POSTGRES_USER:-app}"]
38
+ timeout: 5s
39
+ retries: 5
40
+ start_period: 60s
41
+ volumes:
42
+ - database_data:/var/lib/postgresql/data:rw
43
+ # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
44
+ # - ./docker/db/data:/var/lib/postgresql/data:rw
45
+ '''
46
+ volumes = '''
47
+ database_data:
48
+ '''
49
+
50
+ # Development only: the database published on the port DATABASE_URL names.
51
+ [compose."compose.override.yaml"]
52
+ services = '''
53
+ database:
54
+ ports:
55
+ - "5432:5432"
56
+ '''
57
+
58
+ [notes]
59
+ steps = [
60
+ "With the messenger bundle active, list the orm_* middleware in every bus's middleware: every message is then a unit of work.",
61
+ ]
62
+ check = [
63
+ "<script> debug:bundles — orm is listed and active",
64
+ "<script> orm:migrations:status — it reaches the database",
65
+ ]
66
+ run = ["docker compose up -d database — the PostgreSQL DATABASE_URL points at"]
@@ -1,32 +0,0 @@
1
- # The recipe for xtr-orm: what *Use in an application* in the README takes, as
2
- # data. Keep the two in step — the README is the source.
3
-
4
- [bundles]
5
- # "<module>:<class>" = the environments it is listed with, exactly as in BUNDLES.
6
- "xtr_orm.bundle:OrmBundle" = { all = true }
7
-
8
- [files]
9
- # Destination under the application package = template under this recipe.
10
- # The default connection on DATABASE_URL, written out so the application has
11
- # one place to add replicas, connections and its models' metadata.
12
- "config/orm.py" = "files/config/orm.py.tmpl"
13
-
14
- [env]
15
- # Read when a connection is first used — engine, session, migrator or command —
16
- # not when the application boots. A local PostgreSQL to start from, for the
17
- # postgres extra the README installs; change it, or put the real one in
18
- # .env.local.
19
- DATABASE_URL = "postgresql+asyncpg://app:change-me@127.0.0.1:5432/app"
20
-
21
- [gitignore]
22
- # Nothing: migrations/ is committed.
23
- lines = []
24
-
25
- [notes]
26
- steps = [
27
- "With the messenger bundle active, list the orm_* middleware in every bus's middleware: every message is then a unit of work.",
28
- ]
29
- check = [
30
- "<script> debug:bundles — orm is listed and active",
31
- "<script> orm:migrations:status — it reaches the database",
32
- ]
File without changes
File without changes
File without changes