MCPcopy Create free account
hub / github.com/adlio/schema / InsertAppliedMigration

Method InsertAppliedMigration

postgres.go:57–67  ·  view source on GitHub ↗

InsertAppliedMigration implements the Dialect interface to insert a record into the migrations tracking table *after* a migration has successfully run.

(ctx context.Context, tx Queryer, tableName string, am *AppliedMigration)

Source from the content-addressed store, hash-verified

55// into the migrations tracking table *after* a migration has successfully
56// run.
57func (p postgresDialect) InsertAppliedMigration(ctx context.Context, tx Queryer, tableName string, am *AppliedMigration) error {
58 query := fmt.Sprintf(`
59 INSERT INTO %s
60 ( id, checksum, execution_time_in_millis, applied_at )
61 VALUES
62 ( $1, $2, $3, $4 )`,
63 tableName,
64 )
65 _, err := tx.ExecContext(ctx, query, am.ID, am.MD5(), am.ExecutionTimeInMillis, am.AppliedAt)
66 return err
67}
68
69// GetAppliedMigrations retrieves all data from the migrations tracking table
70func (p postgresDialect) GetAppliedMigrations(ctx context.Context, tx Queryer, tableName string) (migrations []*AppliedMigration, err error) {

Callers

nothing calls this directly

Calls 2

MD5Method · 0.80
ExecContextMethod · 0.65

Tested by

no test coverage detected