Documentation
¶
Index ¶
- Constants
- Variables
- func ApplySQLContent(ctx context.Context, db *sql.DB, content string) error
- func DetectPostgresScratchVersion(ctx context.Context, connectionString string) embeddedpostgres.PostgresVersion
- func FileUsesTransaction(content string) bool
- func FirstError(candidates ...error) error
- func HasSQLExtension(path string) bool
- func IsDownMigration(name string) bool
- func IsSQLSource(path string) bool
- func OpenPostgresConnection(connectionString string, schema string) (*sql.DB, error)
- func QuoteIdentifier(name string) string
- func QuoteIdentifiers(names []string) []string
- func RenderInstructions(instructions []Instruction) string
- func SplitSQLStatements(content string) []string
- func TrimGooseDownSection(content string) string
- func TrimSQLitePrefix(path string) string
- type AlterDomainAction
- type AlterTableAction
- type AutomaticCastLookup
- type Condition
- type Driver
- type DriverName
- type Instruction
- type PostgresAddColumnAction
- type PostgresAddConstraintAction
- type PostgresAddDomainConstraintAction
- type PostgresAddIdentityAction
- type PostgresAggregate
- func (a *PostgresAggregate) CreateInstruction() *PostgresCreateAggregateInstruction
- func (a *PostgresAggregate) Diff(other *PostgresAggregate) []Instruction
- func (a *PostgresAggregate) DropInstruction() *PostgresDropAggregateInstruction
- func (a *PostgresAggregate) Equal(other *PostgresAggregate) bool
- func (a *PostgresAggregate) Signature() string
- type PostgresAlterColumnTypeAction
- type PostgresAlterDomainInstruction
- type PostgresAlterExtensionInstruction
- type PostgresAlterSequenceInstruction
- type PostgresAlterTableInstruction
- type PostgresAlterTypeAddValueInstruction
- type PostgresAttachPartitionInstruction
- type PostgresColumn
- func (c *PostgresColumn) Copy() *PostgresColumn
- func (c *PostgresColumn) Definition() string
- func (c *PostgresColumn) HasEqualAttributes(other *PostgresColumn) bool
- func (c *PostgresColumn) StatisticsInstructions(tableName string) []Instruction
- func (c *PostgresColumn) StorageInstructions(tableName string) []Instruction
- type PostgresCommentOnColumnInstruction
- type PostgresCommentOnIndexInstruction
- type PostgresCommentOnMaterializedViewInstruction
- type PostgresCommentOnRoutineInstruction
- type PostgresCommentOnTableInstruction
- type PostgresCommentOnTypeInstruction
- type PostgresCommentOnViewInstruction
- type PostgresCompositeType
- func (t *PostgresCompositeType) CreateInstruction() *PostgresCreateCompositeTypeInstruction
- func (t *PostgresCompositeType) Diff(other *PostgresCompositeType) []Instruction
- func (t *PostgresCompositeType) DropInstruction() *PostgresDropTypeInstruction
- func (t *PostgresCompositeType) Equal(other *PostgresCompositeType) bool
- type PostgresCompositeTypeAttribute
- type PostgresConstraint
- type PostgresCreateAggregateInstruction
- type PostgresCreateCompositeTypeInstruction
- type PostgresCreateDomainInstruction
- type PostgresCreateEnumTypeInstruction
- type PostgresCreateExtensionInstruction
- type PostgresCreateFunctionInstruction
- type PostgresCreateIndexInstruction
- type PostgresCreateMaterializedViewInstruction
- type PostgresCreateOperatorInstruction
- type PostgresCreateOwnedSequenceInstruction
- type PostgresCreatePolicyInstruction
- type PostgresCreateProcedureInstruction
- type PostgresCreateRuleInstruction
- type PostgresCreateSequenceInstruction
- type PostgresCreateStatisticsInstruction
- type PostgresCreateTableInstruction
- type PostgresCreateTablePartitionInstruction
- type PostgresCreateTriggerInstruction
- type PostgresCreateViewInstruction
- type PostgresDetachPartitionInstruction
- type PostgresDomain
- func (d *PostgresDomain) ConstraintByName(name string) (*PostgresDomainConstraint, bool)
- func (d *PostgresDomain) CreateInstruction() *PostgresCreateDomainInstruction
- func (d *PostgresDomain) Diff(other *PostgresDomain) []Instruction
- func (d *PostgresDomain) DropInstruction() *PostgresDropDomainInstruction
- type PostgresDomainConstraint
- type PostgresDriver
- func (d *PostgresDriver) Close() error
- func (d *PostgresDriver) Diff(ctx context.Context) ([]Instruction, error)
- func (d *PostgresDriver) DiffAggregates(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) DiffCompositeTypes(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) DiffData(ctx context.Context) ([]Instruction, error)
- func (d *PostgresDriver) DiffDomains(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) DiffExtensions(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) DiffFunctions(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) DiffOperators(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) DiffPrivileges(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) DiffSequences(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) DiffStatistics(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) DiffTableData(ctx context.Context, targetTable *PostgresTable, sourceTable *PostgresTable) ([]Instruction, []Instruction, error)
- func (d *PostgresDriver) DiffTables(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) DiffTypes(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) DiffViewsAndMaterializedViews(ctx context.Context) (*SectionDiff, error)
- func (d *PostgresDriver) GetAggregates(ctx context.Context, db *sql.DB) ([]*PostgresAggregate, error)
- func (d *PostgresDriver) GetCompositeTypes(ctx context.Context, db *sql.DB) ([]*PostgresCompositeType, error)
- func (d *PostgresDriver) GetDomains(ctx context.Context, db *sql.DB) ([]*PostgresDomain, error)
- func (d *PostgresDriver) GetExtensions(ctx context.Context, db *sql.DB) ([]*PostgresExtension, error)
- func (d *PostgresDriver) GetFunctions(ctx context.Context, db *sql.DB) ([]*PostgresFunction, error)
- func (d *PostgresDriver) GetMaterializedViewIndexes(ctx context.Context, db *sql.DB, viewName string) ([]*PostgresIndex, error)
- func (d *PostgresDriver) GetMaterializedViews(ctx context.Context, db *sql.DB) ([]*PostgresMaterializedView, error)
- func (d *PostgresDriver) GetOperators(ctx context.Context, db *sql.DB) ([]*PostgresOperator, error)
- func (d *PostgresDriver) GetOwners(ctx context.Context, db *sql.DB) ([]*PostgresOwner, error)
- func (d *PostgresDriver) GetPrivileges(ctx context.Context, db *sql.DB) ([]*PostgresPrivilege, error)
- func (d *PostgresDriver) GetSequences(ctx context.Context, db *sql.DB) ([]*PostgresSequence, error)
- func (d *PostgresDriver) GetStatistics(ctx context.Context, db *sql.DB) ([]*PostgresStatistics, error)
- func (d *PostgresDriver) GetTable(ctx context.Context, db *sql.DB, tableName string) (*PostgresTable, error)
- func (d *PostgresDriver) GetTableData(ctx context.Context, db *sql.DB, tableName string, columnNames []string, ...) (*PostgresTableData, error)
- func (d *PostgresDriver) GetTablePolicies(ctx context.Context, db *sql.DB, tableName string) ([]*PostgresPolicy, error)
- func (d *PostgresDriver) GetTablePrimaryKey(ctx context.Context, db *sql.DB, tableName string) ([]string, error)
- func (d *PostgresDriver) GetTableRules(ctx context.Context, db *sql.DB, tableName string) ([]*PostgresRule, error)
- func (d *PostgresDriver) GetTables(ctx context.Context, db *sql.DB) ([]*PostgresTable, error)
- func (d *PostgresDriver) GetTypes(ctx context.Context, db *sql.DB) ([]*PostgresType, error)
- func (d *PostgresDriver) GetViewColumns(ctx context.Context, db *sql.DB, viewName string) ([]*PostgresViewColumn, error)
- func (d *PostgresDriver) GetViews(ctx context.Context, db *sql.DB) ([]*PostgresView, error)
- func (d *PostgresDriver) HasAutomaticCast(ctx context.Context, db *sql.DB, oldType string, newType string) (bool, error)
- func (d *PostgresDriver) OpenSide(ctx context.Context, connectionString string, schema string, role string) (*sql.DB, error)
- func (d *PostgresDriver) ScratchServer() (*PostgresScratchServer, error)
- func (d *PostgresDriver) StopScratchServer() error
- func (d *PostgresDriver) TableDataInstructions(ctx context.Context, targetTable *PostgresTable) ([]Instruction, error)
- func (d *PostgresDriver) VerifySchema(ctx context.Context, db *sql.DB, schema string, role string) error
- type PostgresDriverConfig
- type PostgresDropAggregateInstruction
- type PostgresDropConstraintAction
- type PostgresDropDefaultAction
- type PostgresDropDomainConstraintAction
- type PostgresDropDomainDefaultAction
- type PostgresDropDomainInstruction
- type PostgresDropDomainNotNullAction
- type PostgresDropExtensionInstruction
- type PostgresDropFunctionInstruction
- type PostgresDropIdentityAction
- type PostgresDropMaterializedViewInstruction
- type PostgresDropNotNullAction
- type PostgresDropOperatorInstruction
- type PostgresDropPolicyInstruction
- type PostgresDropProcedureInstruction
- type PostgresDropRuleInstruction
- type PostgresDropSequenceInstruction
- type PostgresDropStatisticsInstruction
- type PostgresDropTriggerInstruction
- type PostgresDropTypeInstruction
- type PostgresExtension
- type PostgresFunction
- type PostgresGrantInstruction
- type PostgresIndex
- type PostgresInheritAction
- type PostgresInsertOverridingInstruction
- type PostgresMaterializedView
- func (v *PostgresMaterializedView) CreateInstruction() *PostgresCreateMaterializedViewInstruction
- func (v *PostgresMaterializedView) DropInstruction() *PostgresDropMaterializedViewInstruction
- func (v *PostgresMaterializedView) HasEqualColumns(other *PostgresMaterializedView) bool
- func (v *PostgresMaterializedView) IndexByName(name string) (*PostgresIndex, bool)
- func (v *PostgresMaterializedView) Instructions() []Instruction
- type PostgresNoInheritAction
- type PostgresOperator
- func (o *PostgresOperator) CreateInstruction() *PostgresCreateOperatorInstruction
- func (o *PostgresOperator) Diff(other *PostgresOperator) []Instruction
- func (o *PostgresOperator) DropInstruction() *PostgresDropOperatorInstruction
- func (o *PostgresOperator) Equal(other *PostgresOperator) bool
- func (o *PostgresOperator) Signature() string
- type PostgresOwner
- type PostgresPolicy
- type PostgresPrivilege
- type PostgresRelation
- type PostgresReplicaIdentityAction
- type PostgresResetStorageParametersAction
- type PostgresRevokeInstruction
- type PostgresRowLevelSecurityAction
- type PostgresRule
- type PostgresScratchServer
- type PostgresSequence
- type PostgresSetDefaultAction
- type PostgresSetDomainDefaultAction
- type PostgresSetDomainNotNullAction
- type PostgresSetIdentityAction
- type PostgresSetIdentityOptionsAction
- type PostgresSetNotNullAction
- type PostgresSetOwnerInstruction
- type PostgresSetPersistenceAction
- type PostgresSetStatisticsAction
- type PostgresSetStorageAction
- type PostgresSetStorageParametersAction
- type PostgresStatistics
- type PostgresTable
- func (t *PostgresTable) ColumnByName(name string) (*PostgresColumn, bool)
- func (t *PostgresTable) CommentInstructions() []Instruction
- func (t *PostgresTable) ConstraintByName(name string) (*PostgresConstraint, bool)
- func (t *PostgresTable) CreateTableInstruction() *PostgresCreateTableInstruction
- func (t *PostgresTable) DiffRules(other *PostgresTable) []Instruction
- func (t *PostgresTable) DiffTable(other *PostgresTable, hasAutomaticCast AutomaticCastLookup) ([]Instruction, error)
- func (t *PostgresTable) ForeignKeyInstructions() []Instruction
- func (t *PostgresTable) IndexByName(name string) (*PostgresIndex, bool)
- func (t *PostgresTable) Instructions() []Instruction
- func (t *PostgresTable) IsPartition() bool
- func (t *PostgresTable) PolicyByName(name string) (*PostgresPolicy, bool)
- func (t *PostgresTable) ReplicaIdentityInstructions() []Instruction
- func (t *PostgresTable) RowLevelSecurityInstructions() []Instruction
- func (t *PostgresTable) RuleByName(name string) (*PostgresRule, bool)
- func (t *PostgresTable) RuleInstructions() []Instruction
- func (t *PostgresTable) TriggerByName(name string) (*PostgresTrigger, bool)
- type PostgresTableData
- type PostgresTrigger
- type PostgresTriggerEnableAction
- type PostgresType
- type PostgresView
- type PostgresViewColumn
- type SQLCommentInstruction
- type SQLConjunctionCondition
- type SQLDeleteInstruction
- type SQLDropColumnAction
- type SQLDropIndexInstruction
- type SQLDropTableInstruction
- type SQLDropViewInstruction
- type SQLEqualityCondition
- type SQLInsertInstruction
- type SQLInsertSelectInstruction
- type SQLIsNullCondition
- type SQLRenameColumnAction
- type SQLRenameTableAction
- type SQLSetClause
- type SQLSource
- type SQLUpdateInstruction
- type SQLiteAddColumnAction
- type SQLiteAlterTableInstruction
- type SQLiteCheckConstraint
- type SQLiteColumn
- type SQLiteCreateIndexInstruction
- type SQLiteCreateTableInstruction
- type SQLiteCreateTriggerInstruction
- type SQLiteCreateViewInstruction
- type SQLiteCreateVirtualTableInstruction
- type SQLiteDriver
- func (d *SQLiteDriver) Close() error
- func (d *SQLiteDriver) Diff(ctx context.Context) ([]Instruction, error)
- func (d *SQLiteDriver) DiffData(ctx context.Context) ([]Instruction, error)
- func (d *SQLiteDriver) DiffTableData(ctx context.Context, targetTable *SQLiteTable, sourceTable *SQLiteTable) ([]Instruction, []Instruction, error)
- func (d *SQLiteDriver) DiffTables(ctx context.Context) ([]Instruction, error)
- func (d *SQLiteDriver) DiffViews(ctx context.Context) ([]Instruction, error)
- func (d *SQLiteDriver) DiffVirtualTables(ctx context.Context) ([]Instruction, error)
- func (d *SQLiteDriver) GetIndexColumnNames(ctx context.Context, db *sql.DB, indexName string) ([]string, error)
- func (d *SQLiteDriver) GetIndexDefinitions(ctx context.Context, db *sql.DB, tableName string) (map[string]string, error)
- func (d *SQLiteDriver) GetIndexKeys(ctx context.Context, db *sql.DB, indexName string, definitionKeys []string) ([]string, error)
- func (d *SQLiteDriver) GetTable(ctx context.Context, db *sql.DB, tableName string) (*SQLiteTable, error)
- func (d *SQLiteDriver) GetTableColumns(ctx context.Context, db *sql.DB, tableName string) ([]*SQLiteColumn, error)
- func (d *SQLiteDriver) GetTableData(ctx context.Context, db *sql.DB, tableName string, columnNames []string, ...) (*SQLiteTableData, error)
- func (d *SQLiteDriver) GetTableDefinition(ctx context.Context, db *sql.DB, tableName string) (string, error)
- func (d *SQLiteDriver) GetTableForeignKeys(ctx context.Context, db *sql.DB, tableName string) ([]*SQLiteForeignKey, error)
- func (d *SQLiteDriver) GetTableIndexes(ctx context.Context, db *sql.DB, tableName string) ([]*SQLiteIndex, error)
- func (d *SQLiteDriver) GetTablePrimaryKey(ctx context.Context, db *sql.DB, tableName string) ([]string, error)
- func (d *SQLiteDriver) GetTableUniqueKeys(ctx context.Context, db *sql.DB, tableName string) ([][]string, error)
- func (d *SQLiteDriver) GetTables(ctx context.Context, db *sql.DB) ([]*SQLiteTable, error)
- func (d *SQLiteDriver) GetTriggers(ctx context.Context, db *sql.DB, objectName string) ([]*SQLiteTrigger, error)
- func (d *SQLiteDriver) GetViews(ctx context.Context, db *sql.DB) ([]*SQLiteView, error)
- func (d *SQLiteDriver) GetVirtualTables(ctx context.Context, db *sql.DB) ([]*SQLiteVirtualTable, error)
- func (d *SQLiteDriver) OpenSide(ctx context.Context, path string, role string) (*sql.DB, error)
- func (d *SQLiteDriver) RemoveTemporaryDirectory() error
- func (d *SQLiteDriver) TableDataInstructions(ctx context.Context, targetTable *SQLiteTable) ([]Instruction, error)
- func (d *SQLiteDriver) TemporaryDirectory() (string, error)
- type SQLiteDriverConfig
- type SQLiteDropTriggerInstruction
- type SQLiteForeignKey
- type SQLiteIndex
- type SQLiteIndexPredicateCondition
- type SQLitePragmaForeignKeysInstruction
- type SQLiteTable
- func (t *SQLiteTable) ColumnByName(name string) (*SQLiteColumn, bool)
- func (t *SQLiteTable) Copy() *SQLiteTable
- func (t *SQLiteTable) CreateTableInstruction() *SQLiteCreateTableInstruction
- func (t *SQLiteTable) DiffColumns(other *SQLiteTable) *SQLiteTableColumnsDiff
- func (t *SQLiteTable) DiffIndexes(other *SQLiteTable) ([]Instruction, error)
- func (t *SQLiteTable) DiffTable(other *SQLiteTable) ([]Instruction, error)
- func (t *SQLiteTable) DiffTriggers(other *SQLiteTable) ([]Instruction, error)
- func (t *SQLiteTable) IndexByName(name string) (*SQLiteIndex, bool)
- func (t *SQLiteTable) IndexInstructions() []Instruction
- func (t *SQLiteTable) Instructions() []Instruction
- func (t *SQLiteTable) PrimaryKeyColumnNames() []string
- func (t *SQLiteTable) TriggerByName(name string) (*SQLiteTrigger, bool)
- func (t *SQLiteTable) TriggerInstructions() []Instruction
- type SQLiteTableColumnsDiff
- type SQLiteTableData
- type SQLiteTableDefinition
- func (d *SQLiteTableDefinition) ColumnByName(name string) (*SQLiteColumn, bool)
- func (d *SQLiteTableDefinition) DeferrableOf(columns []string) string
- func (d *SQLiteTableDefinition) ForeignKeyNameOf(columns []string) string
- func (d *SQLiteTableDefinition) UniqueConflictOf(columns []string) string
- func (d *SQLiteTableDefinition) UniqueKeysOf(columns []string) []string
- func (d *SQLiteTableDefinition) UniqueNameOf(columns []string) string
- type SQLiteTrigger
- type SQLiteUniqueConstraint
- type SQLiteView
- func (v *SQLiteView) Diff(other *SQLiteView) ([]Instruction, error)
- func (v *SQLiteView) DiffTriggers(other *SQLiteView) []Instruction
- func (v *SQLiteView) Instructions() []Instruction
- func (v *SQLiteView) TriggerByName(name string) (*SQLiteTrigger, bool)
- func (v *SQLiteView) TriggerInstructions() []Instruction
- type SQLiteVirtualTable
- type SectionDiff
Constants ¶
const ( NoTransactionDirective = "-- dbdiff:no-transaction" AtlasNoTransactionDirective = "-- atlas:txmode none" )
const MigrationHistoryTableName = "dbdiff_migrations"
The diff hides this table. Without that step, a diff prints a DROP statement for the table, and the user then erases the history of every migration.
Variables ¶
var SupportedDriverNames = []DriverName{SQLiteDriverName, PostgresDriverName}
Functions ¶
func ApplySQLContent ¶ added in v1.2.0
func DetectPostgresScratchVersion ¶ added in v1.2.0
func DetectPostgresScratchVersion(ctx context.Context, connectionString string) embeddedpostgres.PostgresVersion
func FileUsesTransaction ¶ added in v1.2.0
func FirstError ¶ added in v1.2.0
func HasSQLExtension ¶ added in v1.2.0
func IsDownMigration ¶ added in v1.2.0
func IsSQLSource ¶ added in v1.2.0
func OpenPostgresConnection ¶ added in v1.2.0
func QuoteIdentifier ¶ added in v1.2.0
func QuoteIdentifiers ¶ added in v1.2.0
func RenderInstructions ¶ added in v1.2.0
func RenderInstructions(instructions []Instruction) string
func SplitSQLStatements ¶ added in v1.2.0
PostgreSQL runs the statements of one call in an implicit transaction block, and it refuses CREATE INDEX CONCURRENTLY there. A file that holds the directive takes one call for each statement for that reason, and every other file runs in one call.
A semicolon splits nothing inside parentheses, because the actions of CREATE RULE sit there. It splits nothing inside BEGIN ... END, because the body of a trigger of SQLite and the body of BEGIN ATOMIC hold whole statements. A CASE expression ends with END too, so the block counter reads CASE as an opener.
func TrimGooseDownSection ¶ added in v1.2.0
A goose file holds the up migration and the down migration in one file, and the down part removes the schema that the up part built.
func TrimSQLitePrefix ¶ added in v1.2.0
Types ¶
type AlterDomainAction ¶ added in v1.2.0
type AlterDomainAction interface {
DomainActionClause() string
}
type AlterTableAction ¶ added in v1.2.0
type AlterTableAction interface {
TableActionClause() string
}
type AutomaticCastLookup ¶ added in v1.2.0
type Driver ¶
type Driver interface {
Close() error
Diff(ctx context.Context) ([]Instruction, error)
}
type DriverName ¶ added in v1.2.0
type DriverName string
const ( SQLiteDriverName DriverName = "sqlite3" PostgresDriverName DriverName = "postgres" )
func DetectDriver ¶ added in v1.2.0
func DetectDriver(source string, target string) (DriverName, error)
type Instruction ¶ added in v1.2.0
type Instruction interface {
String() string
// The name of the object that the statement changes, and not a comment of the schema.
Comment() string
}
Every type of the catalogue uses a pointer receiver, so only a pointer satisfies this interface.
func AnnotateInstructions ¶ added in v1.2.0
func AnnotateInstructions(instructions []Instruction) []Instruction
type PostgresAddColumnAction ¶ added in v1.2.0
type PostgresAddColumnAction struct {
Column *PostgresColumn
}
func (*PostgresAddColumnAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresAddColumnAction) TableActionClause() string
type PostgresAddConstraintAction ¶ added in v1.2.0
type PostgresAddConstraintAction struct {
Constraint *PostgresConstraint
}
func (*PostgresAddConstraintAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresAddConstraintAction) TableActionClause() string
type PostgresAddDomainConstraintAction ¶ added in v1.2.0
func (*PostgresAddDomainConstraintAction) DomainActionClause ¶ added in v1.2.0
func (a *PostgresAddDomainConstraintAction) DomainActionClause() string
type PostgresAddIdentityAction ¶ added in v1.2.0
func (*PostgresAddIdentityAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresAddIdentityAction) TableActionClause() string
type PostgresAggregate ¶ added in v1.2.0
type PostgresAggregate struct {
Name string
Arguments string
StateType string
TransitionFunction string
TransitionSpace int64
FinalFunction sql.NullString
FinalFunctionExtra bool
// An empty value is the default READ_ONLY, so an equal pair compares as equal.
FinalFunctionModify string
CombineFunction sql.NullString
SerializeFunction sql.NullString
DeserializeFunction sql.NullString
InitialCondition sql.NullString
MovingTransitionFunction sql.NullString
MovingInverseTransitionFunction sql.NullString
MovingStateType sql.NullString
MovingTransitionSpace int64
MovingFinalFunction sql.NullString
MovingFinalFunctionExtra bool
MovingFinalFunctionModify string
MovingInitialCondition sql.NullString
SortOperator sql.NullString
// An empty value is the default UNSAFE, so an equal pair compares as equal.
Parallel string
}
func (*PostgresAggregate) CreateInstruction ¶ added in v1.2.0
func (a *PostgresAggregate) CreateInstruction() *PostgresCreateAggregateInstruction
func (*PostgresAggregate) Diff ¶ added in v1.2.0
func (a *PostgresAggregate) Diff(other *PostgresAggregate) []Instruction
PostgreSQL changes the name and the owner of an aggregate only, so every other change needs a recreation.
func (*PostgresAggregate) DropInstruction ¶ added in v1.2.0
func (a *PostgresAggregate) DropInstruction() *PostgresDropAggregateInstruction
func (*PostgresAggregate) Equal ¶ added in v1.2.0
func (a *PostgresAggregate) Equal(other *PostgresAggregate) bool
func (*PostgresAggregate) Signature ¶ added in v1.2.0
func (a *PostgresAggregate) Signature() string
type PostgresAlterColumnTypeAction ¶ added in v1.2.0
type PostgresAlterColumnTypeAction struct {
ColumnName string
DataType string
Collation string
UsingCast bool
}
func (*PostgresAlterColumnTypeAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresAlterColumnTypeAction) TableActionClause() string
type PostgresAlterDomainInstruction ¶ added in v1.2.0
type PostgresAlterDomainInstruction struct {
Name string
Action AlterDomainAction
}
func (*PostgresAlterDomainInstruction) Comment ¶ added in v1.2.0
func (i *PostgresAlterDomainInstruction) Comment() string
func (*PostgresAlterDomainInstruction) String ¶ added in v1.2.0
func (i *PostgresAlterDomainInstruction) String() string
type PostgresAlterExtensionInstruction ¶ added in v1.2.0
func (*PostgresAlterExtensionInstruction) Comment ¶ added in v1.2.0
func (i *PostgresAlterExtensionInstruction) Comment() string
func (*PostgresAlterExtensionInstruction) String ¶ added in v1.2.0
func (i *PostgresAlterExtensionInstruction) String() string
type PostgresAlterSequenceInstruction ¶ added in v1.2.0
type PostgresAlterSequenceInstruction struct {
Name string
DataType sql.NullString
Increment sql.NullInt64
Min sql.NullInt64
Max sql.NullInt64
Start sql.NullInt64
Cache sql.NullInt64
Cycle sql.NullBool
Restart sql.NullInt64
}
func (*PostgresAlterSequenceInstruction) Comment ¶ added in v1.2.0
func (i *PostgresAlterSequenceInstruction) Comment() string
func (*PostgresAlterSequenceInstruction) String ¶ added in v1.2.0
func (i *PostgresAlterSequenceInstruction) String() string
type PostgresAlterTableInstruction ¶ added in v1.2.0
type PostgresAlterTableInstruction struct {
Name string
Actions []AlterTableAction
}
func (*PostgresAlterTableInstruction) Comment ¶ added in v1.2.0
func (i *PostgresAlterTableInstruction) Comment() string
func (*PostgresAlterTableInstruction) String ¶ added in v1.2.0
func (i *PostgresAlterTableInstruction) String() string
type PostgresAlterTypeAddValueInstruction ¶ added in v1.2.0
func (*PostgresAlterTypeAddValueInstruction) Comment ¶ added in v1.2.0
func (i *PostgresAlterTypeAddValueInstruction) Comment() string
func (*PostgresAlterTypeAddValueInstruction) String ¶ added in v1.2.0
func (i *PostgresAlterTypeAddValueInstruction) String() string
type PostgresAttachPartitionInstruction ¶ added in v1.2.0
type PostgresAttachPartitionInstruction struct {
ParentName string
PartitionName string
Bound string
}
func (*PostgresAttachPartitionInstruction) Comment ¶ added in v1.2.0
func (i *PostgresAttachPartitionInstruction) Comment() string
func (*PostgresAttachPartitionInstruction) String ¶ added in v1.2.0
func (i *PostgresAttachPartitionInstruction) String() string
type PostgresColumn ¶ added in v1.2.0
type PostgresColumn struct {
Name string
Type string
NotNull bool
Default sql.NullString
Identity string
IdentityOptions string
GeneratedExpression string
Serial string
SerialSequenceName string
Collation string
// Definition writes no comment, because a column definition accepts none.
Comment string
Storage string
StatisticsTarget sql.NullInt64
}
func (*PostgresColumn) Copy ¶ added in v1.2.0
func (c *PostgresColumn) Copy() *PostgresColumn
func (*PostgresColumn) Definition ¶ added in v1.2.0
func (c *PostgresColumn) Definition() string
func (*PostgresColumn) HasEqualAttributes ¶ added in v1.2.0
func (c *PostgresColumn) HasEqualAttributes(other *PostgresColumn) bool
func (*PostgresColumn) StatisticsInstructions ¶ added in v1.2.0
func (c *PostgresColumn) StatisticsInstructions(tableName string) []Instruction
A column definition accepts no statistics source, so a separate statement holds it. The
func (*PostgresColumn) StorageInstructions ¶ added in v1.2.0
func (c *PostgresColumn) StorageInstructions(tableName string) []Instruction
A column definition accepts no storage mode before PostgreSQL 16, so a separate statement
type PostgresCommentOnColumnInstruction ¶ added in v1.2.0
func (*PostgresCommentOnColumnInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCommentOnColumnInstruction) Comment() string
func (*PostgresCommentOnColumnInstruction) String ¶ added in v1.2.0
func (i *PostgresCommentOnColumnInstruction) String() string
type PostgresCommentOnIndexInstruction ¶ added in v1.2.0
func (*PostgresCommentOnIndexInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCommentOnIndexInstruction) Comment() string
func (*PostgresCommentOnIndexInstruction) String ¶ added in v1.2.0
func (i *PostgresCommentOnIndexInstruction) String() string
type PostgresCommentOnMaterializedViewInstruction ¶ added in v1.2.0
func (*PostgresCommentOnMaterializedViewInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCommentOnMaterializedViewInstruction) Comment() string
func (*PostgresCommentOnMaterializedViewInstruction) String ¶ added in v1.2.0
func (i *PostgresCommentOnMaterializedViewInstruction) String() string
type PostgresCommentOnRoutineInstruction ¶ added in v1.2.0
The word ROUTINE covers a function and a procedure, so one type serves both kinds.
func (*PostgresCommentOnRoutineInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCommentOnRoutineInstruction) Comment() string
func (*PostgresCommentOnRoutineInstruction) String ¶ added in v1.2.0
func (i *PostgresCommentOnRoutineInstruction) String() string
type PostgresCommentOnTableInstruction ¶ added in v1.2.0
func (*PostgresCommentOnTableInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCommentOnTableInstruction) Comment() string
func (*PostgresCommentOnTableInstruction) String ¶ added in v1.2.0
func (i *PostgresCommentOnTableInstruction) String() string
type PostgresCommentOnTypeInstruction ¶ added in v1.2.0
func (*PostgresCommentOnTypeInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCommentOnTypeInstruction) Comment() string
func (*PostgresCommentOnTypeInstruction) String ¶ added in v1.2.0
func (i *PostgresCommentOnTypeInstruction) String() string
type PostgresCommentOnViewInstruction ¶ added in v1.2.0
func (*PostgresCommentOnViewInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCommentOnViewInstruction) Comment() string
func (*PostgresCommentOnViewInstruction) String ¶ added in v1.2.0
func (i *PostgresCommentOnViewInstruction) String() string
type PostgresCompositeType ¶ added in v1.2.0
type PostgresCompositeType struct {
Name string
Attributes []*PostgresCompositeTypeAttribute
}
func (*PostgresCompositeType) CreateInstruction ¶ added in v1.2.0
func (t *PostgresCompositeType) CreateInstruction() *PostgresCreateCompositeTypeInstruction
func (*PostgresCompositeType) Diff ¶ added in v1.2.0
func (t *PostgresCompositeType) Diff(other *PostgresCompositeType) []Instruction
One ALTER TYPE statement changes one attribute only, and the order of the attributes stays fixed. A recreation gives the wanted attribute list in every case.
func (*PostgresCompositeType) DropInstruction ¶ added in v1.2.0
func (t *PostgresCompositeType) DropInstruction() *PostgresDropTypeInstruction
func (*PostgresCompositeType) Equal ¶ added in v1.2.0
func (t *PostgresCompositeType) Equal(other *PostgresCompositeType) bool
type PostgresCompositeTypeAttribute ¶ added in v1.2.0
type PostgresConstraint ¶ added in v1.2.0
func (*PostgresConstraint) Clause ¶ added in v1.2.0
func (c *PostgresConstraint) Clause() string
func (*PostgresConstraint) IsForeignKey ¶ added in v1.2.0
func (c *PostgresConstraint) IsForeignKey() bool
type PostgresCreateAggregateInstruction ¶ added in v1.2.0
type PostgresCreateAggregateInstruction struct {
Name string
Arguments string
TransitionFunction string
TransitionSpace int64
StateType string
FinalFunction sql.NullString
FinalFunctionExtra bool
FinalFunctionModify string
CombineFunction sql.NullString
SerializeFunction sql.NullString
DeserializeFunction sql.NullString
InitialCondition sql.NullString
MovingTransitionFunction sql.NullString
MovingInverseTransitionFunction sql.NullString
MovingStateType sql.NullString
MovingTransitionSpace int64
MovingFinalFunction sql.NullString
MovingFinalFunctionExtra bool
MovingFinalFunctionModify string
MovingInitialCondition sql.NullString
SortOperator sql.NullString
Parallel string
}
func (*PostgresCreateAggregateInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateAggregateInstruction) Comment() string
func (*PostgresCreateAggregateInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateAggregateInstruction) String() string
type PostgresCreateCompositeTypeInstruction ¶ added in v1.2.0
type PostgresCreateCompositeTypeInstruction struct {
Name string
Attributes []*PostgresCompositeTypeAttribute
}
func (*PostgresCreateCompositeTypeInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateCompositeTypeInstruction) Comment() string
func (*PostgresCreateCompositeTypeInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateCompositeTypeInstruction) String() string
type PostgresCreateDomainInstruction ¶ added in v1.2.0
type PostgresCreateDomainInstruction struct {
Name string
BaseType string
Default sql.NullString
NotNull bool
Constraints []*PostgresDomainConstraint
}
func (*PostgresCreateDomainInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateDomainInstruction) Comment() string
func (*PostgresCreateDomainInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateDomainInstruction) String() string
type PostgresCreateEnumTypeInstruction ¶ added in v1.2.0
func (*PostgresCreateEnumTypeInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateEnumTypeInstruction) Comment() string
func (*PostgresCreateEnumTypeInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateEnumTypeInstruction) String() string
type PostgresCreateExtensionInstruction ¶ added in v1.2.0
type PostgresCreateExtensionInstruction struct {
Name string
}
func (*PostgresCreateExtensionInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateExtensionInstruction) Comment() string
func (*PostgresCreateExtensionInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateExtensionInstruction) String() string
type PostgresCreateFunctionInstruction ¶ added in v1.2.0
type PostgresCreateFunctionInstruction struct {
Definition string
}
func (*PostgresCreateFunctionInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateFunctionInstruction) Comment() string
func (*PostgresCreateFunctionInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateFunctionInstruction) String() string
type PostgresCreateIndexInstruction ¶ added in v1.2.0
type PostgresCreateIndexInstruction struct {
Definition string
}
func (*PostgresCreateIndexInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateIndexInstruction) Comment() string
func (*PostgresCreateIndexInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateIndexInstruction) String() string
type PostgresCreateMaterializedViewInstruction ¶ added in v1.2.0
func (*PostgresCreateMaterializedViewInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateMaterializedViewInstruction) Comment() string
func (*PostgresCreateMaterializedViewInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateMaterializedViewInstruction) String() string
type PostgresCreateOperatorInstruction ¶ added in v1.2.0
type PostgresCreateOperatorInstruction struct {
Name string
Function string
LeftArgument sql.NullString
RightArgument sql.NullString
Commutator sql.NullString
Negator sql.NullString
RestrictFunction sql.NullString
JoinFunction sql.NullString
CanHash bool
CanMerge bool
}
The name of an operator holds punctuation marks only, so it takes no quotes.
func (*PostgresCreateOperatorInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateOperatorInstruction) Comment() string
func (*PostgresCreateOperatorInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateOperatorInstruction) String() string
type PostgresCreateOwnedSequenceInstruction ¶ added in v1.2.0
type PostgresCreateOwnedSequenceInstruction struct {
Name string
TableName string
ColumnName string
}
func (*PostgresCreateOwnedSequenceInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateOwnedSequenceInstruction) Comment() string
func (*PostgresCreateOwnedSequenceInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateOwnedSequenceInstruction) String() string
type PostgresCreatePolicyInstruction ¶ added in v1.2.0
type PostgresCreatePolicyInstruction struct {
Name string
TableName string
Permissive string
Command string
Roles []string
Using string
WithCheck string
}
func (*PostgresCreatePolicyInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreatePolicyInstruction) Comment() string
func (*PostgresCreatePolicyInstruction) String ¶ added in v1.2.0
func (i *PostgresCreatePolicyInstruction) String() string
type PostgresCreateProcedureInstruction ¶ added in v1.2.0
type PostgresCreateProcedureInstruction struct {
Definition string
}
func (*PostgresCreateProcedureInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateProcedureInstruction) Comment() string
func (*PostgresCreateProcedureInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateProcedureInstruction) String() string
type PostgresCreateRuleInstruction ¶ added in v1.2.0
type PostgresCreateRuleInstruction struct {
Definition string
}
The definition of pg_rules ends with a semicolon, so String adds no second one.
func (*PostgresCreateRuleInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateRuleInstruction) Comment() string
func (*PostgresCreateRuleInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateRuleInstruction) String() string
type PostgresCreateSequenceInstruction ¶ added in v1.2.0
type PostgresCreateSequenceInstruction struct {
Name string
DataType string
Increment int64
Min int64
Max int64
Start int64
Cache int64
Cycle bool
}
func (*PostgresCreateSequenceInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateSequenceInstruction) Comment() string
func (*PostgresCreateSequenceInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateSequenceInstruction) String() string
type PostgresCreateStatisticsInstruction ¶ added in v1.2.0
type PostgresCreateStatisticsInstruction struct {
Definition string
}
func (*PostgresCreateStatisticsInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateStatisticsInstruction) Comment() string
func (*PostgresCreateStatisticsInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateStatisticsInstruction) String() string
type PostgresCreateTableInstruction ¶ added in v1.2.0
type PostgresCreateTableInstruction struct {
Name string
Columns []*PostgresColumn
Constraints []*PostgresConstraint
PartitionKey string
Inherits []string
Unlogged bool
StorageParameters []string
}
func (*PostgresCreateTableInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateTableInstruction) Comment() string
func (*PostgresCreateTableInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateTableInstruction) String() string
type PostgresCreateTablePartitionInstruction ¶ added in v1.2.0
func (*PostgresCreateTablePartitionInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateTablePartitionInstruction) Comment() string
func (*PostgresCreateTablePartitionInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateTablePartitionInstruction) String() string
type PostgresCreateTriggerInstruction ¶ added in v1.2.0
type PostgresCreateTriggerInstruction struct {
Definition string
}
func (*PostgresCreateTriggerInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateTriggerInstruction) Comment() string
func (*PostgresCreateTriggerInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateTriggerInstruction) String() string
type PostgresCreateViewInstruction ¶ added in v1.2.0
func (*PostgresCreateViewInstruction) Comment ¶ added in v1.2.0
func (i *PostgresCreateViewInstruction) Comment() string
func (*PostgresCreateViewInstruction) String ¶ added in v1.2.0
func (i *PostgresCreateViewInstruction) String() string
type PostgresDetachPartitionInstruction ¶ added in v1.2.0
func (*PostgresDetachPartitionInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDetachPartitionInstruction) Comment() string
func (*PostgresDetachPartitionInstruction) String ¶ added in v1.2.0
func (i *PostgresDetachPartitionInstruction) String() string
type PostgresDomain ¶ added in v1.2.0
type PostgresDomain struct {
Name string
BaseType string
NotNull bool
Default sql.NullString
Constraints []*PostgresDomainConstraint
}
func (*PostgresDomain) ConstraintByName ¶ added in v1.2.0
func (d *PostgresDomain) ConstraintByName(name string) (*PostgresDomainConstraint, bool)
func (*PostgresDomain) CreateInstruction ¶ added in v1.2.0
func (d *PostgresDomain) CreateInstruction() *PostgresCreateDomainInstruction
func (*PostgresDomain) Diff ¶ added in v1.2.0
func (d *PostgresDomain) Diff(other *PostgresDomain) []Instruction
PostgreSQL changes no base type of a domain, so a new base type needs a recreation.
func (*PostgresDomain) DropInstruction ¶ added in v1.2.0
func (d *PostgresDomain) DropInstruction() *PostgresDropDomainInstruction
type PostgresDomainConstraint ¶ added in v1.2.0
type PostgresDriver ¶ added in v1.2.0
type PostgresDriver struct {
TargetDatabaseConnection *sql.DB
SourceDatabaseConnection *sql.DB
TargetSchema string
SourceSchema string
CompareData bool
ComparePrivileges bool
ScratchVersion embeddedpostgres.PostgresVersion
// contains filtered or unexported fields
}
func NewPostgresDriver ¶ added in v1.2.0
func NewPostgresDriver(ctx context.Context, config *PostgresDriverConfig) (*PostgresDriver, error)
func (*PostgresDriver) Close ¶ added in v1.2.0
func (d *PostgresDriver) Close() error
func (*PostgresDriver) Diff ¶ added in v1.2.0
func (d *PostgresDriver) Diff(ctx context.Context) ([]Instruction, error)
func (*PostgresDriver) DiffAggregates ¶ added in v1.2.0
func (d *PostgresDriver) DiffAggregates(ctx context.Context) (*SectionDiff, error)
func (*PostgresDriver) DiffCompositeTypes ¶ added in v1.2.0
func (d *PostgresDriver) DiffCompositeTypes(ctx context.Context) (*SectionDiff, error)
func (*PostgresDriver) DiffData ¶ added in v1.2.0
func (d *PostgresDriver) DiffData(ctx context.Context) ([]Instruction, error)
The schema section already creates or drops the other tables.
func (*PostgresDriver) DiffDomains ¶ added in v1.2.0
func (d *PostgresDriver) DiffDomains(ctx context.Context) (*SectionDiff, error)
func (*PostgresDriver) DiffExtensions ¶ added in v1.2.0
func (d *PostgresDriver) DiffExtensions(ctx context.Context) (*SectionDiff, error)
func (*PostgresDriver) DiffFunctions ¶ added in v1.2.0
func (d *PostgresDriver) DiffFunctions(ctx context.Context) (*SectionDiff, error)
func (*PostgresDriver) DiffOperators ¶ added in v1.2.0
func (d *PostgresDriver) DiffOperators(ctx context.Context) (*SectionDiff, error)
func (*PostgresDriver) DiffPrivileges ¶ added in v1.2.0
func (d *PostgresDriver) DiffPrivileges(ctx context.Context) (*SectionDiff, error)
func (*PostgresDriver) DiffSequences ¶ added in v1.2.0
func (d *PostgresDriver) DiffSequences(ctx context.Context) (*SectionDiff, error)
func (*PostgresDriver) DiffStatistics ¶ added in v1.2.0
func (d *PostgresDriver) DiffStatistics(ctx context.Context) (*SectionDiff, error)
An extended statistics object names a table, so this section comes after the tables.
func (*PostgresDriver) DiffTableData ¶ added in v1.2.0
func (d *PostgresDriver) DiffTableData(ctx context.Context, targetTable *PostgresTable, sourceTable *PostgresTable) ([]Instruction, []Instruction, error)
func (*PostgresDriver) DiffTables ¶ added in v1.2.0
func (d *PostgresDriver) DiffTables(ctx context.Context) (*SectionDiff, error)
func (*PostgresDriver) DiffTypes ¶ added in v1.2.0
func (d *PostgresDriver) DiffTypes(ctx context.Context) (*SectionDiff, error)
func (*PostgresDriver) DiffViewsAndMaterializedViews ¶ added in v1.2.0
func (d *PostgresDriver) DiffViewsAndMaterializedViews(ctx context.Context) (*SectionDiff, error)
A view can read a materialized view, and a materialized view can read a view, so the two kinds share one section and one dependency order.
func (*PostgresDriver) GetAggregates ¶ added in v1.2.0
func (d *PostgresDriver) GetAggregates(ctx context.Context, db *sql.DB) ([]*PostgresAggregate, error)
func (*PostgresDriver) GetCompositeTypes ¶ added in v1.2.0
func (d *PostgresDriver) GetCompositeTypes(ctx context.Context, db *sql.DB) ([]*PostgresCompositeType, error)
func (*PostgresDriver) GetDomains ¶ added in v1.2.0
func (d *PostgresDriver) GetDomains(ctx context.Context, db *sql.DB) ([]*PostgresDomain, error)
func (*PostgresDriver) GetExtensions ¶ added in v1.2.0
func (d *PostgresDriver) GetExtensions(ctx context.Context, db *sql.DB) ([]*PostgresExtension, error)
func (*PostgresDriver) GetFunctions ¶ added in v1.2.0
func (d *PostgresDriver) GetFunctions(ctx context.Context, db *sql.DB) ([]*PostgresFunction, error)
func (*PostgresDriver) GetMaterializedViewIndexes ¶ added in v1.2.0
func (d *PostgresDriver) GetMaterializedViewIndexes(ctx context.Context, db *sql.DB, viewName string) ([]*PostgresIndex, error)
func (*PostgresDriver) GetMaterializedViews ¶ added in v1.2.0
func (d *PostgresDriver) GetMaterializedViews(ctx context.Context, db *sql.DB) ([]*PostgresMaterializedView, error)
func (*PostgresDriver) GetOperators ¶ added in v1.2.0
func (d *PostgresDriver) GetOperators(ctx context.Context, db *sql.DB) ([]*PostgresOperator, error)
func (*PostgresDriver) GetOwners ¶ added in v1.2.0
func (d *PostgresDriver) GetOwners(ctx context.Context, db *sql.DB) ([]*PostgresOwner, error)
func (*PostgresDriver) GetPrivileges ¶ added in v1.2.0
func (d *PostgresDriver) GetPrivileges(ctx context.Context, db *sql.DB) ([]*PostgresPrivilege, error)
PostgreSQL gives the privileges of the owner with the object.
func (*PostgresDriver) GetSequences ¶ added in v1.2.0
func (d *PostgresDriver) GetSequences(ctx context.Context, db *sql.DB) ([]*PostgresSequence, error)
func (*PostgresDriver) GetStatistics ¶ added in v1.2.0
func (d *PostgresDriver) GetStatistics(ctx context.Context, db *sql.DB) ([]*PostgresStatistics, error)
func (*PostgresDriver) GetTable ¶ added in v1.2.0
func (d *PostgresDriver) GetTable(ctx context.Context, db *sql.DB, tableName string) (*PostgresTable, error)
func (*PostgresDriver) GetTableData ¶ added in v1.2.0
func (d *PostgresDriver) GetTableData(ctx context.Context, db *sql.DB, tableName string, columnNames []string, primaryKeyColumnNames []string) (*PostgresTableData, error)
PostgreSQL gives no stable order, so the ORDER BY clause keeps the output equal between two runs.
func (*PostgresDriver) GetTablePolicies ¶ added in v1.2.0
func (d *PostgresDriver) GetTablePolicies(ctx context.Context, db *sql.DB, tableName string) ([]*PostgresPolicy, error)
func (*PostgresDriver) GetTablePrimaryKey ¶ added in v1.2.0
func (*PostgresDriver) GetTableRules ¶ added in v1.2.0
func (d *PostgresDriver) GetTableRules(ctx context.Context, db *sql.DB, tableName string) ([]*PostgresRule, error)
pg_rules reports no _RETURN rule, which is the implicit rule of a view.
func (*PostgresDriver) GetTables ¶ added in v1.2.0
func (d *PostgresDriver) GetTables(ctx context.Context, db *sql.DB) ([]*PostgresTable, error)
information_schema reports no partition key, no partition bound, and no replica identity, so the query reads pg_class.
pg_inherits names the parent of a partition and the parent of a table of INHERITS, so relispartition separates the two. Without that test a table of INHERITS takes the statement of a partition, and that statement holds no bound.
func (*PostgresDriver) GetTypes ¶ added in v1.2.0
func (d *PostgresDriver) GetTypes(ctx context.Context, db *sql.DB) ([]*PostgresType, error)
func (*PostgresDriver) GetViewColumns ¶ added in v1.2.0
func (d *PostgresDriver) GetViewColumns(ctx context.Context, db *sql.DB, viewName string) ([]*PostgresViewColumn, error)
The type of each column comes with it, because a type change makes the view invalid.
func (*PostgresDriver) GetViews ¶ added in v1.2.0
func (d *PostgresDriver) GetViews(ctx context.Context, db *sql.DB) ([]*PostgresView, error)
func (*PostgresDriver) HasAutomaticCast ¶ added in v1.2.0
func (d *PostgresDriver) HasAutomaticCast(ctx context.Context, db *sql.DB, oldType string, newType string) (bool, error)
The rules of pg_cast are long, so this function asks the database. ALTER TABLE ALTER COLUMN TYPE uses the assignment context. An unknown type name gives true, and the output then keeps the form that it had before this rule.
func (*PostgresDriver) ScratchServer ¶ added in v1.2.0
func (d *PostgresDriver) ScratchServer() (*PostgresScratchServer, error)
func (*PostgresDriver) StopScratchServer ¶ added in v1.2.0
func (d *PostgresDriver) StopScratchServer() error
func (*PostgresDriver) TableDataInstructions ¶ added in v1.2.0
func (d *PostgresDriver) TableDataInstructions(ctx context.Context, targetTable *PostgresTable) ([]Instruction, error)
The schema section creates this table with no row, so every target row becomes an INSERT statement.
func (*PostgresDriver) VerifySchema ¶ added in v1.2.0
func (d *PostgresDriver) VerifySchema(ctx context.Context, db *sql.DB, schema string, role string) error
PostgreSQL accepts a search path that names no schema, and each query then reads an empty schema. Without this check the diff drops every object of the source.
type PostgresDriverConfig ¶ added in v1.2.0
type PostgresDropAggregateInstruction ¶ added in v1.2.0
func (*PostgresDropAggregateInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropAggregateInstruction) Comment() string
func (*PostgresDropAggregateInstruction) String ¶ added in v1.2.0
func (i *PostgresDropAggregateInstruction) String() string
type PostgresDropConstraintAction ¶ added in v1.2.0
type PostgresDropConstraintAction struct {
ConstraintName string
}
func (*PostgresDropConstraintAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresDropConstraintAction) TableActionClause() string
type PostgresDropDefaultAction ¶ added in v1.2.0
type PostgresDropDefaultAction struct {
ColumnName string
}
func (*PostgresDropDefaultAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresDropDefaultAction) TableActionClause() string
type PostgresDropDomainConstraintAction ¶ added in v1.2.0
type PostgresDropDomainConstraintAction struct {
ConstraintName string
}
func (*PostgresDropDomainConstraintAction) DomainActionClause ¶ added in v1.2.0
func (a *PostgresDropDomainConstraintAction) DomainActionClause() string
type PostgresDropDomainDefaultAction ¶ added in v1.2.0
type PostgresDropDomainDefaultAction struct{}
func (*PostgresDropDomainDefaultAction) DomainActionClause ¶ added in v1.2.0
func (a *PostgresDropDomainDefaultAction) DomainActionClause() string
type PostgresDropDomainInstruction ¶ added in v1.2.0
type PostgresDropDomainInstruction struct {
Name string
}
func (*PostgresDropDomainInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropDomainInstruction) Comment() string
func (*PostgresDropDomainInstruction) String ¶ added in v1.2.0
func (i *PostgresDropDomainInstruction) String() string
type PostgresDropDomainNotNullAction ¶ added in v1.2.0
type PostgresDropDomainNotNullAction struct{}
func (*PostgresDropDomainNotNullAction) DomainActionClause ¶ added in v1.2.0
func (a *PostgresDropDomainNotNullAction) DomainActionClause() string
type PostgresDropExtensionInstruction ¶ added in v1.2.0
type PostgresDropExtensionInstruction struct {
Name string
}
func (*PostgresDropExtensionInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropExtensionInstruction) Comment() string
func (*PostgresDropExtensionInstruction) String ¶ added in v1.2.0
func (i *PostgresDropExtensionInstruction) String() string
type PostgresDropFunctionInstruction ¶ added in v1.2.0
func (*PostgresDropFunctionInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropFunctionInstruction) Comment() string
func (*PostgresDropFunctionInstruction) String ¶ added in v1.2.0
func (i *PostgresDropFunctionInstruction) String() string
type PostgresDropIdentityAction ¶ added in v1.2.0
type PostgresDropIdentityAction struct {
ColumnName string
}
func (*PostgresDropIdentityAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresDropIdentityAction) TableActionClause() string
type PostgresDropMaterializedViewInstruction ¶ added in v1.2.0
type PostgresDropMaterializedViewInstruction struct {
Name string
}
func (*PostgresDropMaterializedViewInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropMaterializedViewInstruction) Comment() string
func (*PostgresDropMaterializedViewInstruction) String ¶ added in v1.2.0
func (i *PostgresDropMaterializedViewInstruction) String() string
type PostgresDropNotNullAction ¶ added in v1.2.0
type PostgresDropNotNullAction struct {
ColumnName string
}
func (*PostgresDropNotNullAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresDropNotNullAction) TableActionClause() string
type PostgresDropOperatorInstruction ¶ added in v1.2.0
type PostgresDropOperatorInstruction struct {
Name string
LeftArgument sql.NullString
RightArgument sql.NullString
}
func (*PostgresDropOperatorInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropOperatorInstruction) Comment() string
func (*PostgresDropOperatorInstruction) String ¶ added in v1.2.0
func (i *PostgresDropOperatorInstruction) String() string
type PostgresDropPolicyInstruction ¶ added in v1.2.0
func (*PostgresDropPolicyInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropPolicyInstruction) Comment() string
func (*PostgresDropPolicyInstruction) String ¶ added in v1.2.0
func (i *PostgresDropPolicyInstruction) String() string
type PostgresDropProcedureInstruction ¶ added in v1.2.0
func (*PostgresDropProcedureInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropProcedureInstruction) Comment() string
func (*PostgresDropProcedureInstruction) String ¶ added in v1.2.0
func (i *PostgresDropProcedureInstruction) String() string
type PostgresDropRuleInstruction ¶ added in v1.2.0
func (*PostgresDropRuleInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropRuleInstruction) Comment() string
func (*PostgresDropRuleInstruction) String ¶ added in v1.2.0
func (i *PostgresDropRuleInstruction) String() string
type PostgresDropSequenceInstruction ¶ added in v1.2.0
type PostgresDropSequenceInstruction struct {
Name string
}
func (*PostgresDropSequenceInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropSequenceInstruction) Comment() string
func (*PostgresDropSequenceInstruction) String ¶ added in v1.2.0
func (i *PostgresDropSequenceInstruction) String() string
type PostgresDropStatisticsInstruction ¶ added in v1.2.0
type PostgresDropStatisticsInstruction struct {
Name string
}
func (*PostgresDropStatisticsInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropStatisticsInstruction) Comment() string
func (*PostgresDropStatisticsInstruction) String ¶ added in v1.2.0
func (i *PostgresDropStatisticsInstruction) String() string
type PostgresDropTriggerInstruction ¶ added in v1.2.0
func (*PostgresDropTriggerInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropTriggerInstruction) Comment() string
func (*PostgresDropTriggerInstruction) String ¶ added in v1.2.0
func (i *PostgresDropTriggerInstruction) String() string
type PostgresDropTypeInstruction ¶ added in v1.2.0
type PostgresDropTypeInstruction struct {
Name string
}
func (*PostgresDropTypeInstruction) Comment ¶ added in v1.2.0
func (i *PostgresDropTypeInstruction) Comment() string
func (*PostgresDropTypeInstruction) String ¶ added in v1.2.0
func (i *PostgresDropTypeInstruction) String() string
type PostgresExtension ¶ added in v1.2.0
func (*PostgresExtension) CreateInstruction ¶ added in v1.2.0
func (e *PostgresExtension) CreateInstruction() *PostgresCreateExtensionInstruction
func (*PostgresExtension) DropInstruction ¶ added in v1.2.0
func (e *PostgresExtension) DropInstruction() *PostgresDropExtensionInstruction
func (*PostgresExtension) UpdateInstruction ¶ added in v1.2.0
func (e *PostgresExtension) UpdateInstruction() *PostgresAlterExtensionInstruction
type PostgresFunction ¶ added in v1.2.0
type PostgresFunction struct {
Name string
Arguments string
ArgumentTypes string
ReturnType string
Kind string
Def string
Comment string
}
func (*PostgresFunction) CommentInstruction ¶ added in v1.2.0
func (f *PostgresFunction) CommentInstruction() *PostgresCommentOnRoutineInstruction
func (*PostgresFunction) CreateInstruction ¶ added in v1.2.0
func (f *PostgresFunction) CreateInstruction() Instruction
func (*PostgresFunction) DropInstruction ¶ added in v1.2.0
func (f *PostgresFunction) DropInstruction() Instruction
func (*PostgresFunction) MatchKey ¶ added in v1.2.0
func (f *PostgresFunction) MatchKey() string
func (*PostgresFunction) Signature ¶ added in v1.2.0
func (f *PostgresFunction) Signature() string
type PostgresGrantInstruction ¶ added in v1.2.0
type PostgresGrantInstruction struct {
Privileges []string
ObjectType string
ObjectName string
Grantee string
}
func (*PostgresGrantInstruction) Comment ¶ added in v1.2.0
func (i *PostgresGrantInstruction) Comment() string
func (*PostgresGrantInstruction) String ¶ added in v1.2.0
func (i *PostgresGrantInstruction) String() string
type PostgresIndex ¶ added in v1.2.0
func (*PostgresIndex) CreateInstruction ¶ added in v1.2.0
func (i *PostgresIndex) CreateInstruction() *PostgresCreateIndexInstruction
func (*PostgresIndex) Instructions ¶ added in v1.2.0
func (i *PostgresIndex) Instructions() []Instruction
CREATE INDEX accepts no comment, so the comment takes its own statement.
type PostgresInheritAction ¶ added in v1.2.0
type PostgresInheritAction struct {
ParentName string
}
func (*PostgresInheritAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresInheritAction) TableActionClause() string
type PostgresInsertOverridingInstruction ¶ added in v1.2.0
type PostgresInsertOverridingInstruction struct {
TableName string
ColumnNames []string
Expressions []string
}
func (*PostgresInsertOverridingInstruction) Comment ¶ added in v1.2.0
func (i *PostgresInsertOverridingInstruction) Comment() string
func (*PostgresInsertOverridingInstruction) String ¶ added in v1.2.0
func (i *PostgresInsertOverridingInstruction) String() string
type PostgresMaterializedView ¶ added in v1.2.0
type PostgresMaterializedView struct {
Name string
Def string
Columns []*PostgresViewColumn
Indexes []*PostgresIndex
Comment string
}
A materialized view reads a table, a view, or a second materialized view, so the diff keeps the order of the dependency.
func (*PostgresMaterializedView) CreateInstruction ¶ added in v1.2.0
func (v *PostgresMaterializedView) CreateInstruction() *PostgresCreateMaterializedViewInstruction
func (*PostgresMaterializedView) DropInstruction ¶ added in v1.2.0
func (v *PostgresMaterializedView) DropInstruction() *PostgresDropMaterializedViewInstruction
func (*PostgresMaterializedView) HasEqualColumns ¶ added in v1.2.0
func (v *PostgresMaterializedView) HasEqualColumns(other *PostgresMaterializedView) bool
func (*PostgresMaterializedView) IndexByName ¶ added in v1.2.0
func (v *PostgresMaterializedView) IndexByName(name string) (*PostgresIndex, bool)
func (*PostgresMaterializedView) Instructions ¶ added in v1.2.0
func (v *PostgresMaterializedView) Instructions() []Instruction
type PostgresNoInheritAction ¶ added in v1.2.0
type PostgresNoInheritAction struct {
ParentName string
}
func (*PostgresNoInheritAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresNoInheritAction) TableActionClause() string
type PostgresOperator ¶ added in v1.2.0
type PostgresOperator struct {
Name string
LeftArgument sql.NullString
RightArgument sql.NullString
Function string
Commutator sql.NullString
Negator sql.NullString
RestrictFunction sql.NullString
JoinFunction sql.NullString
CanHash bool
CanMerge bool
}
func (*PostgresOperator) CreateInstruction ¶ added in v1.2.0
func (o *PostgresOperator) CreateInstruction() *PostgresCreateOperatorInstruction
func (*PostgresOperator) Diff ¶ added in v1.2.0
func (o *PostgresOperator) Diff(other *PostgresOperator) []Instruction
PostgreSQL changes the owner and the support options of an operator only, so a new function needs a recreation.
func (*PostgresOperator) DropInstruction ¶ added in v1.2.0
func (o *PostgresOperator) DropInstruction() *PostgresDropOperatorInstruction
func (*PostgresOperator) Equal ¶ added in v1.2.0
func (o *PostgresOperator) Equal(other *PostgresOperator) bool
func (*PostgresOperator) Signature ¶ added in v1.2.0
func (o *PostgresOperator) Signature() string
type PostgresOwner ¶ added in v1.2.0
func (*PostgresOwner) SetInstruction ¶ added in v1.2.0
func (o *PostgresOwner) SetInstruction() *PostgresSetOwnerInstruction
type PostgresPolicy ¶ added in v1.2.0
type PostgresPolicy struct {
Name string
Table string
Permissive string
Command string
Roles []string
Using string
WithCheck string
}
PostgreSQL holds no action that changes a policy, so the diff prints a DROP statement and a CREATE statement.
func (*PostgresPolicy) CreateInstruction ¶ added in v1.2.0
func (p *PostgresPolicy) CreateInstruction() *PostgresCreatePolicyInstruction
func (*PostgresPolicy) DropInstruction ¶ added in v1.2.0
func (p *PostgresPolicy) DropInstruction() *PostgresDropPolicyInstruction
func (*PostgresPolicy) Equal ¶ added in v1.2.0
func (p *PostgresPolicy) Equal(other *PostgresPolicy) bool
type PostgresPrivilege ¶ added in v1.2.0
type PostgresPrivilege struct {
ObjectType string
ObjectName string
Grantee string
Privileges []string
}
A role belongs to the server and not to the schema. A source server holds other role names in most cases, and a GRANT statement of an absent role fails.
func (*PostgresPrivilege) GrantInstruction ¶ added in v1.2.0
func (p *PostgresPrivilege) GrantInstruction(privileges []string) *PostgresGrantInstruction
func (*PostgresPrivilege) Key ¶ added in v1.2.0
func (p *PostgresPrivilege) Key() string
func (*PostgresPrivilege) RevokeInstruction ¶ added in v1.2.0
func (p *PostgresPrivilege) RevokeInstruction(privileges []string) *PostgresRevokeInstruction
type PostgresRelation ¶ added in v1.2.0
type PostgresRelation struct {
View *PostgresView
MaterializedView *PostgresMaterializedView
}
A view can read a materialized view, and a materialized view can read a view, so one section order per kind cannot hold the dependency. A relation joins the two kinds into one dependency order.
func (*PostgresRelation) Columns ¶ added in v1.2.0
func (r *PostgresRelation) Columns() []*PostgresViewColumn
func (*PostgresRelation) Name ¶ added in v1.2.0
func (r *PostgresRelation) Name() string
type PostgresReplicaIdentityAction ¶ added in v1.2.0
func (*PostgresReplicaIdentityAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresReplicaIdentityAction) TableActionClause() string
type PostgresResetStorageParametersAction ¶ added in v1.2.0
type PostgresResetStorageParametersAction struct {
Names []string
}
func (*PostgresResetStorageParametersAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresResetStorageParametersAction) TableActionClause() string
type PostgresRevokeInstruction ¶ added in v1.2.0
type PostgresRevokeInstruction struct {
Privileges []string
ObjectType string
ObjectName string
Grantee string
}
func (*PostgresRevokeInstruction) Comment ¶ added in v1.2.0
func (i *PostgresRevokeInstruction) Comment() string
func (*PostgresRevokeInstruction) String ¶ added in v1.2.0
func (i *PostgresRevokeInstruction) String() string
type PostgresRowLevelSecurityAction ¶ added in v1.2.0
type PostgresRowLevelSecurityAction struct {
Mode string
}
func (*PostgresRowLevelSecurityAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresRowLevelSecurityAction) TableActionClause() string
type PostgresRule ¶ added in v1.2.0
PostgreSQL holds no action that changes a rule, so a new definition prints a DROP statement and a CREATE statement.
func (*PostgresRule) CreateInstruction ¶ added in v1.2.0
func (r *PostgresRule) CreateInstruction() *PostgresCreateRuleInstruction
func (*PostgresRule) DropInstruction ¶ added in v1.2.0
func (r *PostgresRule) DropInstruction() *PostgresDropRuleInstruction
type PostgresScratchServer ¶ added in v1.2.0
type PostgresScratchServer struct {
// contains filtered or unexported fields
}
func StartPostgresScratchServer ¶ added in v1.2.0
func StartPostgresScratchServer(version embeddedpostgres.PostgresVersion) (*PostgresScratchServer, error)
func (*PostgresScratchServer) ConnectionString ¶ added in v1.2.0
func (s *PostgresScratchServer) ConnectionString(database string) string
func (*PostgresScratchServer) CreateDatabase ¶ added in v1.2.0
func (*PostgresScratchServer) Stop ¶ added in v1.2.0
func (s *PostgresScratchServer) Stop() error
type PostgresSequence ¶ added in v1.2.0
type PostgresSequence struct {
Name string
DataType string
Start int64
Min int64
Max int64
Increment int64
Cache int64
Cycle bool
CurrentValue sql.NullInt64
}
func (*PostgresSequence) CreateInstruction ¶ added in v1.2.0
func (s *PostgresSequence) CreateInstruction() *PostgresCreateSequenceInstruction
func (*PostgresSequence) Diff ¶ added in v1.2.0
func (s *PostgresSequence) Diff(other *PostgresSequence) []Instruction
Separate statements can fail, because a new minimum above the current value is invalid. A restart changes data, so the RESTART WITH clause comes only when the current value falls outside the new range.
func (*PostgresSequence) RestartValue ¶ added in v1.2.0
func (s *PostgresSequence) RestartValue() int64
type PostgresSetDefaultAction ¶ added in v1.2.0
func (*PostgresSetDefaultAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresSetDefaultAction) TableActionClause() string
type PostgresSetDomainDefaultAction ¶ added in v1.2.0
type PostgresSetDomainDefaultAction struct {
Expression string
}
func (*PostgresSetDomainDefaultAction) DomainActionClause ¶ added in v1.2.0
func (a *PostgresSetDomainDefaultAction) DomainActionClause() string
type PostgresSetDomainNotNullAction ¶ added in v1.2.0
type PostgresSetDomainNotNullAction struct{}
func (*PostgresSetDomainNotNullAction) DomainActionClause ¶ added in v1.2.0
func (a *PostgresSetDomainNotNullAction) DomainActionClause() string
type PostgresSetIdentityAction ¶ added in v1.2.0
func (*PostgresSetIdentityAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresSetIdentityAction) TableActionClause() string
type PostgresSetIdentityOptionsAction ¶ added in v1.2.0
func (*PostgresSetIdentityOptionsAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresSetIdentityOptionsAction) TableActionClause() string
PostgreSQL takes one SET for each sequence option of the identity.
type PostgresSetNotNullAction ¶ added in v1.2.0
type PostgresSetNotNullAction struct {
ColumnName string
}
func (*PostgresSetNotNullAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresSetNotNullAction) TableActionClause() string
type PostgresSetOwnerInstruction ¶ added in v1.2.0
func (*PostgresSetOwnerInstruction) Comment ¶ added in v1.2.0
func (i *PostgresSetOwnerInstruction) Comment() string
func (*PostgresSetOwnerInstruction) String ¶ added in v1.2.0
func (i *PostgresSetOwnerInstruction) String() string
type PostgresSetPersistenceAction ¶ added in v1.2.0
type PostgresSetPersistenceAction struct {
Persistence string
}
func (*PostgresSetPersistenceAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresSetPersistenceAction) TableActionClause() string
type PostgresSetStatisticsAction ¶ added in v1.2.0
func (*PostgresSetStatisticsAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresSetStatisticsAction) TableActionClause() string
type PostgresSetStorageAction ¶ added in v1.2.0
func (*PostgresSetStorageAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresSetStorageAction) TableActionClause() string
type PostgresSetStorageParametersAction ¶ added in v1.2.0
type PostgresSetStorageParametersAction struct {
Parameters []string
}
func (*PostgresSetStorageParametersAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresSetStorageParametersAction) TableActionClause() string
type PostgresStatistics ¶ added in v1.2.0
type PostgresStatistics struct {
Name string
// Def holds the text of pg_get_statisticsobjdef, with no semicolon.
Def string
}
PostgreSQL holds no action that changes the columns of such an object, so a new definition prints a DROP statement and a CREATE statement.
func (*PostgresStatistics) CreateInstruction ¶ added in v1.2.0
func (s *PostgresStatistics) CreateInstruction() *PostgresCreateStatisticsInstruction
func (*PostgresStatistics) DropInstruction ¶ added in v1.2.0
func (s *PostgresStatistics) DropInstruction() *PostgresDropStatisticsInstruction
type PostgresTable ¶ added in v1.2.0
type PostgresTable struct {
Name string
Columns []*PostgresColumn
Indexes []*PostgresIndex
Constraints []*PostgresConstraint
Triggers []*PostgresTrigger
Rules []*PostgresRule
PartitionKey string
PartitionParent string
PartitionBound string
// A table of INHERITS is no partition, so it keeps its own columns and its own statement.
Inherits []string
References []string
Comment string
Unlogged bool
StorageParameters []string
ReplicaIdentity string
ReplicaIdentityIndex string
RowLevelSecurity bool
ForceRowLevelSecurity bool
Policies []*PostgresPolicy
}
func (*PostgresTable) ColumnByName ¶ added in v1.2.0
func (t *PostgresTable) ColumnByName(name string) (*PostgresColumn, bool)
func (*PostgresTable) CommentInstructions ¶ added in v1.2.0
func (t *PostgresTable) CommentInstructions() []Instruction
PostgreSQL accepts a comment in no CREATE statement.
func (*PostgresTable) ConstraintByName ¶ added in v1.2.0
func (t *PostgresTable) ConstraintByName(name string) (*PostgresConstraint, bool)
func (*PostgresTable) CreateTableInstruction ¶ added in v1.2.0
func (t *PostgresTable) CreateTableInstruction() *PostgresCreateTableInstruction
func (*PostgresTable) DiffRules ¶ added in v1.2.0
func (t *PostgresTable) DiffRules(other *PostgresTable) []Instruction
func (*PostgresTable) DiffTable ¶ added in v1.2.0
func (t *PostgresTable) DiffTable(other *PostgresTable, hasAutomaticCast AutomaticCastLookup) ([]Instruction, error)
func (*PostgresTable) ForeignKeyInstructions ¶ added in v1.2.0
func (t *PostgresTable) ForeignKeyInstructions() []Instruction
A partition takes the foreign keys of its parent, so a second statement of one fails.
func (*PostgresTable) IndexByName ¶ added in v1.2.0
func (t *PostgresTable) IndexByName(name string) (*PostgresIndex, bool)
func (*PostgresTable) Instructions ¶ added in v1.2.0
func (t *PostgresTable) Instructions() []Instruction
The action of a rule can name a second table, so DiffTables prints the rules apart.
func (*PostgresTable) IsPartition ¶ added in v1.2.0
func (t *PostgresTable) IsPartition() bool
func (*PostgresTable) PolicyByName ¶ added in v1.2.0
func (t *PostgresTable) PolicyByName(name string) (*PostgresPolicy, bool)
func (*PostgresTable) ReplicaIdentityInstructions ¶ added in v1.2.0
func (t *PostgresTable) ReplicaIdentityInstructions() []Instruction
PostgreSQL accepts no replica identity in a CREATE TABLE statement. The mode DEFAULT needs no statement, because every new table holds that mode.
func (*PostgresTable) RowLevelSecurityInstructions ¶ added in v1.2.0
func (t *PostgresTable) RowLevelSecurityInstructions() []Instruction
PostgreSQL accepts no row level security option in a CREATE TABLE statement.
func (*PostgresTable) RuleByName ¶ added in v1.2.0
func (t *PostgresTable) RuleByName(name string) (*PostgresRule, bool)
func (*PostgresTable) RuleInstructions ¶ added in v1.2.0
func (t *PostgresTable) RuleInstructions() []Instruction
func (*PostgresTable) TriggerByName ¶ added in v1.2.0
func (t *PostgresTable) TriggerByName(name string) (*PostgresTrigger, bool)
type PostgresTableData ¶ added in v1.2.0
type PostgresTrigger ¶ added in v1.2.0
func (*PostgresTrigger) CreateInstruction ¶ added in v1.2.0
func (t *PostgresTrigger) CreateInstruction() *PostgresCreateTriggerInstruction
func (*PostgresTrigger) EnableInstructions ¶ added in v1.2.0
func (t *PostgresTrigger) EnableInstructions(tableName string) []Instruction
A CREATE TRIGGER statement accepts no mode, and PostgreSQL builds every trigger with ENABLE, so that mode needs no statement.
type PostgresTriggerEnableAction ¶ added in v1.2.0
func (*PostgresTriggerEnableAction) TableActionClause ¶ added in v1.2.0
func (a *PostgresTriggerEnableAction) TableActionClause() string
type PostgresType ¶ added in v1.2.0
func (*PostgresType) CreateInstruction ¶ added in v1.2.0
func (t *PostgresType) CreateInstruction() *PostgresCreateEnumTypeInstruction
func (*PostgresType) Diff ¶ added in v1.2.0
func (t *PostgresType) Diff(other *PostgresType) []Instruction
PostgreSQL adds a value to an enum, but it removes none and it moves none.
func (*PostgresType) Instructions ¶ added in v1.2.0
func (t *PostgresType) Instructions() []Instruction
CREATE TYPE accepts no comment, so the comment takes its own statement.
func (*PostgresType) StartsWith ¶ added in v1.2.0
func (t *PostgresType) StartsWith(other *PostgresType) bool
type PostgresView ¶ added in v1.2.0
type PostgresView struct {
Name string
Def string
Columns []*PostgresViewColumn
// The query text of the view holds no check option, so the diff compares this field too.
CheckOption string
Comment string
}
func (*PostgresView) CreateInstruction ¶ added in v1.2.0
func (v *PostgresView) CreateInstruction() *PostgresCreateViewInstruction
func (*PostgresView) HasEqualColumns ¶ added in v1.2.0
func (v *PostgresView) HasEqualColumns(other *PostgresView) bool
func (*PostgresView) Instructions ¶ added in v1.2.0
func (v *PostgresView) Instructions() []Instruction
CREATE VIEW accepts no comment, so the comment takes its own statement.
type PostgresViewColumn ¶ added in v1.2.0
A type change of a column keeps the definition text of the view equal, so the diff compares the columns too.
type SQLCommentInstruction ¶ added in v1.2.0
type SQLCommentInstruction struct {
Text string
}
func (*SQLCommentInstruction) Comment ¶ added in v1.2.0
func (i *SQLCommentInstruction) Comment() string
A comment of the output takes no comment of its own.
func (*SQLCommentInstruction) String ¶ added in v1.2.0
func (i *SQLCommentInstruction) String() string
type SQLConjunctionCondition ¶ added in v1.2.0
type SQLConjunctionCondition struct {
Conditions []Condition
}
func (*SQLConjunctionCondition) ConditionClause ¶ added in v1.2.0
func (c *SQLConjunctionCondition) ConditionClause() string
type SQLDeleteInstruction ¶ added in v1.2.0
func (*SQLDeleteInstruction) Comment ¶ added in v1.2.0
func (i *SQLDeleteInstruction) Comment() string
func (*SQLDeleteInstruction) String ¶ added in v1.2.0
func (i *SQLDeleteInstruction) String() string
type SQLDropColumnAction ¶ added in v1.2.0
type SQLDropColumnAction struct {
ColumnName string
}
func (*SQLDropColumnAction) TableActionClause ¶ added in v1.2.0
func (a *SQLDropColumnAction) TableActionClause() string
type SQLDropIndexInstruction ¶ added in v1.2.0
type SQLDropIndexInstruction struct {
Name string
}
func (*SQLDropIndexInstruction) Comment ¶ added in v1.2.0
func (i *SQLDropIndexInstruction) Comment() string
func (*SQLDropIndexInstruction) String ¶ added in v1.2.0
func (i *SQLDropIndexInstruction) String() string
type SQLDropTableInstruction ¶ added in v1.2.0
type SQLDropTableInstruction struct {
Name string
}
func (*SQLDropTableInstruction) Comment ¶ added in v1.2.0
func (i *SQLDropTableInstruction) Comment() string
func (*SQLDropTableInstruction) String ¶ added in v1.2.0
func (i *SQLDropTableInstruction) String() string
type SQLDropViewInstruction ¶ added in v1.2.0
type SQLDropViewInstruction struct {
Name string
}
func (*SQLDropViewInstruction) Comment ¶ added in v1.2.0
func (i *SQLDropViewInstruction) Comment() string
func (*SQLDropViewInstruction) String ¶ added in v1.2.0
func (i *SQLDropViewInstruction) String() string
type SQLEqualityCondition ¶ added in v1.2.0
func (*SQLEqualityCondition) ConditionClause ¶ added in v1.2.0
func (c *SQLEqualityCondition) ConditionClause() string
type SQLInsertInstruction ¶ added in v1.2.0
func (*SQLInsertInstruction) Comment ¶ added in v1.2.0
func (i *SQLInsertInstruction) Comment() string
func (*SQLInsertInstruction) String ¶ added in v1.2.0
func (i *SQLInsertInstruction) String() string
type SQLInsertSelectInstruction ¶ added in v1.2.0
type SQLInsertSelectInstruction struct {
TableName string
ColumnNames []string
SelectExpressions []string
SourceTableName string
}
func (*SQLInsertSelectInstruction) Comment ¶ added in v1.2.0
func (i *SQLInsertSelectInstruction) Comment() string
func (*SQLInsertSelectInstruction) String ¶ added in v1.2.0
func (i *SQLInsertSelectInstruction) String() string
type SQLIsNullCondition ¶ added in v1.2.0
type SQLIsNullCondition struct {
ColumnName string
}
func (*SQLIsNullCondition) ConditionClause ¶ added in v1.2.0
func (c *SQLIsNullCondition) ConditionClause() string
type SQLRenameColumnAction ¶ added in v1.2.0
func (*SQLRenameColumnAction) TableActionClause ¶ added in v1.2.0
func (a *SQLRenameColumnAction) TableActionClause() string
type SQLRenameTableAction ¶ added in v1.2.0
type SQLRenameTableAction struct {
NewName string
}
func (*SQLRenameTableAction) TableActionClause ¶ added in v1.2.0
func (a *SQLRenameTableAction) TableActionClause() string
type SQLSetClause ¶ added in v1.2.0
func (*SQLSetClause) Clause ¶ added in v1.2.0
func (c *SQLSetClause) Clause() string
type SQLSource ¶ added in v1.2.0
func NewSQLSource ¶ added in v1.2.0
type SQLUpdateInstruction ¶ added in v1.2.0
type SQLUpdateInstruction struct {
TableName string
SetClauses []*SQLSetClause
Condition Condition
}
func (*SQLUpdateInstruction) Comment ¶ added in v1.2.0
func (i *SQLUpdateInstruction) Comment() string
func (*SQLUpdateInstruction) String ¶ added in v1.2.0
func (i *SQLUpdateInstruction) String() string
type SQLiteAddColumnAction ¶ added in v1.2.0
type SQLiteAddColumnAction struct {
Column *SQLiteColumn
}
func (*SQLiteAddColumnAction) TableActionClause ¶ added in v1.2.0
func (a *SQLiteAddColumnAction) TableActionClause() string
type SQLiteAlterTableInstruction ¶ added in v1.2.0
type SQLiteAlterTableInstruction struct {
Name string
Action AlterTableAction
}
func (*SQLiteAlterTableInstruction) Comment ¶ added in v1.2.0
func (i *SQLiteAlterTableInstruction) Comment() string
func (*SQLiteAlterTableInstruction) String ¶ added in v1.2.0
func (i *SQLiteAlterTableInstruction) String() string
type SQLiteCheckConstraint ¶ added in v1.2.0
No PRAGMA reports a check, so parseTableDefinition reads it from the CREATE TABLE.
func (*SQLiteCheckConstraint) Clause ¶ added in v1.2.0
func (c *SQLiteCheckConstraint) Clause() string
func (*SQLiteCheckConstraint) Equal ¶ added in v1.2.0
func (c *SQLiteCheckConstraint) Equal(other *SQLiteCheckConstraint) bool
type SQLiteColumn ¶
type SQLiteColumn struct {
Name string
Type string
NotNull bool
PrimaryKey bool
Unique bool
Default sql.NullString
// The value holds the enclosing parentheses.
GeneratedExpression string
GeneratedStored bool
AutoIncrement bool
Collation string
Check string
PrimaryKeyConflict string
UniqueConflict string
NotNullConflict string
// ForeignKeyDeferrable holds the DEFERRABLE clause of a REFERENCES constraint of this
// column. The foreign key of the table keeps that clause, and Definition writes none.
ForeignKeyDeferrable string
}
func (*SQLiteColumn) Copy ¶
func (c *SQLiteColumn) Copy() *SQLiteColumn
func (*SQLiteColumn) Definition ¶ added in v1.2.0
func (c *SQLiteColumn) Definition() string
func (*SQLiteColumn) HasEqualAttributes ¶
func (c *SQLiteColumn) HasEqualAttributes(other *SQLiteColumn) bool
func (*SQLiteColumn) IsGenerated ¶ added in v1.2.0
func (c *SQLiteColumn) IsGenerated() bool
func (*SQLiteColumn) IsTypeChangeCompatible ¶ added in v1.2.0
func (c *SQLiteColumn) IsTypeChangeCompatible(other *SQLiteColumn) bool
type SQLiteCreateIndexInstruction ¶ added in v1.2.0
type SQLiteCreateIndexInstruction struct {
Unique bool
Name string
TableName string
Keys []string
Condition Condition
}
func (*SQLiteCreateIndexInstruction) Comment ¶ added in v1.2.0
func (i *SQLiteCreateIndexInstruction) Comment() string
func (*SQLiteCreateIndexInstruction) String ¶ added in v1.2.0
func (i *SQLiteCreateIndexInstruction) String() string
type SQLiteCreateTableInstruction ¶ added in v1.2.0
type SQLiteCreateTableInstruction struct {
Name string
Columns []*SQLiteColumn
PrimaryKey []string
PrimaryKeyName string
PrimaryKeyConflict string
// A key clause holds the quoted column name with its COLLATE clause and its DESC
// keyword. An empty list keeps the plain names of PrimaryKey.
PrimaryKeyKeys []string
UniqueConstraints []*SQLiteUniqueConstraint
ForeignKeys []*SQLiteForeignKey
CheckConstraints []*SQLiteCheckConstraint
// SQLite accepts a table option after the closing parenthesis. WITHOUT ROWID comes
// first, because SQLite refuses the reverse order.
WithoutRowID bool
Strict bool
}
func (*SQLiteCreateTableInstruction) Comment ¶ added in v1.2.0
func (i *SQLiteCreateTableInstruction) Comment() string
func (*SQLiteCreateTableInstruction) String ¶ added in v1.2.0
func (i *SQLiteCreateTableInstruction) String() string
type SQLiteCreateTriggerInstruction ¶ added in v1.2.0
type SQLiteCreateTriggerInstruction struct {
Definition string
}
func (*SQLiteCreateTriggerInstruction) Comment ¶ added in v1.2.0
func (i *SQLiteCreateTriggerInstruction) Comment() string
func (*SQLiteCreateTriggerInstruction) String ¶ added in v1.2.0
func (i *SQLiteCreateTriggerInstruction) String() string
type SQLiteCreateViewInstruction ¶ added in v1.2.0
type SQLiteCreateViewInstruction struct {
Definition string
}
func (*SQLiteCreateViewInstruction) Comment ¶ added in v1.2.0
func (i *SQLiteCreateViewInstruction) Comment() string
func (*SQLiteCreateViewInstruction) String ¶ added in v1.2.0
func (i *SQLiteCreateViewInstruction) String() string
type SQLiteCreateVirtualTableInstruction ¶ added in v1.2.0
type SQLiteCreateVirtualTableInstruction struct {
Definition string
}
func (*SQLiteCreateVirtualTableInstruction) Comment ¶ added in v1.2.0
func (i *SQLiteCreateVirtualTableInstruction) Comment() string
func (*SQLiteCreateVirtualTableInstruction) String ¶ added in v1.2.0
func (i *SQLiteCreateVirtualTableInstruction) String() string
type SQLiteDriver ¶
type SQLiteDriver struct {
TargetDatabaseConnection *sql.DB
SourceDatabaseConnection *sql.DB
CompareData bool
// contains filtered or unexported fields
}
func NewSQLiteDriver ¶
func NewSQLiteDriver(ctx context.Context, config *SQLiteDriverConfig) (*SQLiteDriver, error)
func (*SQLiteDriver) Close ¶
func (d *SQLiteDriver) Close() error
func (*SQLiteDriver) Diff ¶
func (d *SQLiteDriver) Diff(ctx context.Context) ([]Instruction, error)
func (*SQLiteDriver) DiffData ¶ added in v1.2.0
func (d *SQLiteDriver) DiffData(ctx context.Context) ([]Instruction, error)
The schema section already creates or drops the other tables.
func (*SQLiteDriver) DiffTableData ¶ added in v1.2.0
func (d *SQLiteDriver) DiffTableData(ctx context.Context, targetTable *SQLiteTable, sourceTable *SQLiteTable) ([]Instruction, []Instruction, error)
func (*SQLiteDriver) DiffTables ¶ added in v1.2.0
func (d *SQLiteDriver) DiffTables(ctx context.Context) ([]Instruction, error)
func (*SQLiteDriver) DiffViews ¶ added in v1.2.0
func (d *SQLiteDriver) DiffViews(ctx context.Context) ([]Instruction, error)
func (*SQLiteDriver) DiffVirtualTables ¶ added in v1.2.0
func (d *SQLiteDriver) DiffVirtualTables(ctx context.Context) ([]Instruction, error)
func (*SQLiteDriver) GetIndexColumnNames ¶ added in v1.2.0
func (*SQLiteDriver) GetIndexDefinitions ¶ added in v1.2.0
func (d *SQLiteDriver) GetIndexDefinitions(ctx context.Context, db *sql.DB, tableName string) (map[string]string, error)
An index that a UNIQUE constraint or a PRIMARY KEY builds holds no text.
func (*SQLiteDriver) GetIndexKeys ¶ added in v1.2.0
func (d *SQLiteDriver) GetIndexKeys(ctx context.Context, db *sql.DB, indexName string, definitionKeys []string) ([]string, error)
PRAGMA index_info gives no name for an expression key, no direction, and no collation, so definitionKeys and indexKeyModifiers read those parts from the text.
func (*SQLiteDriver) GetTable ¶ added in v1.2.0
func (d *SQLiteDriver) GetTable(ctx context.Context, db *sql.DB, tableName string) (*SQLiteTable, error)
func (*SQLiteDriver) GetTableColumns ¶ added in v1.2.0
func (d *SQLiteDriver) GetTableColumns(ctx context.Context, db *sql.DB, tableName string) ([]*SQLiteColumn, error)
PRAGMA table_info gives no generated column, so this method reads PRAGMA table_xinfo. That PRAGMA gives no expression, so parseTableDefinition reads it.
func (*SQLiteDriver) GetTableData ¶ added in v1.2.0
func (d *SQLiteDriver) GetTableData(ctx context.Context, db *sql.DB, tableName string, columnNames []string, primaryKeyColumnNames []string) (*SQLiteTableData, error)
func (*SQLiteDriver) GetTableDefinition ¶ added in v1.2.0
func (*SQLiteDriver) GetTableForeignKeys ¶ added in v1.2.0
func (d *SQLiteDriver) GetTableForeignKeys(ctx context.Context, db *sql.DB, tableName string) ([]*SQLiteForeignKey, error)
func (*SQLiteDriver) GetTableIndexes ¶ added in v1.2.0
func (d *SQLiteDriver) GetTableIndexes(ctx context.Context, db *sql.DB, tableName string) ([]*SQLiteIndex, error)
func (*SQLiteDriver) GetTablePrimaryKey ¶ added in v1.2.0
func (*SQLiteDriver) GetTableUniqueKeys ¶ added in v1.2.0
func (d *SQLiteDriver) GetTableUniqueKeys(ctx context.Context, db *sql.DB, tableName string) ([][]string, error)
This method sorts the keys, because SQLite gives no stable order.
func (*SQLiteDriver) GetTables ¶ added in v1.2.0
func (d *SQLiteDriver) GetTables(ctx context.Context, db *sql.DB) ([]*SQLiteTable, error)
A virtual table takes its own statement, and a shadow table belongs to its module. The order of sqlite_master is the order of the creation, so a table that holds a foreign key comes after the table that it names. Keep that order.
func (*SQLiteDriver) GetTriggers ¶ added in v1.2.0
func (d *SQLiteDriver) GetTriggers(ctx context.Context, db *sql.DB, objectName string) ([]*SQLiteTrigger, error)
func (*SQLiteDriver) GetViews ¶ added in v1.2.0
func (d *SQLiteDriver) GetViews(ctx context.Context, db *sql.DB) ([]*SQLiteView, error)
func (*SQLiteDriver) GetVirtualTables ¶ added in v1.2.0
func (d *SQLiteDriver) GetVirtualTables(ctx context.Context, db *sql.DB) ([]*SQLiteVirtualTable, error)
func (*SQLiteDriver) RemoveTemporaryDirectory ¶ added in v1.2.0
func (d *SQLiteDriver) RemoveTemporaryDirectory() error
func (*SQLiteDriver) TableDataInstructions ¶ added in v1.2.0
func (d *SQLiteDriver) TableDataInstructions(ctx context.Context, targetTable *SQLiteTable) ([]Instruction, error)
The schema section creates this table with no row, so every target row becomes an INSERT statement.
func (*SQLiteDriver) TemporaryDirectory ¶ added in v1.2.0
func (d *SQLiteDriver) TemporaryDirectory() (string, error)
type SQLiteDriverConfig ¶ added in v1.2.0
type SQLiteDropTriggerInstruction ¶ added in v1.2.0
type SQLiteDropTriggerInstruction struct {
Name string
}
func (*SQLiteDropTriggerInstruction) Comment ¶ added in v1.2.0
func (i *SQLiteDropTriggerInstruction) Comment() string
func (*SQLiteDropTriggerInstruction) String ¶ added in v1.2.0
func (i *SQLiteDropTriggerInstruction) String() string
type SQLiteForeignKey ¶ added in v1.2.0
type SQLiteForeignKey struct {
Name string
Table string
From []string
To []string
OnUpdate string
OnDelete string
Deferrable string
}
func (*SQLiteForeignKey) Clause ¶ added in v1.2.0
func (fk *SQLiteForeignKey) Clause() string
func (*SQLiteForeignKey) Equal ¶ added in v1.2.0
func (fk *SQLiteForeignKey) Equal(other *SQLiteForeignKey) bool
type SQLiteIndex ¶
type SQLiteIndex struct {
Table string
Name string
// A key holds the SQL text of one key part, so an expression key keeps its text.
Keys []string
Where string
Unique bool
}
func (*SQLiteIndex) CreateInstruction ¶ added in v1.2.0
func (i *SQLiteIndex) CreateInstruction() *SQLiteCreateIndexInstruction
func (*SQLiteIndex) Equal ¶
func (i *SQLiteIndex) Equal(other *SQLiteIndex) bool
type SQLiteIndexPredicateCondition ¶ added in v1.2.0
type SQLiteIndexPredicateCondition struct {
Expression string
}
func (*SQLiteIndexPredicateCondition) ConditionClause ¶ added in v1.2.0
func (c *SQLiteIndexPredicateCondition) ConditionClause() string
type SQLitePragmaForeignKeysInstruction ¶ added in v1.2.0
type SQLitePragmaForeignKeysInstruction struct {
Enabled bool
}
func (*SQLitePragmaForeignKeysInstruction) Comment ¶ added in v1.2.0
func (i *SQLitePragmaForeignKeysInstruction) Comment() string
func (*SQLitePragmaForeignKeysInstruction) String ¶ added in v1.2.0
func (i *SQLitePragmaForeignKeysInstruction) String() string
type SQLiteTable ¶
type SQLiteTable struct {
Name string
Columns []*SQLiteColumn
// These two fields hold a key or a constraint of two or more columns only.
PrimaryKey []string
PrimaryKeyName string
PrimaryKeyConflict string
UniqueConstraints []*SQLiteUniqueConstraint
// A key clause holds the quoted column name with its COLLATE clause and its DESC
// keyword, which no PRAGMA reports.
PrimaryKeyKeys []string
Indexes []*SQLiteIndex
Triggers []*SQLiteTrigger
ForeignKeys []*SQLiteForeignKey
CheckConstraints []*SQLiteCheckConstraint
WithoutRowID bool
Strict bool
}
func (*SQLiteTable) ColumnByName ¶
func (t *SQLiteTable) ColumnByName(name string) (*SQLiteColumn, bool)
func (*SQLiteTable) Copy ¶
func (t *SQLiteTable) Copy() *SQLiteTable
func (*SQLiteTable) CreateTableInstruction ¶ added in v1.2.0
func (t *SQLiteTable) CreateTableInstruction() *SQLiteCreateTableInstruction
func (*SQLiteTable) DiffColumns ¶ added in v1.2.0
func (t *SQLiteTable) DiffColumns(other *SQLiteTable) *SQLiteTableColumnsDiff
func (*SQLiteTable) DiffIndexes ¶ added in v1.2.0
func (t *SQLiteTable) DiffIndexes(other *SQLiteTable) ([]Instruction, error)
func (*SQLiteTable) DiffTable ¶ added in v1.2.0
func (t *SQLiteTable) DiffTable(other *SQLiteTable) ([]Instruction, error)
func (*SQLiteTable) DiffTriggers ¶ added in v1.2.0
func (t *SQLiteTable) DiffTriggers(other *SQLiteTable) ([]Instruction, error)
func (*SQLiteTable) IndexByName ¶
func (t *SQLiteTable) IndexByName(name string) (*SQLiteIndex, bool)
func (*SQLiteTable) IndexInstructions ¶ added in v1.2.0
func (t *SQLiteTable) IndexInstructions() []Instruction
func (*SQLiteTable) Instructions ¶ added in v1.2.0
func (t *SQLiteTable) Instructions() []Instruction
func (*SQLiteTable) PrimaryKeyColumnNames ¶ added in v1.2.0
func (t *SQLiteTable) PrimaryKeyColumnNames() []string
func (*SQLiteTable) TriggerByName ¶
func (t *SQLiteTable) TriggerByName(name string) (*SQLiteTrigger, bool)
func (*SQLiteTable) TriggerInstructions ¶ added in v1.2.0
func (t *SQLiteTable) TriggerInstructions() []Instruction
type SQLiteTableColumnsDiff ¶ added in v1.2.0
type SQLiteTableColumnsDiff struct {
Added []string
Modified []string
Removed []string
Renamed map[string]string
ForeignKeysChanged bool
ConstraintsChanged bool
TableOptionsChanged bool
ColumnOrderChanged bool
AddsStoredGeneratedColumn bool
}
func (*SQLiteTableColumnsDiff) NeedsRecreation ¶ added in v1.2.0
func (d *SQLiteTableColumnsDiff) NeedsRecreation() bool
SQLite supports no ALTER COLUMN, so a modified column, a changed foreign key, a changed table constraint, or a changed table option needs a new table. SQLite also refuses an ADD COLUMN action that holds a STORED generated column.
type SQLiteTableData ¶ added in v1.2.0
type SQLiteTableDefinition ¶ added in v1.2.0
type SQLiteTableDefinition struct {
Columns map[string]*SQLiteColumn
CheckConstraints []*SQLiteCheckConstraint
UniqueNames map[string]string
ForeignKeyNames map[string]string
UniqueConflicts map[string]string
UniqueKeys map[string][]string
ForeignKeyDefers map[string]string
PrimaryKeyName string
PrimaryKeyConflict string
PrimaryKeyKeys []string
WithoutRowID bool
Strict bool
}
PRAGMA table_xinfo gives no expression of a generated column, and no PRAGMA reports a collation, the keyword AUTOINCREMENT, or a check.
func (*SQLiteTableDefinition) ColumnByName ¶ added in v1.2.0
func (d *SQLiteTableDefinition) ColumnByName(name string) (*SQLiteColumn, bool)
func (*SQLiteTableDefinition) DeferrableOf ¶ added in v1.2.0
func (d *SQLiteTableDefinition) DeferrableOf(columns []string) string
func (*SQLiteTableDefinition) ForeignKeyNameOf ¶ added in v1.2.0
func (d *SQLiteTableDefinition) ForeignKeyNameOf(columns []string) string
func (*SQLiteTableDefinition) UniqueConflictOf ¶ added in v1.2.0
func (d *SQLiteTableDefinition) UniqueConflictOf(columns []string) string
func (*SQLiteTableDefinition) UniqueKeysOf ¶ added in v1.2.0
func (d *SQLiteTableDefinition) UniqueKeysOf(columns []string) []string
func (*SQLiteTableDefinition) UniqueNameOf ¶ added in v1.2.0
func (d *SQLiteTableDefinition) UniqueNameOf(columns []string) string
type SQLiteTrigger ¶
type SQLiteUniqueConstraint ¶ added in v1.2.0
type SQLiteUniqueConstraint struct {
Name string
Columns []string
// A key clause holds the quoted column name with its COLLATE clause and its DESC
// keyword, which no PRAGMA reports. An empty list keeps the plain names of Columns.
Keys []string
Conflict string
}
func (*SQLiteUniqueConstraint) Clause ¶ added in v1.2.0
func (c *SQLiteUniqueConstraint) Clause() string
func (*SQLiteUniqueConstraint) Equal ¶ added in v1.2.0
func (c *SQLiteUniqueConstraint) Equal(other *SQLiteUniqueConstraint) bool
type SQLiteView ¶ added in v1.2.0
type SQLiteView struct {
Name string
SQL string
Triggers []*SQLiteTrigger
}
func (*SQLiteView) Diff ¶ added in v1.2.0
func (v *SQLiteView) Diff(other *SQLiteView) ([]Instruction, error)
A DROP VIEW statement removes every trigger of the view.
func (*SQLiteView) DiffTriggers ¶ added in v1.2.0
func (v *SQLiteView) DiffTriggers(other *SQLiteView) []Instruction
func (*SQLiteView) Instructions ¶ added in v1.2.0
func (v *SQLiteView) Instructions() []Instruction
func (*SQLiteView) TriggerByName ¶ added in v1.2.0
func (v *SQLiteView) TriggerByName(name string) (*SQLiteTrigger, bool)
func (*SQLiteView) TriggerInstructions ¶ added in v1.2.0
func (v *SQLiteView) TriggerInstructions() []Instruction
type SQLiteVirtualTable ¶ added in v1.2.0
SQLite holds no ALTER statement for a virtual table, so a new definition prints a DROP statement and a CREATE statement. The module builds the shadow tables.
func (*SQLiteVirtualTable) CreateInstruction ¶ added in v1.2.0
func (t *SQLiteVirtualTable) CreateInstruction() *SQLiteCreateVirtualTableInstruction
func (*SQLiteVirtualTable) DropInstruction ¶ added in v1.2.0
func (t *SQLiteVirtualTable) DropInstruction() *SQLDropTableInstruction
type SectionDiff ¶ added in v1.2.0
type SectionDiff struct {
EarlyRemovals []Instruction
Additions []Instruction
Removals []Instruction
}
An early removal covers the object that blocks an addition of another section.
Source Files
¶
- driver.go
- driver_detection.go
- identifier.go
- instruction.go
- instruction_comment.go
- instruction_postgres_object.go
- instruction_postgres_routine.go
- instruction_postgres_table.go
- instruction_postgres_type.go
- instruction_sqlite.go
- new_driver.go
- postgres.go
- postgres_aggregate.go
- postgres_cast.go
- postgres_column.go
- postgres_composite_type.go
- postgres_constraint.go
- postgres_data.go
- postgres_domain.go
- postgres_extension.go
- postgres_function.go
- postgres_index.go
- postgres_materialized_view.go
- postgres_operator.go
- postgres_policy.go
- postgres_privilege.go
- postgres_rule.go
- postgres_sequence.go
- postgres_sql_source.go
- postgres_statistics.go
- postgres_table.go
- postgres_trigger.go
- postgres_type.go
- postgres_view.go
- sql_source.go
- sql_statement.go
- sqlite.go
- sqlite_check_constraint.go
- sqlite_column.go
- sqlite_data.go
- sqlite_definition.go
- sqlite_foreign_key.go
- sqlite_index.go
- sqlite_sql_source.go
- sqlite_table.go
- sqlite_trigger.go
- sqlite_unique_constraint.go
- sqlite_view.go
- sqlite_virtual_table.go