refactor: flatten monorepo structure to backend/ frontend/ devops/
Rename subdirectories for a cleaner single-repo layout: - website-monitoring-backend/ → backend/ - website-monitoring-frontend/ → frontend/ - website-monitoring-devops/ → devops/ Update all references in package.json scripts, CI workflows, docker-compose, pre-commit hooks, and documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
const fs = require('fs');
|
||||
const { createClient } = require('@supabase/supabase-js');
|
||||
|
||||
// Read environment variables
|
||||
require('dotenv').config();
|
||||
|
||||
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
||||
const serviceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
|
||||
|
||||
if (!supabaseUrl || !serviceRoleKey) {
|
||||
console.error('Missing required environment variables');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const supabase = createClient(supabaseUrl, serviceRoleKey, {
|
||||
auth: {
|
||||
autoRefreshToken: false,
|
||||
persistSession: false
|
||||
}
|
||||
});
|
||||
|
||||
async function deploySchema() {
|
||||
try {
|
||||
console.log('🚀 Starting database schema deployment...');
|
||||
|
||||
// Read the SQL file
|
||||
const sqlContent = fs.readFileSync('supabase-fixes.sql', 'utf8');
|
||||
|
||||
// Split the SQL into individual statements
|
||||
const statements = sqlContent
|
||||
.split(';')
|
||||
.map(stmt => stmt.trim())
|
||||
.filter(stmt => stmt.length > 0 && !stmt.startsWith('--'));
|
||||
|
||||
console.log(`📝 Found ${statements.length} SQL statements to execute`);
|
||||
|
||||
// Execute each statement
|
||||
for (let i = 0; i < statements.length; i++) {
|
||||
const statement = statements[i];
|
||||
if (statement.trim()) {
|
||||
console.log(`⚡ Executing statement ${i + 1}/${statements.length}...`);
|
||||
|
||||
try {
|
||||
const { data, error } = await supabase.rpc('exec_sql', {
|
||||
sql: statement + ';'
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.warn(`⚠️ Warning on statement ${i + 1}:`, error.message);
|
||||
} else {
|
||||
console.log(`✅ Statement ${i + 1} executed successfully`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(`⚠️ Error on statement ${i + 1}:`, err.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('🎉 Database schema deployment completed!');
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Error deploying schema:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
deploySchema();
|
||||
Reference in New Issue
Block a user