Skip to content

Commit

Permalink
move preventAwait to alter-column-builder.ts. (#1031)
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov authored Jun 10, 2024
1 parent 347f0ca commit 42ac7c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/schema/alter-column-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
DefaultValueExpression,
parseDefaultValueExpression,
} from '../parser/default-value-parser.js'
import { preventAwait } from '../util/prevent-await.js'

export class AlterColumnBuilder {
readonly #column: string
Expand Down Expand Up @@ -63,6 +64,8 @@ export class AlterColumnBuilder {
}
}

preventAwait(AlterColumnBuilder, "don't await AlterColumnBuilder instances")

/**
* Allows us to force consumers to do exactly one alteration to a column.
*
Expand Down Expand Up @@ -93,3 +96,5 @@ export class AlteredColumnBuilder implements OperationNodeSource {
export type AlterColumnBuilderCallback = (
builder: AlterColumnBuilder,
) => AlteredColumnBuilder

preventAwait(AlteredColumnBuilder, "don't await AlteredColumnBuilder instances")
5 changes: 2 additions & 3 deletions src/schema/alter-table-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ export interface AlterTableBuilderProps {
readonly node: AlterTableNode
}

preventAwait(AlterTableBuilder, "don't await AlterTableBuilder instances")

export interface ColumnAlteringInterface {
alterColumn(
column: string,
Expand Down Expand Up @@ -469,9 +471,6 @@ export class AlterTableColumnAlteringBuilder
export interface AlterTableColumnAlteringBuilderProps
extends AlterTableBuilderProps {}

preventAwait(AlterTableBuilder, "don't await AlterTableBuilder instances")
preventAwait(AlterColumnBuilder, "don't await AlterColumnBuilder instances")

preventAwait(
AlterTableColumnAlteringBuilder,
"don't await AlterTableColumnAlteringBuilder instances directly. To execute the query you need to call `execute`",
Expand Down

0 comments on commit 42ac7c9

Please sign in to comment.