Documentation ¶
Overview ¶
migrate is the simple migrator, it has one option, which is whether it should remove other tables and fields that aren't mentioned in the schema.
Index ¶
- type Alterer
- type Database
- type GenericDB
- func (g *GenericDB) CreateColumn(table *schema.Table, col *schema.Column) error
- func (g *GenericDB) CreateIndex(table *schema.Table, index schema.Index) error
- func (g *GenericDB) CreateTable(table *schema.Table) error
- func (g *GenericDB) HasColumn(table *schema.Table, col *schema.Column) (bool, error)
- func (g *GenericDB) HasIndex(table *schema.Table, index schema.Index) (bool, error)
- func (g *GenericDB) HasTable(table *schema.Table) (bool, error)
- func (g *GenericDB) ModifyColumn(table *schema.Table, col *schema.Column) error
- func (g *GenericDB) RemoveColumn(table *schema.Table, col *schema.Column) error
- func (g *GenericDB) RemoveIndex(table *schema.Table, index schema.Index) error
- func (g *GenericDB) RemoveTable(table *schema.Table) error
- func (g *GenericDB) RenameColumn(table *schema.Table, col *schema.Column) error
- func (g *GenericDB) RenameTable(table *schema.Table, oldName string) error
- func (g *GenericDB) UpdateTable(table *schema.Table) error
- type MysqlDB
- type PostgresDB
- func (p *PostgresDB) CreateIndex(table *schema.Table, index schema.Index) error
- func (p *PostgresDB) CreateTable(table *schema.Table) error
- func (p *PostgresDB) HasColumn(table *schema.Table, col *schema.Column) (bool, error)
- func (p *PostgresDB) HasIndex(table *schema.Table, index schema.Index) (bool, error)
- func (p PostgresDB) HasTable(table *schema.Table) (bool, error)
- func (p *PostgresDB) LengthableColumns() map[string]bool
- func (*PostgresDB) String() string
- func (p *PostgresDB) UpdateTable(table *schema.Table) error
- type SqliteDB
- func (s *SqliteDB) CreateIndex(table *schema.Table, index schema.Index) error
- func (s *SqliteDB) CreateTable(table *schema.Table) error
- func (s *SqliteDB) HasColumn(table *schema.Table, col *schema.Column) (bool, error)
- func (s *SqliteDB) HasIndex(table *schema.Table, index schema.Index) (bool, error)
- func (s *SqliteDB) HasTable(table *schema.Table) (bool, error)
- func (*SqliteDB) LengthableColumns() map[string]bool
- func (*SqliteDB) String() string
- func (s *SqliteDB) UpdateTable(table *schema.Table) error
- type System
- type Translator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alterer ¶
type Alterer interface { HasTable(*schema.Table) (bool, error) CreateTable(*schema.Table) error RemoveTable(*schema.Table) error UpdateTable(*schema.Table) error RenameTable(*schema.Table, string) error HasColumn(*schema.Table, *schema.Column) (bool, error) CreateColumn(*schema.Table, *schema.Column) error ModifyColumn(*schema.Table, *schema.Column) error RenameColumn(*schema.Table, *schema.Column) error RemoveColumn(*schema.Table, *schema.Column) error HasIndex(*schema.Table, schema.Index) (bool, error) CreateIndex(*schema.Table, schema.Index) error RemoveIndex(*schema.Table, schema.Index) error // contains filtered or unexported methods }
type Database ¶
type Database struct { Alterer DB *sql.DB Schema schema.Schema Translator NewTables []*schema.Table ModifiedTables []*schema.Table DBMS System Log *log.Logger }
func (*Database) ForeignKeysSatisfied ¶
func (*Database) PareFields ¶
func (*Database) SetAlterer ¶
func (d *Database) SetAlterer()
type GenericDB ¶
type GenericDB struct { DB *sql.DB Specific Alterer Convert Translator Log *log.Logger PrimaryKeyDef string LengthableColumns map[string]bool }
func (*GenericDB) CreateColumn ¶
func (*GenericDB) CreateIndex ¶
func (*GenericDB) ModifyColumn ¶
func (*GenericDB) RemoveColumn ¶
func (*GenericDB) RemoveIndex ¶
func (*GenericDB) RenameColumn ¶
func (*GenericDB) RenameTable ¶
type MysqlDB ¶
type MysqlDB struct {
GenericDB
}
MysqlDB is ugh
func (*MysqlDB) CreateIndex ¶
func (*MysqlDB) LengthableColumns ¶
type PostgresDB ¶
type PostgresDB struct {
GenericDB
}
PostgresDB is pretty much the same as sqlite, except it can modify columns
func (*PostgresDB) CreateIndex ¶
func (*PostgresDB) CreateTable ¶
func (p *PostgresDB) CreateTable(table *schema.Table) error
func (*PostgresDB) LengthableColumns ¶
func (p *PostgresDB) LengthableColumns() map[string]bool
func (*PostgresDB) String ¶
func (*PostgresDB) String() string
func (*PostgresDB) UpdateTable ¶
func (p *PostgresDB) UpdateTable(table *schema.Table) error
Click to show internal directories.
Click to hide internal directories.