Files
shop-go/internal/database/migrate.go
T

20 lines
404 B
Go

package database
import (
"context"
"github.com/jackc/pgx/v5/pgxpool"
)
func Migrate(ctx context.Context, pool *pgxpool.Pool) error {
_, err := pool.Exec(ctx, `
CREATE TABLE IF NOT EXISTS admins (
id SERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
`)
return err
}