Build App
ClearDatabase
The cleardatabase
command removes all data from the connected database.
Usage
⚠️ Warning: This command deletes all data from the database irreversibly. Use with caution.
RemoveMigrations
The removemigrations
command deletes all migration files from the project for every app.
Usage
This is useful when resetting migrations during significant changes in the data model.
InitializeData
The initializedata
command is the designated place to include all data initialization commands for the project. Each app should have its initialization scripts incorporated into this command.
Usage
Example operations this command could include:
- Setting up default users.
- Creating default products or plans.
- Preloading essential configurations.
BuildApp
The buildapp
command automates the entire process of resetting and rebuilding your application. It performs the following steps:
- Deletes the database.
- Removes migration files.
- Creates new migrations.
- Applies migrations to the database.
- Runs the static files collection script.
Workflow
- Step 1: Deletes all existing data and database structure.
- Step 2: Removes all migration files from the project.
- Step 3: Creates fresh migration files based on the current models.
- Step 4: Applies these migrations to set up the database schema.
- Step 5: Collects static files for use in the application.
Usage
This command is part of the _initializer
app and is designed to give you a clean slate for development while maintaining a consistent process.
Benefits
- Time-Saving: Automates repetitive tasks, allowing you to focus on development.
- Consistency: Ensures a clean and reliable process for resetting and rebuilding the application.
- Flexibility: Commands like
initializedata
can be tailored to the specific needs of your project.
These commands are essential tools for maintaining productivity during the early and highly iterative stages of project development.