Backend API for an anonymous chat application.
To create a new migration file, use the following command:
diesel migration generate migration_nameThis will create two SQL script files in the migrations folder:
- up.sql - Defines the logic for applying the new changes.
- down.sql - Defines the logic for reverting the changes.
Note: Follow the naming convention
yyyy-mm-dd-description-of-changefor migration names.
Example:2024-10-26-create-table-xyz
Edit the up.sql and down.sql files to specify the SQL commands required for your changes.
Run the migration to apply changes to the database:
diesel migration runTo reflect the new database schema in your code, use:
diesel print-schema > ./src/database/schema.rsThis command will update the schema.rs file with the latest table definitions.
Modify any necessary models in ./src/database/models.rs to align with the updated schema.