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

chore: fix jsdoc errors and add some examples, pt. 1. #1264

Merged
merged 8 commits into from
Nov 19, 2024
Prev Previous commit
Next Next commit
fix jsdoc @ alter-table-add-index-builder.
igalklebanov committed Nov 19, 2024
commit 95b77320d782d2a9ea31416b4047a899b121e687
52 changes: 43 additions & 9 deletions src/schema/alter-table-add-index-builder.ts
Original file line number Diff line number Diff line change
@@ -26,6 +26,23 @@ export class AlterTableAddIndexBuilder

/**
* 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(): AlterTableAddIndexBuilder {
return new AlterTableAddIndexBuilder({
@@ -48,11 +65,11 @@ export class AlterTableAddIndexBuilder
*
* ```ts
* await db.schema
* .alterTable('person')
* .createIndex('person_first_name_and_age_index')
* .column('first_name')
* .column('age desc')
* .execute()
* .alterTable('person')
* .addIndex('person_first_name_and_age_index')
* .column('first_name')
* .column('age desc')
* .execute()
* ```
*
* The generated SQL (MySQL):
@@ -84,10 +101,10 @@ export class AlterTableAddIndexBuilder
*
* ```ts
* await db.schema
* .alterTable('person')
* .addIndex('person_first_name_and_age_index')
* .columns(['first_name', 'age desc'])
* .execute()
* .alterTable('person')
* .addIndex('person_first_name_and_age_index')
* .columns(['first_name', 'age desc'])
* .execute()
* ```
*
* The generated SQL (MySQL):
@@ -144,6 +161,23 @@ export class AlterTableAddIndexBuilder

/**
* Specifies the index type.
*
* ### Examples
*
* ```ts
* await db.schema
* .alterTable('person')
* .addIndex('person_first_name_index')
* .column('first_name')
* .using('hash')
* .execute()
* ```
*
* The generated SQL (MySQL):
*
* ```sql
* alter table `person` add index `person_first_name_index` (`first_name`) using hash
* ```
*/
using(indexType: IndexType): AlterTableAddIndexBuilder
using(indexType: string): AlterTableAddIndexBuilder