schema

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: AGPL-3.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewForeignKeyDefinition

func NewForeignKeyDefinition(command *schema.Command) schema.ForeignKeyDefinition

func NewIndexDefinition

func NewIndexDefinition(command *schema.Command) schema.IndexDefinition

Types

type Blueprint

type Blueprint struct {
	// contains filtered or unexported fields
}

func NewBlueprint

func NewBlueprint(schema schema.Schema, prefix, table string) *Blueprint

func (*Blueprint) BigIncrements

func (r *Blueprint) BigIncrements(column string) schema.ColumnDefinition

func (*Blueprint) BigInteger

func (r *Blueprint) BigInteger(column string) schema.ColumnDefinition

func (*Blueprint) Boolean

func (r *Blueprint) Boolean(column string) schema.ColumnDefinition

func (*Blueprint) Build

func (r *Blueprint) Build(query ormcontract.Query, grammar schema.Grammar) error

func (*Blueprint) Change

func (r *Blueprint) Change() schema.ColumnDefinition

func (*Blueprint) Char

func (r *Blueprint) Char(column string, length ...int) schema.ColumnDefinition

func (*Blueprint) Column

func (r *Blueprint) Column(column, ttype string) schema.ColumnDefinition

func (*Blueprint) Create

func (r *Blueprint) Create()

func (*Blueprint) Date

func (r *Blueprint) Date(column string) schema.ColumnDefinition

func (*Blueprint) DateTime

func (r *Blueprint) DateTime(column string, precision ...int) schema.ColumnDefinition

func (*Blueprint) DateTimeTz

func (r *Blueprint) DateTimeTz(column string, precision ...int) schema.ColumnDefinition

func (*Blueprint) Decimal

func (r *Blueprint) Decimal(column string) schema.ColumnDefinition

func (*Blueprint) Double

func (r *Blueprint) Double(column string) schema.ColumnDefinition

func (*Blueprint) Drop

func (r *Blueprint) Drop()

func (*Blueprint) DropColumn

func (r *Blueprint) DropColumn(column ...string)

func (*Blueprint) DropForeign

func (r *Blueprint) DropForeign(column ...string)

func (*Blueprint) DropForeignByName

func (r *Blueprint) DropForeignByName(name string)

func (*Blueprint) DropFullText

func (r *Blueprint) DropFullText(column ...string)

func (*Blueprint) DropFullTextByName

func (r *Blueprint) DropFullTextByName(name string)

func (*Blueprint) DropIfExists

func (r *Blueprint) DropIfExists()

func (*Blueprint) DropIndex

func (r *Blueprint) DropIndex(column ...string)

func (*Blueprint) DropIndexByName

func (r *Blueprint) DropIndexByName(name string)

func (*Blueprint) DropPrimary

func (r *Blueprint) DropPrimary(column ...string)

func (*Blueprint) DropSoftDeletes

func (r *Blueprint) DropSoftDeletes(column ...string)

func (*Blueprint) DropSoftDeletesTz

func (r *Blueprint) DropSoftDeletesTz(column ...string)

func (*Blueprint) DropTimestamps

func (r *Blueprint) DropTimestamps()

func (*Blueprint) DropTimestampsTz

func (r *Blueprint) DropTimestampsTz()

func (*Blueprint) DropUnique

func (r *Blueprint) DropUnique(column ...string)

func (*Blueprint) DropUniqueByName

func (r *Blueprint) DropUniqueByName(name string)

func (*Blueprint) Enum

func (r *Blueprint) Enum(column string, allowed []any) schema.ColumnDefinition

func (*Blueprint) Float

func (r *Blueprint) Float(column string, precision ...int) schema.ColumnDefinition

func (*Blueprint) Foreign

func (r *Blueprint) Foreign(column ...string) schema.ForeignKeyDefinition

func (*Blueprint) FullText

func (r *Blueprint) FullText(column ...string) schema.IndexDefinition

func (*Blueprint) Geometry added in v0.7.0

func (r *Blueprint) Geometry(column string) schema.ColumnDefinition

func (*Blueprint) GeometryCollection added in v0.7.0

func (r *Blueprint) GeometryCollection(column string) schema.ColumnDefinition

func (*Blueprint) GetAddedColumns

func (r *Blueprint) GetAddedColumns() []schema.ColumnDefinition

func (*Blueprint) GetCommands

func (r *Blueprint) GetCommands() []*schema.Command

func (*Blueprint) GetTableName

func (r *Blueprint) GetTableName() string

func (*Blueprint) HasCommand

func (r *Blueprint) HasCommand(command string) bool

func (*Blueprint) ID

func (r *Blueprint) ID(column ...string) schema.ColumnDefinition

func (*Blueprint) Increments

func (r *Blueprint) Increments(column string) schema.ColumnDefinition

func (*Blueprint) Index

func (r *Blueprint) Index(column ...string) schema.IndexDefinition

func (*Blueprint) Integer

func (r *Blueprint) Integer(column string) schema.ColumnDefinition

func (*Blueprint) IntegerIncrements

func (r *Blueprint) IntegerIncrements(column string) schema.ColumnDefinition

func (*Blueprint) Json

func (r *Blueprint) Json(column string) schema.ColumnDefinition

func (*Blueprint) Jsonb

func (r *Blueprint) Jsonb(column string) schema.ColumnDefinition

func (*Blueprint) LineString added in v0.7.0

func (r *Blueprint) LineString(column string) schema.ColumnDefinition

func (*Blueprint) LongText

func (r *Blueprint) LongText(column string) schema.ColumnDefinition

func (*Blueprint) MediumIncrements

func (r *Blueprint) MediumIncrements(column string) schema.ColumnDefinition

func (*Blueprint) MediumInteger

func (r *Blueprint) MediumInteger(column string) schema.ColumnDefinition

func (*Blueprint) MediumText

func (r *Blueprint) MediumText(column string) schema.ColumnDefinition

func (*Blueprint) MultiLineString added in v0.7.0

func (r *Blueprint) MultiLineString(column string) schema.ColumnDefinition

func (*Blueprint) MultiPoint added in v0.7.0

func (r *Blueprint) MultiPoint(column string) schema.ColumnDefinition

func (*Blueprint) MultiPolygon added in v0.7.0

func (r *Blueprint) MultiPolygon(column string) schema.ColumnDefinition

func (*Blueprint) Point added in v0.7.0

func (r *Blueprint) Point(column string) schema.ColumnDefinition

func (*Blueprint) Polygon added in v0.7.0

func (r *Blueprint) Polygon(column string) schema.ColumnDefinition

func (*Blueprint) Primary

func (r *Blueprint) Primary(column ...string)

func (*Blueprint) Rename

func (r *Blueprint) Rename(to string)

func (*Blueprint) RenameColumn

func (r *Blueprint) RenameColumn(from, to string)

func (*Blueprint) RenameIndex

func (r *Blueprint) RenameIndex(from, to string)

func (*Blueprint) SetTable

func (r *Blueprint) SetTable(name string)

func (*Blueprint) ShortID added in v0.11.0

func (r *Blueprint) ShortID(column ...string) schema.ColumnDefinition

ShortID creates a new short string primary key column on the table. Suitable for client-generated short IDs (e.g., Crockford Base32).

func (*Blueprint) ShouldSkipTransaction added in v0.3.0

func (r *Blueprint) ShouldSkipTransaction() bool

ShouldSkipTransaction returns true if the blueprint should skip the transaction wrapper. This is used for SQLite-specific operations like RenameIndex that have issues with DDL in transactions.

func (*Blueprint) SkipTransaction added in v0.3.0

func (r *Blueprint) SkipTransaction()

SkipTransaction marks the blueprint to skip the transaction wrapper during build. This is primarily used for SQLite RenameIndex operations to avoid savepoint timeout issues.

func (*Blueprint) SmallIncrements

func (r *Blueprint) SmallIncrements(column string) schema.ColumnDefinition

func (*Blueprint) SmallInteger

func (r *Blueprint) SmallInteger(column string) schema.ColumnDefinition

func (*Blueprint) SoftDeletes

func (r *Blueprint) SoftDeletes(column ...string) schema.ColumnDefinition

func (*Blueprint) SoftDeletesTz

func (r *Blueprint) SoftDeletesTz(column ...string) schema.ColumnDefinition

func (*Blueprint) String

func (r *Blueprint) String(column string, length ...int) schema.ColumnDefinition

func (*Blueprint) Text

func (r *Blueprint) Text(column string) schema.ColumnDefinition

func (*Blueprint) Time

func (r *Blueprint) Time(column string, precision ...int) schema.ColumnDefinition

func (*Blueprint) TimeTz

func (r *Blueprint) TimeTz(column string, precision ...int) schema.ColumnDefinition

func (*Blueprint) Timestamp

func (r *Blueprint) Timestamp(column string, precision ...int) schema.ColumnDefinition

func (*Blueprint) TimestampTz

func (r *Blueprint) TimestampTz(column string, precision ...int) schema.ColumnDefinition

func (*Blueprint) Timestamps

func (r *Blueprint) Timestamps(precision ...int)

func (*Blueprint) TimestampsTz

func (r *Blueprint) TimestampsTz(precision ...int)

func (*Blueprint) TinyIncrements

func (r *Blueprint) TinyIncrements(column string) schema.ColumnDefinition

func (*Blueprint) TinyInteger

func (r *Blueprint) TinyInteger(column string) schema.ColumnDefinition

func (*Blueprint) TinyText

func (r *Blueprint) TinyText(column string) schema.ColumnDefinition

func (*Blueprint) ToSql

func (r *Blueprint) ToSql(grammar schema.Grammar) ([]string, error)

func (*Blueprint) Unique

func (r *Blueprint) Unique(column ...string) schema.IndexDefinition

func (*Blueprint) UnsignedBigInteger

func (r *Blueprint) UnsignedBigInteger(column string) schema.ColumnDefinition

func (*Blueprint) UnsignedInteger

func (r *Blueprint) UnsignedInteger(column string) schema.ColumnDefinition

func (*Blueprint) UnsignedMediumInteger

func (r *Blueprint) UnsignedMediumInteger(column string) schema.ColumnDefinition

func (*Blueprint) UnsignedSmallInteger

func (r *Blueprint) UnsignedSmallInteger(column string) schema.ColumnDefinition

func (*Blueprint) UnsignedTinyInteger

func (r *Blueprint) UnsignedTinyInteger(column string) schema.ColumnDefinition

type ColumnDefinition

type ColumnDefinition struct {
	// contains filtered or unexported fields
}

func (*ColumnDefinition) After

func (*ColumnDefinition) AutoIncrement

func (r *ColumnDefinition) AutoIncrement() schema.ColumnDefinition

func (*ColumnDefinition) Change

func (*ColumnDefinition) Collation

func (r *ColumnDefinition) Collation(collation string) schema.ColumnDefinition

func (*ColumnDefinition) Comment

func (r *ColumnDefinition) Comment(comment string) schema.ColumnDefinition

func (*ColumnDefinition) Default

func (r *ColumnDefinition) Default(def any) schema.ColumnDefinition

func (*ColumnDefinition) First

func (*ColumnDefinition) GetAfter

func (r *ColumnDefinition) GetAfter() string

func (*ColumnDefinition) GetAllowed

func (r *ColumnDefinition) GetAllowed() []any

func (*ColumnDefinition) GetAutoIncrement

func (r *ColumnDefinition) GetAutoIncrement() bool

func (*ColumnDefinition) GetChange

func (r *ColumnDefinition) GetChange() bool

func (*ColumnDefinition) GetCollation

func (r *ColumnDefinition) GetCollation() string

func (*ColumnDefinition) GetComment

func (r *ColumnDefinition) GetComment() string

func (*ColumnDefinition) GetDefault

func (r *ColumnDefinition) GetDefault() any

func (*ColumnDefinition) GetFirst

func (r *ColumnDefinition) GetFirst() bool

func (*ColumnDefinition) GetLength

func (r *ColumnDefinition) GetLength() int

func (*ColumnDefinition) GetName

func (r *ColumnDefinition) GetName() string

func (*ColumnDefinition) GetNullable

func (r *ColumnDefinition) GetNullable() bool

func (*ColumnDefinition) GetOnUpdate

func (r *ColumnDefinition) GetOnUpdate() any

func (*ColumnDefinition) GetPlaces

func (r *ColumnDefinition) GetPlaces() int

func (*ColumnDefinition) GetPrecision

func (r *ColumnDefinition) GetPrecision() int

func (*ColumnDefinition) GetSrid added in v0.7.0

func (r *ColumnDefinition) GetSrid() int

func (*ColumnDefinition) GetTotal

func (r *ColumnDefinition) GetTotal() int

func (*ColumnDefinition) GetType

func (r *ColumnDefinition) GetType() string

func (*ColumnDefinition) GetUnsigned

func (r *ColumnDefinition) GetUnsigned() bool

func (*ColumnDefinition) GetUseCurrent

func (r *ColumnDefinition) GetUseCurrent() bool

func (*ColumnDefinition) GetUseCurrentOnUpdate

func (r *ColumnDefinition) GetUseCurrentOnUpdate() bool

func (*ColumnDefinition) IsSetComment

func (r *ColumnDefinition) IsSetComment() bool

func (*ColumnDefinition) Nullable

func (*ColumnDefinition) OnUpdate

func (r *ColumnDefinition) OnUpdate(value any) schema.ColumnDefinition

func (*ColumnDefinition) Places

func (r *ColumnDefinition) Places(places int) schema.ColumnDefinition

func (*ColumnDefinition) Srid added in v0.7.0

func (*ColumnDefinition) Total

func (r *ColumnDefinition) Total(total int) schema.ColumnDefinition

func (*ColumnDefinition) Unsigned

func (*ColumnDefinition) UseCurrent

func (r *ColumnDefinition) UseCurrent() schema.ColumnDefinition

func (*ColumnDefinition) UseCurrentOnUpdate

func (r *ColumnDefinition) UseCurrentOnUpdate() schema.ColumnDefinition

type CommonSchema

type CommonSchema struct {
	// contains filtered or unexported fields
}

func NewCommonSchema

func NewCommonSchema(grammar schema.Grammar, orm orm.Orm) *CommonSchema

func (*CommonSchema) GetTables

func (r *CommonSchema) GetTables() ([]schema.Table, error)

func (*CommonSchema) GetViews

func (r *CommonSchema) GetViews() ([]schema.View, error)

type ForeignKeyDefinition

type ForeignKeyDefinition struct {
	// contains filtered or unexported fields
}

func (*ForeignKeyDefinition) CascadeOnDelete

func (r *ForeignKeyDefinition) CascadeOnDelete() schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) CascadeOnUpdate

func (r *ForeignKeyDefinition) CascadeOnUpdate() schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) Name

func (*ForeignKeyDefinition) NoActionOnDelete

func (r *ForeignKeyDefinition) NoActionOnDelete() schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) NoActionOnUpdate

func (r *ForeignKeyDefinition) NoActionOnUpdate() schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) NullOnDelete

func (*ForeignKeyDefinition) On

func (*ForeignKeyDefinition) References

func (r *ForeignKeyDefinition) References(columns ...string) schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) RestrictOnDelete

func (r *ForeignKeyDefinition) RestrictOnDelete() schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) RestrictOnUpdate

func (r *ForeignKeyDefinition) RestrictOnUpdate() schema.ForeignKeyDefinition

type IndexDefinition

type IndexDefinition struct {
	// contains filtered or unexported fields
}

func (*IndexDefinition) Algorithm

func (r *IndexDefinition) Algorithm(algorithm string) schema.IndexDefinition

func (*IndexDefinition) Deferrable

func (r *IndexDefinition) Deferrable() schema.IndexDefinition

func (*IndexDefinition) InitiallyImmediate

func (r *IndexDefinition) InitiallyImmediate() schema.IndexDefinition

func (*IndexDefinition) Language

func (r *IndexDefinition) Language(name string) schema.IndexDefinition

func (*IndexDefinition) Name

type MysqlSchema

type MysqlSchema struct {
	contractsschema.CommonSchema
	// contains filtered or unexported fields
}

func NewMysqlSchema

func NewMysqlSchema(grammar *grammars.Mysql, orm orm.Orm, prefix string) *MysqlSchema

func (*MysqlSchema) DropAllTables

func (r *MysqlSchema) DropAllTables() error

func (*MysqlSchema) DropAllTypes

func (r *MysqlSchema) DropAllTypes() error

func (*MysqlSchema) DropAllViews

func (r *MysqlSchema) DropAllViews() error

func (*MysqlSchema) GetColumns

func (r *MysqlSchema) GetColumns(table string) ([]contractsschema.Column, error)

func (*MysqlSchema) GetIndexes

func (r *MysqlSchema) GetIndexes(table string) ([]contractsschema.Index, error)

func (*MysqlSchema) GetTypes

func (r *MysqlSchema) GetTypes() ([]contractsschema.Type, error)

type OracleSchema added in v0.7.0

type OracleSchema struct {
	contractsschema.CommonSchema
	// contains filtered or unexported fields
}

func NewOracleSchema added in v0.7.0

func NewOracleSchema(grammar *grammars.Oracle, orm orm.Orm, prefix string) *OracleSchema

func (*OracleSchema) DropAllTables added in v0.7.0

func (r *OracleSchema) DropAllTables() error

func (*OracleSchema) DropAllTypes added in v0.7.0

func (r *OracleSchema) DropAllTypes() error

func (*OracleSchema) DropAllViews added in v0.7.0

func (r *OracleSchema) DropAllViews() error

func (*OracleSchema) GetColumns added in v0.7.0

func (r *OracleSchema) GetColumns(table string) ([]contractsschema.Column, error)

func (*OracleSchema) GetIndexes added in v0.7.0

func (r *OracleSchema) GetIndexes(table string) ([]contractsschema.Index, error)

func (*OracleSchema) GetTypes added in v0.7.0

func (r *OracleSchema) GetTypes() ([]contractsschema.Type, error)

type PostgresSchema

type PostgresSchema struct {
	contractsschema.CommonSchema
	// contains filtered or unexported fields
}

func NewPostgresSchema

func NewPostgresSchema(grammar *grammars.Postgres, orm orm.Orm, schema, prefix string) *PostgresSchema

func (*PostgresSchema) DropAllTables

func (r *PostgresSchema) DropAllTables() error

func (*PostgresSchema) DropAllTypes

func (r *PostgresSchema) DropAllTypes() error

func (*PostgresSchema) DropAllViews

func (r *PostgresSchema) DropAllViews() error

func (*PostgresSchema) GetColumns

func (r *PostgresSchema) GetColumns(table string) ([]contractsschema.Column, error)

func (*PostgresSchema) GetIndexes

func (r *PostgresSchema) GetIndexes(table string) ([]contractsschema.Index, error)

func (*PostgresSchema) GetTypes

func (r *PostgresSchema) GetTypes() ([]contractsschema.Type, error)

type Schema

type Schema struct {
	contractsschema.CommonSchema
	contractsschema.DriverSchema
	// contains filtered or unexported fields
}

func NewSchema

func NewSchema(config config.Config, log log.Log, orm contractsorm.Orm, migrations []contractsschema.Migration) (*Schema, error)

func (*Schema) Connection

func (r *Schema) Connection(name string) contractsschema.Schema

func (*Schema) Create

func (r *Schema) Create(table string, callback func(table contractsschema.Blueprint)) error

func (*Schema) Drop

func (r *Schema) Drop(table string) error

func (*Schema) DropColumns

func (r *Schema) DropColumns(table string, columns []string) error

func (*Schema) DropIfExists

func (r *Schema) DropIfExists(table string) error

func (*Schema) GetColumnListing

func (r *Schema) GetColumnListing(table string) []string

func (*Schema) GetConnection

func (r *Schema) GetConnection() string

func (*Schema) GetForeignKeys

func (r *Schema) GetForeignKeys(table string) ([]contractsschema.ForeignKey, error)

func (*Schema) GetIndexListing

func (r *Schema) GetIndexListing(table string) []string

func (*Schema) GetIndexes

func (r *Schema) GetIndexes(table string) ([]contractsschema.Index, error)

func (*Schema) GetTableListing

func (r *Schema) GetTableListing() []string

func (*Schema) GetTables added in v0.5.0

func (r *Schema) GetTables() ([]contractsschema.Table, error)

func (*Schema) HasColumn

func (r *Schema) HasColumn(table, column string) bool

func (*Schema) HasColumns

func (r *Schema) HasColumns(table string, columns []string) bool

func (*Schema) HasIndex

func (r *Schema) HasIndex(table, index string) bool

func (*Schema) HasTable

func (r *Schema) HasTable(name string) bool

func (*Schema) HasType

func (r *Schema) HasType(name string) bool

func (*Schema) HasView

func (r *Schema) HasView(name string) bool

func (*Schema) Migrations

func (r *Schema) Migrations() []contractsschema.Migration

func (*Schema) Orm

func (r *Schema) Orm() contractsorm.Orm

func (*Schema) Register

func (r *Schema) Register(migrations []contractsschema.Migration)

func (*Schema) Rename

func (r *Schema) Rename(from, to string) error

func (*Schema) RenameColumn

func (r *Schema) RenameColumn(table, from, to string) error

func (*Schema) SetConnection

func (r *Schema) SetConnection(name string)

func (*Schema) Sql

func (r *Schema) Sql(sql string) error

func (*Schema) Table

func (r *Schema) Table(table string, callback func(table contractsschema.Blueprint)) error

type SqliteSchema

type SqliteSchema struct {
	schema.CommonSchema
	// contains filtered or unexported fields
}

func NewSqliteSchema

func NewSqliteSchema(grammar *grammars.Sqlite, orm orm.Orm, prefix string) *SqliteSchema

func (*SqliteSchema) DropAllTables

func (r *SqliteSchema) DropAllTables() error

func (*SqliteSchema) DropAllTypes

func (r *SqliteSchema) DropAllTypes() error

func (*SqliteSchema) DropAllViews

func (r *SqliteSchema) DropAllViews() error

func (*SqliteSchema) GetColumns

func (r *SqliteSchema) GetColumns(table string) ([]schema.Column, error)

func (*SqliteSchema) GetIndexes

func (r *SqliteSchema) GetIndexes(table string) ([]schema.Index, error)

func (*SqliteSchema) GetTypes

func (r *SqliteSchema) GetTypes() ([]schema.Type, error)

type SqlserverSchema

type SqlserverSchema struct {
	contractsschema.CommonSchema
	// contains filtered or unexported fields
}

func NewSqlserverSchema

func NewSqlserverSchema(grammar *grammars.Sqlserver, orm orm.Orm, prefix string) *SqlserverSchema

func (*SqlserverSchema) DropAllTables

func (r *SqlserverSchema) DropAllTables() error

func (*SqlserverSchema) DropAllTypes

func (r *SqlserverSchema) DropAllTypes() error

func (*SqlserverSchema) DropAllViews

func (r *SqlserverSchema) DropAllViews() error

func (*SqlserverSchema) GetColumns

func (r *SqlserverSchema) GetColumns(table string) ([]contractsschema.Column, error)

func (*SqlserverSchema) GetIndexes

func (r *SqlserverSchema) GetIndexes(table string) ([]contractsschema.Index, error)

func (*SqlserverSchema) GetTypes

func (r *SqlserverSchema) GetTypes() ([]contractsschema.Type, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL