binaries

package
v0.17.0-otel Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

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

View Source
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

View Source
const PrismaVersion = "4.7.1"

PrismaVersion is a hardcoded version of the Prisma CLI.

Variables

View Source
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.

View Source
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",
}}
View Source
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 DownloadCLI(toDir string) error

func DownloadEngine

func DownloadEngine(name string, toDir string) (file string, err error)

func FetchEngine

func FetchEngine(toDir string, engineName string, binaryPlatformName string) error

func FetchNative

func FetchNative(toDir string) error

FetchNative fetches the Prisma binaries needed for the generator to a given directory

func GetEnginePath

func GetEnginePath(dir, engine, binaryName string) string

func GlobalCacheDir

func GlobalCacheDir() string

GlobalCacheDir returns the path of where the CLI lives internally, this is the global temp dir

func GlobalTempDir

func GlobalTempDir(version string) string

GlobalTempDir returns the path of where the engines live internally, this is the global temp dir

func GlobalUnpackDir

func GlobalUnpackDir(version string) string

func PrismaCLIName

func PrismaCLIName() string

PrismaCLIName returns the local file path of where the CLI lives

Types

type Engine

type Engine struct {
	Name string
	Env  string
}

Directories

Path Synopsis
Package platform provides runtime methods to find out the correct prisma binary to use
Package platform provides runtime methods to find out the correct prisma binary to use

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL