feat: implement Migration module with controller, service, and entity, including migration creation logic
This commit is contained in:
22
tests/base/createMigration.ts
Normal file
22
tests/base/createMigration.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import createMigration from "../functions/createMigration";
|
||||
import createProject from "../functions/createProject";
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const project = await createProject("Test Project");
|
||||
|
||||
const result_1 = await createMigration(project.token, [
|
||||
{
|
||||
name: "users",
|
||||
fields: {
|
||||
name: { type: "string", isNullable: false },
|
||||
age: { type: "int", isNullable: true },
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
console.log("Migration 1:", result_1.data);
|
||||
} catch (error) {
|
||||
console.error("Error during test execution:", error);
|
||||
}
|
||||
})();
|
||||
15
tests/functions/createMigration.ts
Normal file
15
tests/functions/createMigration.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import axios from "axios";
|
||||
import { config } from "../config";
|
||||
|
||||
export default async (token: string, tables: any) => {
|
||||
try {
|
||||
const response = await axios.post(`${config.url}/migrations/create`, {
|
||||
token,
|
||||
tables,
|
||||
});
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("Error in creating migration:", error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user