Add migration-5-to-7 module: Hibernate 5.6.15 vs 7.4.14 jar diff, compile checks, schema defaults and cheat-sheet snippets
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YPgGH6aMbSLANL3E2HHmS6
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Lines up output/06-schema-5.6.15.txt and output/06-schema-7.4.14.txt side by side into output/06-schema-diff.txt."""
|
||||
import pathlib
|
||||
|
||||
OUT = pathlib.Path(__file__).resolve().parent.parent / "output"
|
||||
|
||||
|
||||
def read(version):
|
||||
seq, cols, section = {}, {}, None
|
||||
for line in (OUT / f"06-schema-{version}.txt").read_text().splitlines():
|
||||
if line.startswith("-- sequences"):
|
||||
section = "seq"
|
||||
elif line.startswith("-- columns"):
|
||||
section = "col"
|
||||
elif section == "seq":
|
||||
name, inc = line.rsplit(" ", 1)
|
||||
seq[name] = inc
|
||||
elif section == "col":
|
||||
name, typ = line.split(" ", 1)
|
||||
cols[name] = typ
|
||||
return seq, cols
|
||||
|
||||
|
||||
s5, c5 = read("5.6.15")
|
||||
s7, c7 = read("7.4.14")
|
||||
rows = [f"{'':<14}{'Hibernate 5.6.15':<26}{'Hibernate 7.4.14':<26}", "-- id sequences (name, increment)"]
|
||||
rows.append(f"{'':<14}{', '.join(f'{k} {v}' for k, v in s5.items()):<26}{', '.join(f'{k} {v}' for k, v in s7.items())}")
|
||||
rows.append("-- column types in H2")
|
||||
for name in sorted(set(c5) | set(c7)):
|
||||
a, b = c5.get(name, "-"), c7.get(name, "-")
|
||||
rows.append(f"{name:<14}{a:<26}{b:<26}{'(same)' if a == b else '<-- differs'}")
|
||||
(OUT / "06-schema-diff.txt").write_text("\n".join(rows) + "\n")
|
||||
print("\n".join(rows))
|
||||
Reference in New Issue
Block a user