binaries

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 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.

**NOTE: This is just for documentation purposes. The Prisma CLI is automatically published. **


How to build Prisma CLI binaries

Prisma CLI binaries are automatically published to S3 by a GitHub action. You can follow the instructions below to build these binaries yourself.

Prerequisites

Requires NodeJS.

Install the AWS CLI and authenticate.

Build the binary and upload to S3
Publish the latest Prisma version
sh publish-latest.sh
Publish a specific Prisma version
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 = "aebc046ce8b88ebbcb45efe31cbe7d06fd6abc0a"

EngineVersion is a hardcoded version of the Prisma Engine. The versions can be found under https://github.com/prisma/prisma-engines/commits/main

View Source
const PrismaVersion = "5.5.2"

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",
}, {
	"schema-engine",
	"PRISMA_SCHEMA_ENGINE_BINARY",
}}
View Source
var PrismaURL = "https://packaged-cli.prisma.sh/%s-%s-%s-%s.gz"

PrismaURL points to an S3 bucket URL where the CLI binaries are stored.

Functions

func DownloadCLI

func DownloadCLI(toDir string) error

func FetchEngine

func FetchEngine(dir string, engineName string, binaryName 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, engineName, 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