Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore:Migration fixes #196

Merged
merged 3 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/api/CampusService.pb.go

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

892 changes: 520 additions & 372 deletions server/api/CampusService.pb.gw.go

Large diffs are not rendered by default.

190 changes: 115 additions & 75 deletions server/api/CampusService_grpc.pb.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions server/api/buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: cc916c31859748a68fd229a3c8d7a2e8
digest: shake256:469b049d0eb04203d5272062636c078decefc96fec69739159c25d85349c50c34c7706918a8b216c5c27f76939df48452148cff8c5c3ae77fa6ba5c25c1b8bf8
commit: 28151c0d0a1641bf938a7672c500e01d
digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de
47 changes: 43 additions & 4 deletions server/api/gen/openapiv2/CampusService.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiCafeteria"
}
}
Expand All @@ -191,6 +192,7 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiTagsOverview"
}
}
Expand Down Expand Up @@ -247,6 +249,7 @@
"200": {
"description": "A successful response.",
"schema": {
"type": "object",
"properties": {}
}
},
Expand Down Expand Up @@ -438,23 +441,23 @@
},
{
"name": "year",
"description": "\u003e=2022 until the current year.",
"description": "\u003e=2022 until the current year",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "week",
"description": "range 1 - 53.",
"description": "range 1 - 53",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "day",
"description": "range 0 (Monday) - 4 (Friday).",
"description": "range 0 (Monday) - 4 (Friday)",
"in": "query",
"required": false,
"type": "integer",
Expand All @@ -475,6 +478,7 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiTagsOverview"
}
}
Expand All @@ -500,6 +504,7 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiTagsOverview"
}
}
Expand Down Expand Up @@ -555,6 +560,7 @@
"200": {
"description": "A successful response.",
"schema": {
"type": "object",
"properties": {}
}
},
Expand Down Expand Up @@ -600,7 +606,7 @@
"parameters": [
{
"name": "eventId",
"description": "optional parameter, will return all events if no id is specified.",
"description": "optional parameter, will return all events if no id is specified",
"in": "query",
"required": false,
"type": "integer",
Expand Down Expand Up @@ -720,6 +726,7 @@
},
{
"name": "imageNr",
"description": "todo where does the file come from?",
"in": "path",
"required": true,
"type": "integer",
Expand Down Expand Up @@ -805,6 +812,7 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiGetLocationsReplyLocation"
}
}
Expand Down Expand Up @@ -868,6 +876,7 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiNewsSource"
}
}
Expand Down Expand Up @@ -1007,6 +1016,7 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/GetRoomMapsReplyMap"
}
}
Expand Down Expand Up @@ -1074,6 +1084,7 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/GetRoomScheduleReplyRoomScheduleEvent"
}
}
Expand Down Expand Up @@ -1109,6 +1120,7 @@
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiRoom"
}
}
Expand Down Expand Up @@ -1276,6 +1288,7 @@
"rating": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiSingleRatingReply"
}
},
Expand All @@ -1298,6 +1311,7 @@
"ratingTags": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiRatingTagResult"
}
}
Expand Down Expand Up @@ -1342,6 +1356,7 @@
"rating": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiSingleRatingReply"
}
},
Expand All @@ -1364,12 +1379,14 @@
"ratingTags": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiRatingTagResult"
}
},
"nameTags": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiRatingTagResult"
}
}
Expand Down Expand Up @@ -1460,6 +1477,7 @@
"areaFacilitiesByBuildingNr": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiRoomInformationElement"
}
}
Expand All @@ -1471,6 +1489,7 @@
"building2Gps": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiBuilding2GpsElement"
}
}
Expand All @@ -1482,6 +1501,7 @@
"cafeteria": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiCafeteria"
}
}
Expand Down Expand Up @@ -1529,6 +1549,7 @@
"events": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiEventListMsgElement"
}
}
Expand All @@ -1540,6 +1561,7 @@
"kinos": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiKinoMsgElement"
}
}
Expand All @@ -1551,6 +1573,7 @@
"listOfElevators": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiRoomInformationElement"
}
}
Expand All @@ -1562,6 +1585,7 @@
"listOfToilets": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiRoomInformationElement"
}
}
Expand All @@ -1573,6 +1597,7 @@
"locations": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiGetLocationsReplyLocation"
}
}
Expand Down Expand Up @@ -1619,6 +1644,7 @@
"information": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiMoreInformationElement"
}
}
Expand Down Expand Up @@ -1660,6 +1686,7 @@
"facilities": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiOpeningTimesMsgElement"
}
}
Expand All @@ -1671,6 +1698,7 @@
"responsiblePerson": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiResponsiblePersonElement"
}
}
Expand Down Expand Up @@ -1706,6 +1734,7 @@
"maps": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/GetRoomMapsReplyMap"
}
}
Expand All @@ -1725,6 +1754,7 @@
"events": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/GetRoomScheduleReplyRoomScheduleEvent"
}
}
Expand Down Expand Up @@ -1753,6 +1783,7 @@
"rooms": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiStudyRoomMsgElement"
}
}
Expand All @@ -1764,6 +1795,7 @@
"ratingTags": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiTagsOverview"
}
}
Expand Down Expand Up @@ -1928,6 +1960,7 @@
"ratingTags": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiRatingTag"
},
"title": "Optional list of tag ratings add as many tags with a rating (1-5) of the list of cafeteriaRatingTags"
Expand Down Expand Up @@ -1962,6 +1995,7 @@
"ratingTags": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiRatingTag"
},
"title": "Optional list of tag ratings add as many tags with a rating (1-5) of the list of dishRatingTags"
Expand Down Expand Up @@ -1992,6 +2026,7 @@
"sources": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiNewsSource"
}
}
Expand Down Expand Up @@ -2210,6 +2245,7 @@
"rooms": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiRoom"
}
}
Expand Down Expand Up @@ -2251,6 +2287,7 @@
"ratingTags": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiRatingTagNewRequest"
}
},
Expand Down Expand Up @@ -2298,6 +2335,7 @@
"rooms": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiStudyRoom"
}
}
Expand Down Expand Up @@ -2340,6 +2378,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
9 changes: 4 additions & 5 deletions server/backend/migration/20221210000000.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ func (m TumDBMigrator) migrate20221210000000() *gormigrate.Migration {
return err
}

// Add the 'canteenHeadCount' enum value
// err = tx.Exec("ALTER TABLE crontab MODIFY COLUMN type enum('news', 'mensa', 'chat', 'kino', 'roomfinder', 'ticketsale', 'alarm', 'fileDownload','dishNameDownload','averageRatingComputation', 'canteenHeadCount');").Error
if err != nil {
// allow "canteenHeadCount" in the enum
if err := SafeEnumMigrate(tx, model.Crontab{}, "type", "canteenHeadCount"); err != nil {
return err
}

Expand All @@ -40,8 +39,8 @@ func (m TumDBMigrator) migrate20221210000000() *gormigrate.Migration {
if err != nil {
return err
}
// Remove the 'canteenHeadCount' enum value
return tx.Exec("ALTER TABLE crontab MODIFY COLUMN type enum('news', 'mensa', 'chat', 'kino', 'roomfinder', 'ticketsale', 'alarm', 'fileDownload','dishNameDownload','averageRatingComputation');").Error
// Remove the 'canteenHeadCount' from the enum
return SafeEnumRollback(tx, model.Crontab{}, "type", "canteenHeadCount")
},
}
}
Loading