-
-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathtypeorm_instructions.txt
More file actions
42 lines (37 loc) · 1.51 KB
/
typeorm_instructions.txt
File metadata and controls
42 lines (37 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Generate migration after entity changes
yarn workspace @maintainerr/server migration:generate src/database/migrations/<migr_name>
// Run migrations
yarn workspace @maintainerr/server migration:run
// Revert migrations
yarn workspace @maintainerr/server migration:revert
// Show migration status
yarn workspace @maintainerr/server migration:show
// Create empty migration
yarn workspace @maintainerr/server migration:create src/database/migrations/<migr_name>
// ---
// Checking for pending migrations (e.g. before a release)
//
// Important: always generate against a database with all existing migrations applied.
// Generating against an empty database produces a false positive that recreates all tables.
//
// Steps:
//
// 1. Check out the last released version and start the app to build a migrated database:
//
// git checkout v<last-release-tag> (e.g. v3.1.0)
// yarn install --frozen-lockfile
// yarn dev
// Wait for the server to fully start (migrations run automatically on boot), then stop it.
//
// 2. Switch back to your working branch and generate:
//
// git checkout <your-branch>
// yarn install --frozen-lockfile
// cd apps/server
// yarn migration:generate src/database/migrations/<MigrationName>
//
// 3. Interpret the result:
// - "No changes in database schema were found" — schema is in sync, no migration needed.
// - A migration file is generated — review it, the changes are real schema drift.
//
// 4. Clean up: remove or empty data/maintainerr.sqlite so it doesn't get committed.