- Add gantt task CRUD bash and TypeScript utilities - Update MEMORY.md with CRUD capabilities and rules - Update daily memory with subagent completions - Document: full task links, attach-then-delete rule
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
// Migrate blog-backup data from JSON to Supabase
|
|
const { createClient } = require('@supabase/supabase-js');
|
|
|
|
const SUPABASE_URL = 'https://qnatchrjlpehiijwtreh.supabase.co';
|
|
const SUPABASE_SERVICE_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFuYXRjaHJqbHBlaGlpand0cmVoIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc3MTY0MDQzNiwiZXhwIjoyMDg3MjE2NDM2fQ.s8NJDL3iRXpjiFkqVdEf5QxQN41IJ8D3qRGKJWq6MKk';
|
|
|
|
const supabase = createClient(SUPABASE_URL, SUPABASE_SERVICE_KEY);
|
|
|
|
const messages = require('/Users/mattbruce/Documents/Projects/OpenClaw/Web/blog-backup/data/messages.json');
|
|
|
|
async function migrate() {
|
|
console.log(`Migrating ${messages.length} messages...`);
|
|
|
|
const { error } = await supabase
|
|
.from('blog_messages')
|
|
.upsert(messages.map(m => ({
|
|
id: m.id,
|
|
date: m.date,
|
|
content: m.content,
|
|
timestamp: m.timestamp
|
|
})), { onConflict: 'id' });
|
|
|
|
if (error) {
|
|
console.error('Migration failed:', error);
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log('Migration complete!');
|
|
|
|
// Verify
|
|
const { data, error: countError } = await supabase
|
|
.from('blog_messages')
|
|
.select('*', { count: 'exact' });
|
|
|
|
console.log(`Total messages in Supabase: ${data?.length || 0}`);
|
|
}
|
|
|
|
migrate();
|