ensureMigrationsTable creates the migrations tracking table if it doesn't exist
(ctx context.Context)
| 36 | |
| 37 | // ensureMigrationsTable creates the migrations tracking table if it doesn't exist |
| 38 | func (m *Migrator) ensureMigrationsTable(ctx context.Context) error { |
| 39 | query := ` |
| 40 | CREATE TABLE IF NOT EXISTS schema_migrations ( |
| 41 | version INTEGER PRIMARY KEY, |
| 42 | name VARCHAR(255) NOT NULL, |
| 43 | applied_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() |
| 44 | ) |
| 45 | ` |
| 46 | _, err := m.conn.Exec(ctx, query) |
| 47 | return err |
| 48 | } |
| 49 | |
| 50 | // getAppliedMigrations returns a map of already applied migration versions |
| 51 | func (m *Migrator) getAppliedMigrations(ctx context.Context) (map[int]bool, error) { |