chore: update Angular cache and TypeScript build info

This commit is contained in:
2025-09-20 22:33:11 -04:00
parent 9c03f5f5fe
commit 3f04191623
25 changed files with 750 additions and 54 deletions
+18 -6
View File
@@ -9,7 +9,12 @@ const overrideDbFile = process.env.NEWTUBE_DB_FILE && String(process.env.NEWTUBE
: null;
const dbDir = overrideDbFile ? path.dirname(overrideDbFile) : path.join(root, 'db');
const dbFile = overrideDbFile || path.join(dbDir, 'newtube.db');
const schemaFile = path.join(root, 'db', 'schema.sql');
// Try multiple schema locations to survive when /app/db is a mounted volume
const schemaCandidates = [
path.join(root, 'db', 'schema.sql'), // normal repo path (may be hidden by a volume)
path.join(root, 'db-schema', 'schema.sql'), // immutable path bundled in image
];
const schemaFile = schemaCandidates.find(p => fs.existsSync(p));
if (!fs.existsSync(dbDir)) {
fs.mkdirSync(dbDir, { recursive: true });
@@ -19,12 +24,19 @@ if (!fs.existsSync(dbDir)) {
const db = new Database(dbFile);
db.pragma('foreign_keys = ON');
// Run schema if present
if (fs.existsSync(schemaFile)) {
const ddl = fs.readFileSync(schemaFile, 'utf8');
if (ddl && ddl.trim().length) {
db.exec(ddl);
// Run schema if present (first boot)
if (schemaFile && fs.existsSync(schemaFile)) {
try {
const ddl = fs.readFileSync(schemaFile, 'utf8');
if (ddl && ddl.trim().length) {
db.exec(ddl);
console.log(`[db] Applied schema from ${schemaFile}`);
}
} catch (e) {
console.warn(`[db] Failed to apply schema from ${schemaFile}:`, e?.message || e);
}
} else {
console.warn('[db] No schema.sql found in expected locations:', schemaCandidates.join(', '));
}
// Lightweight schema upgrades for existing databases (SQLite is permissive)