0
0
Supabasecloud~20 mins

Running migrations locally and remotely in Supabase - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Supabase Migration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
What happens when you run supabase db push locally?

You run the command supabase db push on your local machine connected to your Supabase project. What is the expected behavior?

AIt deletes all existing migrations and resets the database schema.
BIt generates migration files locally but does not apply them to any database.
CIt applies all unapplied migrations to the local development database only.
DIt applies all unapplied migrations to the remote Supabase database immediately.
Attempts:
2 left
💡 Hint

Think about what 'push' means in the context of local development databases.

Architecture
intermediate
2:00remaining
How should you manage migrations when working with a team on Supabase?

Your team is collaborating on a Supabase project. What is the best practice for managing database migrations to avoid conflicts?

AOnly the team lead runs migrations remotely; others do not run migrations locally.
BEach developer runs migrations independently without sharing migration files.
CDelete migration files after applying them to keep the project clean.
DStore migration files in version control and apply migrations sequentially on remote and local databases.
Attempts:
2 left
💡 Hint

Think about how version control helps teams coordinate changes.

Configuration
advanced
2:00remaining
What is the correct way to run migrations on a remote Supabase database?

You want to apply your local migration files to the remote Supabase database. Which command should you use?

Asupabase migration up --project-ref <project_ref>
Bsupabase db reset --remote
Csupabase db remote migrate --apply
Dsupabase db push --remote
Attempts:
2 left
💡 Hint

Look for the command that explicitly applies migrations remotely with project reference.

security
advanced
2:00remaining
What security risk exists if you run migrations remotely without proper access control?

Consider running migrations on your remote Supabase database without restricting access. What is the main security risk?

AThe migrations will run slower due to network latency.
BUnauthorized users could modify the database schema causing data loss or corruption.
CLocal migration files might get deleted accidentally.
DThe remote database will automatically back up before migration.
Attempts:
2 left
💡 Hint

Think about who can run commands on your remote database.

Best Practice
expert
3:00remaining
What is the recommended workflow to safely deploy database schema changes in Supabase from local to remote?

Choose the best sequence of steps to safely develop, test, and deploy database schema changes using Supabase migrations.

AWrite migration files locally → Run <code>supabase db push</code> locally → Commit migration files → Run <code>supabase migration up --project-ref</code> remotely
BCommit migration files → Run <code>supabase db push</code> locally → Write migration files locally → Run <code>supabase migration up --project-ref</code> remotely
CRun <code>supabase migration up --project-ref</code> remotely → Write migration files locally → Commit migration files → Run <code>supabase db push</code> locally
DWrite migration files locally → Run <code>supabase migration up --project-ref</code> remotely → Run <code>supabase db push</code> locally → Commit migration files
Attempts:
2 left
💡 Hint

Think about the order of writing, testing locally, committing, then deploying remotely.