We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/khromov/llmctx'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
clear-db.jsβ’1.1 KiB
#!/usr/bin/env node
import PG from 'pg'
// Hardcoded to match the default in src/lib/server/db.ts
const DB_URL = 'postgres://admin:admin@localhost:5432/db'
async function clearDatabase() {
console.log('π Starting database clear...')
console.log(`π‘ Connecting to: ${DB_URL}`)
const client = new PG.Pool({
connectionString: DB_URL,
max: 1
})
try {
// Test connection first
await client.query('SELECT NOW()')
console.log('β Database connection successful')
console.log('ποΈ Dropping all tables...')
// Just drop and recreate the public schema - no fancy permissions
await client.query(`
DROP SCHEMA IF EXISTS public CASCADE;
CREATE SCHEMA public;
`)
console.log('β All tables dropped and schema recreated')
console.log('π Database cleared!')
} catch (error) {
console.error('β Error clearing database:', error)
process.exit(1)
} finally {
await client.end()
}
}
// Add safety check for production
if (process.env.NODE_ENV === 'production') {
console.error('β Database clear is not allowed in production!')
process.exit(1)
}
// Run the script
clearDatabase()