Skip to content

Commit

Permalink
chore(prisma): upgrade to prisma 4.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
steebchen committed Feb 8, 2023
1 parent d69488b commit f405c72
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- uses: actions/checkout@v3

- name: integration
run: docker build . -f test/integration/integration.dockerfile -t integration && docker run integration
run: docker build . --platform linux/amd64 -f test/integration/integration.dockerfile -t integration && docker run --platform linux/amd64 integration
4 changes: 2 additions & 2 deletions binaries/binaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
)

// PrismaVersion is a hardcoded version of the Prisma CLI.
const PrismaVersion = "4.7.1"
const PrismaVersion = "4.9.0"

// EngineVersion is a hardcoded version of the Prisma Engine.
// The versions can be found under https://github.com/prisma/prisma-engines/commits/master
const EngineVersion = "272861e07ab64f234d3ffc4094e32bd61775599c"
const EngineVersion = "ceb5c99003b99c9ee2c1d2e618e359c14aef2ea5"

// PrismaURL points to an S3 bucket URL where the CLI binaries are stored.
var PrismaURL = "https://packaged-cli.prisma.sh/%s-%s-%s-x64.gz"
Expand Down
18 changes: 5 additions & 13 deletions binaries/bindata/bindata.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,15 @@ func WriteFile(name, pkg, platform, from, to string) error {
func writeHeader(w io.Writer, pkg, name, platform string) error {
var constraints string
if platform == "linux" {
if name == "linux" {
// TODO dynamically construct these with allTargets in run.go
// TODO only include these for engines, not for the CLI
constraints = `// +build !debian_openssl_1_0_x
// +build !debian_openssl_1_1_x
// +build !rhel_openssl_1_0_x
// +build !rhel_openssl_1_1_x`
constraints += "\n"
} else {
constraints = "// +build linux\n"
}
constraints = "// +build linux\n"
}

// TODO jjajajajajajaj
constraints = ""

_, err := fmt.Fprintf(w, `// Code generated by Prisma Client Go. DO NOT EDIT.
//nolint
// +build !codeanalysis
// +build %s
// +build !prisma_ignore
%s
package %s
Expand All @@ -62,7 +54,7 @@ import (
func init() {
unpack.Unpack(data, "%s", "%s")
}
`, name, constraints, pkg, name, binaries.EngineVersion)
`, constraints, pkg, name, binaries.EngineVersion)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion generator/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ func generateBinaries(input *Root) error {
}

targets = add(targets, "native")
targets = add(targets, "linux")

// TODO refactor
for _, name := range targets {
Expand Down Expand Up @@ -178,6 +177,7 @@ func generateQueryEngineFiles(binaryTargets []string, pkg, outputDir string) err

enginePath := binaries.GetEnginePath(binaries.GlobalCacheDir(), "query-engine", name)

// TODO change
pt := name
if strings.Contains(name, "debian") || strings.Contains(name, "rhel") {
pt = "linux"
Expand Down
2 changes: 2 additions & 0 deletions test/integration/integration.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RUN go mod download -x

RUN go run github.com/prisma/prisma-client-go db push --schema schemax.prisma

RUN ls -Rlah /app/test/integration

# build the integration binary with all dependencies
RUN go build -o /app/main .

Expand Down
37 changes: 19 additions & 18 deletions test/integration/schemax.prisma
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
datasource db {
provider = "sqlite"
url = "file:dev.db"
provider = "sqlite"
url = "file:dev.db"
}

generator db {
provider = "go run github.com/prisma/prisma-client-go"
disableGitignore = true
provider = "go run github.com/prisma/prisma-client-go"
disableGitignore = true
binaryTargets = ["debian-openssl-1.1.x"]
}

model User {
id String @default(cuid()) @id @map("_id")
createdAt DateTime @default(now())
email String @unique
name String?
age Int?
id String @default(cuid()) @id @map("_id")
createdAt DateTime @default(now())
email String @unique
name String?
age Int?
posts Post[]
posts Post[]
}

model Post {
id String @default(cuid()) @id @map("_id")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
published Boolean
title String
content String?
id String @default(cuid()) @id @map("_id")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
published Boolean
title String
content String?
author User @relation(fields: [authorID], references: [id])
authorID String
author User @relation(fields: [authorID], references: [id])
authorID String
}

0 comments on commit f405c72

Please sign in to comment.