19 lines
798 B
JavaScript
19 lines
798 B
JavaScript
import { AppData } from "../../data/app-data";
|
|
import MariaDBQuoteGen from "./mariadb-quote-gen";
|
|
import runSchemaQuery from "./run-schema-query";
|
|
export default async function upsertDbManagerTable({ tableName, config, }) {
|
|
const now = Date.now();
|
|
await runSchemaQuery({
|
|
query: `INSERT INTO ${MariaDBQuoteGen(AppData["DbSchemaManagerTableName"])} (table_name, created_at, updated_at) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE updated_at = VALUES(updated_at)`,
|
|
values: [tableName, now, now],
|
|
config,
|
|
});
|
|
}
|
|
export async function removeDbManagerTable({ tableName, config, }) {
|
|
await runSchemaQuery({
|
|
query: `DELETE FROM ${MariaDBQuoteGen(AppData["DbSchemaManagerTableName"])} WHERE table_name = ?`,
|
|
values: [tableName],
|
|
config,
|
|
});
|
|
}
|