Commit 382d518a authored by sim's avatar sim

[DB] Alembic: add support for roles

parent 9295d182
......@@ -98,6 +98,19 @@ class DropTriggerOp(ReversibleOp):
return CreateTriggerOp(
@Operations.register_operation("create_role", "invoke_for_target")
@Operations.register_operation("replace_sp", "replace")
class CreateRoleOp(ReversibleOp):
def reverse(self):
return DropRoleOp(
@Operations.register_operation("drop_role", "invoke_for_target")
class DropRoleOp(ReversibleOp):
def reverse(self):
return CreateRoleOp(
def create_view(operations, operation):
operations.execute("CREATE VIEW %s AS %s" % (
......@@ -143,3 +156,19 @@ def drop_trigger(operations, operation):[1]
def create_role(operations, operation):
args =
"CREATE ROLE %s WITH %s" % (,
args[0] if len(args) else 'NOLOGIN'
def drop_role(operations, operation):
operations.execute("DROP ROLE %s" %
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment