import { Logger } from "./logger.js"; import { DB } from "./db.js"; import { DropFunction } from "./operations/functions/dropFunction.js"; import { CreateFunction } from "./operations/functions/createFunction.js"; import { RenameFunction } from "./operations/functions/renameFunction.js"; import { PgLiteral } from "./utils/PgLiteral.js"; import { DropColumns } from "./operations/tables/dropColumns.js"; import { AlterSequence } from "./operations/sequences/alterSequence.js"; import { DropSequence } from "./operations/sequences/dropSequence.js"; import { CreateSequence } from "./operations/sequences/createSequence.js"; import { RenameSequence } from "./operations/sequences/renameSequence.js"; import { ColumnDefinitions } from "./operations/tables/shared.js"; import { AddColumns } from "./operations/tables/addColumns.js"; import { DropConstraint } from "./operations/tables/dropConstraint.js"; import { CreateConstraint } from "./operations/tables/addConstraint.js"; import { AlterColumn } from "./operations/tables/alterColumn.js"; import { AlterTable } from "./operations/tables/alterTable.js"; import { DropTable } from "./operations/tables/dropTable.js"; import { CreateTable } from "./operations/tables/createTable.js"; import { RenameColumn } from "./operations/tables/renameColumn.js"; import { RenameConstraint } from "./operations/tables/renameConstraint.js"; import { RenameTable } from "./operations/tables/renameTable.js"; import { DropCast } from "./operations/casts/dropCast.js"; import { CreateCast } from "./operations/casts/createCast.js"; import { AlterDomain } from "./operations/domains/alterDomain.js"; import { DropDomain } from "./operations/domains/dropDomain.js"; import { CreateDomain } from "./operations/domains/createDomain.js"; import { RenameDomain } from "./operations/domains/renameDomain.js"; import { DropExtension } from "./operations/extensions/dropExtension.js"; import { CreateExtension } from "./operations/extensions/createExtension.js"; import { RevokeOnSchemas } from "./operations/grants/revokeOnSchemas.js"; import { GrantOnSchemas } from "./operations/grants/grantOnSchemas.js"; import { RevokeOnTables } from "./operations/grants/revokeOnTables.js"; import { GrantOnTables } from "./operations/grants/grantOnTables.js"; import { RevokeRoles } from "./operations/grants/revokeRoles.js"; import { GrantRoles } from "./operations/grants/grantRoles.js"; import { DropIndex } from "./operations/indexes/dropIndex.js"; import { CreateIndex } from "./operations/indexes/createIndex.js"; import { RenameIndex } from "./operations/indexes/renameIndex.js"; import { AlterMaterializedView } from "./operations/materializedViews/alterMaterializedView.js"; import { DropMaterializedView } from "./operations/materializedViews/dropMaterializedView.js"; import { CreateMaterializedView } from "./operations/materializedViews/createMaterializedView.js"; import { RefreshMaterializedView } from "./operations/materializedViews/refreshMaterializedView.js"; import { RenameMaterializedView } from "./operations/materializedViews/renameMaterializedView.js"; import { RenameMaterializedViewColumn } from "./operations/materializedViews/renameMaterializedViewColumn.js"; import { AddToOperatorFamily } from "./operations/operators/addToOperatorFamily.js"; import { DropOperator } from "./operations/operators/dropOperator.js"; import { CreateOperator } from "./operations/operators/createOperator.js"; import { DropOperatorClass } from "./operations/operators/dropOperatorClass.js"; import { CreateOperatorClass } from "./operations/operators/createOperatorClass.js"; import { DropOperatorFamily } from "./operations/operators/dropOperatorFamily.js"; import { CreateOperatorFamily } from "./operations/operators/createOperatorFamily.js"; import { RemoveFromOperatorFamily } from "./operations/operators/removeFromOperatorFamily.js"; import { RenameOperatorClass } from "./operations/operators/renameOperatorClass.js"; import { RenameOperatorFamily } from "./operations/operators/renameOperatorFamily.js"; import { AlterPolicy } from "./operations/policies/alterPolicy.js"; import { DropPolicy } from "./operations/policies/dropPolicy.js"; import { CreatePolicy } from "./operations/policies/createPolicy.js"; import { RenamePolicy } from "./operations/policies/renamePolicy.js"; import { AlterRole } from "./operations/roles/alterRole.js"; import { DropRole } from "./operations/roles/dropRole.js"; import { CreateRole } from "./operations/roles/createRole.js"; import { RenameRole } from "./operations/roles/renameRole.js"; import { DropSchema } from "./operations/schemas/dropSchema.js"; import { CreateSchema } from "./operations/schemas/createSchema.js"; import { RenameSchema } from "./operations/schemas/renameSchema.js"; import { Sql } from "./operations/sql.js"; import { DropTrigger } from "./operations/triggers/dropTrigger.js"; import { CreateTrigger } from "./operations/triggers/createTrigger.js"; import { RenameTrigger } from "./operations/triggers/renameTrigger.js"; import { DropTypeAttribute } from "./operations/types/dropTypeAttribute.js"; import { AddTypeAttribute } from "./operations/types/addTypeAttribute.js"; import { AddTypeValue } from "./operations/types/addTypeValue.js"; import { DropType } from "./operations/types/dropType.js"; import { CreateType } from "./operations/types/createType.js"; import { RenameType } from "./operations/types/renameType.js"; import { RenameTypeAttribute } from "./operations/types/renameTypeAttribute.js"; import { RenameTypeValue } from "./operations/types/renameTypeValue.js"; import { SetTypeAttribute } from "./operations/types/setTypeAttribute.js"; import { AlterView } from "./operations/views/alterView.js"; import { AlterViewColumn } from "./operations/views/alterViewColumn.js"; import { DropView } from "./operations/views/dropView.js"; import { CreateView } from "./operations/views/createView.js"; import { RenameView } from "./operations/views/renameView.js"; //#region src/migrationBuilder.d.ts declare class MigrationBuilder { /** * Install an extension. * * @alias addExtension * * @see https://www.postgresql.org/docs/current/sql-createextension.html */ readonly createExtension: (...args: Parameters) => void; /** * Remove an extension. * * @see https://www.postgresql.org/docs/current/sql-dropextension.html */ readonly dropExtension: (...args: Parameters) => void; /** * Install an extension. * * @alias createExtension * * @see https://www.postgresql.org/docs/current/sql-createextension.html */ readonly addExtension: (...args: Parameters) => void; /** * Define a new table. * * @see https://www.postgresql.org/docs/current/sql-createtable.html */ readonly createTable: (...args: Parameters) => void; /** * Remove a table. * * @see https://www.postgresql.org/docs/current/sql-droptable.html */ readonly dropTable: (...args: Parameters) => void; /** * Rename a table. * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly renameTable: (...args: Parameters) => void; /** * Change the definition of a table. * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly alterTable: (...args: Parameters) => void; /** * Add columns to a table. * * @alias addColumn * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly addColumns: (...args: Parameters) => void; /** * Remove columns from a table. * * @alias dropColumn * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly dropColumns: (...args: Parameters) => void; /** * Rename a column. * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly renameColumn: (...args: Parameters) => void; /** * Change the definition of a column. * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly alterColumn: (...args: Parameters) => void; /** * Add a column to a table. * * @alias addColumns * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly addColumn: (...args: Parameters) => void; /** * Remove a column from a table. * * @alias dropColumns * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly dropColumn: (...args: Parameters) => void; /** * Add a constraint to a table. * * @alias createConstraint * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly addConstraint: (...args: Parameters) => void; /** * Remove a constraint from a table. * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly dropConstraint: (...args: Parameters) => void; /** * Rename a constraint. * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly renameConstraint: (...args: Parameters) => void; /** * Add a constraint to a table. * * @alias addConstraint * * @see https://www.postgresql.org/docs/current/sql-altertable.html */ readonly createConstraint: (...args: Parameters) => void; /** * Define a new data type. * * @alias addType * * @see https://www.postgresql.org/docs/current/sql-createtype.html */ readonly createType: (...args: Parameters) => void; /** * Remove a data type. * * @see https://www.postgresql.org/docs/current/sql-droptype.html */ readonly dropType: (...args: Parameters) => void; /** * Define a new data type. * * @alias createType * * @see https://www.postgresql.org/docs/current/sql-createtype.html */ readonly addType: (...args: Parameters) => void; /** * Rename a data type. * * @see https://www.postgresql.org/docs/current/sql-altertype.html */ readonly renameType: (...args: Parameters) => void; /** * Rename a data type attribute. * * @see https://www.postgresql.org/docs/current/sql-altertype.html */ readonly renameTypeAttribute: (...args: Parameters) => void; /** * Rename a data type value. * * @see https://www.postgresql.org/docs/current/sql-altertype.html */ readonly renameTypeValue: (...args: Parameters) => void; /** * Add an attribute to a data type. * * @see https://www.postgresql.org/docs/current/sql-altertype.html */ readonly addTypeAttribute: (...args: Parameters) => void; /** * Remove an attribute from a data type. * * @see https://www.postgresql.org/docs/current/sql-altertype.html */ readonly dropTypeAttribute: (...args: Parameters) => void; /** * Set an attribute of a data type. * * @see https://www.postgresql.org/docs/current/sql-altertype.html */ readonly setTypeAttribute: (...args: Parameters) => void; /** * Add a value to a data type. * * @see https://www.postgresql.org/docs/current/sql-altertype.html */ readonly addTypeValue: (...args: Parameters) => void; /** * Define a new index. * * @alias addIndex * * @see https://www.postgresql.org/docs/current/sql-createindex.html */ readonly createIndex: (...args: Parameters) => void; /** * Remove an index. * * @see https://www.postgresql.org/docs/current/sql-dropindex.html */ readonly dropIndex: (...args: Parameters) => void; /** * Define a new index. * * @alias createIndex * * @see https://www.postgresql.org/docs/current/sql-createindex.html */ readonly addIndex: (...args: Parameters) => void; /** * Rename an index. * * @see https://www.postgresql.org/docs/current/sql-alterindex.html */ readonly renameIndex: (...args: Parameters) => void; /** * Define a new database role. * * @see https://www.postgresql.org/docs/current/sql-createrole.html */ readonly createRole: (...args: Parameters) => void; /** * Remove a database role. * * @see https://www.postgresql.org/docs/current/sql-droprole.html */ readonly dropRole: (...args: Parameters) => void; /** * Change a database role. * * @see https://www.postgresql.org/docs/current/sql-alterrole.html */ readonly alterRole: (...args: Parameters) => void; /** * Rename a database role. * * @see https://www.postgresql.org/docs/current/sql-alterrole.html */ readonly renameRole: (...args: Parameters) => void; /** * Define a new function. * * @see https://www.postgresql.org/docs/current/sql-createfunction.html */ readonly createFunction: (...args: Parameters) => void; /** * Remove a function. * * @see https://www.postgresql.org/docs/current/sql-dropfunction.html */ readonly dropFunction: (...args: Parameters) => void; /** * Rename a function. * * @see https://www.postgresql.org/docs/current/sql-alterfunction.html */ readonly renameFunction: (...args: Parameters) => void; /** * Define a new trigger. * * @see https://www.postgresql.org/docs/current/sql-createtrigger.html */ readonly createTrigger: (...args: Parameters) => void; /** * Remove a trigger. * * @see https://www.postgresql.org/docs/current/sql-droptrigger.html */ readonly dropTrigger: (...args: Parameters) => void; /** * Rename a trigger. * * @see https://www.postgresql.org/docs/current/sql-altertrigger.html */ readonly renameTrigger: (...args: Parameters) => void; /** * Define a new schema. * * @see https://www.postgresql.org/docs/current/sql-createschema.html */ readonly createSchema: (...args: Parameters) => void; /** * Remove a schema. * * @see https://www.postgresql.org/docs/current/sql-dropschema.html */ readonly dropSchema: (...args: Parameters) => void; /** * Rename a schema. * * @see https://www.postgresql.org/docs/current/sql-alterschema.html */ readonly renameSchema: (...args: Parameters) => void; /** * Define a new domain. * * @see https://www.postgresql.org/docs/current/sql-createdomain.html */ readonly createDomain: (...args: Parameters) => void; /** * Remove a domain. * * @see https://www.postgresql.org/docs/current/sql-dropdomain.html */ readonly dropDomain: (...args: Parameters) => void; /** * Change the definition of a domain. * * @see https://www.postgresql.org/docs/current/sql-alterdomain.html */ readonly alterDomain: (...args: Parameters) => void; /** * Rename a domain. * * @see https://www.postgresql.org/docs/current/sql-alterdomain.html */ readonly renameDomain: (...args: Parameters) => void; /** * Define a new sequence generator. * * @see https://www.postgresql.org/docs/current/sql-createsequence.html */ readonly createSequence: (...args: Parameters) => void; /** * Remove a sequence. * * @see https://www.postgresql.org/docs/current/sql-dropsequence.html */ readonly dropSequence: (...args: Parameters) => void; /** * Change the definition of a sequence generator. * * @see https://www.postgresql.org/docs/current/sql-altersequence.html */ readonly alterSequence: (...args: Parameters) => void; /** * Rename a sequence. * * @see https://www.postgresql.org/docs/current/sql-altersequence.html */ readonly renameSequence: (...args: Parameters) => void; /** * Define a new operator. * * @see https://www.postgresql.org/docs/current/sql-createoperator.html */ readonly createOperator: (...args: Parameters) => void; /** * Remove an operator. * * @see https://www.postgresql.org/docs/current/sql-dropoperator.html */ readonly dropOperator: (...args: Parameters) => void; /** * Define a new operator class. * * @see https://www.postgresql.org/docs/current/sql-createopclass.html */ readonly createOperatorClass: (...args: Parameters) => void; /** * Remove an operator class. * * @see https://www.postgresql.org/docs/current/sql-dropopclass.html */ readonly dropOperatorClass: (...args: Parameters) => void; /** * Rename an operator class. * * @see https://www.postgresql.org/docs/current/sql-alteropclass.html */ readonly renameOperatorClass: (...args: Parameters) => void; /** * Define a new operator family. * * @see https://www.postgresql.org/docs/current/sql-createopfamily.html */ readonly createOperatorFamily: (...args: Parameters) => void; /** * Remove an operator family. * * @see https://www.postgresql.org/docs/current/sql-dropopfamily.html */ readonly dropOperatorFamily: (...args: Parameters) => void; /** * Rename an operator family. * * @see https://www.postgresql.org/docs/current/sql-alteropfamily.html */ readonly renameOperatorFamily: (...args: Parameters) => void; /** * Add an operator to an operator family. * * @see https://www.postgresql.org/docs/current/sql-alteropfamily.html */ readonly addToOperatorFamily: (...args: Parameters) => void; /** * Remove an operator from an operator family. * * @see https://www.postgresql.org/docs/current/sql-alteropfamily.html */ readonly removeFromOperatorFamily: (...args: Parameters) => void; /** * Define a new row-level security policy for a table. * * @see https://www.postgresql.org/docs/current/sql-createpolicy.html */ readonly createPolicy: (...args: Parameters) => void; /** * Remove a row-level security policy from a table. * * @see https://www.postgresql.org/docs/current/sql-droppolicy.html */ readonly dropPolicy: (...args: Parameters) => void; /** * Change the definition of a row-level security policy. * * @see https://www.postgresql.org/docs/current/sql-alterpolicy.html */ readonly alterPolicy: (...args: Parameters) => void; /** * Rename a row-level security policy. * * @see https://www.postgresql.org/docs/current/sql-alterpolicy.html */ readonly renamePolicy: (...args: Parameters) => void; /** * Define a new view. * * @see https://www.postgresql.org/docs/current/sql-createview.html */ readonly createView: (...args: Parameters) => void; /** * Remove a view. * * @see https://www.postgresql.org/docs/current/sql-dropview.html */ readonly dropView: (...args: Parameters) => void; /** * Change the definition of a view. * * @see https://www.postgresql.org/docs/current/sql-alterview.html */ readonly alterView: (...args: Parameters) => void; /** * Change the definition of a view column. * * @see https://www.postgresql.org/docs/current/sql-alterview.html */ readonly alterViewColumn: (...args: Parameters) => void; /** * Rename a view. * * @see https://www.postgresql.org/docs/current/sql-alterview.html */ readonly renameView: (...args: Parameters) => void; /** * Define a new materialized view. * * @see https://www.postgresql.org/docs/current/sql-creatematerializedview.html */ readonly createMaterializedView: (...args: Parameters) => void; /** * Remove a materialized view. * * @see https://www.postgresql.org/docs/current/sql-dropmaterializedview.html */ readonly dropMaterializedView: (...args: Parameters) => void; /** * Change the definition of a materialized view. * * @see https://www.postgresql.org/docs/current/sql-altermaterializedview.html */ readonly alterMaterializedView: (...args: Parameters) => void; /** * Rename a materialized view. * * @see https://www.postgresql.org/docs/current/sql-altermaterializedview.html */ readonly renameMaterializedView: (...args: Parameters) => void; /** * Rename a materialized view column. * * @see https://www.postgresql.org/docs/current/sql-altermaterializedview.html */ readonly renameMaterializedViewColumn: (...args: Parameters) => void; /** * Replace the contents of a materialized view. * * @see https://www.postgresql.org/docs/current/sql-refreshmaterializedview.html */ readonly refreshMaterializedView: (...args: Parameters) => void; /** * Define access privileges. * * @see https://www.postgresql.org/docs/current/sql-grant.html */ readonly grantRoles: (...args: Parameters) => void; /** * Remove access privileges. * * @see https://www.postgresql.org/docs/current/sql-revoke.html */ readonly revokeRoles: (...args: Parameters) => void; /** * Define access privileges. * * @see https://www.postgresql.org/docs/current/sql-grant.html */ readonly grantOnSchemas: (...args: Parameters) => void; /** * Remove access privileges. * * @see https://www.postgresql.org/docs/current/sql-revoke.html */ readonly revokeOnSchemas: (...args: Parameters) => void; /** * Define access privileges. * * @see https://www.postgresql.org/docs/current/sql-grant.html */ readonly grantOnTables: (...args: Parameters) => void; /** * Remove access privileges. * * @see https://www.postgresql.org/docs/current/sql-revoke.html */ readonly revokeOnTables: (...args: Parameters) => void; /** * Define a new cast. * * @see https://www.postgresql.org/docs/current/sql-createcast.html */ readonly createCast: (...args: Parameters) => void; /** * Remove a cast. * * @see https://www.postgresql.org/docs/current/sql-dropcast.html */ readonly dropCast: (...args: Parameters) => void; /** * Run raw SQL, with some optional _[very basic](http://mir.aculo.us/2011/03/09/little-helpers-a-tweet-sized-javascript-templating-engine/)_ mustache templating. * * This is a low-level operation, and you should use the higher-level operations whenever possible. * * @param sql SQL query to run. * @param args Optional `key/val` of arguments to replace. * * @see https://www.postgresql.org/docs/current/sql-commands.html */ readonly sql: (...args: Parameters) => void; /** * Inserts raw string, **which is not escaped**. * * @param sql String to **not escaped**. * * @example * { default: pgm.func('CURRENT_TIMESTAMP') } */ readonly func: (sql: string) => PgLiteral; /** * The `db` client instance. * * Can be used to run queries directly. */ readonly db: DB; private _steps; private _REVERSE_MODE; private _useTransaction; constructor(db: DB, typeShorthands: ColumnDefinitions | undefined, shouldDecamelize: boolean, logger: Logger); /** * Run the reverse of the migration. Useful for creating a new migration that * reverts a previous migration. */ enableReverseMode(): this; /** * By default, all migrations are run in one transaction, but some DB * operations like add type value (`pgm.addTypeValue`) does not work if the * type is not created in the same transaction. * e.g. if it is created in previous migration. You need to run specific * migration outside a transaction (`pgm.noTransaction`). * Be aware that this means that you can have some migrations applied and some * not applied, if there is some error during migrating (leading to `ROLLBACK`). */ noTransaction(): this; isUsingTransaction(): boolean; getSql(): string; getSqlSteps(): string[]; } //#endregion export { MigrationBuilder };