GithubHelp home page GithubHelp logo

使用PostgreSql,当dev环境的数据库schema与sit环境不一致时,调用IDbAccessor.UpdateSql方法会报错 about efcore.sharding HOT 9 CLOSED

NCrab1998 avatar NCrab1998 commented on June 13, 2024
使用PostgreSql,当dev环境的数据库schema与sit环境不一致时,调用IDbAccessor.UpdateSql方法会报错

from efcore.sharding.

Comments (9)

Coldairarrow avatar Coldairarrow commented on June 13, 2024

为么测试环境和生产环境schema不一致,这不是给自己挖坑?

from efcore.sharding.

NCrab1998 avatar NCrab1998 commented on June 13, 2024

为么测试环境和生产环境schema不一致,这不是给自己挖坑?

这不是 sit 环境跟 prd 环境一不一致的问题, 那只是我描述发现问题的过程
只是感觉这 schema 写死在 table 标签, 配置连接字符串的"Search Path"也没用, 不太好
而且查询方法是没问题的, 就这个 UpdateSql 要组装 SQL 的地方给报错了

from efcore.sharding.

hkszlq avatar hkszlq commented on June 13, 2024

为么测试环境和生产环境schema不一致,这不是给自己挖坑?

通常生产环境的Schema不会取名默认的Public.
假如Postgresql的Schema是“Other”,希望从Postgresql的连接字符串比如Search Path="Othter",框架自动取得Schema:“Other”, UpdateSQL方法会使用Other.TABLCNMMA来执行语句

from efcore.sharding.

Coldairarrow avatar Coldairarrow commented on June 13, 2024

为什么测试环境不设为Othter?
并且标准连接字符串中并没有这个定义,https://www.connectionstrings.com/npgsql/
如果想自己定义,这不符合约定大于配置原则

from efcore.sharding.

hkszlq avatar hkszlq commented on June 13, 2024

为什么测试环境不设为Othter?
测试环境可以使用啊,重新改成'Other',重新编译即可,但如果将来生产环境改名或其他项目不用这个名字了岂不是要重新编译造成不便呀。
并且标准连接字符串中并没有这个定义,https://www.connectionstrings.com/npgsql/
有呀,参考:https://www.npgsql.org/doc/connection-string-parameters.html
Search Path | Sets the schema search path. 设置此值会拿到实际使用的schema

如果想自己定义,这不符合约定大于配置原则
这是客户安全部门的硬性要求不能使用默认schema名称,没办法啊

from efcore.sharding.

Coldairarrow avatar Coldairarrow commented on June 13, 2024

这个schema应该是按照业务划分的,在数据库设计的时候就应该定下来,而不是说可以随便改变的东西
只要代码是同一份,那么数据库就应该是一样的结构

from efcore.sharding.

hkszlq avatar hkszlq commented on June 13, 2024

这个schema应该是按照业务划分的,在数据库设计的时候就应该定下来,而不是说可以随便改变的东西
只要代码是同一份,那么数据库就应该是一样的结构

对的,一般定下来就不会改的,只是如果您的框架能通过更改配置自适应Schema那就更加完美了。

from efcore.sharding.

Coldairarrow avatar Coldairarrow commented on June 13, 2024

做都能做,但是没必要做,如果仅仅为了支持这种特殊场景而去自定义一个配置项,意义不大
所以不考虑

from efcore.sharding.

hkszlq avatar hkszlq commented on June 13, 2024

做都能做,但是没必要做,如果仅仅为了支持这种特殊场景而去自定义一个配置项,意义不大
所以不考虑

了解。

from efcore.sharding.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.