forked from airbytehq/airbyte-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RBAC] add ORGANIZATION_MEMBER permission type - DB migration (#9273)
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...yte/db/instance/configs/migrations/V0_50_24_006__AddPermissionTypeOrganizationMember.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} |