Skip to content

Commit

Permalink
Rm DbMigration Controller (#20213)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmoriceau authored Dec 8, 2022
1 parent d64c9b6 commit 020b95a
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 397 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.google.common.annotations.VisibleForTesting;
import io.airbyte.api.client.generated.AttemptApi;
import io.airbyte.api.client.generated.ConnectionApi;
import io.airbyte.api.client.generated.DbMigrationApi;
import io.airbyte.api.client.generated.DestinationApi;
import io.airbyte.api.client.generated.DestinationDefinitionApi;
import io.airbyte.api.client.generated.DestinationDefinitionSpecificationApi;
Expand Down Expand Up @@ -58,7 +57,6 @@ public class AirbyteApiClient {
private final SourceDefinitionSpecificationApi sourceDefinitionSpecificationApi;
private final WorkspaceApi workspaceApi;
private final HealthApi healthApi;
private final DbMigrationApi dbMigrationApi;
private final AttemptApi attemptApi;
private final StateApi stateApi;

Expand All @@ -75,7 +73,6 @@ public AirbyteApiClient(final ApiClient apiClient) {
sourceDefinitionSpecificationApi = new SourceDefinitionSpecificationApi(apiClient);
workspaceApi = new WorkspaceApi(apiClient);
healthApi = new HealthApi(apiClient);
dbMigrationApi = new DbMigrationApi(apiClient);
attemptApi = new AttemptApi(apiClient);
stateApi = new StateApi(apiClient);
}
Expand Down Expand Up @@ -128,10 +125,6 @@ public HealthApi getHealthApi() {
return healthApi;
}

public DbMigrationApi getDbMigrationApi() {
return dbMigrationApi;
}

public AttemptApi getAttemptApi() {
return attemptApi;
}
Expand Down
48 changes: 0 additions & 48 deletions airbyte-api/src/main/openapi/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ tags:
description: Source OAuth related resources to delegate access from user.
- name: source_oauth
description: Source OAuth related resources to delegate access from user.
- name: db_migration
description: Database migration related resources.
- name: web_backend
description: |
Endpoints for the Airbyte web application. Those APIs should not be called outside the web application implementation and are not
Expand Down Expand Up @@ -1612,52 +1610,6 @@ paths:
$ref: "#/components/schemas/CheckConnectionRead"
"422":
$ref: "#/components/responses/InvalidInputResponse"
/v1/db_migrations/list:
post:
tags:
- db_migration
summary: List all database migrations
operationId: listMigrations
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/DbMigrationRequestBody"
required: true
responses:
"200":
description: Successful operation
content:
application/json:
schema:
$ref: "#/components/schemas/DbMigrationReadList"
"404":
$ref: "#/components/responses/NotFoundResponse"
"422":
$ref: "#/components/responses/InvalidInputResponse"
/v1/db_migrations/migrate:
post:
tags:
- db_migration
summary: Migrate the database to the latest version
operationId: executeMigrations
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/DbMigrationRequestBody"
required: true
responses:
"200":
description: Successful operation
content:
application/json:
schema:
$ref: "#/components/schemas/DbMigrationExecutionRead"
"404":
$ref: "#/components/responses/NotFoundResponse"
"422":
$ref: "#/components/responses/InvalidInputResponse"
/v1/source_oauths/oauth_params/create:
post:
tags:
Expand Down
8 changes: 2 additions & 6 deletions airbyte-server/src/main/java/io/airbyte/server/ServerApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import io.airbyte.server.errors.UncaughtExceptionMapper;
import io.airbyte.server.handlers.AttemptHandler;
import io.airbyte.server.handlers.ConnectionsHandler;
import io.airbyte.server.handlers.DbMigrationHandler;
import io.airbyte.server.handlers.DestinationDefinitionsHandler;
import io.airbyte.server.handlers.DestinationHandler;
import io.airbyte.server.handlers.HealthCheckHandler;
Expand Down Expand Up @@ -292,8 +291,6 @@ public static ServerRunnable getServer(final ServerFactory apiFactory,
connectionsHandler,
envVariableFeatureFlags);

final DbMigrationHandler dbMigrationHandler = new DbMigrationHandler(configsDatabase, configsFlyway, jobsDatabase, jobsFlyway);

final DestinationDefinitionsHandler destinationDefinitionsHandler = new DestinationDefinitionsHandler(configRepository, syncSchedulerClient,
destinationHandler);

Expand Down Expand Up @@ -371,7 +368,6 @@ public static ServerRunnable getServer(final ServerFactory apiFactory,
jobsFlyway,
attemptHandler,
connectionsHandler,
dbMigrationHandler,
destinationDefinitionsHandler,
destinationHandler,
healthCheckHandler,
Expand Down Expand Up @@ -406,9 +402,9 @@ public static void main(final String[] args) {
// Ensure that the database resources are closed on application shutdown
CloseableShutdownHook.registerRuntimeShutdownHook(configsDataSource, jobsDataSource, configsDslContext, jobsDslContext);

final Flyway configsFlyway = FlywayFactory.create(configsDataSource, DbMigrationHandler.class.getSimpleName(),
final Flyway configsFlyway = FlywayFactory.create(configsDataSource, ServerApp.class.getSimpleName(),
ConfigsDatabaseMigrator.DB_IDENTIFIER, ConfigsDatabaseMigrator.MIGRATION_FILE_LOCATION);
final Flyway jobsFlyway = FlywayFactory.create(jobsDataSource, DbMigrationHandler.class.getSimpleName(), JobsDatabaseMigrator.DB_IDENTIFIER,
final Flyway jobsFlyway = FlywayFactory.create(jobsDataSource, ServerApp.class.getSimpleName(), JobsDatabaseMigrator.DB_IDENTIFIER,
JobsDatabaseMigrator.MIGRATION_FILE_LOCATION);

getServer(new ServerFactory.Api(), configs, configsDslContext, configsFlyway, jobsDslContext, jobsFlyway).start();
Expand Down
10 changes: 0 additions & 10 deletions airbyte-server/src/main/java/io/airbyte/server/ServerFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import io.airbyte.persistence.job.JobPersistence;
import io.airbyte.server.apis.AttemptApiController;
import io.airbyte.server.apis.ConnectionApiController;
import io.airbyte.server.apis.DbMigrationApiController;
import io.airbyte.server.apis.DestinationApiController;
import io.airbyte.server.apis.DestinationDefinitionApiController;
import io.airbyte.server.apis.DestinationDefinitionSpecificationApiController;
Expand All @@ -36,7 +35,6 @@
import io.airbyte.server.apis.WorkspaceApiController;
import io.airbyte.server.apis.binders.AttemptApiBinder;
import io.airbyte.server.apis.binders.ConnectionApiBinder;
import io.airbyte.server.apis.binders.DbMigrationBinder;
import io.airbyte.server.apis.binders.DestinationApiBinder;
import io.airbyte.server.apis.binders.DestinationDefinitionApiBinder;
import io.airbyte.server.apis.binders.DestinationDefinitionSpecificationApiBinder;
Expand All @@ -57,7 +55,6 @@
import io.airbyte.server.apis.binders.WorkspaceApiBinder;
import io.airbyte.server.apis.factories.AttemptApiFactory;
import io.airbyte.server.apis.factories.ConnectionApiFactory;
import io.airbyte.server.apis.factories.DbMigrationApiFactory;
import io.airbyte.server.apis.factories.DestinationApiFactory;
import io.airbyte.server.apis.factories.DestinationDefinitionApiFactory;
import io.airbyte.server.apis.factories.DestinationDefinitionSpecificationApiFactory;
Expand All @@ -78,7 +75,6 @@
import io.airbyte.server.apis.factories.WorkspaceApiFactory;
import io.airbyte.server.handlers.AttemptHandler;
import io.airbyte.server.handlers.ConnectionsHandler;
import io.airbyte.server.handlers.DbMigrationHandler;
import io.airbyte.server.handlers.DestinationDefinitionsHandler;
import io.airbyte.server.handlers.DestinationHandler;
import io.airbyte.server.handlers.HealthCheckHandler;
Expand Down Expand Up @@ -123,7 +119,6 @@ ServerRunnable create(final SynchronousSchedulerClient synchronousSchedulerClien
final Flyway jobsFlyway,
final AttemptHandler attemptHandler,
final ConnectionsHandler connectionsHandler,
final DbMigrationHandler dbMigrationHandler,
final DestinationDefinitionsHandler destinationDefinitionsHandler,
final DestinationHandler destinationApiHandler,
final HealthCheckHandler healthCheckHandler,
Expand Down Expand Up @@ -161,7 +156,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
final Flyway jobsFlyway,
final AttemptHandler attemptHandler,
final ConnectionsHandler connectionsHandler,
final DbMigrationHandler dbMigrationHandler,
final DestinationDefinitionsHandler destinationDefinitionsHandler,
final DestinationHandler destinationApiHandler,
final HealthCheckHandler healthCheckHandler,
Expand All @@ -187,8 +181,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
schedulerHandler,
mdc);

DbMigrationApiFactory.setValues(dbMigrationHandler, mdc);

DestinationApiFactory.setValues(destinationApiHandler, schedulerHandler, mdc);

DestinationDefinitionApiFactory.setValues(destinationDefinitionsHandler);
Expand Down Expand Up @@ -229,7 +221,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
final Set<Class<?>> componentClasses = Set.of(
AttemptApiController.class,
ConnectionApiController.class,
DbMigrationApiController.class,
DestinationApiController.class,
DestinationDefinitionApiController.class,
DestinationDefinitionSpecificationApiController.class,
Expand All @@ -253,7 +244,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
new CorsFilter(),
new AttemptApiBinder(),
new ConnectionApiBinder(),
new DbMigrationBinder(),
new DestinationApiBinder(),
new DestinationDefinitionApiBinder(),
new DestinationDefinitionSpecificationApiBinder(),
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 020b95a

Please sign in to comment.