MCPcopy
hub / github.com/rubenv/sql-migrate / GetMigrationRecords

Method GetMigrationRecords

migrate.go:825–839  ·  view source on GitHub ↗
(db *sql.DB, dialect string)

Source from the content-addressed store, hash-verified

823}
824
825func (ms MigrationSet) GetMigrationRecords(db *sql.DB, dialect string) ([]*MigrationRecord, error) {
826 dbMap, err := ms.getMigrationDbMap(db, dialect)
827 if err != nil {
828 return nil, err
829 }
830
831 var records []*MigrationRecord
832 query := fmt.Sprintf("SELECT * FROM %s ORDER BY %s ASC", dbMap.Dialect.QuotedTableForQuery(ms.SchemaName, ms.getTableName()), dbMap.Dialect.QuoteField("id"))
833 _, err = dbMap.Select(&records, query)
834 if err != nil {
835 return nil, err
836 }
837
838 return records, nil
839}
840
841func (ms MigrationSet) getMigrationDbMap(db *sql.DB, dialect string) (*gorp.DbMap, error) {
842 d, ok := MigrationDialects[dialect]

Callers 2

GetMigrationRecordsFunction · 0.80
RunMethod · 0.80

Calls 2

getMigrationDbMapMethod · 0.95
getTableNameMethod · 0.95

Tested by

no test coverage detected