/opt/canhelp/node_modules/kysely/dist/esm/schema
NameSizeModeActions
alter-column-builder.d.ts19490644editdlrm
alter-column-builder.js23250644editdlrm
alter-table-add-foreign-key-constraint-builder.d.ts18600644editdlrm
alter-table-add-foreign-key-constraint-builder.js23770644editdlrm
alter-table-add-index-builder.d.ts42480644editdlrm
alter-table-add-index-builder.js49410644editdlrm
alter-table-builder.d.ts71540644editdlrm
alter-table-builder.js113360644editdlrm
alter-table-drop-constraint-builder.d.ts11930644editdlrm
alter-table-drop-constraint-builder.js20170644editdlrm
alter-table-executor.d.ts8190644editdlrm
alter-table-executor.js5510644editdlrm
check-constraint-builder.d.ts6550644editdlrm
check-constraint-builder.js4280644editdlrm
column-definition-builder.d.ts140560644editdlrm
column-definition-builder.js174010644editdlrm
create-index-builder.d.ts60630644editdlrm
create-index-builder.js59830644editdlrm
create-schema-builder.d.ts10590644editdlrm
create-schema-builder.js10280644editdlrm
create-table-builder.d.ts111210644editdlrm
create-table-builder.js137010644editdlrm
create-type-builder.d.ts12360644editdlrm
create-type-builder.js11790644editdlrm
create-view-builder.d.ts21010644editdlrm
create-view-builder.js30820644editdlrm
drop-index-builder.d.ts12190644editdlrm
drop-index-builder.js16310644editdlrm
drop-schema-builder.d.ts10740644editdlrm
drop-schema-builder.js12500644editdlrm
drop-table-builder.d.ts10650644editdlrm
drop-table-builder.js12420644editdlrm
drop-type-builder.d.ts10240644editdlrm
drop-type-builder.js10270644editdlrm
drop-view-builder.d.ts10930644editdlrm
drop-view-builder.js14510644editdlrm
foreign-key-constraint-builder.d.ts14620644editdlrm
foreign-key-constraint-builder.js16630644editdlrm
primary-key-constraint-builder.d.ts8970644editdlrm
primary-key-constraint-builder.js11800644editdlrm
refresh-materialized-view-builder.d.ts19540644editdlrm
refresh-materialized-view-builder.js23910644editdlrm
schema.d.ts62710644editdlrm
schema.js94900644editdlrm
unique-constraint-builder.d.ts10690644editdlrm
unique-constraint-builder.js14370644editdlrm
Edit: /opt/canhelp/node_modules/kysely/dist/esm/schema/alter-table-add-index-builder.js (4941B)
/// import { AddIndexNode } from '../operation-node/add-index-node.js'; import { AlterTableNode } from '../operation-node/alter-table-node.js'; import { RawNode } from '../operation-node/raw-node.js'; import { parseOrderedColumnName, } from '../parser/reference-parser.js'; import { freeze } from '../util/object-utils.js'; export class AlterTableAddIndexBuilder { #props; constructor(props) { this.#props = freeze(props); } /** * Makes the index unique. * * ### Examples * * ```ts * await db.schema * .alterTable('person') * .addIndex('person_first_name_index') * .unique() * .column('email') * .execute() * ``` * * The generated SQL (MySQL): * * ```sql * alter table `person` add unique index `person_first_name_index` (`email`) * ``` */ unique() { return new AlterTableAddIndexBuilder({ ...this.#props, node: AlterTableNode.cloneWithTableProps(this.#props.node, { addIndex: AddIndexNode.cloneWith(this.#props.node.addIndex, { unique: true, }), }), }); } /** * Adds a column to the index. * * Also see {@link columns} for adding multiple columns at once or {@link expression} * for specifying an arbitrary expression. * * ### Examples * * ```ts * await db.schema * .alterTable('person') * .addIndex('person_first_name_and_age_index') * .column('first_name') * .column('age desc') * .execute() * ``` * * The generated SQL (MySQL): * * ```sql * alter table `person` add index `person_first_name_and_age_index` (`first_name`, `age` desc) * ``` */ column(column) { return new AlterTableAddIndexBuilder({ ...this.#props, node: AlterTableNode.cloneWithTableProps(this.#props.node, { addIndex: AddIndexNode.cloneWithColumns(this.#props.node.addIndex, [ parseOrderedColumnName(column), ]), }), }); } /** * Specifies a list of columns for the index. * * Also see {@link column} for adding a single column or {@link expression} for * specifying an arbitrary expression. * * ### Examples * * ```ts * await db.schema * .alterTable('person') * .addIndex('person_first_name_and_age_index') * .columns(['first_name', 'age desc']) * .execute() * ``` * * The generated SQL (MySQL): * * ```sql * alter table `person` add index `person_first_name_and_age_index` (`first_name`, `age` desc) * ``` */ columns(columns) { return new AlterTableAddIndexBuilder({ ...this.#props, node: AlterTableNode.cloneWithTableProps(this.#props.node, { addIndex: AddIndexNode.cloneWithColumns(this.#props.node.addIndex, columns.map(parseOrderedColumnName)), }), }); } /** * Specifies an arbitrary expression for the index. * * ### Examples * * ```ts * import { sql } from 'kysely' * * await db.schema * .alterTable('person') * .addIndex('person_first_name_index') * .expression(sql`(first_name < 'Sami')`) * .execute() * ``` * * The generated SQL (MySQL): * * ```sql * alter table `person` add index `person_first_name_index` ((first_name < 'Sami')) * ``` */ expression(expression) { return new AlterTableAddIndexBuilder({ ...this.#props, node: AlterTableNode.cloneWithTableProps(this.#props.node, { addIndex: AddIndexNode.cloneWithColumns(this.#props.node.addIndex, [ expression.toOperationNode(), ]), }), }); } using(indexType) { return new AlterTableAddIndexBuilder({ ...this.#props, node: AlterTableNode.cloneWithTableProps(this.#props.node, { addIndex: AddIndexNode.cloneWith(this.#props.node.addIndex, { using: RawNode.createWithSql(indexType), }), }), }); } /** * Simply calls the provided function passing `this` as the only argument. `$call` returns * what the provided function returns. */ $call(func) { return func(this); } toOperationNode() { return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId); } compile() { return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId); } async execute() { await this.#props.executor.executeQuery(this.compile()); } }