Merge branch 'staging' of https://github.com/buster-so/buster into staging

This commit is contained in:
Nate Kelley 2025-09-09 15:46:53 -06:00
commit f19d02f097
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
2 changed files with 1 additions and 55 deletions

View File

@ -36,7 +36,7 @@
"db:pull": "drizzle-kit pull",
"db:push": "drizzle-kit push",
"db:reset": "supabase db reset",
"db:seed": "bun run scripts/setup-db.ts && bun run scripts/seed.ts",
"db:seed": "bun run scripts/seed.ts",
"db:start-supabase": "supabase start",
"db:stop": "supabase stop",
"db:studio": "drizzle-kit studio",

View File

@ -1,54 +0,0 @@
#!/usr/bin/env bun
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { closePool } from '../src/connection';
import { executeSqlFile } from './executeSqlFile';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
/**
* Setup database with migrations, setup.sql, and seed.sql
*/
async function setupDatabase(): Promise<void> {
try {
console.log('🔧 Starting database setup...\n');
// Step 1: Run migrations
console.log('This assumes that the database is already running and migrations have been run');
// Step 2: Execute setup.sql
const setupSqlPath = join(__dirname, '..', 'drizzle', 'setup.sql');
await executeSqlFile(setupSqlPath);
console.log('🎉 Database setup completed successfully!');
console.log('Seeding database has not been run yet');
} catch (error) {
console.error('❌ Database setup failed:', error);
process.exit(1);
} finally {
await closePool();
}
}
// Check if DATABASE_URL is defined
if (!process.env.DATABASE_URL) {
console.error('❌ ERROR: DATABASE_URL environment variable is not defined');
console.error('Please ensure you have a .env file with DATABASE_URL configured');
process.exit(1);
}
if (!process.env.SUPABASE_URL) {
console.error('❌ ERROR: SUPABASE_URL environment variable is not defined');
console.error('Please ensure you have a .env file with SUPABASE_URL configured');
process.exit(1);
}
if (!process.env.SUPABASE_SERVICE_ROLE_KEY) {
console.error('❌ ERROR: SUPABASE_SERVICE_ROLE_KEY environment variable is not defined');
console.error('Please ensure you have a .env file with SUPABASE_SERVICE_ROLE_KEY configured');
process.exit(1);
}
await setupDatabase();