mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-27 13:47:56 -05:00
SQL solution migration to Kysely + getting rid of routes folder (#1530)
* Kysely initial * Badges initial * Badge routes migrated * Badges migrated * Calendar work * Fix one type problem * Calendar work * findResultsByUserId work * Calendar reworking finished * PlusSuggestions work * Migrated suggestions * Builds progress * Migrated builds * Admin migrated * Migrate articles * User search * Faster getUser * Selectable/insertable as global * Refresh prod db script + patronTier index * identifierToUserId * updateProfile * findByIdentifier * More indexes * User upsert * upsertLite * findAllPlusMembers * updateResultHighlights * updateMany * User finished migration * Fix types * Fix PlusVotingResult typing * PlusVotingRepository WIP * Migrated resultsByMonthYear * Migrated plusVotes (done with db. related migrations) * Plus code to features folder * Fix TODOs * Export * Fix range * Migrate some user pages * Move rest user routes * Move /play * Map list generator * Front page * Move map list generation logic * Move plus voting logic * Info * API * Adjust TODOs * theme * Auth * Remove TODO
This commit is contained in:
34
scripts/refresh-prod-db.ts
Normal file
34
scripts/refresh-prod-db.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
|
||||
function main() {
|
||||
const dbProdPath = path.join(__dirname, "..", "db-prod.sqlite3");
|
||||
const dbProdShmPath = path.join(__dirname, "..", "db-prod.sqlite3-shm");
|
||||
const dbProdWalPath = path.join(__dirname, "..", "db-prod.sqlite3-wal");
|
||||
const dbCopyPath = path.join(__dirname, "..", "db-copy.sqlite3");
|
||||
|
||||
if (!fs.existsSync(dbCopyPath)) {
|
||||
console.error(`File ${dbCopyPath} does not exist`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// delete db-prod.sqlite3-shm file if exists
|
||||
if (fs.existsSync(dbProdShmPath)) {
|
||||
fs.unlinkSync(dbProdShmPath);
|
||||
}
|
||||
|
||||
// delete db-prod.sqlite3-wal file if exists
|
||||
if (fs.existsSync(dbProdWalPath)) {
|
||||
fs.unlinkSync(dbProdWalPath);
|
||||
}
|
||||
|
||||
// delete db-prod.sqlite3 if exists
|
||||
if (fs.existsSync(dbProdPath)) {
|
||||
fs.unlinkSync(dbProdPath);
|
||||
}
|
||||
|
||||
// copy db-copy.sqlite3 to db-prod.sqlite3
|
||||
fs.copyFileSync(dbCopyPath, dbProdPath);
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user