39 lines
1.2 KiB
Markdown
39 lines
1.2 KiB
Markdown
# 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 haven’t).
|
||
|
||
## 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).
|