(forcedSchemas string, syncETCDEvent bool, postMigrationEventTimeout time.Duration)
| 100 | } |
| 101 | |
| 102 | func emitPostMigrateEvent(forcedSchemas string, syncETCDEvent bool, postMigrationEventTimeout time.Duration) { |
| 103 | config := util.GetConfig() |
| 104 | |
| 105 | log.Info("Emit post-migrate event") |
| 106 | |
| 107 | modifiedSchemas := selectModifiedSchemas(forcedSchemas) |
| 108 | |
| 109 | if len(modifiedSchemas) == 0 { |
| 110 | log.Info("No modified schemas, skipping post-migration event") |
| 111 | return |
| 112 | } |
| 113 | |
| 114 | log.Debug("Modified schemas: %s", strings.Join(modifiedSchemas, ", ")) |
| 115 | |
| 116 | schemaFiles := config.GetStringList("schemas", nil) |
| 117 | |
| 118 | if schemaFiles == nil { |
| 119 | log.Fatal("No schema specified in configuration") |
| 120 | } |
| 121 | |
| 122 | manager := schema.GetManager() |
| 123 | if err := manager.LoadSchemasFromFiles(schemaFiles...); err != nil { |
| 124 | log.Fatal(err) |
| 125 | } |
| 126 | |
| 127 | if err := publishEvent(postMigrationEnvName, modifiedSchemas, eventPostMigration, syncETCDEvent, postMigrationEventTimeout); err != nil { |
| 128 | log.Fatal("Publish post-migrate event failed: %s", err) |
| 129 | } |
| 130 | |
| 131 | schema.ClearManager() |
| 132 | |
| 133 | log.Info("Published post-migrate event: %s", strings.Join(modifiedSchemas, ", ")) |
| 134 | } |
| 135 | |
| 136 | func actionMigrate(subcmd string) func(context *cli.Context) { |
| 137 | return withinLockedMigration(func(context *cli.Context) { |
no test coverage detected