Skip to content

Commit 58b730e

Browse files
authored
update migration swagger (#318)
1 parent 9ece8f5 commit 58b730e

File tree

12 files changed

+639
-906
lines changed

12 files changed

+639
-906
lines changed

internal/cli/serverless/migration/template.go

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,9 @@ const (
6262
"certAllowedCn": ["client-cn"]
6363
}
6464
},
65-
// Optional block/allow rules to control synced schemas/tables (mutually exclusive with routeRules)
66-
"baRules": {
67-
"doDbs": ["app_db"],
68-
"doTables": [
69-
{"schema": "app_db", "table": "orders"},
70-
{"schema": "app_db", "table": "customers"}
71-
]
72-
},
73-
// Optional route rules to rename objects during migration (mutually exclusive with baRules)
74-
"routeRules": [
65+
// Optional migration rule sample
66+
"migrationRules": [
67+
// Example of migrating a specific table
7568
{
7669
"sourceTable": {
7770
"schemaPattern": "app_db",
@@ -81,7 +74,30 @@ const (
8174
"schema": "app_db",
8275
"table": "orders_copy"
8376
}
84-
}
77+
},
78+
// Example of migrating all tables in a schema
79+
{
80+
"sourceTable": {
81+
"schemaPattern": "use_db",
82+
"tablePattern": "*"
83+
},
84+
"targetTable": {
85+
"schema": "use_db",
86+
// set empty to use the source table name
87+
"table": ""
88+
}
89+
},
90+
// Example of migrating all tables with a prefix to a single table
91+
{
92+
"sourceTable": {
93+
"schemaPattern": "use_db",
94+
"tablePattern": "user_*"
95+
},
96+
"targetTable": {
97+
"schema": "use_db",
98+
"table": "user"
99+
}
100+
}
85101
],
86102
}
87103
]
@@ -119,15 +135,9 @@ const (
119135
"certAllowedCn": ["client-cn"]
120136
}
121137
},
122-
// Optional block/allow rules when only part of the data should be replicated (mutually exclusive with routeRules)
123-
"baRules": {
124-
"doDbs": ["app_db"],
125-
"doTables": [
126-
{"schema": "app_db", "table": "orders"}
127-
]
128-
},
129-
// Optional route rule sample for remapping objects during incremental sync (mutually exclusive with baRules)
130-
"routeRules": [
138+
// Optional migration rule sample
139+
"migrationRules": [
140+
// Example of migrating a specific table
131141
{
132142
"sourceTable": {
133143
"schemaPattern": "app_db",
@@ -137,7 +147,30 @@ const (
137147
"schema": "app_db",
138148
"table": "orders_copy"
139149
}
140-
}
150+
},
151+
// Example of migrating all tables in a schema
152+
{
153+
"sourceTable": {
154+
"schemaPattern": "use_db",
155+
"tablePattern": "*"
156+
},
157+
"targetTable": {
158+
"schema": "use_db",
159+
// set empty to use the source table name
160+
"table": ""
161+
}
162+
},
163+
// Example of migrating all tables with a prefix to a single table
164+
{
165+
"sourceTable": {
166+
"schemaPattern": "use_db",
167+
"tablePattern": "user_*"
168+
},
169+
"targetTable": {
170+
"schema": "use_db",
171+
"table": "user"
172+
}
173+
}
141174
],
142175
// Optional start position for incremental sync (binlog position or GTID)
143176
"binlogName": "mysql-bin.000001",

0 commit comments

Comments
 (0)