- Migrated all pages from Next.js to Astro - Added PDPA-compliant Privacy Policy (Thai) - Added PDPA-compliant Terms & Conditions (Thai) - Added Cookie Policy with disclosure (Thai) - Implemented cookie consent banner (client-side) - Integrated Umami Analytics placeholder - Blog system with 3 posts - Optimized Docker configuration for production - Static site build (184KB, 11 pages) - Ready for Easypanel deployment Backup: /Users/kunthawatgreethong/Gitea/dealplustech-backup-nextjs-20260309.tar.gz
34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
import crypto from "node:crypto";
|
|
import fs from "node:fs";
|
|
function readMigrationFiles(config) {
|
|
const migrationFolderTo = config.migrationsFolder;
|
|
const migrationQueries = [];
|
|
const journalPath = `${migrationFolderTo}/meta/_journal.json`;
|
|
if (!fs.existsSync(journalPath)) {
|
|
throw new Error(`Can't find meta/_journal.json file`);
|
|
}
|
|
const journalAsString = fs.readFileSync(`${migrationFolderTo}/meta/_journal.json`).toString();
|
|
const journal = JSON.parse(journalAsString);
|
|
for (const journalEntry of journal.entries) {
|
|
const migrationPath = `${migrationFolderTo}/${journalEntry.tag}.sql`;
|
|
try {
|
|
const query = fs.readFileSync(`${migrationFolderTo}/${journalEntry.tag}.sql`).toString();
|
|
const result = query.split("--> statement-breakpoint").map((it) => {
|
|
return it;
|
|
});
|
|
migrationQueries.push({
|
|
sql: result,
|
|
bps: journalEntry.breakpoints,
|
|
folderMillis: journalEntry.when,
|
|
hash: crypto.createHash("sha256").update(query).digest("hex")
|
|
});
|
|
} catch {
|
|
throw new Error(`No file ${migrationPath} found in ${migrationFolderTo} folder`);
|
|
}
|
|
}
|
|
return migrationQueries;
|
|
}
|
|
export {
|
|
readMigrationFiles
|
|
};
|
|
//# sourceMappingURL=migrator.js.map
|