dbconform 0.2.7__tar.gz → 0.2.8__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.
- {dbconform-0.2.7/src/dbconform.egg-info → dbconform-0.2.8}/PKG-INFO +1 -1
- {dbconform-0.2.7 → dbconform-0.2.8}/pyproject.toml +2 -2
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/adapters/model_schema.py +45 -6
- {dbconform-0.2.7 → dbconform-0.2.8/src/dbconform.egg-info}/PKG-INFO +1 -1
- {dbconform-0.2.7 → dbconform-0.2.8}/LICENSE +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/README.md +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/setup.cfg +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/__init__.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/adapters/__init__.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/adapters/sa_to_neutral.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/cli.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/compare/__init__.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/compare/db_schema.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/compare/diff.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/conform.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/errors.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/internal/__init__.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/internal/objects.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/internal/types.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/plan/__init__.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/plan/builder.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/plan/steps.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/schema/__init__.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/schema/db_schema.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/schema/diff.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/schema/model_schema.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/schema/objects.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/schema/sa_to_neutral.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/sql_dialect/__init__.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/sql_dialect/base.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/sql_dialect/postgresql.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/sql_dialect/sqlite.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform/sql_dialect/sqlite_rebuild.py +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform.egg-info/SOURCES.txt +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform.egg-info/dependency_links.txt +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform.egg-info/entry_points.txt +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform.egg-info/requires.txt +0 -0
- {dbconform-0.2.7 → dbconform-0.2.8}/src/dbconform.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dbconform"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.8"
|
|
8
8
|
description = "Synchronize database schema to models — document-driven project."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -62,7 +62,7 @@ where = ["src"]
|
|
|
62
62
|
dbconform = "dbconform.cli:main"
|
|
63
63
|
|
|
64
64
|
[tool.commitizen]
|
|
65
|
-
version = "0.2.
|
|
65
|
+
version = "0.2.8"
|
|
66
66
|
version_scheme = "semver"
|
|
67
67
|
commit = true
|
|
68
68
|
tag = true
|
|
@@ -149,6 +149,45 @@ def _default_expr(column: Any, _dialect: Dialect | None) -> str | None:
|
|
|
149
149
|
return None
|
|
150
150
|
|
|
151
151
|
|
|
152
|
+
def _column_is_implicit_autoincrement_pk(
|
|
153
|
+
column: Any,
|
|
154
|
+
*,
|
|
155
|
+
is_single_pk: bool,
|
|
156
|
+
pk_col_name: str | None,
|
|
157
|
+
integer_type_names: tuple[str, ...],
|
|
158
|
+
) -> bool:
|
|
159
|
+
"""
|
|
160
|
+
Decide whether a column should be treated as autoincrement in internal schema.
|
|
161
|
+
|
|
162
|
+
Policy: dbconform prefers explicit SQLAlchemy/SQLModel model declarations, but we
|
|
163
|
+
intentionally support SQLAlchemy's documented implicit autoincrement behavior for
|
|
164
|
+
compatibility (single integer PK with ``autoincrement='auto'`` and no other default
|
|
165
|
+
generator). See docs/requirements/01-functional.md (Schema parity scope).
|
|
166
|
+
"""
|
|
167
|
+
is_pk_col = pk_col_name is not None and column.name == pk_col_name
|
|
168
|
+
is_integer = type(column.type).__name__ in integer_type_names
|
|
169
|
+
if not (is_single_pk and is_pk_col and is_integer):
|
|
170
|
+
return False
|
|
171
|
+
|
|
172
|
+
sa_auto = getattr(column, "autoincrement", False)
|
|
173
|
+
if sa_auto is True:
|
|
174
|
+
return True
|
|
175
|
+
if sa_auto is False:
|
|
176
|
+
return False
|
|
177
|
+
if isinstance(sa_auto, str):
|
|
178
|
+
if sa_auto != "auto":
|
|
179
|
+
return False
|
|
180
|
+
# SQLAlchemy docs: implicit autoincrement applies only when no other
|
|
181
|
+
# default-generating construct is present.
|
|
182
|
+
has_other_default_generator = (
|
|
183
|
+
getattr(column, "default", None) is not None
|
|
184
|
+
or getattr(column, "server_default", None) is not None
|
|
185
|
+
or getattr(column, "identity", None) is not None
|
|
186
|
+
)
|
|
187
|
+
return not has_other_default_generator
|
|
188
|
+
return False
|
|
189
|
+
|
|
190
|
+
|
|
152
191
|
def _extract_table_def(
|
|
153
192
|
table: Table,
|
|
154
193
|
target_schema: str | None,
|
|
@@ -167,12 +206,12 @@ def _extract_table_def(
|
|
|
167
206
|
default = _default_expr(col, dialect)
|
|
168
207
|
type_str = _column_type_str(col, dialect)
|
|
169
208
|
comment = getattr(col, "comment", None)
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
209
|
+
autoincrement = _column_is_implicit_autoincrement_pk(
|
|
210
|
+
col,
|
|
211
|
+
is_single_pk=bool(is_single_pk),
|
|
212
|
+
pk_col_name=pk_col_name,
|
|
213
|
+
integer_type_names=_integer_type_names,
|
|
214
|
+
)
|
|
176
215
|
columns.append(
|
|
177
216
|
ColumnDef(
|
|
178
217
|
name=col.name,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|