Skip to content

Commit

Permalink
make it runnable
Browse files Browse the repository at this point in the history
  • Loading branch information
oaraujocesar committed Oct 4, 2024
1 parent fd3f4bb commit 9c32938
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 5 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
golang 1.23.0
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
ports:
- "${DB_PORT}:5432"
volumes:
- ./internal/database/scripts/create-db.sql:/docker-entrypoint-initdb.d/create_database.sql
- psql_volume:/var/lib/postgresql/data

volumes:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module mpf

go 1.23.1
go 1.23.2

require (
github.com/jackc/pgx/v5 v5.7.1
Expand Down
12 changes: 12 additions & 0 deletions internal/database/scripts/create-db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
DO
$do$
BEGIN
IF NOT EXISTS (
SELECT
FROM pg_catalog.pg_database
WHERE datname = 'mpf'
) THEN
PERFORM dblink_exec('dbname=postgres', 'CREATE DATABASE mpf');
END IF;
END
$do$;
15 changes: 13 additions & 2 deletions internal/database/sqlc/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions internal/database/sqlc/users.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9c32938

Please sign in to comment.