53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
// import createMigration from "../functions/createMigration";
|
|
// import createDatabase from "../functions/createDatabase";
|
|
// import createDatabaseNode from "../functions/createDatabaseNode";
|
|
// import createProject from "../functions/createProject";
|
|
import createQuery from "../functions/createQuery";
|
|
// import databaseMigrationUp from "../functions/databaseMigrationUp";
|
|
import runQuery from "../functions/runQuery";
|
|
import * as fs from "fs";
|
|
import * as path from "path";
|
|
|
|
(async () => {
|
|
try {
|
|
// const node = await createDatabaseNode("localhost", 3306, "root", "root");
|
|
|
|
// console.log("Database node created:", node);
|
|
|
|
// const project = await createProject("Test Project");
|
|
|
|
// console.log("Project created:", project);
|
|
|
|
// const db = await createDatabase(project.id, node.id);
|
|
|
|
// console.log("Database created:", db);
|
|
|
|
// const migration = await createMigration(
|
|
// db.id,
|
|
// "CREATE TABLE `test` (id INT AUTO_INCREMENT PRIMARY KEY, col1 VARCHAR(255))",
|
|
// "DROP TABLE `test`"
|
|
// );
|
|
|
|
// console.log("Migration created:", migration);
|
|
|
|
// const migrationResult = await databaseMigrationUp(db.id);
|
|
|
|
// console.log("Migrations applied:", migrationResult);
|
|
|
|
const payloadPath = path.join(__dirname, "case1-payload.js");
|
|
const query = await createQuery(
|
|
{ token: "04c38f93-f2fb-4d2c-a8e2-791effa35239" },
|
|
fs.readFileSync(payloadPath, { encoding: "utf-8" })
|
|
);
|
|
|
|
console.log(query);
|
|
|
|
const result = await runQuery(query.id, { id: 1 });
|
|
|
|
console.log("Query Result:", result.data);
|
|
console.log("headers:", result.headers);
|
|
} catch (error) {
|
|
console.error("Error during test execution");
|
|
}
|
|
})();
|