Comments (1)
Sync2 同步能够部分智能的根据结构体的变动检测表结构的变动,并自动同步。
- 自动检测和创建表,这个检测是根据表的名字
- 自动检测和新增表中的字段,这个检测是根据字段名,同时对表中多余的字段给出警告信息
- 自动检测,创建和删除索引和唯一索引,这个检测是根据索引的一个或多个字段名,而不根据索引名称。因此这里需要注意,如果在一个有大量数据的表中引入新的索引,数据库可能需要一定的时间来建立索引。
- 自动转换varchar字段类型到text字段类型,自动警告其它字段类型在模型和数据库之间不一致的情况。
- 自动警告字段的默认值,是否为空信息在模型和数据库之间不匹配的情况
以上这些警告信息需要将engine.ShowWarn
设置为 true
才会显示。
err := engine.Sync2(new(User), new(Group))
from xorm.
Related Issues (20)
- 子查询不可用 HOT 1
- no primary key for col HOT 2
- 支持sql拦截器吗 或者计划支持么 HOT 1
- 查询float类型的数据与实际的数据不一致 HOT 2
- 还继续维护吗?
- 当我使用engin.SQL(sqlStr, args...).Query().List()方法得时候,如果字段是NULL 返回得结果里面不展示为啥?
- 使用原生sql语句配合Limit函数进行数据库分页查询出错
- processor.BeforeInsert() 为什么不传入参数
- 读写分离能力与文档不符合
- 错误的test, 也没有example HOT 1
- orm方式插入数据时未赋值的string类型字段会插入空字符串而非使用tag 定义的`default`中的值
- model支持外键
- session.QueryRows中方法查询失败后,未检查返回的core.Rows是否为nil,直接rows.close,导致panic HOT 2
- 会考虑支持CockroachDB吗? HOT 2
- 嵌套类型不能正确设值 HOT 2
- unsupported type xorm.sqlExpr, a struct
- 建议123
- ORACLE insert bug HOT 1
- 为什么engine中删除showExecTime方法 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xorm.