-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
190 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
PORT=8080 | ||
APP_ENV=local | ||
|
||
DB_HOST=localhost | ||
DB_PORT=5432 | ||
DB_DATABASE=blueprint | ||
DB_USERNAME=melkey | ||
DB_PASSWORD=password1234 | ||
DB_SCHEMA=public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package database | ||
|
||
import ( | ||
"database/sql" | ||
"embed" | ||
|
||
"github.com/pressly/goose/v3" | ||
) | ||
|
||
//go:embed migrations/*.sql | ||
var embedMigrations embed.FS | ||
|
||
func Up(db *sql.DB) { | ||
goose.SetBaseFS(embedMigrations) | ||
|
||
if err := goose.SetDialect("postgres"); err != nil { | ||
panic(err) | ||
} | ||
|
||
if err := goose.Up(db, "migrations"); err != nil { | ||
panic(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- +goose Up | ||
-- +goose StatementBegin | ||
CREATE TABLE IF NOT EXISTS users ( | ||
id SERIAL PRIMARY KEY, | ||
name VARCHAR(255) NOT NULL | ||
); | ||
-- +goose StatementEnd | ||
|
||
-- +goose Down | ||
-- +goose StatementBegin | ||
DROP TABLE IF EXISTS users; | ||
-- +goose StatementEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- name: GetUsers :many | ||
SELECT * FROM users; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: "2" | ||
sql: | ||
- engine: "postgresql" | ||
queries: "internal/database/queries" | ||
schema: "internal/database/migrations" | ||
gen: | ||
go: | ||
package: "database" | ||
out: "internal/database/sqlc" | ||
sql_package: "pgx/v5" |