Skip to content

Commit

Permalink
made sure that there is no float vs double vs decimal confusion for l…
Browse files Browse the repository at this point in the history
…at/lon
  • Loading branch information
CommanderStorm committed Aug 23, 2024
1 parent 36d3be9 commit 1f89462
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions server/backend/migration/20220713000000.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ type InitialCafeteria struct {
Cafeteria int64 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteria;type:int;not null;" json:"canteen" `
Name string `gorm:"column:name;type:text;not null;" json:"name" `
Address string `gorm:"column:address;type:text;not null;" json:"address" `
Latitude float32 `gorm:"column:latitude;type:float;not null;" json:"latitude" `
Longitude float32 `gorm:"column:longitude;type:float;not null;" json:"longitude"`
Latitude float64 `gorm:"column:latitude;type:double;not null;" json:"latitude" `
Longitude float64 `gorm:"column:longitude;type:double;not null;" json:"longitude"`
}

// TableName sets the insert table name for this struct type
Expand Down Expand Up @@ -186,10 +186,10 @@ func (n *InitialDishToDishNameTag) TableName() string {
type InitialCafeteriaRatingAverage struct {
CafeteriaRatingAverage int64 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRatingAverage;type:int;not null;" json:"canteenRatingAverage" `
CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"canteenID"`
Average float64 `gorm:"column:average;type:float;not null;" json:"average" `
Average float32 `gorm:"column:average;type:float;not null;" json:"average" `
Min int32 `gorm:"column:min;type:int;not null;" json:"min"`
Max int32 `gorm:"column:max;type:int;not null;" json:"max"`
Std float64 `gorm:"column:std;type:float;not null;" json:"std"`
Std float32 `gorm:"column:std;type:float;not null;" json:"std"`
}

// TableName sets the insert table name for this struct type
Expand Down Expand Up @@ -234,10 +234,10 @@ type InitialDishRatingAverage struct {
DishRatingAverage int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishRatingAverage;type:int;not null;" json:"dishRatingAverage" `
CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"`
DishID int64 `gorm:"column:dishID;foreignKey:dish;type:int;not null;" json:"dishID"`
Average float64 `gorm:"column:average;type:float;not null;" json:"average" `
Average float32 `gorm:"column:average;type:float;not null;" json:"average" `
Min int32 `gorm:"column:min;type:int;not null;" json:"min"`
Max int32 `gorm:"column:max;type:int;not null;" json:"max"`
Std float64 `gorm:"column:std;type:float;not null;" json:"std"`
Std float32 `gorm:"column:std;type:float;not null;" json:"std"`
}

// TableName sets the insert table name for this struct type
Expand Down
8 changes: 4 additions & 4 deletions server/backend/migration/20231015000000.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
type CafeteriaRatingAverage struct {
CafeteriaRatingAverage int64 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRatingAverage;type:int;not null;"`
CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;"`
Average float64 `gorm:"column:average;type:float;not null;"`
Average float32 `gorm:"column:average;type:float;not null;"`
Min int32 `gorm:"column:min;type:int;not null;"`
Max int32 `gorm:"column:max;type:int;not null;"`
Std float64 `gorm:"column:std;type:float;not null;"`
Std float32 `gorm:"column:std;type:float;not null;"`
}

// TableName sets the insert table name for this struct type
Expand All @@ -27,10 +27,10 @@ type DishRatingAverage struct {
DishRatingAverage int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishRatingAverage;type:int;not null;"`
CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;"`
DishID int64 `gorm:"column:dishID;foreignKey:dish;type:int;not null;"`
Average float64 `gorm:"column:average;type:float;not null;"`
Average float32 `gorm:"column:average;type:float;not null;"`
Min int32 `gorm:"column:min;type:int;not null;"`
Max int32 `gorm:"column:max;type:int;not null;"`
Std float64 `gorm:"column:std;type:float;not null;"`
Std float32 `gorm:"column:std;type:float;not null;"`
}

// TableName sets the insert table name for this struct type
Expand Down
4 changes: 2 additions & 2 deletions server/backend/migration/static_data/source-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ create table if not exists feedback
reply_to text charset utf8 null,
feedback text charset utf8 not null,
image_count int null,
latitude decimal(11, 8) null,
longitude decimal(11, 8) null,
latitude double null,
longitude double null,
timestamp datetime /* mariadb-5.3 */ default current_timestamp() null
) auto_increment = 293;

Expand Down
4 changes: 2 additions & 2 deletions server/model/cafeteria.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type Cafeteria struct {
Cafeteria int64 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteria;type:int;not null;" json:"canteen" `
Name string `gorm:"column:name;type:text;not null;" json:"name" `
Address string `gorm:"column:address;type:text;not null;" json:"address" `
Latitude float32 `gorm:"column:latitude;type:float;not null;" json:"latitude" `
Longitude float32 `gorm:"column:longitude;type:float;not null;" json:"longitude"`
Latitude float64 `gorm:"column:latitude;type:double;not null;" json:"latitude" `
Longitude float64 `gorm:"column:longitude;type:double;not null;" json:"longitude"`
}

// TableName sets the insert table name for this struct type
Expand Down
4 changes: 2 additions & 2 deletions server/model/cafeteria_rating_statistic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package model
// CafeteriaRatingStatistic is a view for statistics of cafeteria ratings
type CafeteriaRatingStatistic struct {
CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;"`
Average float64 `gorm:"column:average;type:float;not null;"`
Average float32 `gorm:"column:average;type:float;not null;"`
Min int32 `gorm:"column:min;type:int;not null;"`
Max int32 `gorm:"column:max;type:int;not null;"`
Std float64 `gorm:"column:std;type:float;not null;"`
Std float32 `gorm:"column:std;type:float;not null;"`
}
4 changes: 2 additions & 2 deletions server/model/dish_rating_statistic.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package model
type DishRatingStatistic struct {
CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;"`
DishID int64 `gorm:"column:dishID;foreignKey:dish;type:int;not null;"`
Average float64 `gorm:"column:average;type:float;not null;"`
Average float32 `gorm:"column:average;type:float;not null;"`
Min int32 `gorm:"column:min;type:int;not null;"`
Max int32 `gorm:"column:max;type:int;not null;"`
Std float64 `gorm:"column:std;type:float;not null;"`
Std float32 `gorm:"column:std;type:float;not null;"`
}
4 changes: 2 additions & 2 deletions server/model/feedback.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ type Feedback struct {
ReplyToEmail null.String `gorm:"column:reply_to_email;type:text;null;uniqueIndex:receiver_reply_to_feedback_app_version_uindex,expression:reply_to_email(100)"`
ReplyToName null.String `gorm:"column:reply_to_name;type:text;null"`
Feedback string `gorm:"column:feedback;type:text;not null;uniqueIndex:receiver_reply_to_feedback_app_version_uindex,expression:feedback(255)"`
Latitude null.Float `gorm:"column:latitude;type:float;null;"`
Longitude null.Float `gorm:"column:longitude;type:float;null;"`
Latitude null.Float `gorm:"column:latitude;type:double;null;"`
Longitude null.Float `gorm:"column:longitude;type:double;null;"`
OsVersion null.String `gorm:"column:os_version;type:text;null;"`
AppVersion null.String `gorm:"column:app_version;type:text;null;uniqueIndex:receiver_reply_to_feedback_app_version_uindex,expression:app_version(100)"`
Processed bool `gorm:"column:processed;type:boolean;default:false;not null;"`
Expand Down

0 comments on commit 1f89462

Please sign in to comment.