add: migration

This commit is contained in:
2026-02-17 16:04:49 +03:30
parent 2555cc12d1
commit 7ccf822a5c
18 changed files with 790 additions and 74 deletions
+38
View File
@@ -0,0 +1,38 @@
# Test companies seed (production-safe)
Add about **1000 test companies** for a specific business, then remove them in one go.
- **Business ID:** `e5e760b9-46a5-4194-bb3d-00a46c24d72a`
- All test rows use the prefix **`TEST_SEED_`** (company name, emails, etc.) so they are easy to identify and delete without touching real data.
## 1. Seed test companies
From project root:
```bash
pnpm run build
pnpm run seed:test-companies
```
Requirements:
- Business `e5e760b9-46a5-4194-bb3d-00a46c24d72a` must exist.
- At least one **Industry** must exist for that business (create one in the app if needed).
- **Role** `USER` must exist (run `pnpm run seed:run` once if you havent).
## 2. After testing: remove test data
Same DB, same business:
```bash
pnpm run seed:cleanup-test-companies
```
This **soft-deletes** all companies whose name starts with `TEST_SEED_` and their linked users for that business. No schema changes, no hard deletes.
## Changing business ID or count
Edit the constants at the top of:
- `database/seeders/test-companies.seeder.ts``TEST_BUSINESS_ID`, `TEST_COMPANIES_COUNT`
- `database/seeders/cleanup-test-companies.seeder.ts``TEST_BUSINESS_ID` (must match).