Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
382d518a
Commit
382d518a
authored
Oct 05, 2017
by
sim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DB] Alembic: add support for roles
parent
9295d182
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
alembic.py
gargantext/util/alembic.py
+29
-0
No files found.
gargantext/util/alembic.py
View file @
382d518a
...
@@ -98,6 +98,19 @@ class DropTriggerOp(ReversibleOp):
...
@@ -98,6 +98,19 @@ class DropTriggerOp(ReversibleOp):
return
CreateTriggerOp
(
self
.
target
)
return
CreateTriggerOp
(
self
.
target
)
@
Operations
.
register_operation
(
"create_role"
,
"invoke_for_target"
)
@
Operations
.
register_operation
(
"replace_sp"
,
"replace"
)
class
CreateRoleOp
(
ReversibleOp
):
def
reverse
(
self
):
return
DropRoleOp
(
self
.
target
)
@
Operations
.
register_operation
(
"drop_role"
,
"invoke_for_target"
)
class
DropRoleOp
(
ReversibleOp
):
def
reverse
(
self
):
return
CreateRoleOp
(
self
.
target
)
@
Operations
.
implementation_for
(
CreateViewOp
)
@
Operations
.
implementation_for
(
CreateViewOp
)
def
create_view
(
operations
,
operation
):
def
create_view
(
operations
,
operation
):
operations
.
execute
(
"CREATE VIEW
%
s AS
%
s"
%
(
operations
.
execute
(
"CREATE VIEW
%
s AS
%
s"
%
(
...
@@ -143,3 +156,19 @@ def drop_trigger(operations, operation):
...
@@ -143,3 +156,19 @@ def drop_trigger(operations, operation):
operation
.
target
.
args
[
1
]
operation
.
target
.
args
[
1
]
)
)
)
)
@
Operations
.
implementation_for
(
CreateRoleOp
)
def
create_role
(
operations
,
operation
):
args
=
operation
.
target
.
args
operations
.
execute
(
"CREATE ROLE
%
s WITH
%
s"
%
(
operation
.
target
.
name
,
args
[
0
]
if
len
(
args
)
else
'NOLOGIN'
)
)
@
Operations
.
implementation_for
(
DropRoleOp
)
def
drop_role
(
operations
,
operation
):
operations
.
execute
(
"DROP ROLE
%
s"
%
operation
.
target
.
name
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment