Documentation ¶
Index ¶
- Constants
- Variables
- type AddColumnMigration
- type AddIndexMigration
- type AddTableMigration
- type BaseDialect
- func (b *BaseDialect) AddColumnSQL(tableName string, col *Column) string
- func (b *BaseDialect) AndStr() string
- func (b *BaseDialect) CleanDB(engine *xorm.Engine) error
- func (b *BaseDialect) ColString(col *Column) string
- func (b *BaseDialect) ColStringNoPk(col *Column) string
- func (b *BaseDialect) ColumnCheckSQL(tableName, columnName string) (string, []interface{})
- func (b *BaseDialect) CopyTableData(sourceTable string, targetTable string, sourceCols []string, ...) string
- func (b *BaseDialect) CreateIndexSQL(tableName string, index *Index) string
- func (b *BaseDialect) CreateTableSQL(table *Table) string
- func (b *BaseDialect) DateTimeFunc(value string) string
- func (b *BaseDialect) Default(col *Column) string
- func (b *BaseDialect) DriverName() string
- func (b *BaseDialect) DropIndexSQL(tableName string, index *Index) string
- func (b *BaseDialect) DropTable(tableName string) string
- func (b *BaseDialect) EqStr() string
- func (b *BaseDialect) GetDBName(_ string) (string, error)
- func (b *BaseDialect) LikeStr() string
- func (b *BaseDialect) Limit(limit int64) string
- func (b *BaseDialect) LimitOffset(limit int64, offset int64) string
- func (b *BaseDialect) Lock(_ LockCfg) error
- func (b *BaseDialect) NoOpSQL() string
- func (b *BaseDialect) OrStr() string
- func (b *BaseDialect) OrderBy(order string) string
- func (b *BaseDialect) PostInsertId(table string, sess *xorm.Session) error
- func (b *BaseDialect) PreInsertId(table string, sess *xorm.Session) error
- func (b *BaseDialect) QuoteColList(cols []string) string
- func (b *BaseDialect) RenameColumn(table Table, column *Column, newName string) string
- func (b *BaseDialect) RenameTable(oldName string, newName string) string
- func (b *BaseDialect) ShowCreateNull() bool
- func (b *BaseDialect) TruncateDBTables(engine *xorm.Engine) error
- func (b *BaseDialect) Unlock(_ LockCfg) error
- func (b *BaseDialect) UpdateTableSQL(tableName string, columns []*Column) string
- func (b *BaseDialect) UpsertSQL(tableName string, keyCols, updateCols []string) string
- type CodeMigration
- type Column
- type ColumnType
- type CopyTableDataMigration
- type Dialect
- type DropIndexMigration
- type DropTableMigration
- type ExistsMigrationCondition
- type IfColumnNotExistsCondition
- type IfIndexExistsCondition
- type IfIndexNotExistsCondition
- type Index
- type LockCfg
- type Migration
- type MigrationBase
- type MigrationCondition
- type MigrationLog
- type Migrator
- func (mg *Migrator) AddCreateMigration()
- func (mg *Migrator) AddMigration(id string, m Migration)
- func (mg *Migrator) GetMigrationIDs(excludeNotLogged bool) []string
- func (mg *Migrator) GetMigrationLog() (map[string]MigrationLog, error)
- func (mg *Migrator) InTransaction(callback dbTransactionFunc) error
- func (mg *Migrator) MigrationsCount() int
- func (mg *Migrator) RemoveMigrationLogs(migrationsIDs ...string)
- func (mg *Migrator) Start(isDatabaseLockingEnabled bool, lockAttemptTimeout int) (err error)
- type MySQLDialect
- func (db *MySQLDialect) AutoIncrStr() string
- func (db *MySQLDialect) BatchSize() int
- func (db *MySQLDialect) BooleanStr(value bool) string
- func (db *MySQLDialect) CleanDB(engine *xorm.Engine) error
- func (db *MySQLDialect) ColumnCheckSQL(tableName, columnName string) (string, []interface{})
- func (db *MySQLDialect) ErrorMessage(err error) string
- func (db *MySQLDialect) GetDBName(dsn string) (string, error)
- func (db *MySQLDialect) IndexCheckSQL(tableName, indexName string) (string, []interface{})
- func (db *MySQLDialect) IsDeadlock(err error) bool
- func (db *MySQLDialect) IsUniqueConstraintViolation(err error) bool
- func (db *MySQLDialect) Lock(cfg LockCfg) error
- func (db *MySQLDialect) Quote(name string) string
- func (db *MySQLDialect) RenameColumn(table Table, column *Column, newName string) string
- func (db *MySQLDialect) SQLType(c *Column) string
- func (db *MySQLDialect) SupportEngine() bool
- func (db *MySQLDialect) TruncateDBTables(engine *xorm.Engine) error
- func (db *MySQLDialect) Unlock(cfg LockCfg) error
- func (db *MySQLDialect) UpdateTableSQL(tableName string, columns []*Column) string
- func (db *MySQLDialect) UpsertMultipleSQL(tableName string, keyCols, updateCols []string, count int) (string, error)
- func (db *MySQLDialect) UpsertSQL(tableName string, keyCols, updateCols []string) string
- type NotExistsMigrationCondition
- type PostgresDialect
- func (db *PostgresDialect) AutoIncrStr() string
- func (db *PostgresDialect) BatchSize() int
- func (db *PostgresDialect) BooleanStr(value bool) string
- func (db *PostgresDialect) CleanDB(engine *xorm.Engine) error
- func (db *PostgresDialect) DropIndexSQL(tableName string, index *Index) string
- func (db *PostgresDialect) ErrorMessage(err error) string
- func (db *PostgresDialect) GetDBName(dsn string) (string, error)
- func (db *PostgresDialect) IndexCheckSQL(tableName, indexName string) (string, []interface{})
- func (db *PostgresDialect) IsDeadlock(err error) bool
- func (db *PostgresDialect) IsUniqueConstraintViolation(err error) bool
- func (db *PostgresDialect) LikeStr() string
- func (db *PostgresDialect) Lock(cfg LockCfg) error
- func (db *PostgresDialect) OrderBy(order string) string
- func (db *PostgresDialect) PostInsertId(table string, sess *xorm.Session) error
- func (db *PostgresDialect) Quote(name string) string
- func (db *PostgresDialect) SQLType(c *Column) string
- func (db *PostgresDialect) SupportEngine() bool
- func (db *PostgresDialect) TruncateDBTables(engine *xorm.Engine) error
- func (db *PostgresDialect) Unlock(cfg LockCfg) error
- func (db *PostgresDialect) UpdateTableSQL(tableName string, columns []*Column) string
- func (db *PostgresDialect) UpsertMultipleSQL(tableName string, keyCols, updateCols []string, count int) (string, error)
- func (db *PostgresDialect) UpsertSQL(tableName string, keyCols, updateCols []string) string
- type RawSQLMigration
- func (m *RawSQLMigration) Default(sql string) *RawSQLMigration
- func (m *RawSQLMigration) Mssql(sql string) *RawSQLMigration
- func (m *RawSQLMigration) Mysql(sql string) *RawSQLMigration
- func (m *RawSQLMigration) Postgres(sql string) *RawSQLMigration
- func (m *RawSQLMigration) SQL(dialect Dialect) string
- func (m *RawSQLMigration) SQLite(sql string) *RawSQLMigration
- func (m *RawSQLMigration) Set(dialect string, sql string) *RawSQLMigration
- type RenameColumnMigration
- type RenameTableMigration
- type SQLType
- type SQLite3
- func (db *SQLite3) AutoIncrStr() string
- func (db *SQLite3) BatchSize() int
- func (db *SQLite3) BooleanStr(value bool) string
- func (db *SQLite3) CleanDB(engine *xorm.Engine) error
- func (db *SQLite3) DateTimeFunc(value string) string
- func (db *SQLite3) DropIndexSQL(tableName string, index *Index) string
- func (db *SQLite3) ErrorMessage(err error) string
- func (db *SQLite3) IndexCheckSQL(tableName, indexName string) (string, []interface{})
- func (db *SQLite3) IsDeadlock(err error) bool
- func (db *SQLite3) IsUniqueConstraintViolation(err error) bool
- func (db *SQLite3) Quote(name string) string
- func (db *SQLite3) SQLType(c *Column) string
- func (db *SQLite3) SupportEngine() bool
- func (db *SQLite3) TruncateDBTables(engine *xorm.Engine) error
- func (db *SQLite3) UpsertMultipleSQL(tableName string, keyCols, updateCols []string, count int) (string, error)
- func (db *SQLite3) UpsertSQL(tableName string, keyCols, updateCols []string) string
- type Table
- type TableCharsetMigration
Constants ¶
const ( Postgres = "postgres" SQLite = "sqlite3" MySQL = "mysql" MSSQL = "mssql" )
const ( IndexType = iota + 1 UniqueIndex )
Variables ¶
var ( ErrLockDB = fmt.Errorf("failed to obtain lock") ErrReleaseLockDB = fmt.Errorf("failed to release lock") )
var ( ErrMigratorIsLocked = fmt.Errorf("migrator is locked") ErrMigratorIsUnlocked = fmt.Errorf("migrator is unlocked") )
var ( DB_Bit = "BIT" DB_TinyInt = "TINYINT" DB_SmallInt = "SMALLINT" DB_MediumInt = "MEDIUMINT" DB_Int = "INT" DB_Integer = "INTEGER" DB_BigInt = "BIGINT" DB_Set = "SET" DB_Char = "CHAR" DB_Varchar = "VARCHAR" DB_NVarchar = "NVARCHAR" DB_TinyText = "TINYTEXT" DB_Text = "TEXT" DB_MediumText = "MEDIUMTEXT" DB_LongText = "LONGTEXT" DB_Uuid = "UUID" DB_Date = "DATE" DB_DateTime = "DATETIME" DB_Time = "TIME" DB_TimeStamp = "TIMESTAMP" DB_TimeStampz = "TIMESTAMPZ" DB_Decimal = "DECIMAL" DB_Numeric = "NUMERIC" DB_Real = "REAL" DB_Float = "FLOAT" DB_Double = "DOUBLE" DB_Binary = "BINARY" DB_VarBinary = "VARBINARY" DB_TinyBlob = "TINYBLOB" DB_Blob = "BLOB" DB_MediumBlob = "MEDIUMBLOB" DB_LongBlob = "LONGBLOB" DB_Bytea = "BYTEA" DB_Bool = "BOOL" DB_Serial = "SERIAL" DB_BigSerial = "BIGSERIAL" )
Functions ¶
This section is empty.
Types ¶
type AddColumnMigration ¶
type AddColumnMigration struct { MigrationBase // contains filtered or unexported fields }
func NewAddColumnMigration ¶
func NewAddColumnMigration(table Table, col *Column) *AddColumnMigration
func (*AddColumnMigration) Column ¶
func (m *AddColumnMigration) Column(col *Column) *AddColumnMigration
func (*AddColumnMigration) SQL ¶
func (m *AddColumnMigration) SQL(dialect Dialect) string
func (*AddColumnMigration) Table ¶
func (m *AddColumnMigration) Table(tableName string) *AddColumnMigration
type AddIndexMigration ¶
type AddIndexMigration struct { MigrationBase // contains filtered or unexported fields }
func NewAddIndexMigration ¶
func NewAddIndexMigration(table Table, index *Index) *AddIndexMigration
func (*AddIndexMigration) SQL ¶
func (m *AddIndexMigration) SQL(dialect Dialect) string
func (*AddIndexMigration) Table ¶
func (m *AddIndexMigration) Table(tableName string) *AddIndexMigration
type AddTableMigration ¶
type AddTableMigration struct { MigrationBase // contains filtered or unexported fields }
func NewAddTableMigration ¶
func NewAddTableMigration(table Table) *AddTableMigration
func (*AddTableMigration) SQL ¶
func (m *AddTableMigration) SQL(d Dialect) string
type BaseDialect ¶
type BaseDialect struct {
// contains filtered or unexported fields
}
func (*BaseDialect) AddColumnSQL ¶
func (b *BaseDialect) AddColumnSQL(tableName string, col *Column) string
func (*BaseDialect) AndStr ¶
func (b *BaseDialect) AndStr() string
func (*BaseDialect) ColString ¶
func (b *BaseDialect) ColString(col *Column) string
func (*BaseDialect) ColStringNoPk ¶
func (b *BaseDialect) ColStringNoPk(col *Column) string
func (*BaseDialect) ColumnCheckSQL ¶
func (b *BaseDialect) ColumnCheckSQL(tableName, columnName string) (string, []interface{})
func (*BaseDialect) CopyTableData ¶
func (*BaseDialect) CreateIndexSQL ¶
func (b *BaseDialect) CreateIndexSQL(tableName string, index *Index) string
func (*BaseDialect) CreateTableSQL ¶
func (b *BaseDialect) CreateTableSQL(table *Table) string
func (*BaseDialect) DateTimeFunc ¶
func (b *BaseDialect) DateTimeFunc(value string) string
func (*BaseDialect) Default ¶
func (b *BaseDialect) Default(col *Column) string
func (*BaseDialect) DriverName ¶
func (b *BaseDialect) DriverName() string
func (*BaseDialect) DropIndexSQL ¶
func (b *BaseDialect) DropIndexSQL(tableName string, index *Index) string
func (*BaseDialect) DropTable ¶
func (b *BaseDialect) DropTable(tableName string) string
func (*BaseDialect) EqStr ¶
func (b *BaseDialect) EqStr() string
func (*BaseDialect) LikeStr ¶
func (b *BaseDialect) LikeStr() string
func (*BaseDialect) Limit ¶
func (b *BaseDialect) Limit(limit int64) string
func (*BaseDialect) LimitOffset ¶
func (b *BaseDialect) LimitOffset(limit int64, offset int64) string
func (*BaseDialect) Lock ¶
func (b *BaseDialect) Lock(_ LockCfg) error
func (*BaseDialect) NoOpSQL ¶
func (b *BaseDialect) NoOpSQL() string
func (*BaseDialect) OrStr ¶
func (b *BaseDialect) OrStr() string
func (*BaseDialect) OrderBy ¶
func (b *BaseDialect) OrderBy(order string) string
func (*BaseDialect) PostInsertId ¶
func (b *BaseDialect) PostInsertId(table string, sess *xorm.Session) error
func (*BaseDialect) PreInsertId ¶
func (b *BaseDialect) PreInsertId(table string, sess *xorm.Session) error
func (*BaseDialect) QuoteColList ¶
func (b *BaseDialect) QuoteColList(cols []string) string
func (*BaseDialect) RenameColumn ¶
func (b *BaseDialect) RenameColumn(table Table, column *Column, newName string) string
func (*BaseDialect) RenameTable ¶
func (b *BaseDialect) RenameTable(oldName string, newName string) string
func (*BaseDialect) ShowCreateNull ¶
func (b *BaseDialect) ShowCreateNull() bool
func (*BaseDialect) TruncateDBTables ¶
func (b *BaseDialect) TruncateDBTables(engine *xorm.Engine) error
func (*BaseDialect) Unlock ¶
func (b *BaseDialect) Unlock(_ LockCfg) error
func (*BaseDialect) UpdateTableSQL ¶
func (b *BaseDialect) UpdateTableSQL(tableName string, columns []*Column) string
type CodeMigration ¶
type Column ¶
type Column struct { Name string Type string Length int Length2 int Nullable bool IsPrimaryKey bool IsAutoIncrement bool IsLatin bool Default string }
func (*Column) StringNoPk ¶
type CopyTableDataMigration ¶
type CopyTableDataMigration struct { MigrationBase // contains filtered or unexported fields }
func NewCopyTableDataMigration ¶
func NewCopyTableDataMigration(targetTable string, sourceTable string, colMap map[string]string) *CopyTableDataMigration
func (*CopyTableDataMigration) SQL ¶
func (m *CopyTableDataMigration) SQL(d Dialect) string
type Dialect ¶
type Dialect interface { DriverName() string Quote(string) string AndStr() string AutoIncrStr() string OrStr() string EqStr() string ShowCreateNull() bool SQLType(col *Column) string SupportEngine() bool LikeStr() string Default(col *Column) string BooleanStr(bool) string DateTimeFunc(string) string BatchSize() int OrderBy(order string) string CreateIndexSQL(tableName string, index *Index) string CreateTableSQL(table *Table) string AddColumnSQL(tableName string, col *Column) string CopyTableData(sourceTable string, targetTable string, sourceCols []string, targetCols []string) string DropTable(tableName string) string DropIndexSQL(tableName string, index *Index) string // RenameTable is deprecated, its use cause breaking changes // so, it should no longer be used. Kept for legacy reasons. RenameTable(oldName string, newName string) string // RenameColumn is deprecated, its use cause breaking changes // so, it should no longer be used. Kept for legacy reasons. RenameColumn(table Table, column *Column, newName string) string UpdateTableSQL(tableName string, columns []*Column) string IndexCheckSQL(tableName, indexName string) (string, []interface{}) ColumnCheckSQL(tableName, columnName string) (string, []interface{}) // UpsertSQL returns the upsert sql statement for a dialect UpsertSQL(tableName string, keyCols, updateCols []string) string UpsertMultipleSQL(tableName string, keyCols, updateCols []string, count int) (string, error) ColString(*Column) string ColStringNoPk(*Column) string Limit(limit int64) string LimitOffset(limit int64, offset int64) string PreInsertId(table string, sess *xorm.Session) error PostInsertId(table string, sess *xorm.Session) error CleanDB(engine *xorm.Engine) error TruncateDBTables(engine *xorm.Engine) error NoOpSQL() string IsUniqueConstraintViolation(err error) bool ErrorMessage(err error) string IsDeadlock(err error) bool Lock(LockCfg) error Unlock(LockCfg) error GetDBName(string) (string, error) }
func NewDialect ¶
func NewMysqlDialect ¶
func NewMysqlDialect() Dialect
func NewPostgresDialect ¶
func NewPostgresDialect() Dialect
func NewSQLite3Dialect ¶
func NewSQLite3Dialect() Dialect
type DropIndexMigration ¶
type DropIndexMigration struct { MigrationBase // contains filtered or unexported fields }
func NewDropIndexMigration ¶
func NewDropIndexMigration(table Table, index *Index) *DropIndexMigration
func (*DropIndexMigration) SQL ¶
func (m *DropIndexMigration) SQL(dialect Dialect) string
type DropTableMigration ¶
type DropTableMigration struct { MigrationBase // contains filtered or unexported fields }
func NewDropTableMigration ¶
func NewDropTableMigration(tableName string) *DropTableMigration
func (*DropTableMigration) SQL ¶
func (m *DropTableMigration) SQL(d Dialect) string
type ExistsMigrationCondition ¶
type ExistsMigrationCondition struct{}
func (*ExistsMigrationCondition) IsFulfilled ¶
func (c *ExistsMigrationCondition) IsFulfilled(results []map[string][]byte) bool
type IfColumnNotExistsCondition ¶
type IfColumnNotExistsCondition struct { NotExistsMigrationCondition TableName string ColumnName string }
func (*IfColumnNotExistsCondition) SQL ¶
func (c *IfColumnNotExistsCondition) SQL(dialect Dialect) (string, []interface{})
type IfIndexExistsCondition ¶
type IfIndexExistsCondition struct { ExistsMigrationCondition TableName string IndexName string }
func (*IfIndexExistsCondition) SQL ¶
func (c *IfIndexExistsCondition) SQL(dialect Dialect) (string, []interface{})
type IfIndexNotExistsCondition ¶
type IfIndexNotExistsCondition struct { NotExistsMigrationCondition TableName string IndexName string }
func (*IfIndexNotExistsCondition) SQL ¶
func (c *IfIndexNotExistsCondition) SQL(dialect Dialect) (string, []interface{})
type Migration ¶
type Migration interface { SQL(dialect Dialect) string Id() string SetId(string) GetCondition() MigrationCondition // SkipMigrationLog is used by dashboard alert migration to Grafana 8 Alerts // for skipping recording it in the migration_log so that it can run several times. // For all the other migrations it should be false. SkipMigrationLog() bool }
type MigrationBase ¶
type MigrationBase struct { Condition MigrationCondition // contains filtered or unexported fields }
func (*MigrationBase) GetCondition ¶
func (m *MigrationBase) GetCondition() MigrationCondition
func (*MigrationBase) Id ¶
func (m *MigrationBase) Id() string
func (*MigrationBase) SetId ¶
func (m *MigrationBase) SetId(id string)
func (*MigrationBase) SkipMigrationLog ¶
func (m *MigrationBase) SkipMigrationLog() bool
type MigrationCondition ¶
type MigrationLog ¶
type Migrator ¶
type Migrator struct { DBEngine *xorm.Engine Dialect Dialect Logger log.Logger Cfg *setting.Cfg // contains filtered or unexported fields }
func NewScopedMigrator ¶
NewScopedMigrator should only be used for the transition to a new storage engine
func (*Migrator) AddCreateMigration ¶
func (mg *Migrator) AddCreateMigration()
AddCreateMigration adds the initial migration log table -- this should likely be automatic and first, but enough tests exists that do not expect that we can keep it explicit
func (*Migrator) AddMigration ¶
func (*Migrator) GetMigrationIDs ¶
func (*Migrator) GetMigrationLog ¶
func (mg *Migrator) GetMigrationLog() (map[string]MigrationLog, error)
func (*Migrator) InTransaction ¶
func (*Migrator) MigrationsCount ¶
func (*Migrator) RemoveMigrationLogs ¶
type MySQLDialect ¶
type MySQLDialect struct {
BaseDialect
}
func (*MySQLDialect) AutoIncrStr ¶
func (db *MySQLDialect) AutoIncrStr() string
func (*MySQLDialect) BatchSize ¶
func (db *MySQLDialect) BatchSize() int
func (*MySQLDialect) BooleanStr ¶
func (db *MySQLDialect) BooleanStr(value bool) string
func (*MySQLDialect) ColumnCheckSQL ¶
func (db *MySQLDialect) ColumnCheckSQL(tableName, columnName string) (string, []interface{})
func (*MySQLDialect) ErrorMessage ¶
func (db *MySQLDialect) ErrorMessage(err error) string
func (*MySQLDialect) IndexCheckSQL ¶
func (db *MySQLDialect) IndexCheckSQL(tableName, indexName string) (string, []interface{})
func (*MySQLDialect) IsDeadlock ¶
func (db *MySQLDialect) IsDeadlock(err error) bool
func (*MySQLDialect) IsUniqueConstraintViolation ¶
func (db *MySQLDialect) IsUniqueConstraintViolation(err error) bool
func (*MySQLDialect) Lock ¶
func (db *MySQLDialect) Lock(cfg LockCfg) error
func (*MySQLDialect) Quote ¶
func (db *MySQLDialect) Quote(name string) string
func (*MySQLDialect) RenameColumn ¶
func (db *MySQLDialect) RenameColumn(table Table, column *Column, newName string) string
func (*MySQLDialect) SQLType ¶
func (db *MySQLDialect) SQLType(c *Column) string
func (*MySQLDialect) SupportEngine ¶
func (db *MySQLDialect) SupportEngine() bool
func (*MySQLDialect) TruncateDBTables ¶
func (db *MySQLDialect) TruncateDBTables(engine *xorm.Engine) error
TruncateDBTables truncates all the tables. A special case is the dashboard_acl table where we keep the default permissions.
func (*MySQLDialect) Unlock ¶
func (db *MySQLDialect) Unlock(cfg LockCfg) error
func (*MySQLDialect) UpdateTableSQL ¶
func (db *MySQLDialect) UpdateTableSQL(tableName string, columns []*Column) string
func (*MySQLDialect) UpsertMultipleSQL ¶
type NotExistsMigrationCondition ¶
type NotExistsMigrationCondition struct{}
func (*NotExistsMigrationCondition) IsFulfilled ¶
func (c *NotExistsMigrationCondition) IsFulfilled(results []map[string][]byte) bool
type PostgresDialect ¶
type PostgresDialect struct {
BaseDialect
}
func (*PostgresDialect) AutoIncrStr ¶
func (db *PostgresDialect) AutoIncrStr() string
func (*PostgresDialect) BatchSize ¶
func (db *PostgresDialect) BatchSize() int
func (*PostgresDialect) BooleanStr ¶
func (db *PostgresDialect) BooleanStr(value bool) string
func (*PostgresDialect) DropIndexSQL ¶
func (db *PostgresDialect) DropIndexSQL(tableName string, index *Index) string
func (*PostgresDialect) ErrorMessage ¶
func (db *PostgresDialect) ErrorMessage(err error) string
func (*PostgresDialect) GetDBName ¶
func (db *PostgresDialect) GetDBName(dsn string) (string, error)
func (*PostgresDialect) IndexCheckSQL ¶
func (db *PostgresDialect) IndexCheckSQL(tableName, indexName string) (string, []interface{})
func (*PostgresDialect) IsDeadlock ¶
func (db *PostgresDialect) IsDeadlock(err error) bool
func (*PostgresDialect) IsUniqueConstraintViolation ¶
func (db *PostgresDialect) IsUniqueConstraintViolation(err error) bool
func (*PostgresDialect) LikeStr ¶
func (db *PostgresDialect) LikeStr() string
func (*PostgresDialect) Lock ¶
func (db *PostgresDialect) Lock(cfg LockCfg) error
func (*PostgresDialect) OrderBy ¶
func (db *PostgresDialect) OrderBy(order string) string
OrderBy normalizes ordering so that nulls end up last in sorting, which they do by default in both sqlite and mysql but not postgres order should be a string like `dashboard.id ASC`
func (*PostgresDialect) PostInsertId ¶
func (db *PostgresDialect) PostInsertId(table string, sess *xorm.Session) error
func (*PostgresDialect) Quote ¶
func (db *PostgresDialect) Quote(name string) string
func (*PostgresDialect) SQLType ¶
func (db *PostgresDialect) SQLType(c *Column) string
func (*PostgresDialect) SupportEngine ¶
func (db *PostgresDialect) SupportEngine() bool
func (*PostgresDialect) TruncateDBTables ¶
func (db *PostgresDialect) TruncateDBTables(engine *xorm.Engine) error
TruncateDBTables truncates all the tables. A special case is the dashboard_acl table where we keep the default permissions.
func (*PostgresDialect) Unlock ¶
func (db *PostgresDialect) Unlock(cfg LockCfg) error
func (*PostgresDialect) UpdateTableSQL ¶
func (db *PostgresDialect) UpdateTableSQL(tableName string, columns []*Column) string
func (*PostgresDialect) UpsertMultipleSQL ¶
func (db *PostgresDialect) UpsertMultipleSQL(tableName string, keyCols, updateCols []string, count int) (string, error)
UpsertMultipleSQL returns the upsert sql statement for PostgreSQL dialect
type RawSQLMigration ¶
type RawSQLMigration struct { MigrationBase // contains filtered or unexported fields }
func NewRawSQLMigration ¶
func NewRawSQLMigration(sql string) *RawSQLMigration
NewRawSQLMigration should be used carefully, the usage of SQL statements that cause breaking changes like renaming a table or a column, or changing a column type should not be used.
func (*RawSQLMigration) Default ¶
func (m *RawSQLMigration) Default(sql string) *RawSQLMigration
func (*RawSQLMigration) Mssql ¶
func (m *RawSQLMigration) Mssql(sql string) *RawSQLMigration
func (*RawSQLMigration) Mysql ¶
func (m *RawSQLMigration) Mysql(sql string) *RawSQLMigration
func (*RawSQLMigration) Postgres ¶
func (m *RawSQLMigration) Postgres(sql string) *RawSQLMigration
func (*RawSQLMigration) SQL ¶
func (m *RawSQLMigration) SQL(dialect Dialect) string
func (*RawSQLMigration) SQLite ¶
func (m *RawSQLMigration) SQLite(sql string) *RawSQLMigration
func (*RawSQLMigration) Set ¶
func (m *RawSQLMigration) Set(dialect string, sql string) *RawSQLMigration
type RenameColumnMigration ¶
type RenameColumnMigration struct { MigrationBase // contains filtered or unexported fields }
func NewRenameColumnMigration ¶
func NewRenameColumnMigration(table Table, column *Column, newName string) *RenameColumnMigration
NewRenameColumnMigration may cause breaking changes. DEPRECATED: It should no longer be used. Kept only for legacy reasons.
func (*RenameColumnMigration) Column ¶
func (m *RenameColumnMigration) Column(column *Column) *RenameColumnMigration
func (*RenameColumnMigration) Rename ¶
func (m *RenameColumnMigration) Rename(newName string) *RenameColumnMigration
func (*RenameColumnMigration) SQL ¶
func (m *RenameColumnMigration) SQL(d Dialect) string
func (*RenameColumnMigration) Table ¶
func (m *RenameColumnMigration) Table(table Table) *RenameColumnMigration
type RenameTableMigration ¶
type RenameTableMigration struct { MigrationBase // contains filtered or unexported fields }
func NewRenameTableMigration ¶
func NewRenameTableMigration(oldName string, newName string) *RenameTableMigration
NewRenameTableMigration may cause breaking changes. DEPRECATED: It should no longer be used. Kept only for legacy reasons.
func (*RenameTableMigration) Rename ¶
func (m *RenameTableMigration) Rename(oldName string, newName string) *RenameTableMigration
func (*RenameTableMigration) SQL ¶
func (m *RenameTableMigration) SQL(d Dialect) string
type SQLite3 ¶
type SQLite3 struct {
BaseDialect
}
func (*SQLite3) AutoIncrStr ¶
func (*SQLite3) BooleanStr ¶
func (*SQLite3) DateTimeFunc ¶
func (*SQLite3) DropIndexSQL ¶
func (*SQLite3) ErrorMessage ¶
func (*SQLite3) IndexCheckSQL ¶
func (*SQLite3) IsDeadlock ¶
func (*SQLite3) IsUniqueConstraintViolation ¶
func (*SQLite3) SupportEngine ¶
func (*SQLite3) TruncateDBTables ¶
TruncateDBTables deletes all data from all the tables and resets the sequences. A special case is the dashboard_acl table where we keep the default permissions.
type TableCharsetMigration ¶
type TableCharsetMigration struct { MigrationBase // contains filtered or unexported fields }
func NewTableCharsetMigration ¶
func NewTableCharsetMigration(tableName string, columns []*Column) *TableCharsetMigration
func (*TableCharsetMigration) SQL ¶
func (m *TableCharsetMigration) SQL(d Dialect) string