dbconform 0.2.2__tar.gz → 0.2.4__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.2/src/dbconform.egg-info → dbconform-0.2.4}/PKG-INFO +1 -1
- {dbconform-0.2.2 → dbconform-0.2.4}/pyproject.toml +2 -2
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/conform.py +1 -1
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/plan/builder.py +7 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/plan/steps.py +41 -1
- {dbconform-0.2.2 → dbconform-0.2.4/src/dbconform.egg-info}/PKG-INFO +1 -1
- {dbconform-0.2.2 → dbconform-0.2.4}/LICENSE +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/README.md +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/setup.cfg +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/__init__.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/adapters/__init__.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/adapters/model_schema.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/adapters/sa_to_neutral.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/cli.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/compare/__init__.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/compare/db_schema.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/compare/diff.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/errors.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/internal/__init__.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/internal/objects.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/internal/types.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/plan/__init__.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/schema/__init__.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/schema/db_schema.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/schema/diff.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/schema/model_schema.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/schema/objects.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/schema/sa_to_neutral.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/sql_dialect/__init__.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/sql_dialect/base.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/sql_dialect/postgresql.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/sql_dialect/sqlite.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform/sql_dialect/sqlite_rebuild.py +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform.egg-info/SOURCES.txt +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform.egg-info/dependency_links.txt +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform.egg-info/entry_points.txt +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/src/dbconform.egg-info/requires.txt +0 -0
- {dbconform-0.2.2 → dbconform-0.2.4}/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.4"
|
|
8
8
|
description = "Synchronize database schema to models — document-driven project."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -61,7 +61,7 @@ where = ["src"]
|
|
|
61
61
|
dbconform = "dbconform.cli:main"
|
|
62
62
|
|
|
63
63
|
[tool.commitizen]
|
|
64
|
-
version = "0.2.
|
|
64
|
+
version = "0.2.4"
|
|
65
65
|
version_scheme = "semver"
|
|
66
66
|
commit = true
|
|
67
67
|
tag = true
|
|
@@ -498,7 +498,7 @@ class DbConform:
|
|
|
498
498
|
)
|
|
499
499
|
if isinstance(plan_or_error, ConformError):
|
|
500
500
|
return plan_or_error
|
|
501
|
-
plan = plan_or_error
|
|
501
|
+
plan: ConformPlan = plan_or_error
|
|
502
502
|
if not commit_per_step and not conn.in_transaction():
|
|
503
503
|
conn.commit()
|
|
504
504
|
apply_err = _apply_plan(
|
|
@@ -232,6 +232,13 @@ class ConformPlanBuilder:
|
|
|
232
232
|
alter_sql = self.dialect.alter_column_sql(name, old_col, new_col)
|
|
233
233
|
if alter_sql:
|
|
234
234
|
if self.dialect.would_shrink(old_col, new_col) and not self.allow_shrink_column:
|
|
235
|
+
skipped_steps.append(
|
|
236
|
+
SkippedStep(
|
|
237
|
+
description=f"Alter column {new_col.name} on {name}",
|
|
238
|
+
reason="Column shrink blocked: allow_shrink_column=False",
|
|
239
|
+
table_name=name,
|
|
240
|
+
)
|
|
241
|
+
)
|
|
235
242
|
continue
|
|
236
243
|
steps.append(
|
|
237
244
|
AlterTableStep(
|
|
@@ -9,7 +9,8 @@ from __future__ import annotations
|
|
|
9
9
|
|
|
10
10
|
from collections.abc import Iterator
|
|
11
11
|
from dataclasses import dataclass, field
|
|
12
|
-
from typing import Any
|
|
12
|
+
from typing import Any, TextIO
|
|
13
|
+
import sys
|
|
13
14
|
|
|
14
15
|
from dbconform.internal.objects import (
|
|
15
16
|
ColumnDef,
|
|
@@ -128,3 +129,42 @@ class ConformPlan:
|
|
|
128
129
|
def statements(self) -> list[str]:
|
|
129
130
|
"""Return list of SQL statements (excludes RebuildTableStep; use apply executor)."""
|
|
130
131
|
return [s.sql for s in self.steps if s.sql is not None and s.sql.strip()]
|
|
132
|
+
|
|
133
|
+
def summary(self) -> str:
|
|
134
|
+
"""
|
|
135
|
+
Return a human-readable summary of the plan.
|
|
136
|
+
|
|
137
|
+
Includes counts of steps, extra_tables, and skipped_steps, plus brief details
|
|
138
|
+
for each section. See docs/requirements/01-functional.md (Plan and DDL order)
|
|
139
|
+
and 02-non-functional.md (Observability).
|
|
140
|
+
"""
|
|
141
|
+
lines: list[str] = []
|
|
142
|
+
lines.append(
|
|
143
|
+
f"ConformPlan: {len(self.steps)} steps, "
|
|
144
|
+
f"{len(self.extra_tables)} extra tables, "
|
|
145
|
+
f"{len(self.skipped_steps)} skipped steps"
|
|
146
|
+
)
|
|
147
|
+
if self.steps:
|
|
148
|
+
lines.append("Steps:")
|
|
149
|
+
for step in self.steps:
|
|
150
|
+
lines.append(f"- {step.description}")
|
|
151
|
+
if self.extra_tables:
|
|
152
|
+
lines.append("Extra tables:")
|
|
153
|
+
for name in self.extra_tables:
|
|
154
|
+
lines.append(f"- {name}")
|
|
155
|
+
if self.skipped_steps:
|
|
156
|
+
lines.append("Skipped steps:")
|
|
157
|
+
for s in self.skipped_steps:
|
|
158
|
+
table = f" on {s.table_name}" if s.table_name is not None else ""
|
|
159
|
+
lines.append(f"- {s.description}{table} (reason: {s.reason})")
|
|
160
|
+
return "\n".join(lines)
|
|
161
|
+
|
|
162
|
+
def print_summary(self, file: TextIO | None = None) -> None:
|
|
163
|
+
"""
|
|
164
|
+
Pretty-print the plan summary to a file-like object (stdout by default).
|
|
165
|
+
|
|
166
|
+
Convenience wrapper around summary() so callers can quickly inspect
|
|
167
|
+
planned steps, extra tables, and skipped steps.
|
|
168
|
+
"""
|
|
169
|
+
target = file if file is not None else sys.stdout
|
|
170
|
+
target.write(self.summary() + "\n")
|
|
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
|