- final devops magick;
This commit is contained in:
parent
afa3e03a27
commit
e99506032b
|
|
@ -9,6 +9,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install -ldflags '-extldflags "-sta
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=app-builder /go/bin/main /ticket-pimp
|
COPY --from=app-builder /go/bin/main /ticket-pimp
|
||||||
COPY --from=app-builder /go/src/ticket-pimp/cmd/prod.env /
|
COPY --from=app-builder /go/src/ticket-pimp/cmd/prod.env /
|
||||||
|
COPY --from=app-builder /go/src/ticket-pimp/internal/storage/migrate/* /internal/storage/migrate/
|
||||||
# the tls certificates:
|
# the tls certificates:
|
||||||
# NB: this pulls directly from the upstream image, which already has ca-certificates:
|
# NB: this pulls directly from the upstream image, which already has ca-certificates:
|
||||||
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ func initBotWith(token string) *discordgo.Session {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("unable to create discord session: %v", err)
|
log.Fatalf("unable to create discord session: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return discord
|
return discord
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,6 +42,7 @@ func checkPrivateMessaging(s *discordgo.Session, i *discordgo.InteractionCreate)
|
||||||
})
|
})
|
||||||
return errors.New("no private messages! lol")
|
return errors.New("no private messages! lol")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,9 +112,16 @@ func (c *client) createRepoHandler(s *discordgo.Session, i *discordgo.Interactio
|
||||||
// Making request:
|
// Making request:
|
||||||
resp := c.controller.CreateGit(context.TODO(), req)
|
resp := c.controller.CreateGit(context.TODO(), req)
|
||||||
if resp.Project == nil {
|
if resp.Project == nil {
|
||||||
result = resp.Message.Error()
|
if resp.Message != nil {
|
||||||
|
result = resp.Message.Error()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
result = resp.Project.DiscordString() + "Errors: " + resp.Message.Error()
|
|
||||||
|
result = resp.Project.DiscordString()
|
||||||
|
if resp.Message != nil {
|
||||||
|
result += "Errors: " + resp.Message.Error()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
c.defaultFollowUp(result, s, i)
|
c.defaultFollowUp(result, s, i)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,15 @@ func (c *client) getInfo(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result = err.Error()
|
result = err.Error()
|
||||||
} else {
|
} else {
|
||||||
result = project.DiscordString()
|
if project != nil {
|
||||||
if err != nil {
|
result = project.DiscordString()
|
||||||
result += "Errors: " + err.Error()
|
if err != nil {
|
||||||
|
result += "Errors: " + err.Error()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result = "Something wrong with retrieving project from db"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -198,14 +203,14 @@ func (c *client) createTicketHandler(s *discordgo.Session, i *discordgo.Interact
|
||||||
|
|
||||||
dchan, err = s.ChannelEdit(dchan.ID, &edit)
|
dchan, err = s.ChannelEdit(dchan.ID, &edit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result = fmt.Sprintf("channel created, but unable to edit: %v\n", err)
|
result = fmt.Sprintf("channel %s created, but unable to edit follow up message: %v\n", p.ShortName, err)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_, err = s.ChannelMessageSend(dchan.ID, "Hello!")
|
_, err = s.ChannelMessageSend(dchan.ID, "Hello!")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("message send problem: %v\n", err)
|
log.Printf("message send problem: %v\n", err)
|
||||||
}
|
}
|
||||||
result = dchan.ID
|
result = "Project " + p.ShortName + "Was created"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
40
cmd/main.go
40
cmd/main.go
|
|
@ -16,11 +16,18 @@ import (
|
||||||
"ticket-pimp/client/telegram"
|
"ticket-pimp/client/telegram"
|
||||||
|
|
||||||
"github.com/jackc/pgx/v5/pgxpool"
|
"github.com/jackc/pgx/v5/pgxpool"
|
||||||
|
"github.com/jackc/pgx/v5/stdlib"
|
||||||
|
migrate "github.com/rubenv/sql-migrate"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
envfile = "prod.env"
|
||||||
|
migrationfile = "internal/storage/migrate"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.Print("started")
|
log.Print("started")
|
||||||
config := domain.InitConfig("develop.env")
|
config := domain.InitConfig(envfile)
|
||||||
run(config)
|
run(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,17 +36,40 @@ func run(conf domain.Config) {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// -- DB connection init -- START
|
// -- DB connection init -- START
|
||||||
|
connString := fmt.Sprintf(
|
||||||
|
"postgresql://%s:%s@%s:%s/%s",
|
||||||
|
conf.DB.User, conf.DB.Pass, conf.DB.Host, conf.DB.Port, conf.DB.Name,
|
||||||
|
)
|
||||||
conn, err := pgxpool.New(
|
conn, err := pgxpool.New(
|
||||||
ctx,
|
ctx,
|
||||||
fmt.Sprintf(
|
connString)
|
||||||
"postgresql://%s:%s@%s:%s/%s",
|
|
||||||
conf.DB.User, conf.DB.Pass, conf.DB.Host, conf.DB.Port, conf.DB.Name,
|
|
||||||
))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("DB connection failed: %v", err)
|
log.Fatalf("DB connection failed: %v", err)
|
||||||
}
|
}
|
||||||
// -- DB connection init -- END
|
// -- DB connection init -- END
|
||||||
|
|
||||||
|
// Aply migrations:
|
||||||
|
|
||||||
|
dbConnConfig, err := pgxpool.ParseConfig(connString)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("unable to parse connString: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
migrations := &migrate.FileMigrationSource{
|
||||||
|
Dir: migrationfile,
|
||||||
|
}
|
||||||
|
|
||||||
|
db := stdlib.OpenDB(*dbConnConfig.ConnConfig)
|
||||||
|
|
||||||
|
const dialect = "postgres"
|
||||||
|
n, err := migrate.Exec(db, dialect, migrations, migrate.Up)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("unable to handle migrations: %v", err)
|
||||||
|
}
|
||||||
|
fmt.Printf("Applied %d migrations!\n", n)
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
gitService := services.NewGit(conf.Git)
|
gitService := services.NewGit(conf.Git)
|
||||||
cloudService := services.NewCloud(conf.Cloud)
|
cloudService := services.NewCloud(conf.Cloud)
|
||||||
codaService := services.NewCodaClient(conf.Coda)
|
codaService := services.NewCodaClient(conf.Coda)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
services:
|
||||||
|
ticket-pimp:
|
||||||
|
container_name: pimp
|
||||||
|
image: naudachu/ticket-pimp
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
postgres:
|
||||||
|
container_name: db
|
||||||
|
image: "postgres:16.1-alpine3.18"
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: "tickets"
|
||||||
|
POSTGRES_USER: "postgres"
|
||||||
|
POSTGRES_PASSWORD: "postgres"
|
||||||
|
volumes:
|
||||||
|
- db:./postgres-data:/var/lib/postgresql/data
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "pg_isready", "-q", "-d", "tickets", "-U", "postgres" ]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
4
go.mod
4
go.mod
|
|
@ -11,6 +11,7 @@ require (
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
|
||||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
||||||
github.com/golang/mock v1.6.0 // indirect
|
github.com/golang/mock v1.6.0 // indirect
|
||||||
github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect
|
github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect
|
||||||
|
|
@ -19,12 +20,15 @@ require (
|
||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
||||||
|
github.com/jackc/pgx v3.6.2+incompatible // indirect
|
||||||
github.com/jackc/puddle/v2 v2.2.1 // indirect
|
github.com/jackc/puddle/v2 v2.2.1 // indirect
|
||||||
github.com/onsi/ginkgo/v2 v2.10.0 // indirect
|
github.com/onsi/ginkgo/v2 v2.10.0 // indirect
|
||||||
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/quic-go/qpack v0.4.0 // indirect
|
github.com/quic-go/qpack v0.4.0 // indirect
|
||||||
github.com/quic-go/qtls-go1-19 v0.3.2 // indirect
|
github.com/quic-go/qtls-go1-19 v0.3.2 // indirect
|
||||||
github.com/quic-go/qtls-go1-20 v0.2.2 // indirect
|
github.com/quic-go/qtls-go1-20 v0.2.2 // indirect
|
||||||
github.com/quic-go/quic-go v0.35.1 // indirect
|
github.com/quic-go/quic-go v0.35.1 // indirect
|
||||||
|
github.com/rubenv/sql-migrate v1.5.2 // indirect
|
||||||
github.com/stretchr/testify v1.8.4 // indirect
|
github.com/stretchr/testify v1.8.4 // indirect
|
||||||
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce // indirect
|
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce // indirect
|
||||||
golang.org/x/crypto v0.10.0 // indirect
|
golang.org/x/crypto v0.10.0 // indirect
|
||||||
|
|
|
||||||
10
go.sum
10
go.sum
|
|
@ -3,6 +3,8 @@ github.com/bwmarrin/discordgo v0.27.1/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/go-gorp/gorp/v3 v3.1.0 h1:ItKF/Vbuj31dmV4jxA1qblpSwkl9g1typ24xoe70IGs=
|
||||||
|
github.com/go-gorp/gorp/v3 v3.1.0/go.mod h1:dLEjIyyRNiXvNZ8PSmzpt1GsWAUK8kjVhEpjH8TixEw=
|
||||||
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
|
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
|
||||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
||||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
|
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
|
||||||
|
|
@ -27,6 +29,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
|
||||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
|
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
|
||||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||||
|
github.com/jackc/pgx v3.6.2+incompatible h1:2zP5OD7kiyR3xzRYMhOcXVvkDZsImVXfj+yIyTQf3/o=
|
||||||
|
github.com/jackc/pgx v3.6.2+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I=
|
||||||
github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY=
|
github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY=
|
||||||
github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA=
|
github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA=
|
||||||
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
|
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
|
||||||
|
|
@ -38,6 +42,8 @@ github.com/mr-linch/go-tg v0.9.1/go.mod h1:276w69YW4pEo3ZYta+LQe4v/ut2w2h1ksP4zi
|
||||||
github.com/onsi/ginkgo/v2 v2.10.0 h1:sfUl4qgLdvkChZrWCYndY2EAu9BRIw1YphNAzy1VNWs=
|
github.com/onsi/ginkgo/v2 v2.10.0 h1:sfUl4qgLdvkChZrWCYndY2EAu9BRIw1YphNAzy1VNWs=
|
||||||
github.com/onsi/ginkgo/v2 v2.10.0/go.mod h1:UDQOh5wbQUlMnkLfVaIUMtQ1Vus92oM+P2JX1aulgcE=
|
github.com/onsi/ginkgo/v2 v2.10.0/go.mod h1:UDQOh5wbQUlMnkLfVaIUMtQ1Vus92oM+P2JX1aulgcE=
|
||||||
github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU=
|
github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU=
|
||||||
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
|
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
|
||||||
|
|
@ -48,8 +54,11 @@ github.com/quic-go/qtls-go1-20 v0.2.2 h1:WLOPx6OY/hxtTxKV1Zrq20FtXtDEkeY00CGQm8G
|
||||||
github.com/quic-go/qtls-go1-20 v0.2.2/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM=
|
github.com/quic-go/qtls-go1-20 v0.2.2/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM=
|
||||||
github.com/quic-go/quic-go v0.35.1 h1:b0kzj6b/cQAf05cT0CkQubHM31wiA+xH3IBkxP62poo=
|
github.com/quic-go/quic-go v0.35.1 h1:b0kzj6b/cQAf05cT0CkQubHM31wiA+xH3IBkxP62poo=
|
||||||
github.com/quic-go/quic-go v0.35.1/go.mod h1:+4CVgVppm0FNjpG3UcX8Joi/frKOH7/ciD5yGcwOO1g=
|
github.com/quic-go/quic-go v0.35.1/go.mod h1:+4CVgVppm0FNjpG3UcX8Joi/frKOH7/ciD5yGcwOO1g=
|
||||||
|
github.com/rubenv/sql-migrate v1.5.2 h1:bMDqOnrJVV/6JQgQ/MxOpU+AdO8uzYYA/TxFUBzFtS0=
|
||||||
|
github.com/rubenv/sql-migrate v1.5.2/go.mod h1:H38GW8Vqf8F0Su5XignRyaRcbXbJunSWxs+kmzlg0Is=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
|
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
|
||||||
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
|
@ -105,3 +114,4 @@ google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
development:
|
development:
|
||||||
dialect: postgres
|
dialect: postgres
|
||||||
datasource: host=localhost dbname=tickets user=postgres password=postgres sslmode=disable
|
datasource: host=postgres dbname=tickets user=postgres password=postgres sslmode=disable
|
||||||
dir: migrate
|
dir: migrate
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
-- +migrate Up
|
|
||||||
CREATE TABLE tickets (
|
|
||||||
id SERIAL PRIMARY KEY,
|
|
||||||
key VARCHAR(10),
|
|
||||||
channelID VARCHAR(255),
|
|
||||||
project_git VARCHAR(255),
|
|
||||||
build_git VARCHAR(255),
|
|
||||||
folder VARCHAR(255),
|
|
||||||
created_at TIMESTAMPTZ DEFAULT current_timestamp,
|
|
||||||
deleted_at TIMESTAMPTZ,
|
|
||||||
updated_at TIMESTAMPTZ
|
|
||||||
);
|
|
||||||
|
|
||||||
-- +migrate Down
|
|
||||||
DROP TABLE tickets;
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
-- +migrate Up
|
||||||
|
CREATE TABLE appconfig (
|
||||||
|
ticket_key VARCHAR(5),
|
||||||
|
ticket_id INT
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO appconfig (ticket_key, ticket_id) VALUES ('xpp', 1);
|
||||||
|
|
||||||
|
CREATE TABLE tickets (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
key VARCHAR(10),
|
||||||
|
channelID VARCHAR(255),
|
||||||
|
project_git VARCHAR(255),
|
||||||
|
build_git VARCHAR(255),
|
||||||
|
folder VARCHAR(255),
|
||||||
|
|
||||||
|
created_at TIMESTAMPTZ DEFAULT current_timestamp,
|
||||||
|
deleted_at TIMESTAMPTZ,
|
||||||
|
updated_at TIMESTAMPTZ
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE tasks (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
creator VARCHAR(255),
|
||||||
|
creator_link VARCHAR(255),
|
||||||
|
messageID VARCHAR(255),
|
||||||
|
|
||||||
|
description TEXT,
|
||||||
|
assignee VARCHAR(255),
|
||||||
|
|
||||||
|
created_at TIMESTAMPTZ DEFAULT current_timestamp,
|
||||||
|
deleted_at TIMESTAMPTZ,
|
||||||
|
updated_at TIMESTAMPTZ
|
||||||
|
);
|
||||||
|
|
||||||
|
-- +migrate Down
|
||||||
|
DROP TABLE tickets;
|
||||||
|
DROP TABLE appconfig;
|
||||||
|
DROP TABLE tasks;
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
-- +migrate Up
|
|
||||||
CREATE TABLE appconfig (
|
|
||||||
ticket_key VARCHAR(5),
|
|
||||||
ticket_id INT
|
|
||||||
);
|
|
||||||
|
|
||||||
-- +migrate Up
|
|
||||||
INSERT INTO appconfig (ticket_key, ticket_id) VALUES ('P', 100);
|
|
||||||
|
|
||||||
-- +migrate Down
|
|
||||||
DROP TABLE appconfig;
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
-- +migrate Up
|
|
||||||
CREATE TABLE tasks (
|
|
||||||
id SERIAL PRIMARY KEY,
|
|
||||||
creator VARCHAR(255),
|
|
||||||
creator_link VARCHAR(255),
|
|
||||||
messageID VARCHAR(255),
|
|
||||||
|
|
||||||
description TEXT,
|
|
||||||
assignee VARCHAR(255),
|
|
||||||
|
|
||||||
created_at TIMESTAMPTZ DEFAULT current_timestamp,
|
|
||||||
deleted_at TIMESTAMPTZ,
|
|
||||||
updated_at TIMESTAMPTZ
|
|
||||||
);
|
|
||||||
|
|
||||||
-- +migrate Down
|
|
||||||
DROP TABLE tasks;
|
|
||||||
Loading…
Reference in New Issue