PrintStatus prints the status of each built-in migration.
(db pg.DB)
| 56 | |
| 57 | // PrintStatus prints the status of each built-in migration. |
| 58 | func PrintStatus(db pg.DB) error { |
| 59 | err := loadStatus(db, migrations) |
| 60 | if err != nil { |
| 61 | return err |
| 62 | } |
| 63 | |
| 64 | fmt.Printf("%-60s\t%-6s\t%s\n", "filename", "hash", "applied_at") |
| 65 | for _, m := range migrations { |
| 66 | appliedAt := "(pending)" |
| 67 | if !m.AppliedAt.IsZero() { |
| 68 | appliedAt = m.AppliedAt.Format(time.RFC3339) |
| 69 | } |
| 70 | fmt.Printf("%-60s\t%-6s\t%s\n", m.Name, m.Hash[:6], appliedAt) |
| 71 | } |
| 72 | return nil |
| 73 | } |
| 74 | |
| 75 | const createMigrationTableSQL = ` |
| 76 | CREATE TABLE IF NOT EXISTS migrations ( |
nothing calls this directly
no test coverage detected