Schema
Backup/Fetch SQL
Type ="pull"
Info
playWithSchema()
requires two arguments, first one is the type
string and second is optional when type is pull
type="pull"
,A new Directory is created in root directory named as "presql" contain "schema.sql" file.
index.js
import presql from "./connection";
async function CreateDbBackup() {
const data = presql.playWithSchema({ type: "pull" }); //type = "pull" to create backup schema
console.log(data);
}
Upload SQL File
Type ="push"
index.js
import presql from "./connection";
import path = from "path";
import * as fs from "fs";
const rootDir = path.resolve(__dirname, "presql","schema.sql)
async function CreateDbBackup() {
const SchemaSQLFile = fs.readFileSync(rootDir).toString();
const data = presql.playWithSchema({type:"push"},SchemaSQLFile)
console.log(data);
}