***
Wartungsfenster jeden ersten Mittwoch vormittag im Monat
***
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Formatscaper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Center for Research Data Management
Formatscaper
Commits
07272dd1
Commit
07272dd1
authored
1 year ago
by
Moser, Maximilian
Browse files
Options
Downloads
Patches
Plain Diff
Add a unique constraint for filenames per record
parent
72ac9f87
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
formatscaper/models.py
+4
-1
4 additions, 1 deletion
formatscaper/models.py
with
4 additions
and
1 deletion
formatscaper/models.py
+
4
−
1
View file @
07272dd1
import
dataclasses
import
dataclasses
from
typing
import
List
,
Optional
from
typing
import
List
,
Optional
from
sqlalchemy
import
ForeignKey
,
create_engine
from
sqlalchemy
import
ForeignKey
,
UniqueConstraint
,
create_engine
from
sqlalchemy.orm
import
DeclarativeBase
,
Mapped
,
Session
,
mapped_column
,
relationship
from
sqlalchemy.orm
import
DeclarativeBase
,
Mapped
,
Session
,
mapped_column
,
relationship
...
@@ -98,6 +98,9 @@ class Result(ModelBase):
...
@@ -98,6 +98,9 @@ class Result(ModelBase):
format_id
:
Mapped
[
Optional
[
int
]]
=
mapped_column
(
ForeignKey
(
"
format.id
"
))
format_id
:
Mapped
[
Optional
[
int
]]
=
mapped_column
(
ForeignKey
(
"
format.id
"
))
format
:
Mapped
[
Format
]
=
relationship
(
back_populates
=
"
results
"
)
format
:
Mapped
[
Format
]
=
relationship
(
back_populates
=
"
results
"
)
# filenames are unique per record
__table_args__
=
UniqueConstraint
(
"
record
"
,
"
filename
"
)
@property
@property
def
risk
(
self
):
def
risk
(
self
):
"""
Calculate the risk assessment for the file.
"""
"""
Calculate the risk assessment for the file.
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment