feat: terminology fix (Entry→Event), diary page generation, settings refactor
- Rename Entry→Event throughout frontend and backend - Change 'journal' terminology to 'diary page' - Add professional footer with links - Redirect to diary page after generation - Error handling for generation failures - Fix settings to store per-provider configs in providerSettings - Backend reads API key from providerSettings - Use prisma db push instead of migrate for schema sync - Clean up duplicate entries.ts file
This commit is contained in:
37
start.sh
37
start.sh
@@ -1,40 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Check if database exists and has data
|
||||
if [ -f /data/deardiary.db ]; then
|
||||
# Database exists - ensure migration tracking exists
|
||||
bun -e "
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
const prisma = new PrismaClient({ datasourceUrl: 'file:/data/deardiary.db' });
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
const tables = await prisma.\$queryRaw\`SELECT name FROM sqlite_master WHERE type='table' AND name='_prisma_migrations'\`;
|
||||
if (tables.length === 0) {
|
||||
await prisma.\$executeRaw\`
|
||||
CREATE TABLE _prisma_migrations (
|
||||
id TEXT PRIMARY KEY,
|
||||
checksum TEXT NOT NULL,
|
||||
finished_at DATETIME,
|
||||
migration_name TEXT NOT NULL,
|
||||
logs TEXT,
|
||||
rolled_back_at DATETIME,
|
||||
started_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
applied_steps_count INTEGER NOT NULL DEFAULT 0
|
||||
)
|
||||
\`;
|
||||
await prisma.\$executeRaw\`INSERT INTO _prisma_migrations (id, checksum, finished_at, migration_name, applied_steps_count) VALUES (lower(hex(randomblob(16))), 'baseline', datetime('now'), '00000000000000_init', 1)\`;
|
||||
console.log('Migration table created');
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Migration check done');
|
||||
}
|
||||
await prisma.\$disconnect();
|
||||
}
|
||||
main();
|
||||
"
|
||||
fi
|
||||
# Push schema to database on startup
|
||||
echo "Setting up database..."
|
||||
bunx prisma db push --skip-generate
|
||||
|
||||
echo "Starting server..."
|
||||
nginx -g 'daemon off;' &
|
||||
|
||||
Reference in New Issue
Block a user