Introduction
Backup and disaster recovery help keep your data safe and restore it if something goes wrong.
Backup and disaster recovery help keep your data safe and restore it if something goes wrong.
1. Enable automated backups in Supabase project settings. 2. Use Supabase CLI or API to create manual backups. 3. Restore backups via Supabase dashboard or CLI when needed.
backup.sql.# To create a manual backup using Supabase CLI
supabase db dump --file backup.sqlbackup.sql file using psql. Ensure DATABASE_URL is set to your Supabase DB URL.# To restore a backup using psql CLI
psql $DATABASE_URL < backup.sql# Enable automated backups
Go to Supabase dashboard > Project Settings > Database > Backups > Turn on automated backupsThis example shows how to enable backups, create a manual backup file, and restore it using Supabase CLI and psql.
# Step 1: Enable automated backups in Supabase dashboard # Step 2: Create a manual backup supabase db dump --file my_backup.sql # Step 3: Restore from backup if needed psql $DATABASE_URL < my_backup.sql
Always test your backups by restoring them in a safe environment.
Keep backup files secure to prevent unauthorized access.
Automated backups help but manual backups give you control before big changes.
Backups save copies of your data to protect against loss.
Disaster recovery restores your data quickly after problems.
Supabase offers automated and manual backup options for safety.
const backup = await supabase.storage.from('backups').upload('backup-2024-06-01.sql', file);
console.log(backup.error);const { data, error } = await supabase.rpc('restore_backup', { backup_id: 123 });
if (error) console.log(error.message);Pass the test and this pattern moves unknown