Integrity check compares a cast-stripped default against the raw one — every converged migrate exits non-zero

未关闭
#97 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
64/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
csharp, postgresql
领域
databases

调研方向

Start at the post-apply schema integrity check and its comparison with the default read from pg_attrdef; reproduce the report against a converged database or a migration using an explicit ::text default. Done means both values are normalized consistently, the check passes, and migrate exits 0 when no operations are needed.

由索引模型根据 Issue 内容生成。

描述

Version

DataProviderMigrate 0.9.12-beta.

Summary

The post-apply schema integrity check reports a mismatch between a default and
itself, differing only by the ::text cast:

Migration completed successfully
SCHEMA INTEGRITY CHECK FAILED
public.topup.status: default expected 'pending' but found 'pending'::text

The schema declares exactly what the database contains:

- name: status
  type: Text
  isNullable: false
  defaultValue: "'pending'::text"

One side of the comparison is normalised (cast stripped) and the other is not, so
they can never match for any defaultValue written with an explicit cast.

Impact

This is worse than cosmetic, because it destroys the exit code as a signal:

Phase: all — applying 1 of 1 operation(s):
  AddCheckConstraintOperation
Migration completed successfully
SCHEMA INTEGRITY CHECK FAILED
make: *** [migrate] Error 1

The migration applied correctly and the tool still exits non-zero. A fully converged
database does the same:

Schema is up to date — no operations needed
SCHEMA INTEGRITY CHECK FAILED

So an operator cannot distinguish "your migration failed" from "your migration worked
and the checker is comparing a string to itself", and no wrapper can gate on the exit
status. We hit this while diagnosing a real failure (#96) and had to read the log body
to tell the two apart.

Expected

Normalise both sides before comparing — parse the default to a value, or apply the
same cast-stripping to the value read from pg_attrdef that is applied to the schema
value. A converged database should exit 0.

主要语言
C#
星标
68
派生
4
平均合并
50 分钟
30 天内合并 PR
2

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Nimblesite/DataProvider 的其他 Issue

查看 Nimblesite/DataProvider 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。