-
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
1 parent
de8824a
commit 870748c
Showing
12 changed files
with
226 additions
and
54 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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
dev: | ||
make -j docker-up | ||
|
||
dev-stop: | ||
docker compose down | ||
|
||
docker-up: | ||
docker compose up -d | ||
|
||
|
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,11 @@ | ||
meta { | ||
name: Health | ||
type: http | ||
seq: 1 | ||
} | ||
|
||
get { | ||
url: /health | ||
body: none | ||
auth: none | ||
} |
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,16 @@ | ||
# Database Migrations | ||
|
||
The production db is hosted in a fly.io app, so to run a migration, we must do it locally by creating | ||
a proxy connection to the fly.io Postgres app. | ||
|
||
Create the proxy | ||
|
||
```sh | ||
fly proxy 5432 -a sac-tech-job-board-db | ||
``` | ||
|
||
Then, in another terminal window | ||
|
||
```sh | ||
go run main.go | ||
``` |
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,29 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"os" | ||
|
||
"github.com/golang-migrate/migrate/v4" | ||
_ "github.com/golang-migrate/migrate/v4/database/postgres" | ||
_ "github.com/golang-migrate/migrate/v4/source/file" | ||
_ "github.com/joho/godotenv/autoload" | ||
) | ||
|
||
func main() { | ||
dbURL, ok := os.LookupEnv("POSTGRES_URL") | ||
if !ok { | ||
log.Fatal("POSTGRES_URL is not set") | ||
} | ||
|
||
m, err := migrate.New("file://migrations", dbURL) | ||
if err != nil { | ||
log.Fatalf("error creating migrator: %v\n", err) | ||
} | ||
|
||
if err := m.Up(); err != nil { | ||
log.Fatalf("error applying migrations: %v\n", err) | ||
} | ||
|
||
log.Println("migrations applied") | ||
} |
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,11 @@ | ||
DROP schema IF EXISTS users CASCADE; | ||
|
||
DROP schema IF EXISTS organizations CASCADE; | ||
|
||
DROP schema IF EXISTS jobs CASCADE; | ||
|
||
DROP TYPE IF EXISTS public.employment_type CASCADE; | ||
|
||
DROP TYPE IF EXISTS public.pay_type CASCADE; | ||
|
||
DROP FUNCTION IF EXISTS public.updated_timestamp() CASCADE; |
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
Oops, something went wrong.