@mbc-cqrs-serverless/tenant
Version:
Multiple tenant management
24 lines • 974 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const path_1 = require("path");
const constants_1 = require("./constants");
// Path to the JSON file
const jsonFilePath = (0, path_1.resolve)(__dirname, '../../../../prisma/dynamodbs/cqrs.json'); // Replace with your actual file name
try {
// Read the JSON file
const rawData = (0, fs_1.readFileSync)(jsonFilePath, 'utf-8');
const jsonData = JSON.parse(rawData);
// Ensure jsonData is an array
if (!Array.isArray(jsonData)) {
throw new Error('The JSON content is not an array.');
}
// Add "master" to the array if it doesn't exist
if (!jsonData.includes(constants_1.TABLE_NAME)) {
jsonData.push(constants_1.TABLE_NAME);
}
// Write the updated JSON back to the file
(0, fs_1.writeFileSync)(jsonFilePath, JSON.stringify(jsonData, null, 2), 'utf-8');
}
catch (error) { }
//# sourceMappingURL=update-scheme.js.map