Given that you have you CLI authorization set up correct you can run a SQL script against your PlanetScale database like this:
pscale shell sample main --org lakruzz < createdb.sql
In the command above, sample is the name of the Planetscale database you want to connect to, main is the name of the branch you want to connect to, --org lakruzz specifies the organization (a.k.a you user handle) and < createdb.sql redirects the contents of the SQL script to the shell subcommand, which is used by pscale shell to connect to the database and open a prompt - or in this case - execute the script.
The branch is not required, if the database only have one. And you can use the same command ot open an interactive SQL prompt like this:
pscale shell sample --org lakruzz
For more details see:
Given that you have you CLI authorization set up correct you can run a SQL script against your PlanetScale database like this:
In the command above,
sampleis the name of the Planetscale database you want to connect to,mainis the name of the branch you want to connect to,--org lakruzzspecifies the organization (a.k.a you user handle) and< createdb.sqlredirects the contents of the SQL script to theshellsubcommand, which is used bypscaleshell to connect to the database and open a prompt - or in this case - execute the script.The branch is not required, if the database only have one. And you can use the same command ot open an interactive SQL prompt like this:
For more details see: