Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Kontr 2.0
Portal API Backend
Commits
75bab1f7
Verified
Commit
75bab1f7
authored
Mar 31, 2019
by
Kristyna Pekarkova
Committed by
Peter Stanko
Apr 13, 2019
Browse files
Add review item versioning
parent
c7c7bb6e
Changes
2
Show whitespace changes
Inline
Side-by-side
migrations/versions/949bc914e571_.py
0 → 100644
View file @
75bab1f7
"""empty message
Revision ID: 949bc914e571
Revises: 6347503cdaef
Create Date: 2019-03-31 17:50:21.196715
"""
from
alembic
import
op
import
sqlalchemy
as
sa
# revision identifiers, used by Alembic.
revision
=
'949bc914e571'
down_revision
=
'6347503cdaef'
branch_labels
=
None
depends_on
=
None
def
upgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
add_column
(
'reviewItem'
,
sa
.
Column
(
'version_id'
,
sa
.
Integer
(),
nullable
=
False
))
# ### end Alembic commands ###
def
downgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
drop_column
(
'reviewItem'
,
'version_id'
)
# ### end Alembic commands ###
portal/database/models.py
View file @
75bab1f7
...
...
@@ -1037,6 +1037,7 @@ class ReviewItem(db.Model, EntityBase):
file
=
db
.
Column
(
db
.
String
(
256
),
nullable
=
True
)
line_start
=
db
.
Column
(
db
.
Integer
,
nullable
=
True
)
line_end
=
db
.
Column
(
db
.
Integer
,
nullable
=
True
)
version_id
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
)
def
__init__
(
self
,
user
:
User
,
review
:
Review
,
content
:
str
=
None
,
file
:
str
=
None
,
line
:
int
=
None
,
line_start
:
int
=
None
,
line_end
:
int
=
None
):
...
...
@@ -1060,6 +1061,10 @@ class ReviewItem(db.Model, EntityBase):
self
.
line_start
=
line
self
.
line_end
=
line
__mapper_args__
=
{
"version_id_col"
:
version_id
}
@
hybrid_property
def
line
(
self
)
->
int
:
"""Get line by default returns line_start
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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