MCPcopy Index your code
hub / github.com/bytebase/bytebase / TestSyncerForMySQL

Function TestSyncerForMySQL

backend/tests/syncer_test.go:252–537  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

250}
251
252func TestSyncerForMySQL(t *testing.T) {
253 const (
254 databaseName = "test_sync_mysql_schema_db"
255 createSchema = `
256 CREATE TABLE trd (
257 a int DEFAULT NULL,
258 b int DEFAULT NULL,
259 c int DEFAULT NULL,
260 UNIQUE KEY a (a,b,c)
261 );
262 CREATE TABLE t1 (
263 id int PRIMARY KEY
264 );
265 CREATE TABLE tfk (
266 a int DEFAULT NULL,
267 b int DEFAULT NULL,
268 c int DEFAULT NULL,
269 KEY a (a,b,c),
270 CONSTRAINT tfk_ibfk_1 FOREIGN KEY (a, b, c) REFERENCES trd (a, b, c),
271 CONSTRAINT tfk_ibfk_2 FOREIGN KEY (a) REFERENCES t1 (id)
272 );
273 `
274 expectedSchema = `{
275 "name":"instances/instance-syncer-mysql/databases/test_sync_mysql_schema_db/metadata",
276 "schemas":[
277 {
278 "tables":[
279 {
280 "name":"t1",
281 "columns":[
282 {
283 "name":"id",
284 "position":1,
285 "type":"int"
286 }
287 ],
288 "indexes":[
289 {
290 "name":"PRIMARY",
291 "expressions":[
292 "id"
293 ],
294 "keyLength": [
295 "-1"
296 ],
297 "descending": [
298 false
299 ],
300 "type":"BTREE",
301 "unique":true,
302 "primary":true,
303 "visible":true
304 }
305 ],
306 "charset": "utf8mb4",
307 "engine":"InnoDB",
308 "collation":"utf8mb4_general_ci",
309 "dataSize":"16384"

Callers

nothing calls this directly

Calls 11

CloseMethod · 0.95
createDatabaseMethod · 0.95
changeDatabaseMethod · 0.95
getMySQLContainerFunction · 0.85
UnmarshalMethod · 0.80
CloseMethod · 0.65
CreateInstanceMethod · 0.65
GetDatabaseMethod · 0.65
CreateSheetMethod · 0.65
GetDatabaseMetadataMethod · 0.65

Tested by

no test coverage detected