Comments (4)
You are possible to use it already, but because it doesn't works with sqlite, so haven't add it to README.
from gorm.
Just tried it for this structure on a PostgreSQL database
type User struct {
Id int64
Name string
db.AddIndex("name")
Doesn't seem to create any index.
from gorm.
Should be?
db.Model(User{}).AddIndex("name")
from gorm.
Thanks! It worked!
What about a parameter to specify whether the index should be UNIQUE or not?
from gorm.
Related Issues (20)
- 针对下列复杂SQL查询,GORM怎么处理? HOT 3
- mysql JSON_SET cannot be used in many ways HOT 2
- “删除关联”无法正常工作 HOT 1
- 单列索引在不指定索引名时索引名生成规则用的是定义field name,而不是用的 column name HOT 5
- Joins 必须要写sql语句?好呆的设计啊 HOT 5
- I want to implement global error handling in Gorm
- how to control timeout for every single sql statement,like create,update,query,raw sql HOT 1
- Transaction not commit under certain special circumstances. HOT 1
- gorm gen 生成的 entity, 应该怎么写 hooks 呢? HOT 8
- autoIncrementIncrement not work in postgres
- The plugin BeforeCreate conflicts with the model's BeforeCreate, and the program crashes HOT 1
- Callback().Update() 不生效 HOT 1
- 内存泄漏 HOT 1
- how to add comment for a table(not field) by using automigrate?
- model只有一个字段并设置为unique,使用AutoMigrate,第二次启动服务Migrate会报错 HOT 6
- 关于在BeforeUpdate钩子函数中执行变更字段的问题
- db.frist bug HOT 5
- Duplicate savepoint names resulting in partial rollbacks in nested transactions
- Update docs to reflect db.Save behavior HOT 3
- How to select all the columns in Join query? HOT 4
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 gorm.