nodal
nodal copied to clipboard
Create index on multiple column
trafficstars
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?
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.