Files
golibs/datastores/sql/postgres/dialect.go
Jacob Bohanon aceea44c90 Extract generic migration logic into datastores/sql/migrate package
Move database-agnostic migration logic (file discovery, version tracking,
bootstrap detection) into a shared migrate package behind a Dialect
interface, leaving postgres as a thin wrapper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:10:11 -05:00

16 lines
506 B
Go

package postgres
import "fmt"
// Dialect implements migrate.Dialect for PostgreSQL.
type Dialect struct{}
// Placeholder returns PostgreSQL's positional bind parameter ($1, $2, …).
func (Dialect) Placeholder(n int) string { return fmt.Sprintf("$%d", n) }
// TableExistsQuery returns a query that checks whether a table exists in
// PostgreSQL using information_schema.
func (Dialect) TableExistsQuery() string {
return "SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name = $1)"
}