Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
49eeb29f
Commit
49eeb29f
authored
5 months ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
DB: Soubor s diplomy si pamatuje, zda je schválen
parent
9184d8d0
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
db/db.ddl
+1
-0
1 addition, 0 deletions
db/db.ddl
db/upgrade-20250117.sql
+1
-0
1 addition, 0 deletions
db/upgrade-20250117.sql
mo/db.py
+4
-0
4 additions, 0 deletions
mo/db.py
with
6 additions
and
0 deletions
db/db.ddl
+
1
−
0
View file @
49eeb29f
...
@@ -532,6 +532,7 @@ CREATE TABLE cert_files (
...
@@ -532,6 +532,7 @@ CREATE TABLE cert_files (
cert_set_id int NOT NULL REFERENCES cert_sets(contest_id) ON DELETE CASCADE,
cert_set_id int NOT NULL REFERENCES cert_sets(contest_id) ON DELETE CASCADE,
type cert_type NOT NULL,
type cert_type NOT NULL,
pdf_file text NOT NULL, -- relativně vůči mo.util.data_dir('cert')
pdf_file text NOT NULL, -- relativně vůči mo.util.data_dir('cert')
approved bool NOT NULL DEFAULT false,
UNIQUE (cert_set_id, type)
UNIQUE (cert_set_id, type)
);
);
...
...
This diff is collapsed.
Click to expand it.
db/upgrade-20250117.sql
+
1
−
0
View file @
49eeb29f
...
@@ -30,6 +30,7 @@ CREATE TABLE cert_files (
...
@@ -30,6 +30,7 @@ CREATE TABLE cert_files (
cert_set_id
int
NOT
NULL
REFERENCES
cert_sets
(
contest_id
)
ON
DELETE
CASCADE
,
cert_set_id
int
NOT
NULL
REFERENCES
cert_sets
(
contest_id
)
ON
DELETE
CASCADE
,
type
cert_type
NOT
NULL
,
type
cert_type
NOT
NULL
,
pdf_file
text
NOT
NULL
,
-- relativně vůči mo.util.data_dir('cert')
pdf_file
text
NOT
NULL
,
-- relativně vůči mo.util.data_dir('cert')
approved
bool
NOT
NULL
DEFAULT
false
,
UNIQUE
(
cert_set_id
,
type
)
UNIQUE
(
cert_set_id
,
type
)
);
);
...
...
This diff is collapsed.
Click to expand it.
mo/db.py
+
4
−
0
View file @
49eeb29f
...
@@ -1152,6 +1152,7 @@ class CertFile(Base):
...
@@ -1152,6 +1152,7 @@ class CertFile(Base):
cert_set_id
=
Column
(
Integer
,
ForeignKey
(
'
cert_sets.contest_id
'
,
ondelete
=
'
CASCADE
'
),
primary_key
=
True
)
cert_set_id
=
Column
(
Integer
,
ForeignKey
(
'
cert_sets.contest_id
'
,
ondelete
=
'
CASCADE
'
),
primary_key
=
True
)
type
=
Column
(
Enum
(
CertType
,
name
=
'
cert_type
'
),
nullable
=
False
,
primary_key
=
True
)
type
=
Column
(
Enum
(
CertType
,
name
=
'
cert_type
'
),
nullable
=
False
,
primary_key
=
True
)
pdf_file
=
Column
(
Text
,
nullable
=
False
)
pdf_file
=
Column
(
Text
,
nullable
=
False
)
approved
=
Column
(
Boolean
,
server_default
=
text
(
"
false
"
),
nullable
=
False
)
class
Certificate
(
Base
):
class
Certificate
(
Base
):
...
@@ -1164,6 +1165,9 @@ class Certificate(Base):
...
@@ -1164,6 +1165,9 @@ class Certificate(Base):
page_number
=
Column
(
Integer
,
nullable
=
False
)
page_number
=
Column
(
Integer
,
nullable
=
False
)
cert_set
=
relationship
(
'
CertSet
'
)
cert_set
=
relationship
(
'
CertSet
'
)
cert_file
=
relationship
(
'
CertFile
'
,
primaryjoin
=
'
and_(CertFile.cert_set_id == Certificate.cert_set_id, CertFile.type == Certificate.type)
'
,
foreign_keys
=
'
[Certificate.cert_set_id, Certificate.type]
'
)
user
=
relationship
(
'
User
'
)
user
=
relationship
(
'
User
'
)
...
...
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