Skip to content

sgohlke/planetscale-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

PlanetScale pscale CLI helper scripts (Recording from live demo at PlanetScale Happy-Half-Hour)

Ever wanted to accomplish a complex database workflow with pscale CLI and needed a way to automate asynchronous operations like database branch creation or schema change requests merges? Interested in using the PlanetScale database branching, approval and merging features directly out of your pull/merge requests?

image

This is a collection of helper scripts around the PlanetScale CLI to synchronously

Examples from the community how to make use of those pscale workflows

In the issues section of this repo you will find examples how to integrate your favorite framework and CI with the pscale workflow examples provided here. If you have our own examples you like to share with the commmunity and get the chance to win some swag, please add your example here.

Zero-setup Action workflows included ✨

In case you like to see those helper scripts in action without any further manual configuration, just

  1. Create a copy of this repo by clicking on the green 'Use this template' button or just here. Both private and public repo visibility work.

image

  1. Create a PlanetScale account: If you have not done already, sign up here for a PlanetScale account, you can have one database for free. Do not create a database yet though, this step will be automated as part of the first Action workflow.

  2. Switch to the Actions tab in your repo

image

  1. Start the workflows manually, in the displayed order.

image

  1. When you run the workflows, follow the output where it will ask you to authenticate to PlanetScale by clicking the displayed links.

image

Issue-Ops based workflow

The workflows covered so far have been all triggered as manual GitHub Action jobs. If you start the "Create branch/PR for schema change" workflow, a pull request like this one will be created that is associated with a PlanetScale deploy request and the desired schema changes. Those schema changes can then be applied by adding a /ps-mergecomment to the pull request. This IssueOps command will also create GitHub deployment events, so that you could have other integrations and Action based workflows hook into the deployment lifecycle.

image

You can also create a database branch and deploy request based on an already existing Pull Request using /ps-create: image

If you like to refresh the schema information of your branch or add additional DDL statements, use /ps-update:

image

Approvals can be done using /ps-approve:

image

Finally, you can delete the database branch associated with a Git branch using /ps-delete:

image

Stay tuned for updates and any feedbacks / PRs are welcome 😊

Releases

No releases published

Packages

No packages published

Languages