Skip to content

Commit

Permalink
[RBAC] add ORGANIZATION_MEMBER permission type - DB migration (#9273)
Browse files Browse the repository at this point in the history
  • Loading branch information
keyihuang committed Oct 16, 2023
1 parent 630ae7e commit 8428a14
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class BootloaderTest {

// ⚠️ This line should change with every new migration to show that you meant to make a new
// migration to the prod database
private static final String CURRENT_CONFIGS_MIGRATION_VERSION = "0.50.24.005";
private static final String CURRENT_CONFIGS_MIGRATION_VERSION = "0.50.24.006";
private static final String CURRENT_JOBS_MIGRATION_VERSION = "0.50.4.001";
private static final String CDK_VERSION = "1.2.3";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.db.instance.configs.migrations;

import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;
import org.jooq.DSLContext;
import org.jooq.impl.DSL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Add a new Organization role as "ORGANIZATION_MEMBER".
*/
public class V0_50_24_006__AddPermissionTypeOrganizationMember extends BaseJavaMigration {

private static final Logger LOGGER = LoggerFactory.getLogger(V0_50_24_006__AddPermissionTypeOrganizationMember.class);
private static final String PERMISSION_TYPE_ENUM_NAME = "permission_type";
private static final String ORGANIZATION_MEMBER = "organization_member";

@Override
public void migrate(final Context context) throws Exception {
LOGGER.info("Running migration: {}", this.getClass().getSimpleName());

final DSLContext ctx = DSL.using(context.getConnection());

ctx.alterType(PERMISSION_TYPE_ENUM_NAME).addValue(ORGANIZATION_MEMBER).execute();
}

}

0 comments on commit 8428a14

Please sign in to comment.