Compare commits

..
18 Commits
Author SHA1 Message Date
Dustin Pianalto c9ac3235db Fix syntax errors
CI / build (push) Has been cancelled
2021-01-20 23:18:30 -09:00
Dustin Pianalto 4dc9a6e846 Test adding migration files to container
CI / build (push) Has been cancelled
2021-01-20 23:04:17 -09:00
Dustin Pianalto 662db7cd9d Test adding migration files to container 2021-01-20 23:04:14 -09:00
Dustin Pianalto 57072010dc Test adding migration files to container
CI / build (push) Has been cancelled
2021-01-20 22:44:17 -09:00
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
4 changed files with 21 additions and 13 deletions
+7 -5
View File
@@ -26,11 +26,13 @@ jobs:
with: with:
go-version: 1.15 go-version: 1.15
- name: Install go-bindata - name: Install go-bindata and build migrations
run: go get -u github.com/go-bindata/go-bindata/... env:
GOPATH: /home/runner/work/Geeksbot/
- name: Build migrations run: |
run: go-bindata -pkg migrations -o $GITHUB_WORKSPACE/internal/database/migrations/bindata.go $GITHUB_WORKSPACE/internal/database/migrations/ 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 - name: Build container image
env: env:
+2
View File
@@ -8,6 +8,7 @@ RUN go mod download
COPY . . COPY . .
RUN go install github.com/dustinpianalto/geeksbot/... RUN go install github.com/dustinpianalto/geeksbot/...
RUN go get -u github.com/go-bindata/go-bindata/...
CMD [ "go", "run", "cmd/geeksbot/main.go"] CMD [ "go", "run", "cmd/geeksbot/main.go"]
@@ -16,5 +17,6 @@ from alpine
WORKDIR /bin WORKDIR /bin
COPY --from=dev /go/bin/geeksbot ./geeksbot COPY --from=dev /go/bin/geeksbot ./geeksbot
COPY --from=dev /go/bin/go-bindata ./go-bindata
CMD [ "geeksbot" ] CMD [ "geeksbot" ]
+8 -4
View File
@@ -30,15 +30,19 @@ func ConnectDatabase(dbConnString string) {
db.SetConnMaxLifetime(300) db.SetConnMaxLifetime(300)
d, err := bindata.WithInstance(s) d, err := bindata.WithInstance(s)
if err != nil { 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{}) instance, err := postgres.WithInstance(db, &postgres.Config{})
if err != nil { 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) m, err := migrate.NewWithInstance("go-bindata", d, "postgres", instance)
if err != nil { 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")
} }
@@ -5,7 +5,7 @@ BEGIN;
prefixes varchar(10)[], prefixes varchar(10)[],
PRIMARY KEY(id) PRIMARY KEY(id)
); );
CREATE TYPE IF NOT EXISTS role_type as ENUM ( CREATE TYPE role_type as ENUM (
'normal', 'normal',
'moderator', 'moderator',
'admin', 'admin',
@@ -25,7 +25,7 @@ BEGIN;
id varchar(30), id varchar(30),
guild_id varchar(30), guild_id varchar(30),
admin boolean, admin boolean,
default boolean, default_channel boolean,
new_patron boolean, new_patron boolean,
PRIMARY KEY(id), PRIMARY KEY(id),
CONSTRAINT fk_guild CONSTRAINT fk_guild
@@ -45,7 +45,7 @@ BEGIN;
id varchar(30), id varchar(30),
created_at timestamp, created_at timestamp,
modified_at timestamp, modified_at timestamp,
content varchar(2000) content varchar(2000),
previous_content varchar(2000)[], previous_content varchar(2000)[],
channel_id varchar(30), channel_id varchar(30),
author_id varchar(30), author_id varchar(30),
@@ -89,7 +89,7 @@ BEGIN;
REFERENCES roles(id) REFERENCES roles(id)
ON DELETE SET NULL, ON DELETE SET NULL,
CONSTRAINT fk_tier CONSTRAINT fk_tier
FOREIGN_KEY(next_tier) FOREIGN KEY(next_tier)
REFERENCES patreon_tier(id) REFERENCES patreon_tier(id)
ON DELETE SET NULL ON DELETE SET NULL
); );