0
0
Supabasecloud~20 mins

Creating migrations in Supabase - Practice Exercises

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 with no new migration files?

You have an existing Supabase project with migrations applied. You run the command supabase db push but have not added any new migration files. What is the expected behavior?

AThe command detects no new migrations and makes no changes to the database schema.
BThe command applies all existing migrations again, duplicating schema changes.
CThe command deletes all existing tables and recreates them from scratch.
DThe command throws an error indicating no migration files found.
Attempts:
2 left
💡 Hint

Think about what happens if there is nothing new to apply.

Configuration
intermediate
2:00remaining
Which file must be updated to configure the database connection for Supabase migrations?

To run migrations with Supabase CLI, you need to specify the database connection details. Which configuration file is used to set the connection string for migrations?

Asupabase/config.toml
Bsupabase/.dbconfig
Csupabase/migrations.yaml
D.env
Attempts:
2 left
💡 Hint

Supabase uses environment variables for sensitive info.

Architecture
advanced
3:00remaining
What is the best practice for organizing migration files in a Supabase project?

Consider a Supabase project with multiple developers working on database schema changes. How should migration files be organized to avoid conflicts and ensure smooth deployment?

AEach developer keeps migration files locally and runs them manually without sharing.
BStore all migration files in a single folder with timestamped filenames and commit them to version control.
CUse a single migration file for all changes and overwrite it for every update.
DStore migration files outside the project folder to avoid accidental commits.
Attempts:
2 left
💡 Hint

Think about collaboration and version control.

security
advanced
3:00remaining
Which practice improves security when managing Supabase migration files?

When handling migration files that include sensitive schema changes, which practice helps protect sensitive information?

AAvoid including sensitive data like passwords or secrets directly in migration files.
BStore migration files in a public repository for transparency.
CInclude database credentials inside migration SQL scripts for automation.
DEncrypt migration files before committing to version control.
Attempts:
2 left
💡 Hint

Think about what should never be in code files.

🧠 Conceptual
expert
3:00remaining
What is the effect of running supabase db reset in a project with existing migrations?

You run supabase db reset in your project directory. What happens to your database and migration files?

AMigration files are deleted but the database remains unchanged.
BOnly the last migration is applied to the existing database without dropping it.
CThe database is dropped and recreated, then all migrations are reapplied from the first to last.
DThe command only clears the migration history without affecting the database schema.
Attempts:
2 left
💡 Hint

Consider what 'reset' usually means for a database.