Module

x/kysely_postgrs_js_dialect/deps.ts>kysely.AlterTableBuilder#addIndex

Kysely dialect for PostgreSQL using the Postgres.js client.
method kysely.AlterTableBuilder.prototype.addIndex
import { kysely } from "https://dotland.deno.dev/x/kysely_postgrs_js_dialect@v0.27.3/deps.ts";
const { AlterTableBuilder } = kysely;

This can be used to add index to table.

Examples

db.schema.alterTable('person')
  .addIndex('person_email_index')
  .column('email')
  .unique()
  .execute()

The generated SQL (MySQL):

alter table `person` add unique index `person_email_index` (`email`)

Parameters

indexName: string

Returns

AlterTableAddIndexBuilder