asqueel-migration 0.2.0__tar.gz → 0.2.2__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.
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/CHANGELOG.md +42 -1
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/PKG-INFO +45 -9
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/README.md +34 -6
- asqueel_migration-0.2.2/RELEASING.md +85 -0
- asqueel_migration-0.2.2/docs/capabilities.md +85 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/docs/conf.py +7 -9
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/docs/index.rst +8 -0
- asqueel_migration-0.2.2/docs/known_limits.md +85 -0
- asqueel_migration-0.2.2/docs/maintenance.md +82 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/docs/producer_guide.md +220 -70
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/pyproject.toml +24 -5
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/scripts/check_distribution.py +5 -1
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/__init__.py +1 -1
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/adapters/pg_adapter.py +1 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/adapters/sqlite_adapter.py +8 -4
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/cli.py +4 -2
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/command_builder.py +59 -25
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/database.py +11 -8
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/diff_engine.py +3 -2
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/editor_service.py +7 -8
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/exceptions.py +3 -3
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/executor.py +3 -2
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/migrator.py +104 -57
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/readers/base_reader.py +25 -2
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/readers/pg_reader.py +9 -4
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/readers/sqlite_reader.py +33 -3
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/schemas/sql_model-1.0.xsd +1 -1
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/schemas/structure-1.0.json +1 -1
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/service.py +8 -3
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/structures.py +17 -5
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/validation.py +39 -14
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/writers/base_writer.py +5 -3
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/writers/mssql_writer.py +1 -1
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/writers/mysql_writer.py +1 -1
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/writers/pg_writer.py +4 -2
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/writers/sqlite_writer.py +20 -8
- asqueel_migration-0.2.2/tests/test_editor_service_contracts.py +50 -0
- asqueel_migration-0.2.2/tests/test_legacy_unique_removal.py +116 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_migration_sqlite.py +5 -5
- asqueel_migration-0.2.2/tests/test_serial4.py +182 -0
- asqueel_migration-0.2.2/tests/test_service.py +326 -0
- asqueel_migration-0.2.2/tests/test_sqlite_contracts.py +263 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_sqlite_writer.py +1 -1
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_validation.py +87 -0
- asqueel_migration-0.2.0/tests/test_service.py +0 -79
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/.gitignore +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/LICENSE +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/NOTICE +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/assets/branding/asqueel-migration-inverse.svg +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/assets/branding/asqueel-migration-primary.svg +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/assets/branding/asqueel-monogram.svg +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/docs/_static/brand.css +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/docs/legacy_test_alignment.md +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/_sql.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/adapters/__init__.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/adapters/mssql_adapter.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/adapters/mysql_adapter.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/json_producer.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/py.typed +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/readers/__init__.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/readers/mssql_reader.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/readers/mysql_reader.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/writers/__init__.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/src/asqueel_migration/xml_producer.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/__init__.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/conftest.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/support/__init__.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/support/migration_base.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/support/mssql_database.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/support/mysql_database.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/support/orm_producer.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/support/pg_database.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/support/sqlite_database.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/support/sqltools.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_capabilities.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_cli.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_connection_error.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_editor_service.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_execution_atomicity.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_executor_column_order.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_identifier_quoting.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_index_roundtrip.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_json_producer.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_migration_modes_pg.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_migration_mssql.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_migration_mysql.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_migration_pg.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_mssql_writer.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_mysql_writer.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_pg_adapter.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_regressions.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_size_normalization.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_todo_features.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_wave0_pg.py +0 -0
- {asqueel_migration-0.2.0 → asqueel_migration-0.2.2}/tests/test_xml_producer.py +0 -0
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.2 — 2026-10-15
|
|
4
|
+
|
|
5
|
+
- Remove column UNIQUE using the actual constraint and index names from the
|
|
6
|
+
database catalog, following GenroPy #1425. Qualify standalone index drops by
|
|
7
|
+
schema, remove all objects enforcing that column's uniqueness, and preserve
|
|
8
|
+
ordinary indexes. Repeated preparation converges and duplicate values are
|
|
9
|
+
accepted after the removal.
|
|
10
|
+
- Recognize simple single-column UNIQUE indexes as column uniqueness while
|
|
11
|
+
preserving explicitly declared index names, ordering and options. Partial,
|
|
12
|
+
expression and multi-column indexes retain their separate semantics.
|
|
13
|
+
|
|
14
|
+
- Add PostgreSQL `serial4` declarations across JSON/XML contracts, SQL generation
|
|
15
|
+
and introspection. Preserve existing SERIAL4 sequences/data and legacy `I`
|
|
16
|
+
adoption; retain `serial` as SERIAL8. Refuse implicit SERIAL4 conversions (#25);
|
|
17
|
+
explicit SERIAL4-to-SERIAL8 migration is tracked separately in #27.
|
|
18
|
+
|
|
19
|
+
- Fix SQLite `main` migration to use the configured file and recognize legacy
|
|
20
|
+
`TIMESTAMP` declarations without changing stored data (#20, #22).
|
|
21
|
+
- Create and introspect same-schema foreign keys and composite UNIQUE constraints
|
|
22
|
+
on new SQLite tables; reject unsupported existing-table changes (#21, #24).
|
|
23
|
+
- Expose `SqlMigrator.skipped` and plan `skipped_changes` as structured omissions,
|
|
24
|
+
preserving warning strings and legacy plan `skipped` (#15).
|
|
25
|
+
- Make mypy blocking, document gradual typing enforcement, use a single Hatch
|
|
26
|
+
version source, complete the `all` extra and validate release artifacts on PRs
|
|
27
|
+
(#4, #5).
|
|
28
|
+
- Publish a dialect matrix, known limits and current milestone status (#2).
|
|
29
|
+
|
|
30
|
+
## 0.2.1 — 2026-10-12
|
|
31
|
+
|
|
32
|
+
- Use the connection's database name for creation even when the desired
|
|
33
|
+
structure carries a different model label.
|
|
34
|
+
- Reject missing service inputs before database access, and report malformed
|
|
35
|
+
containers as validation errors with field paths, with or without the
|
|
36
|
+
optional JSON Schema validator.
|
|
37
|
+
- Expand contract coverage for reviewed plans, input ownership, repeatable
|
|
38
|
+
preparation, unsupported operations, removals and connection cleanup.
|
|
39
|
+
- Refresh internal architecture and usage documentation for caller-supplied
|
|
40
|
+
schemas and the extracted server application. Annotate conversion tables and
|
|
41
|
+
capabilities, and include the development typing dependencies needed for a
|
|
42
|
+
clean mypy run without suppressing import diagnostics.
|
|
43
|
+
|
|
3
44
|
## 0.2.0 — 2026-10-12
|
|
4
45
|
|
|
5
46
|
- Move the Kajenn HTTP/MCP application to the separate
|
|
@@ -20,7 +61,7 @@
|
|
|
20
61
|
generated SQL. SQLite schema attachment also handles quoted aliases and paths
|
|
21
62
|
containing apostrophes (#16).
|
|
22
63
|
|
|
23
|
-
## 0.1.2
|
|
64
|
+
## 0.1.2
|
|
24
65
|
|
|
25
66
|
- Rename the distribution, Python package and CLI to Asqueel Migration.
|
|
26
67
|
- Retain all fixes from 0.1.1; prepare GitHub Trusted Publishing for the new name.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: asqueel-migration
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Database schema migration engine - compares desired structure with actual database and generates SQL commands
|
|
5
5
|
Project-URL: Homepage, https://github.com/asqueel-org/asqueel-migration
|
|
6
6
|
Project-URL: Documentation, https://github.com/asqueel-org/asqueel-migration/tree/main/docs
|
|
@@ -26,9 +26,12 @@ Requires-Python: >=3.10
|
|
|
26
26
|
Requires-Dist: dictdiffer>=0.9.0
|
|
27
27
|
Provides-Extra: all
|
|
28
28
|
Requires-Dist: jsonschema>=4.18; extra == 'all'
|
|
29
|
-
Requires-Dist: mypy>=1.
|
|
29
|
+
Requires-Dist: mypy>=1.18.2; extra == 'all'
|
|
30
30
|
Requires-Dist: myst-parser>=4.0.0; extra == 'all'
|
|
31
31
|
Requires-Dist: psycopg[binary]>=3.1.0; extra == 'all'
|
|
32
|
+
Requires-Dist: pymssql; extra == 'all'
|
|
33
|
+
Requires-Dist: pymssql>=2.4.4; extra == 'all'
|
|
34
|
+
Requires-Dist: pymysql; extra == 'all'
|
|
32
35
|
Requires-Dist: pytest-cov>=4.0; extra == 'all'
|
|
33
36
|
Requires-Dist: pytest-sugar>=1.0; extra == 'all'
|
|
34
37
|
Requires-Dist: pytest>=7.0; extra == 'all'
|
|
@@ -38,14 +41,19 @@ Requires-Dist: sphinx-rtd-theme>=3.0.0; extra == 'all'
|
|
|
38
41
|
Requires-Dist: sphinx>=8.0.0; extra == 'all'
|
|
39
42
|
Requires-Dist: sphinxcontrib-mermaid>=1.0.0; extra == 'all'
|
|
40
43
|
Requires-Dist: testing-postgresql>=1.3; extra == 'all'
|
|
44
|
+
Requires-Dist: types-jsonschema; extra == 'all'
|
|
45
|
+
Requires-Dist: types-pymysql; extra == 'all'
|
|
41
46
|
Provides-Extra: dev
|
|
42
47
|
Requires-Dist: jsonschema>=4.18; extra == 'dev'
|
|
43
|
-
Requires-Dist: mypy>=1.
|
|
48
|
+
Requires-Dist: mypy>=1.18.2; extra == 'dev'
|
|
49
|
+
Requires-Dist: pymssql>=2.4.4; extra == 'dev'
|
|
44
50
|
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
45
51
|
Requires-Dist: pytest-sugar>=1.0; extra == 'dev'
|
|
46
52
|
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
47
53
|
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
48
54
|
Requires-Dist: testing-postgresql>=1.3; extra == 'dev'
|
|
55
|
+
Requires-Dist: types-jsonschema; extra == 'dev'
|
|
56
|
+
Requires-Dist: types-pymysql; extra == 'dev'
|
|
49
57
|
Provides-Extra: docs
|
|
50
58
|
Requires-Dist: myst-parser>=4.0.0; extra == 'docs'
|
|
51
59
|
Requires-Dist: sphinx-autodoc-typehints>=3.0.0; extra == 'docs'
|
|
@@ -89,8 +97,8 @@ execution.
|
|
|
89
97
|
|
|
90
98
|
- **Four dialects**: PostgreSQL (primary), SQLite, MySQL, MSSQL — one
|
|
91
99
|
reader/writer/adapter trio per dialect, capability-gated.
|
|
92
|
-
- **Two equivalent external formats**: human JSON and
|
|
93
|
-
|
|
100
|
+
- **Two equivalent external formats**: human JSON and XML with a packaged
|
|
101
|
+
XSD; the same model in either compiles to the identical internal
|
|
94
102
|
structure.
|
|
95
103
|
- **Deterministic entity matching**: FK/UNIQUE/index names are
|
|
96
104
|
structural hashes computed from schema + table + columns, so
|
|
@@ -113,7 +121,7 @@ pip install "asqueel-migration[postgresql]"
|
|
|
113
121
|
|
|
114
122
|
Extras: `postgresql` (psycopg 3), `mysql` (PyMySQL), `mssql`
|
|
115
123
|
(pymssql), `validation` (jsonschema), `docs`, `dev`, `all`.
|
|
116
|
-
SQLite needs no extra (stdlib driver).
|
|
124
|
+
SQLite needs no extra (stdlib driver). `all` includes all the extras listed above.
|
|
117
125
|
|
|
118
126
|
## Quickstart
|
|
119
127
|
|
|
@@ -139,6 +147,7 @@ structure = JsonStructureProducer(model).get_json_struct()
|
|
|
139
147
|
|
|
140
148
|
db = PgDatabase({"dbname": "mydb", "host": "localhost"},
|
|
141
149
|
application_schemas=["public"])
|
|
150
|
+
# Pre-create mydb when using public; see docs/known_limits.md.
|
|
142
151
|
migrator = SqlMigrator(db)
|
|
143
152
|
migrator.ormStructure = StructureValidator().validate(structure)
|
|
144
153
|
migrator.prepareMigrationCommands()
|
|
@@ -155,10 +164,11 @@ Three input formats, from the friendliest to the most technical:
|
|
|
155
164
|
|
|
156
165
|
1. **Human JSON** — readable JSON with names and lists, compiled by
|
|
157
166
|
`JsonStructureProducer` (above).
|
|
158
|
-
2. **XML** — the same information
|
|
167
|
+
2. **XML** — the same information described by the packaged XSD
|
|
159
168
|
(`sql_model-1.0.xsd`), ideal for editors and GUIs; compiled by
|
|
160
169
|
`XmlStructureProducer`. The inverse `struct_to_xml()` turns an
|
|
161
|
-
introspected database back into editable XML.
|
|
170
|
+
introspected database back into editable XML. The producer parses XML;
|
|
171
|
+
callers that need XSD validation perform it separately.
|
|
162
172
|
3. **Normalized JSON** — the internal contract, built directly with
|
|
163
173
|
the `new_*_item` factories (the route an ORM extractor takes).
|
|
164
174
|
|
|
@@ -236,11 +246,19 @@ finally:
|
|
|
236
246
|
```
|
|
237
247
|
|
|
238
248
|
`SqlMigrator(db, structure=desired)` validates and snapshots the input.
|
|
249
|
+
The service functions require a desired schema: `None` is rejected before
|
|
250
|
+
accessing the database. `SqlMigrator(db)` still supports deferred assignment.
|
|
251
|
+
Malformed structure containers raise `SqlValidationError` with their field
|
|
252
|
+
paths, including when the optional `jsonschema` dependency is absent.
|
|
239
253
|
The legacy `migrator.ormStructure = desired` form remains available and now
|
|
240
254
|
copies its input. Each preparation filters a fresh working copy; source data
|
|
241
255
|
and repeated warnings are preserved. To change the desired schema, assign it
|
|
242
256
|
again: edits to the exposed working dictionary do not update the source.
|
|
243
257
|
|
|
258
|
+
The connection's database name is the physical destination, including for
|
|
259
|
+
`CREATE DATABASE`. The desired structure's `root.entity_name` is a model label
|
|
260
|
+
and does not redirect creation to another database.
|
|
261
|
+
|
|
244
262
|
Plan identifiers cover the desired/current structure and generated commands.
|
|
245
263
|
They detect drift before execution, but do not prevent concurrent external DDL.
|
|
246
264
|
Unsupported operations block `apply_migration`; post-apply verification reports
|
|
@@ -266,11 +284,29 @@ The legacy XML helpers in `editor_service` remain transport-independent.
|
|
|
266
284
|
| `writers/` | Per-dialect DDL generation |
|
|
267
285
|
| `adapters/` | Concrete `Database`/adapter pairs per dialect |
|
|
268
286
|
|
|
287
|
+
## Development checks
|
|
288
|
+
|
|
289
|
+
Install the development dependencies before running static checks:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
python -m pip install -e ".[dev,postgresql]"
|
|
293
|
+
python -m ruff check src tests
|
|
294
|
+
python -m mypy src/asqueel_migration
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
The `dev` extra includes JSON Schema and PyMySQL stubs, and the pymssql driver
|
|
298
|
+
with its bundled Python 3 stubs. These are development dependencies; using the
|
|
299
|
+
migrator does not require installing every database driver. Mypy reads the
|
|
300
|
+
installed `dictdiffer` source because it has no published stubs.
|
|
301
|
+
|
|
269
302
|
## Documentation
|
|
270
303
|
|
|
271
304
|
Full documentation on
|
|
272
305
|
[Read the Docs](https://asqueel-migration.readthedocs.io).
|
|
273
|
-
|
|
306
|
+
See the [dialect matrix](docs/capabilities.md), [known limits](docs/known_limits.md),
|
|
307
|
+
and [test/release instructions](docs/maintenance.md). Features marked unreleased
|
|
308
|
+
are not in the published 0.2.1 package.
|
|
309
|
+
Current milestones and historical designs are indexed in [roadmap/](roadmap/00_INDEX.md).
|
|
274
310
|
|
|
275
311
|
## License
|
|
276
312
|
|
|
@@ -25,8 +25,8 @@ execution.
|
|
|
25
25
|
|
|
26
26
|
- **Four dialects**: PostgreSQL (primary), SQLite, MySQL, MSSQL — one
|
|
27
27
|
reader/writer/adapter trio per dialect, capability-gated.
|
|
28
|
-
- **Two equivalent external formats**: human JSON and
|
|
29
|
-
|
|
28
|
+
- **Two equivalent external formats**: human JSON and XML with a packaged
|
|
29
|
+
XSD; the same model in either compiles to the identical internal
|
|
30
30
|
structure.
|
|
31
31
|
- **Deterministic entity matching**: FK/UNIQUE/index names are
|
|
32
32
|
structural hashes computed from schema + table + columns, so
|
|
@@ -49,7 +49,7 @@ pip install "asqueel-migration[postgresql]"
|
|
|
49
49
|
|
|
50
50
|
Extras: `postgresql` (psycopg 3), `mysql` (PyMySQL), `mssql`
|
|
51
51
|
(pymssql), `validation` (jsonschema), `docs`, `dev`, `all`.
|
|
52
|
-
SQLite needs no extra (stdlib driver).
|
|
52
|
+
SQLite needs no extra (stdlib driver). `all` includes all the extras listed above.
|
|
53
53
|
|
|
54
54
|
## Quickstart
|
|
55
55
|
|
|
@@ -75,6 +75,7 @@ structure = JsonStructureProducer(model).get_json_struct()
|
|
|
75
75
|
|
|
76
76
|
db = PgDatabase({"dbname": "mydb", "host": "localhost"},
|
|
77
77
|
application_schemas=["public"])
|
|
78
|
+
# Pre-create mydb when using public; see docs/known_limits.md.
|
|
78
79
|
migrator = SqlMigrator(db)
|
|
79
80
|
migrator.ormStructure = StructureValidator().validate(structure)
|
|
80
81
|
migrator.prepareMigrationCommands()
|
|
@@ -91,10 +92,11 @@ Three input formats, from the friendliest to the most technical:
|
|
|
91
92
|
|
|
92
93
|
1. **Human JSON** — readable JSON with names and lists, compiled by
|
|
93
94
|
`JsonStructureProducer` (above).
|
|
94
|
-
2. **XML** — the same information
|
|
95
|
+
2. **XML** — the same information described by the packaged XSD
|
|
95
96
|
(`sql_model-1.0.xsd`), ideal for editors and GUIs; compiled by
|
|
96
97
|
`XmlStructureProducer`. The inverse `struct_to_xml()` turns an
|
|
97
|
-
introspected database back into editable XML.
|
|
98
|
+
introspected database back into editable XML. The producer parses XML;
|
|
99
|
+
callers that need XSD validation perform it separately.
|
|
98
100
|
3. **Normalized JSON** — the internal contract, built directly with
|
|
99
101
|
the `new_*_item` factories (the route an ORM extractor takes).
|
|
100
102
|
|
|
@@ -172,11 +174,19 @@ finally:
|
|
|
172
174
|
```
|
|
173
175
|
|
|
174
176
|
`SqlMigrator(db, structure=desired)` validates and snapshots the input.
|
|
177
|
+
The service functions require a desired schema: `None` is rejected before
|
|
178
|
+
accessing the database. `SqlMigrator(db)` still supports deferred assignment.
|
|
179
|
+
Malformed structure containers raise `SqlValidationError` with their field
|
|
180
|
+
paths, including when the optional `jsonschema` dependency is absent.
|
|
175
181
|
The legacy `migrator.ormStructure = desired` form remains available and now
|
|
176
182
|
copies its input. Each preparation filters a fresh working copy; source data
|
|
177
183
|
and repeated warnings are preserved. To change the desired schema, assign it
|
|
178
184
|
again: edits to the exposed working dictionary do not update the source.
|
|
179
185
|
|
|
186
|
+
The connection's database name is the physical destination, including for
|
|
187
|
+
`CREATE DATABASE`. The desired structure's `root.entity_name` is a model label
|
|
188
|
+
and does not redirect creation to another database.
|
|
189
|
+
|
|
180
190
|
Plan identifiers cover the desired/current structure and generated commands.
|
|
181
191
|
They detect drift before execution, but do not prevent concurrent external DDL.
|
|
182
192
|
Unsupported operations block `apply_migration`; post-apply verification reports
|
|
@@ -202,11 +212,29 @@ The legacy XML helpers in `editor_service` remain transport-independent.
|
|
|
202
212
|
| `writers/` | Per-dialect DDL generation |
|
|
203
213
|
| `adapters/` | Concrete `Database`/adapter pairs per dialect |
|
|
204
214
|
|
|
215
|
+
## Development checks
|
|
216
|
+
|
|
217
|
+
Install the development dependencies before running static checks:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
python -m pip install -e ".[dev,postgresql]"
|
|
221
|
+
python -m ruff check src tests
|
|
222
|
+
python -m mypy src/asqueel_migration
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
The `dev` extra includes JSON Schema and PyMySQL stubs, and the pymssql driver
|
|
226
|
+
with its bundled Python 3 stubs. These are development dependencies; using the
|
|
227
|
+
migrator does not require installing every database driver. Mypy reads the
|
|
228
|
+
installed `dictdiffer` source because it has no published stubs.
|
|
229
|
+
|
|
205
230
|
## Documentation
|
|
206
231
|
|
|
207
232
|
Full documentation on
|
|
208
233
|
[Read the Docs](https://asqueel-migration.readthedocs.io).
|
|
209
|
-
|
|
234
|
+
See the [dialect matrix](docs/capabilities.md), [known limits](docs/known_limits.md),
|
|
235
|
+
and [test/release instructions](docs/maintenance.md). Features marked unreleased
|
|
236
|
+
are not in the published 0.2.1 package.
|
|
237
|
+
Current milestones and historical designs are indexed in [roadmap/](roadmap/00_INDEX.md).
|
|
210
238
|
|
|
211
239
|
## License
|
|
212
240
|
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Release Asqueel Migration
|
|
2
|
+
|
|
3
|
+
Distribution: `asqueel-migration`. Python package: `asqueel_migration`.
|
|
4
|
+
Repository: `asqueel-org/asqueel-migration`. Release version: `0.2.2`.
|
|
5
|
+
The single version source is `src/asqueel_migration/__init__.py`; Hatch reads it
|
|
6
|
+
for both wheel and source archive. See [CHANGELOG.md](CHANGELOG.md).
|
|
7
|
+
The retained historical tags `v0.1.0` and `v0.1.1`
|
|
8
|
+
belong to the former distribution and must not be moved or reused.
|
|
9
|
+
|
|
10
|
+
## One-time PyPI setup
|
|
11
|
+
|
|
12
|
+
While signed in as the intended PyPI owner, open
|
|
13
|
+
[Publishing](https://pypi.org/manage/account/publishing/) and add a pending GitHub
|
|
14
|
+
publisher with these exact values:
|
|
15
|
+
|
|
16
|
+
| Field | Value |
|
|
17
|
+
|---|---|
|
|
18
|
+
| PyPI project name | `asqueel-migration` |
|
|
19
|
+
| GitHub owner | `asqueel-org` |
|
|
20
|
+
| Repository | `asqueel-migration` |
|
|
21
|
+
| Workflow filename | `publish.yml` |
|
|
22
|
+
| GitHub environment | `release` |
|
|
23
|
+
|
|
24
|
+
A pending publisher does not reserve a project name. The first successful upload
|
|
25
|
+
creates the project. The repository must have a `release` environment matching this
|
|
26
|
+
configuration. No API token is required. See the official
|
|
27
|
+
[Trusted Publishing guide](https://docs.pypi.org/trusted-publishers/using-a-publisher/).
|
|
28
|
+
|
|
29
|
+
## Verify before publishing
|
|
30
|
+
|
|
31
|
+
Run the test suite, build documentation, then run:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
python -m build
|
|
35
|
+
python -m twine check --strict dist/*
|
|
36
|
+
python scripts/check_distribution.py dist/*
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Install the built wheel in a fresh environment with the `dev`, `postgresql`
|
|
40
|
+
and `validation` extras. Run the tests from the matching source archive, with
|
|
41
|
+
`PYTHONPATH` unset, and verify that `asqueel_migration.__file__` points into the
|
|
42
|
+
environment's `site-packages`. Run `pip check`, Ruff and mypy as well.
|
|
43
|
+
For PostgreSQL regressions, use the disposable server selected by
|
|
44
|
+
`GNR_TEST_PG_HOST`, `GNR_TEST_PG_PORT`, `GNR_TEST_PG_USER` and
|
|
45
|
+
`GNR_TEST_PG_PASSWORD`, or the existing `testing.postgresql` fixture.
|
|
46
|
+
|
|
47
|
+
For 0.2.2, `tests/test_legacy_unique_removal.py` must pass against the installed
|
|
48
|
+
wheel: real constraint/index names, schema-qualified index removal, preserved
|
|
49
|
+
ordinary indexes, explicit unique indexes, convergence and accepted duplicates.
|
|
50
|
+
Do not certify these checks against published 0.2.1, which lacks the fix.
|
|
51
|
+
Also verify Asqueel's native and hierarchical migration JSON against this wheel,
|
|
52
|
+
without importing either project's source tree. Record unavailable dialects
|
|
53
|
+
and skipped tests separately from successful checks.
|
|
54
|
+
|
|
55
|
+
Ensure the UNIQUE changes and regression tests are tracked before tagging.
|
|
56
|
+
Untracked files may enter a local build but are absent from a fresh CI checkout.
|
|
57
|
+
|
|
58
|
+
The manual `publish.yml` workflow builds, validates and smoke-tests both artifacts;
|
|
59
|
+
it uploads to PyPI only when the selected ref is a matching `v*` version tag.
|
|
60
|
+
Do not create the release tag until the publisher configuration and release
|
|
61
|
+
contents have been reviewed. Uploaded PyPI files cannot be replaced in place.
|
|
62
|
+
|
|
63
|
+
Publish **asqueel-migration first**, once release is authorized. Asqueel's
|
|
64
|
+
`migration` and `dev` extras depend on its public distribution. Once 0.2.2 is
|
|
65
|
+
available from PyPI, update the consumer's minimum version and CI pins as
|
|
66
|
+
appropriate and repeat installation without the migration checkout or a local
|
|
67
|
+
wheel. A local 0.2.2 artifact proves preparation, not publication.
|
|
68
|
+
|
|
69
|
+
Building and checking artifacts does not publish them. Read the Docs project/account
|
|
70
|
+
configuration is independent of the checked-in Sphinx configuration.
|
|
71
|
+
|
|
72
|
+
## Local 0.2.2 candidate verification — 2026-10-15
|
|
73
|
+
|
|
74
|
+
- Installed wheel, with imports verified under the isolated environment:
|
|
75
|
+
**581 tests passed**, including the 13 UNIQUE regressions; 12 MySQL/MSSQL
|
|
76
|
+
cases skipped because Docker was unavailable, and 5 explicitly deferred cases.
|
|
77
|
+
- Consumer Asqueel 0.6.0 wheel: **235 tests passed**, covering the native and
|
|
78
|
+
hierarchical invoice JSON, PostgreSQL application/convergence and SERIAL4.
|
|
79
|
+
Neither package was imported from its checkout.
|
|
80
|
+
- Ruff, mypy (32 source files), `pip check`, strict Twine metadata checks and
|
|
81
|
+
packaged-contract checks passed. Documentation built with warnings treated as
|
|
82
|
+
errors and the external Python intersphinx inventory disabled for offline use.
|
|
83
|
+
|
|
84
|
+
These are local artifact checks, not a claim that remote CI has run or that
|
|
85
|
+
0.2.2 has been published. MySQL and MSSQL still require their integration jobs.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Dialect capabilities
|
|
2
|
+
|
|
3
|
+
This page describes the current development branch. The SQLite `main`, legacy
|
|
4
|
+
`TIMESTAMP`, fresh-table foreign key, composite UNIQUE and PostgreSQL `serial4`
|
|
5
|
+
features are **unreleased**;
|
|
6
|
+
0.2.1 does not include them. See the changelog before adopting these features.
|
|
7
|
+
|
|
8
|
+
The tables describe the migration engine, not everything the database itself
|
|
9
|
+
supports. **I** = introspect, **C** = create, **A** = alter an existing object,
|
|
10
|
+
**D** = remove a database-only object from the desired model. A dash means no
|
|
11
|
+
implemented migration path. Column removal requires `allow_removals=True`.
|
|
12
|
+
Explicit rebuilds of an index or constraint can drop the old object even though
|
|
13
|
+
standalone removal is not implemented.
|
|
14
|
+
|
|
15
|
+
## PostgreSQL
|
|
16
|
+
|
|
17
|
+
| Entity | I | C | A | D |
|
|
18
|
+
| --- | --- | --- | --- | --- |
|
|
19
|
+
| Database | Existence | Yes | — | — |
|
|
20
|
+
| Schema | Yes | Yes | — | — |
|
|
21
|
+
| Table | Yes | Yes | Columns, PK, constraints, indexes, comments | — |
|
|
22
|
+
| Column | Yes | Yes | Type/size, default, nullability, uniqueness, comment | Opt-in |
|
|
23
|
+
| Primary key | Yes | Yes | Rebuild | — |
|
|
24
|
+
| Foreign key | Yes | Yes | Rebuild | — |
|
|
25
|
+
| UNIQUE / CHECK | Yes | Yes | Rebuild | — |
|
|
26
|
+
| Index | Yes | Yes | Rename or rebuild | — |
|
|
27
|
+
| Extension | Yes | Yes | — | — |
|
|
28
|
+
| Table/column comment | Yes | Yes | Replace | — |
|
|
29
|
+
| Event trigger | Yes | — | — | — |
|
|
30
|
+
| View, routine, table trigger, custom type, standalone sequence | — | — | — | — |
|
|
31
|
+
|
|
32
|
+
Foreign key deferral and index method, predicate, tablespace and storage options
|
|
33
|
+
are represented. Type conversion depends on the conversion matrix and existing
|
|
34
|
+
data; `force`/`backup` can be destructive. `serial` means 64-bit BIGSERIAL; `serial4` declares 32-bit sequence-backed keys.
|
|
35
|
+
See [serial widths and conversion limits](known_limits.md).
|
|
36
|
+
|
|
37
|
+
## SQLite
|
|
38
|
+
|
|
39
|
+
| Entity | I | C | A | D |
|
|
40
|
+
| --- | --- | --- | --- | --- |
|
|
41
|
+
| Database | File existence | File creation | — | — |
|
|
42
|
+
| Schema | `main` or attached file | `main` already exists; other schemas attach files | — | — |
|
|
43
|
+
| Table | Yes | Yes | Add columns/indexes; selected index rebuilds | — |
|
|
44
|
+
| Column | Declared types, defaults, nullability | Yes | Add; type/default/nullability changes unsupported | Opt-in, subject to SQLite restrictions |
|
|
45
|
+
| Primary key | Yes | With table | — | — |
|
|
46
|
+
| Foreign key | Yes | With table, same schema | — | — |
|
|
47
|
+
| Composite UNIQUE | Yes | With table | — | — |
|
|
48
|
+
| Single-column UNIQUE | Yes | With table/column | Adding/removing uniqueness on an existing column unsupported | — |
|
|
49
|
+
| CHECK | — | — | — | — |
|
|
50
|
+
| Index | Columns and predicate; unique-index fidelity limited | Yes, including partial indexes | Rebuild; unique-index fidelity limited | — |
|
|
51
|
+
| Comments, extensions, event triggers, extended entities | — | — | — | — |
|
|
52
|
+
|
|
53
|
+
Foreign keys are inline in `CREATE TABLE`, enforced on connections opened by
|
|
54
|
+
this library, and read through `PRAGMA foreign_key_list`. UPDATE/DELETE actions
|
|
55
|
+
and composite references round-trip. Cross-attached-file foreign keys and
|
|
56
|
+
requested deferral options are rejected by reviewed apply. Constraint names are
|
|
57
|
+
not recovered by SQLite PRAGMAs; use the default `ignore_constraint_name=True`.
|
|
58
|
+
No automatic table rebuild is implemented. `TIMESTAMP` maps to `DH` without
|
|
59
|
+
rewriting a legacy column. Use dtype `I` for SQLite integer primary keys.
|
|
60
|
+
|
|
61
|
+
## MySQL and SQL Server
|
|
62
|
+
|
|
63
|
+
| Entity | MySQL I / C / A / D | SQL Server I / C / A / D |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| Database/schema | Yes / Yes / — / — | Yes / Yes / — / — |
|
|
66
|
+
| Table | Yes / Yes / columns and constraints / — | Yes / Yes / columns and constraints / — |
|
|
67
|
+
| Column | Yes / Yes / type, default, nullability, uniqueness / opt-in | Yes / Yes / type, default, nullability, uniqueness / opt-in |
|
|
68
|
+
| Primary key | Yes / Yes / rebuild / — | Yes / Yes / rebuild / — |
|
|
69
|
+
| Foreign key | Yes / Yes / rebuild / — | Yes / Yes / rebuild / — |
|
|
70
|
+
| UNIQUE / CHECK | Yes / Yes / rebuild / — | Yes / Yes / rebuild / — |
|
|
71
|
+
| Index | Yes / Yes / rename or rebuild / — | Yes / Yes / rename or rebuild / — |
|
|
72
|
+
| Comments, extensions, event triggers, extended entities | — / — / — / — | — / — / — / — |
|
|
73
|
+
|
|
74
|
+
Both dialects reject requested FK deferral and unsupported index options. SQL
|
|
75
|
+
Server supports filtered indexes; MySQL does not. Type conversions have no
|
|
76
|
+
PostgreSQL-style conversion expressions and may require a destructive fallback.
|
|
77
|
+
The CI integration suites exercise both backends; they are not SQLite substitutes.
|
|
78
|
+
|
|
79
|
+
## Interpreting a plan
|
|
80
|
+
|
|
81
|
+
`empty` only means no SQL was generated. Inspect `skipped_changes` for structured
|
|
82
|
+
omissions (`capability`, `context`, `warning`); legacy `skipped` remains a list of
|
|
83
|
+
warning strings. `apply_migration` refuses any recorded unsupported change before
|
|
84
|
+
DDL. Database-only objects retained by the additive contract are not omissions.
|
|
85
|
+
See [known limits](known_limits.md) and [test setup](maintenance.md).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Sphinx configuration for asqueel-migration documentation."""
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
|
-
from importlib
|
|
4
|
+
from importlib import import_module
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
7
|
# Add src to path
|
|
@@ -11,10 +11,8 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
|
|
11
11
|
project = "Asqueel Migration"
|
|
12
12
|
copyright = "2025-2026, Softwell S.r.l."
|
|
13
13
|
author = "Softwell S.r.l."
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
except PackageNotFoundError:
|
|
17
|
-
release = "0.1.2"
|
|
14
|
+
# Document the checked-out source even when an older wheel is installed.
|
|
15
|
+
release = import_module("asqueel_migration").__version__
|
|
18
16
|
|
|
19
17
|
# Extensions
|
|
20
18
|
extensions = [
|
|
@@ -28,7 +26,10 @@ extensions = [
|
|
|
28
26
|
]
|
|
29
27
|
|
|
30
28
|
# Templates
|
|
31
|
-
exclude_patterns = [
|
|
29
|
+
exclude_patterns = [
|
|
30
|
+
"_build", "Thumbs.db", ".DS_Store",
|
|
31
|
+
"legacy_test_alignment.md", "decisioni-e-ripartenza.md",
|
|
32
|
+
]
|
|
32
33
|
|
|
33
34
|
# HTML output
|
|
34
35
|
html_theme = "sphinx_rtd_theme"
|
|
@@ -52,6 +53,3 @@ intersphinx_mapping = {
|
|
|
52
53
|
napoleon_google_docstring = True
|
|
53
54
|
napoleon_numpy_docstring = False
|
|
54
55
|
napoleon_include_init_with_doc = True
|
|
55
|
-
|
|
56
|
-
# Keep the internal legacy-test audit out of the developer manual.
|
|
57
|
-
exclude_patterns = ["_build", ".DS_Store", "legacy_test_alignment.md"]
|
|
@@ -12,8 +12,16 @@ design — any producer that emits the JSON contract can drive it.
|
|
|
12
12
|
|
|
13
13
|
Supported dialects: PostgreSQL, SQLite, MySQL, MSSQL.
|
|
14
14
|
|
|
15
|
+
The producer guide covers normalized input, reviewed ``plan_migration`` /
|
|
16
|
+
``apply_migration`` execution, connection ownership and the PostgreSQL CLI.
|
|
17
|
+
HTTP, OpenAPI, MCP and backup/restore belong to the separate
|
|
18
|
+
`Asqueel DB Manager <https://github.com/asqueel-org/asqueel-dbmanager>`_ application.
|
|
19
|
+
|
|
15
20
|
.. toctree::
|
|
16
21
|
:maxdepth: 2
|
|
17
22
|
:caption: Contents
|
|
18
23
|
|
|
19
24
|
producer_guide
|
|
25
|
+
capabilities
|
|
26
|
+
known_limits
|
|
27
|
+
maintenance
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Known limits
|
|
2
|
+
|
|
3
|
+
These limits apply to the current development branch; the capability matrix
|
|
4
|
+
marks features not yet released in 0.2.1.
|
|
5
|
+
|
|
6
|
+
## Additive comparison, removals and renames
|
|
7
|
+
|
|
8
|
+
The engine checks whether the database can host the model. Extra database
|
|
9
|
+
objects remain. `allow_removals=True` enables the implemented DROP COLUMN handler;
|
|
10
|
+
it does not delete tables, schemas, indexes, relations, constraints or extensions.
|
|
11
|
+
Column drops can fail on dependencies and do not perform an automatic cascade.
|
|
12
|
+
Table and column renames are not inferred: a new name is treated as an addition,
|
|
13
|
+
and opting into removals can lose data. Index/constraint names are normally
|
|
14
|
+
ignored when structural identity matches. Use a deliberate external migration
|
|
15
|
+
for renames and unsupported schema transformations.
|
|
16
|
+
|
|
17
|
+
## Execution and concurrency
|
|
18
|
+
|
|
19
|
+
Database creation is separate from the target DDL transaction. PostgreSQL,
|
|
20
|
+
SQLite and SQL Server roll back the target DDL unit on failure; a newly created
|
|
21
|
+
database/file can remain. MySQL DDL can commit implicitly and reports best-effort
|
|
22
|
+
execution. Back up data and review destructive conversions before applying.
|
|
23
|
+
|
|
24
|
+
A `plan_id` detects drift between review and execution, but does not lock other
|
|
25
|
+
DDL writers. Coordinate migrations at the application/deployment level. The
|
|
26
|
+
post-apply `verified` flag reports convergence, not a rollback if verification
|
|
27
|
+
finds residual changes. Replan and review before retrying after a failure.
|
|
28
|
+
|
|
29
|
+
## SQLite
|
|
30
|
+
|
|
31
|
+
`main` uses the configured database file. Other schemas use sibling files
|
|
32
|
+
`<stem>_<schema>.db`; there is no `*_main.db`. This support is unreleased after
|
|
33
|
+
0.2.1. Temporary/in-memory layouts are not part of the file-based facade contract.
|
|
34
|
+
|
|
35
|
+
New tables can declare same-schema foreign keys and composite UNIQUE constraints
|
|
36
|
+
in the development branch. Additions or changes to those constraints on existing
|
|
37
|
+
tables require a table rebuild, which the engine does not implement. CHECK,
|
|
38
|
+
foreign key deferral and cross-file foreign keys remain unsupported. Do not
|
|
39
|
+
suppress skipped-operation errors to create an unconstrained schema.
|
|
40
|
+
|
|
41
|
+
SQLite PRAGMAs do not expose FK names or deferral clauses. The reader represents
|
|
42
|
+
FK columns, target and actions, with structural names; it does not prove the
|
|
43
|
+
absence of an existing deferred constraint. Standalone unique indexes also have
|
|
44
|
+
limited introspection fidelity; prefer declared UNIQUE constraints for uniqueness.
|
|
45
|
+
Declared type mapping is not a full SQLite affinity equivalence system. Legacy
|
|
46
|
+
`TIMESTAMP` is recognized as `DH`; this does not imply arbitrary type aliases are
|
|
47
|
+
interchangeable. SQLite integer primary keys should use `I`, not `serial`.
|
|
48
|
+
|
|
49
|
+
## PostgreSQL SERIAL4 and SERIAL8
|
|
50
|
+
|
|
51
|
+
`dtype="serial"` continues to mean BIGSERIAL/SERIAL8. The development branch
|
|
52
|
+
adds `dtype="serial4"` for PostgreSQL's 32-bit integer with a sequence-backed
|
|
53
|
+
default. New tables create SERIAL4 keys; existing integer columns with a
|
|
54
|
+
`nextval(...)` default are read as `serial4`. Planning/applying the matching
|
|
55
|
+
model preserves values, sequence ownership/name/options/current position,
|
|
56
|
+
defaults and dependent constraints without DDL.
|
|
57
|
+
|
|
58
|
+
Legacy `I` declarations can still adopt existing SERIAL4 columns without changing
|
|
59
|
+
them. An `I` declaration on a fresh database remains a plain integer without
|
|
60
|
+
auto-generation. A plain integer without a sequence default is not SERIAL4.
|
|
61
|
+
The new declaration is PostgreSQL-only and cannot override `size` or `sqldefault`.
|
|
62
|
+
This feature is unreleased after 0.2.1 and requires the coordinated Asqueel grammar
|
|
63
|
+
update when used through `AsqueelDb`.
|
|
64
|
+
|
|
65
|
+
Automatic conversions to/from `serial4` are rejected, including empty columns
|
|
66
|
+
and `force`/`backup` modes; adopting SERIAL4 as `I` is the compatibility exception.
|
|
67
|
+
The separate [issue #27](https://github.com/asqueel-org/asqueel-migration/issues/27)
|
|
68
|
+
tracks the explicit SERIAL4-to-SERIAL8 upgrade preserving sequences and
|
|
69
|
+
constraints. Changing the declaration to `serial` is not an upgrade procedure.
|
|
70
|
+
|
|
71
|
+
## PostgreSQL initial public schema
|
|
72
|
+
|
|
73
|
+
Creating a missing database whose desired model includes `public` can attempt
|
|
74
|
+
`CREATE SCHEMA public` after PostgreSQL already created it. Pre-create the target
|
|
75
|
+
database before planning, or use a dedicated application schema. This is an
|
|
76
|
+
existing engine limitation, not addressed by the SQLite changes.
|
|
77
|
+
|
|
78
|
+
## Other contract boundaries
|
|
79
|
+
|
|
80
|
+
Views, routines, table triggers, custom types and standalone sequences remain
|
|
81
|
+
design proposals. Event trigger creation is not implemented even though the
|
|
82
|
+
structure can represent it. The CLI drives PostgreSQL through `SqlMigrator` and
|
|
83
|
+
does not yet accept a reviewed `plan_id`; use `plan_migration`/`apply_migration`
|
|
84
|
+
for strict unsupported-operation rejection. XML parsing does not execute XSD
|
|
85
|
+
validation automatically. The HTTP/MCP server is in Asqueel DB Manager.
|