Skip to content

Commit

Permalink
made sure that stp_type is nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Jul 3, 2024
1 parent 829b78f commit 56461ad
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 46 deletions.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Add down migration script here

ALTER TABLE calendar RENAME COLUMN title_de TO stp_title_de;
ALTER TABLE calendar RENAME COLUMN title_en TO stp_title_en;

DELETE FROM calendar where stp_type is null;
ALTER TABLE calendar CHANGE COLUMN stp_type SET NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Add up migration script here
ALTER TABLE calendar RENAME COLUMN stp_title_de TO title_de;
ALTER TABLE calendar RENAME COLUMN stp_title_en TO title_en;

ALTER TABLE calendar ALTER COLUMN stp_type drop not null;
10 changes: 5 additions & 5 deletions server/main-api/src/calendar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ mod tests {
end_at: *TIME_2014,
title_de: "Quantenteleportation".into(),
title_en: "Quantum teleportation".into(),
stp_type: "Vorlesung mit Zentralübung".into(),
stp_type: Some("Vorlesung mit Zentralübung".into()),
entry_type: models::EventType::Lecture,
detailed_entry_type: "Abhaltung".into(),
},
Expand All @@ -212,7 +212,7 @@ mod tests {
end_at: *TIME_2016,
title_de: "Quantenteleportation 2".into(),
title_en: "Quantum teleportation 2".into(),
stp_type: "Vorlesung mit Zentralübung".into(),
stp_type: Some("Vorlesung mit Zentralübung".into()),
entry_type: models::EventType::Lecture,
detailed_entry_type: "Abhaltung".into(),
},
Expand All @@ -223,7 +223,7 @@ mod tests {
end_at: *TIME_2016,
title_de: "Wartung".into(),
title_en: "maintenance".into(),
stp_type: "Vorlesung mit Zentralübung".into(),
stp_type: Some("Vorlesung mit Zentralübung".into()),
entry_type: models::EventType::Barred,
detailed_entry_type: "Abhaltung".into(),
},
Expand All @@ -234,7 +234,7 @@ mod tests {
end_at: *TIME_2020,
title_de: "Quantenteleportation 3".into(),
title_en: "Quantum teleportation 3".into(),
stp_type: "Vorlesung".into(),
stp_type: Some("Vorlesung".into()),
entry_type: models::EventType::Other,
detailed_entry_type: "Abhaltung".into(),
},
Expand All @@ -245,7 +245,7 @@ mod tests {
end_at: *TIME_2010,
title_de: "Quantenteleportation 3".into(),
title_en: "Quantum teleportation 3".into(),
stp_type: "Vorlesung".into(),
stp_type: Some("Vorlesung".into()),
entry_type: models::EventType::Exam,
detailed_entry_type: "Abhaltung".into(),
},
Expand Down
2 changes: 1 addition & 1 deletion server/main-api/src/calendar/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub(super) struct Event {
/// e.g. Quantum teleportation
pub(super) title_en: String,
/// e.g. Vorlesung mit Zentralübung
pub(super) stp_type: String,
pub(super) stp_type: Option<String>,
/// e.g. lecture
pub(super) entry_type: EventType,
/// e.g. Abhaltung
Expand Down

0 comments on commit 56461ad

Please sign in to comment.