Add deployment helpers and environment config

- Add manual deployment instructions for self-hosted Supabase
- Add schema refresh SQL scripts
- Add deployment helper scripts
- Add Supabase environment configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
dwindown
2025-12-23 10:26:06 +07:00
parent 6e411b160a
commit 0a3aca7cbc
6 changed files with 280 additions and 0 deletions

55
bypass-schema-cache.ts Normal file
View File

@@ -0,0 +1,55 @@
// Temporary workaround to bypass PostgREST schema cache
// Add this function to IntegrasiTab.tsx
async function saveGoogleServiceAccountJSON(supabase: any, jsonValue: string) {
try {
// Use raw SQL to bypass PostgREST schema cache
const { data, error } = await supabase.rpc('exec', {
sql: `
UPDATE platform_settings
SET google_service_account_json = $1
WHERE id = (SELECT id FROM platform_settings LIMIT 1)
`,
params: [jsonValue]
});
if (error) throw error;
return { success: true };
} catch (error) {
console.error('Error saving service account:', error);
return { error };
}
}
// Alternative: Create a temporary edge function to handle the save
// Add to supabase/functions/save-service-account/index.ts
/*
import { serve } from "https://deno.land/std@0.190.0/http/server.ts";
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
serve(async (req: Request) => {
const supabaseUrl = Deno.env.get("SUPABASE_URL")!;
const supabaseServiceKey = Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")!;
const supabase = createClient(supabaseUrl, supabaseServiceKey);
const { json_value } = await req.json();
const { data, error } = await supabase
.from('platform_settings')
.update({ google_service_account_json: json_value })
.neq('id', '');
if (error) {
return new Response(
JSON.stringify({ success: false, error: error.message }),
{ status: 500, headers: { "Content-Type": "application/json" } }
);
}
return new Response(
JSON.stringify({ success: true }),
{ headers: { "Content-Type": "application/json" } }
);
});
*/