Skip to content

Commit 610edc9

Browse files
committed
docs
1 parent ce3f4c0 commit 610edc9

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

MIGRATE.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# LaunchQL Migration System Documentation
2+
3+
## Architecture Overview
4+
5+
LaunchQL provides a modern, TypeScript-based database migration system that serves as a drop-in replacement for Sqitch. The system is split into two main packages:
6+
7+
- **@launchql/core**: High-level orchestration layer that manages multi-module projects, dependencies, and deployment strategies
8+
- **@launchql/migrate**: Low-level migration engine that handles the actual database operations
9+
10+
## System Flow
11+
12+
```mermaid
13+
graph TB
14+
subgraph "User Interface"
15+
CLI["CLI Commands<br/>deploy/revert/verify"]
16+
API["API Usage<br/>LaunchQLProject"]
17+
end
18+
19+
subgraph "@launchql/core"
20+
LP["LaunchQLProject<br/>Project Management"]
21+
DM["deployModules()<br/>revertModules()<br/>verifyModules()"]
22+
DP["deployProject()<br/>Multi-module orchestration"]
23+
MOD["Module Resolution<br/>& Dependencies"]
24+
FAST["Fast Deploy<br/>Package & Cache"]
25+
end
26+
27+
subgraph "@launchql/migrate"
28+
LM["LaunchQLMigrate<br/>Client"]
29+
PARSER["Plan Parser<br/>parsePlanFile()"]
30+
SQL["SQL Execution<br/>withTransaction()"]
31+
SCHEMA["launchql_migrate<br/>Schema"]
32+
end
33+
34+
subgraph "Database"
35+
PG[("PostgreSQL")]
36+
MS[("Migration State<br/>projects, changes,<br/>dependencies, events")]
37+
end
38+
39+
CLI --> DM
40+
API --> LP
41+
LP --> MOD
42+
DM --> DP
43+
DP --> MOD
44+
DP --> FAST
45+
DP --> LM
46+
DM --> LM
47+
48+
LM --> PARSER
49+
LM --> SQL
50+
SQL --> PG
51+
SCHEMA --> MS
52+
MS --> PG
53+
54+
style CLI fill:#e1f5fe
55+
style API fill:#e1f5fe
56+
style LP fill:#c5e1a5
57+
style DM fill:#c5e1a5
58+
style DP fill:#c5e1a5
59+
style MOD fill:#c5e1a5
60+
style FAST fill:#c5e1a5
61+
style LM fill:#ffccbc
62+
style PARSER fill:#ffccbc
63+
style SQL fill:#ffccbc
64+
style SCHEMA fill:#ffccbc
65+
style PG fill:#f5f5f5
66+
style MS fill:#f5f5f5
67+
```
68+
69+
70+
```mermaid
71+
sequenceDiagram
72+
participant User
73+
participant Core as @launchql/core
74+
participant Migrate as @launchql/migrate
75+
participant DB as PostgreSQL
76+
participant FS as File System
77+
78+
User->>Core: deployModules(options)
79+
80+
alt Recursive Mode
81+
Core->>Core: getModuleMap()
82+
Core->>Core: resolveDependencies()
83+
loop For each dependent module
84+
Core->>Migrate: deploy(moduleOptions)
85+
Migrate->>FS: parsePlanFile(planPath)
86+
Migrate->>FS: readScript(deploy/change.sql)
87+
Migrate->>DB: BEGIN (if useTransaction)
88+
Migrate->>DB: CALL launchql_migrate.deploy(...)
89+
Migrate->>DB: COMMIT (if useTransaction)
90+
end
91+
else Direct Mode
92+
Core->>Migrate: deploy(options)
93+
Migrate->>FS: parsePlanFile(planPath)
94+
Migrate->>FS: getChangesInOrder()
95+
loop For each change
96+
Migrate->>DB: Check launchql_migrate.is_deployed()
97+
alt Not deployed
98+
Migrate->>FS: readScript(deploy/change.sql)
99+
Migrate->>DB: CALL launchql_migrate.deploy(...)
100+
else Already deployed
101+
Migrate->>Migrate: Skip change
102+
end
103+
end
104+
end
105+
106+
Migrate-->>Core: DeployResult
107+
Core-->>User: Success/Failure
108+
```

0 commit comments

Comments
 (0)