Mirror for https://github.com/STBoyden/go-portfolio
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs(migrations): add documentation for RunMigrations

Generated by CodeRabbit

stboyden.com 2bce106a 23a66cc9

verified
+8
+8
internal/pkg/migrations/migrations.go
··· 15 15 16 16 var ErrDatabaseEnvironmentVariableNotSet = errors.New("DB_URL environment variable not set") 17 17 18 + // RunMigrations applies database schema migrations to a PostgreSQL database 19 + // using the specified migration source. It loads environment variables from a 20 + // predefined file and checks for the "DB_URL" variable (trimming any 21 + // surrounding quotes). If "DB_URL" is missing, it returns 22 + // [ErrDatabaseEnvironmentVariableNotSet]. It then opens a PostgreSQL driver 23 + // connection, initializes a migration instance with the given source, and 24 + // executes the migration using the Up method, returning any errors encountered 25 + // except for those indicating no changes. 18 26 func RunMigrations(source string) error { 19 27 env, _ := gotenv.LoadEnvFromFS(fs.EnvFile, gotenv.LoadOptions{OverrideExistingVars: false}) 20 28