Compare commits

..
14 Commits
Author SHA1 Message Date
Dustin Pianalto ab8db644cb Test adding migration files to container
CI / build (push) Has been cancelled
2021-01-20 22:40:15 -09:00
Dustin Pianalto 1d3a218e2d Check error when running migrations
CI / build (push) Has been cancelled
2021-01-20 22:37:04 -09:00
Dustin Pianalto 080a417eff Check error when running migrations
CI / build (push) Has been cancelled
2021-01-20 22:21:01 -09:00
Dustin Pianalto 4e1fa43e8e Fix typo in workflow
CI / build (push) Has been cancelled
2021-01-20 22:13:59 -09:00
Dustin Pianalto eed0ca1865 Fix typo in workflow
CI / build (push) Has been cancelled
2021-01-20 22:11:22 -09:00
Dustin Pianalto 2e7b1d2531 Fix typo in workflow
CI / build (push) Has been cancelled
2021-01-20 22:10:39 -09:00
Dustin Pianalto cd0fb03605 Fix typo in workflow
CI / build (push) Has been cancelled
2021-01-20 22:08:22 -09:00
Dustin Pianalto cc8fff4e3d Fix typo in workflow
CI / build (push) Has been cancelled
2021-01-20 21:59:24 -09:00
Dustin Pianalto 3e98bd145a Fix typo in workflow
CI / build (push) Has been cancelled
2021-01-20 21:53:56 -09:00
Dustin Pianalto 36a3cd26ba Fix typo in workflow
CI / build (push) Has been cancelled
2021-01-20 21:50:13 -09:00
Dustin Pianalto d3bbef1d7f Fix typo in workflow
CI / build (push) Has been cancelled
2021-01-20 21:40:29 -09:00
Dustin Pianalto bec8f37fa5 Fix typo in workflow
CI / build (push) Has been cancelled
2021-01-20 21:37:58 -09:00
Dustin Pianalto a097deefac Fix typo in workflow
CI / build (push) Has been cancelled
2021-01-20 21:36:43 -09:00
Dustin Pianalto 0b310e3d00 Fix typo in workflow
CI / build (push) Has been cancelled
2021-01-20 21:28:55 -09:00
3 changed files with 16 additions and 9 deletions
+7 -5
View File
@@ -26,11 +26,13 @@ jobs:
with:
go-version: 1.15
- name: Install go-bindata
run: go get -u github.com/go-bindata/go-bindata/...
- name: Build migrations
run: go-bindata -pkg migrations -o $GITHUB_WORKSPACE/internal/database/migrations/bindata.go $GITHUB_WORKSPACE/internal/database/migrations/
- name: Install go-bindata and build migrations
env:
GOPATH: /home/runner/work/Geeksbot/
run: |
go get -u github.com/go-bindata/go-bindata/...
/home/runner/work/Geeksbot/bin/go-bindata -pkg migrations -o $GITHUB_WORKSPACE/internal/database/migrations/bindata.go $GITHUB_WORKSPACE/internal/database/migrations/
head $GITHUB_WORKSPACE/internal/database/migrations/bindata.go
- name: Build container image
env:
+1
View File
@@ -16,5 +16,6 @@ from alpine
WORKDIR /bin
COPY --from=dev /go/bin/geeksbot ./geeksbot
COPY --from=dev /go/src/Geeksbot/internal/database/migrations/* ./
CMD [ "geeksbot" ]
+8 -4
View File
@@ -30,15 +30,19 @@ func ConnectDatabase(dbConnString string) {
db.SetConnMaxLifetime(300)
d, err := bindata.WithInstance(s)
if err != nil {
log.Fatal(fmt.Errorf("Cannot load migrations: %w", err))
log.Fatal(fmt.Errorf("cannot load migrations: %w", err))
}
instance, err := postgres.WithInstance(db, &postgres.Config{})
if err != nil {
log.Fatal(fmt.Errorf("Cannot create db driver: %w", err))
log.Fatal(fmt.Errorf("cannot create db driver: %w", err))
}
m, err := migrate.NewWithInstance("go-bindata", d, "postgres", instance)
if err != nil {
log.Fatal(fmt.Errorf("Cannot create migration instance: %w", err))
log.Fatal(fmt.Errorf("cannot create migration instance: %w", err))
}
m.Up()
err = m.Up()
if err != nil {
log.Fatal(fmt.Errorf("error running migrations: %w", err))
}
log.Println("Migrations Run")
}