Constructive operations
They are the operations that create, alter, or drop tables, columns, indexes, constraints, and so on.
-
CreateTable(tableName schema.TableName, f func(*PostgresTableDef), opts ...schema.TableOptions)
-
AddTableComment(tableName schema.TableName, comment *string, opts ...schema.TableCommentOptions)
-
AddExtension(name string, option ...schema.ExtensionOptions)
-
AddForeignKey(fromTable, toTable schema.TableName, opts ...schema.AddForeignKeyConstraintOptions)
-
AddIndex(table schema.TableName, columns []string, option ...schema.IndexOptions)
-
CreateEnum(name string, values []string, opts ...schema.CreateEnumOptions)
-
AddEnumValue(name string, value string, opts ...schema.AddEnumValueOptions)
Each of this functions are reversible, it means that in a migration that implement the change
function, when you
rollback the migration you don't have to write manually the rollback operation, the library will do it for you.