Documentation ¶
Overview ¶
Package migration provides facilities for mutating database schema in a controlled manner.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BaseMigrations = []*Migration{ &Migration{ Version: 1, Queries: []*db.QueryPair{ &db.QueryPair{ Query: `CREATE TABLE IF NOT EXISTS killmail ( id INTEGER PRIMARY KEY, esi_hash TEXT NOT NULL, solar_system_id INTEGER NOT NULL, ship_type_id INTEGER, killmail_time INTEGER NOT NULL, killmail_time_agg_day INTEGER NOT NULL, killmail_time_agg_week INTEGER NOT NULL, killmail_time_agg_month INTEGER NOT NULL, character_id INTEGER, corporation_id INTEGER, alliance_id INTEGER, damage_taken INTEGER, position_x REAL, position_y REAL, position_z REAL, is_awox INTEGER, is_npc INTEGER, is_solo INTEGER, location_id INTEGER, zkb_points INTEGER, value_fitted REAL, value_total REAL );`, }, &db.QueryPair{ Query: `CREATE TABLE IF NOT EXISTS attacker ( id INTEGER PRIMARY KEY AUTOINCREMENT, killmail_id INTEGER NOT NULL REFERENCES killmail(id) ON UPDATE CASCADE ON DELETE CASCADE, character_id INTEGER, corporation_id INTEGER, alliance_id INTEGER, damage_done INTEGER, final_blow INTEGER, security_status REAL, ship_type_id INTEGER, weapon_type_id INTEGER );`, }, &db.QueryPair{ Query: `CREATE TABLE IF NOT EXISTS item ( id INTEGER PRIMARY KEY AUTOINCREMENT, killmail_id INTEGER NOT NULL REFERENCES killmail(id) ON UPDATE CASCADE ON DELETE CASCADE, item_type_id INTEGER, flag INTEGER, quantity_destroyed INTEGER, singleton INTEGER );`, }, }, }, }
BaseMigrations is the set of migrations that create the core schema that powers the base product.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides methods for querying the current database schema state and applying needed upgrades.
func NewManager ¶
NewManager returns a new Manager for the given db. A nil db returns an error.
type Migration ¶
A Migration is a collection of queries that will alter the database from one known schema to another.
type Option ¶
An Option mutates potentially unexported fields of the manager in a defined way. Options are provided as an optional slice to NewManager.
func WithLogger ¶
WithLogger applies the given logger to the new Manager instance. A nil logger value returns an error.