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

Method CreateMigrationsTable

postgres.go:41–52  ·  view source on GitHub ↗

CreateMigrationsTable implements the Dialect interface to create the table which tracks applied migrations. It only creates the table if it does not already exist

(ctx context.Context, tx Queryer, tableName string)

Source from the content-addressed store, hash-verified

39// table which tracks applied migrations. It only creates the table if it
40// does not already exist
41func (p postgresDialect) CreateMigrationsTable(ctx context.Context, tx Queryer, tableName string) error {
42 query := fmt.Sprintf(`
43 CREATE TABLE IF NOT EXISTS %s (
44 id VARCHAR(255) NOT NULL,
45 checksum VARCHAR(32) NOT NULL DEFAULT '',
46 execution_time_in_millis INTEGER NOT NULL DEFAULT 0,
47 applied_at TIMESTAMP WITH TIME ZONE NOT NULL
48 )
49 `, tableName)
50 _, err := tx.ExecContext(ctx, query)
51 return err
52}
53
54// InsertAppliedMigration implements the Dialect interface to insert a record
55// into the migrations tracking table *after* a migration has successfully

Callers

nothing calls this directly

Calls 1

ExecContextMethod · 0.65

Tested by

no test coverage detected