Refactor code structure for improved readability and maintainability
This commit is contained in:
49
MIGRATIONS.md
Normal file
49
MIGRATIONS.md
Normal file
@ -0,0 +1,49 @@
|
||||
# TypeORM Migrations Guide
|
||||
|
||||
This project uses TypeORM migrations for database schema management in production environments.
|
||||
|
||||
## Migration Commands
|
||||
|
||||
### Generate Migration
|
||||
|
||||
Generate a migration file based on entity changes:
|
||||
|
||||
```bash
|
||||
# Start the database first
|
||||
yarn docker:dev:detached
|
||||
|
||||
# Generate migration from entity changes
|
||||
yarn migration:generate src/migrations/YourMigrationName
|
||||
```
|
||||
|
||||
### Create Empty Migration
|
||||
|
||||
Create an empty migration file for custom SQL:
|
||||
|
||||
```bash
|
||||
yarn migration:create src/migrations/YourMigrationName
|
||||
```
|
||||
|
||||
### Run Migrations
|
||||
|
||||
Apply pending migrations to the database:
|
||||
|
||||
```bash
|
||||
yarn migration:run
|
||||
```
|
||||
|
||||
### Revert Migration
|
||||
|
||||
Revert the last applied migration:
|
||||
|
||||
```bash
|
||||
yarn migration:revert
|
||||
```
|
||||
|
||||
### Show Migration Status
|
||||
|
||||
Show which migrations have been applied:
|
||||
|
||||
```bash
|
||||
yarn migration:show
|
||||
```
|
||||
Reference in New Issue
Block a user