MCPcopy
hub / github.com/modelcontextprotocol/registry / ensureMigrationsTable

Method ensureMigrationsTable

internal/database/migrate.go:38–48  ·  view source on GitHub ↗

ensureMigrationsTable creates the migrations tracking table if it doesn't exist

(ctx context.Context)

Source from the content-addressed store, hash-verified

36
37// ensureMigrationsTable creates the migrations tracking table if it doesn't exist
38func (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
51func (m *Migrator) getAppliedMigrations(ctx context.Context) (map[int]bool, error) {

Callers 1

MigrateMethod · 0.95

Calls 1

ExecMethod · 0.80

Tested by

no test coverage detected