Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create index on multiple column #334

Open
ginsuma opened this issue May 27, 2017 · 1 comment
Open

Create index on multiple column #334

ginsuma opened this issue May 27, 2017 · 1 comment

Comments

@ginsuma
Copy link

ginsuma commented May 27, 2017

I tried with
this.createIndex("table",["col1","col2","col3"],"int")
but after run "nodal db:migrate", got error: column "col1,col2,col3" does not exist.
Btw, what does "type" in "createIndex(table, column, type)" mean?

@maxism
Copy link
Contributor

maxism commented May 30, 2017

You should call createIndex(table, columnName, indexType) method as many times as how many indexes you need to create. For example,

this.createIndex('table', 'col1');
this.createIndex('table', 'col2');
this.createIndex('table', 'col3');

The last parameter of that method describes type of index you are creating. For PostgreSQL database you can use different index types: btree, hash, gist, gin... Read https://www.postgresql.org/docs/9.5/static/indexes-types.html for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants