README
¶
Prisma binaries
There are two types of binaries needed by the Go client, one being the Prisma Engine binaries and the other being the Prisma CLI binaries.
Prisma Engine binaries are fully managed, maintained and automatically updated by the Prisma team, as they are also needed for our NodeJS client.
Prisma CLI binaries are not officially managed and were just by the maintainers of the Go client. This is why there is a some documentation here and a script on how to build, upload and bump the Prisma CLI binaries.
How to build Prisma CLI binaries
Prerequisites
Install zeit/pkg:
npm i -g pkg
Install the AWS CLI and authenticate.
Build the binary and upload to S3
sh publish.sh <version>
# e.g.
sh publish.sh 3.0.0
You can check the available versions on the Prisma releases page.
NOTE:
Prisma employees
Any Prisma employee can authenticate with the Prisma Go client account. If you are a community member and would like to bump the binaries, please ask us to do so in the #prisma-client-go channel in our public Slack.
Community members
If you want to set up Prisma CLI binaries yourself, authenticate with your own AWS account and adapt the bucket name in publish.sh
.
When using the client, you will need to override the URL with env vars whenever you run the Go client, specifically
PRISMA_CLI_URL
and PRISMA_ENGINE_URL
. You can see the shape of these values in binaries/binaries.go#L24-L28.
This will also print the query engine version which you will need in the next step.
Bump the binaries in the Go client
Go to binaries/binaries.go
and adapt the PrismaVersion
and EngineVersion
to the new version values.
Push to a new branch, create a PR, and merge if tests are green (e.g. #709).
When internal breaking changes happen, adaptions may be needed.
Documentation
¶
Index ¶
- Constants
- Variables
- func DownloadCLI(toDir string) error
- func DownloadEngine(name string, toDir string) (file string, err error)
- func FetchEngine(toDir string, engineName string, binaryPlatformName string) error
- func FetchNative(toDir string) error
- func GetEnginePath(dir, engine, binaryName string) string
- func GlobalCacheDir() string
- func GlobalTempDir(version string) string
- func GlobalUnpackDir(version string) string
- func PrismaCLIName() string
- type Engine
Constants ¶
const EngineVersion = "272861e07ab64f234d3ffc4094e32bd61775599c"
EngineVersion is a hardcoded version of the Prisma Engine. The versions can be found under https://github.com/prisma/prisma-engines/commits/master
const PrismaVersion = "4.7.1"
PrismaVersion is a hardcoded version of the Prisma CLI.
Variables ¶
var EngineURL = "https://binaries.prisma.sh/all_commits/%s/%s/%s.gz"
EngineURL points to an S3 bucket URL where the Prisma engines are stored.
var Engines = []Engine{{
"query-engine",
"PRISMA_QUERY_ENGINE_BINARY",
}, {
"migration-engine",
"PRISMA_MIGRATION_ENGINE_BINARY",
}, {
"introspection-engine",
"PRISMA_INTROSPECTION_ENGINE_BINARY",
}, {
"prisma-fmt",
"PRISMA_FMT_BINARY",
}}
var PrismaURL = "https://packaged-cli.prisma.sh/%s-%s-%s-x64.gz"
PrismaURL points to an S3 bucket URL where the CLI binaries are stored.
Functions ¶
func DownloadCLI ¶
func FetchEngine ¶
func FetchNative ¶
FetchNative fetches the Prisma binaries needed for the generator to a given directory
func GetEnginePath ¶
func GlobalCacheDir ¶
func GlobalCacheDir() string
GlobalCacheDir returns the path of where the CLI lives internally, this is the global temp dir
func GlobalTempDir ¶
GlobalTempDir returns the path of where the engines live internally, this is the global temp dir
func GlobalUnpackDir ¶
func PrismaCLIName ¶
func PrismaCLIName() string
PrismaCLIName returns the local file path of where the CLI lives