Skip to content

Commit

Permalink
fixed there being a difference between :CURRENT_TIMESTAMP and `:cur…
Browse files Browse the repository at this point in the history
…rent_timestamp()`

the second one is needed because of mysql
  • Loading branch information
CommanderStorm committed Aug 23, 2024
1 parent 1f89462 commit 8a8ef67
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions server/backend/migration/20220713000000.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type InitialCafeteriaRating struct {
Points int32 `gorm:"column:points;type:int;not null;" json:"points"`
Comment string `gorm:"column:comment;type:text;" json:"comment" `
CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"canteenID"`
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:CURRENT_TIMESTAMP;OnUpdate:CURRENT_TIMESTAMP;" json:"timestamp" `
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:current_timestamp();OnUpdate:current_timestamp();" json:"timestamp" `
Image string `gorm:"column:image;type:text;" json:"image"`
}

Expand Down Expand Up @@ -150,7 +150,7 @@ type InitialDishRating struct {
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"`
Comment string `gorm:"column:comment;type:text;" json:"comment"`
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:CURRENT_TIMESTAMP;OnUpdate:CURRENT_TIMESTAMP;" json:"timestamp"`
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:current_timestamp();OnUpdate:current_timestamp();" json:"timestamp"`
Image string `gorm:"column:image;type:text;" json:"image"`
}

Expand Down
2 changes: 1 addition & 1 deletion server/backend/migration/20221210000000.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type InitialCanteenHeadCount struct {
Count uint32 `gorm:"column:count;type:int;not null;" json:"count"`
MaxCount uint32 `gorm:"column:max_count;type:int;not null;" json:"max_count"`
Percent float32 `gorm:"column:percent;type:float;not null;" json:"percent"`
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:CURRENT_TIMESTAMP;OnUpdate:CURRENT_TIMESTAMP;" json:"timestamp" `
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:current_timestamp();OnUpdate:current_timestamp();" json:"timestamp" `
}

// TableName sets the insert table name for this struct type
Expand Down
2 changes: 1 addition & 1 deletion server/model/cafeteria_rating.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type CafeteriaRating struct {
Points int32 `gorm:"column:points;type:int;not null;" json:"points"`
Comment string `gorm:"column:comment;type:text;" json:"comment" `
CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"canteenID"`
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:CURRENT_TIMESTAMP;OnUpdate:CURRENT_TIMESTAMP;" json:"timestamp" `
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:current_timestamp();OnUpdate:current_timestamp();" json:"timestamp" `
Image string `gorm:"column:image;type:text;" json:"image"`
}

Expand Down
2 changes: 1 addition & 1 deletion server/model/canteen_head_count.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type CanteenHeadCount struct {
Count uint32 `gorm:"column:count;type:int;not null;" json:"count"`
MaxCount uint32 `gorm:"column:max_count;type:int;not null;" json:"max_count"`
Percent float32 `gorm:"column:percent;type:float;not null;" json:"percent"`
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:CURRENT_TIMESTAMP;OnUpdate:CURRENT_TIMESTAMP;" json:"timestamp" `
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:current_timestamp();OnUpdate:current_timestamp();" json:"timestamp" `
}

// TableName sets the insert table name for this struct type
Expand Down
2 changes: 1 addition & 1 deletion server/model/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Device struct {
Member null.Int `gorm:"column:member;type:int;" json:"member"`
UUID string `gorm:"column:uuid;type:varchar(50);not null" json:"uuid"`
Created null.Time `gorm:"column:created;type:timestamp;" json:"created"`
LastAccess time.Time `gorm:"column:lastAccess;type:timestamp;default:CURRENT_TIMESTAMP;OnUpdate:CURRENT_TIMESTAMP;not null" json:"last_access"`
LastAccess time.Time `gorm:"column:lastAccess;type:timestamp;default:current_timestamp();OnUpdate:current_timestamp();not null" json:"last_access"`
LastAPI string `gorm:"column:lastApi;type:text;not null;default:('')" json:"last_api"`
Developer string `gorm:"column:developer;type:enum('true','false');default:'false';not null" json:"developer"`
OsVersion string `gorm:"column:osVersion;type:text;not null;default:('')" json:"os_version"`
Expand Down
2 changes: 1 addition & 1 deletion server/model/dish_rating.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type DishRating struct {
DishID int64 `gorm:"column:dishID;type:int;not null;index:dish_rating_dish_dish_fk" json:"dishID"`
Dish Dish `gorm:"foreignKey:dishID;references:dish;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Comment string `gorm:"column:comment;type:text;" json:"comment"`
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:CURRENT_TIMESTAMP;OnUpdate:CURRENT_TIMESTAMP;" json:"timestamp"`
Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;default:current_timestamp();OnUpdate:current_timestamp();" json:"timestamp"`
Image string `gorm:"column:image;type:text;" json:"image"`
}

Expand Down
2 changes: 1 addition & 1 deletion server/model/feedback.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Feedback struct {
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;"`
Timestamp null.Time `gorm:"column:timestamp;type:datetime;default:CURRENT_TIMESTAMP;null;"`
Timestamp null.Time `gorm:"column:timestamp;type:datetime;default:current_timestamp();null;"`
}

// TableName sets the insert table name for this struct type
Expand Down
2 changes: 1 addition & 1 deletion server/model/kino.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
type Kino struct {
Id int64 `gorm:"primary_key;AUTO_INCREMENT;column:kino;type:int;not null;"`
Date time.Time `gorm:"column:date;type:datetime;not null;"`
Created time.Time `gorm:"column:created;type:timestamp;not null;default:CURRENT_TIMESTAMP"`
Created time.Time `gorm:"column:created;type:timestamp;not null;default:current_timestamp()"`
Title string `gorm:"column:title;type:text;not null;"`
Year null.String `gorm:"column:year;type:varchar(4)"`
Runtime null.String `gorm:"column:runtime;type:varchar(40)"`
Expand Down
2 changes: 1 addition & 1 deletion server/model/news.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
type News struct {
News int64 `gorm:"primary_key;AUTO_INCREMENT;column:news;type:int;"`
Date time.Time `gorm:"column:date;type:datetime;"`
Created time.Time `gorm:"column:created;type:timestamp;default:CURRENT_TIMESTAMP;"`
Created time.Time `gorm:"column:created;type:timestamp;default:current_timestamp();"`
Title string `gorm:"column:title;type:text;size:255;"`
Description string `gorm:"column:description;type:text;size:65535;"`
NewsSourceID int64 `gorm:"column:src;type:int;"`
Expand Down
6 changes: 3 additions & 3 deletions server/model/news_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ type NewsAlert struct {
File File `gorm:"foreignKey:FileID;references:file;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Name null.String `gorm:"column:name;type:varchar(100);" json:"name"`
Link null.String `gorm:"column:link;type:text;size:65535;" json:"link"`
Created time.Time `gorm:"column:created;type:timestamp;default:CURRENT_TIMESTAMP;" json:"created"`
From time.Time `gorm:"column:from;type:datetime;default:CURRENT_TIMESTAMP;" json:"from"`
To time.Time `gorm:"column:to;type:datetime;default:CURRENT_TIMESTAMP;" json:"to"`
Created time.Time `gorm:"column:created;type:timestamp;default:current_timestamp();" json:"created"`
From time.Time `gorm:"column:from;type:datetime;default:current_timestamp();" json:"from"`
To time.Time `gorm:"column:to;type:datetime;default:current_timestamp();" json:"to"`
}

// TableName sets the insert table name for this struct type
Expand Down
2 changes: 1 addition & 1 deletion server/model/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Notification struct {
Location null.Int `gorm:"column:location;type:int;" json:"location"`
Title string `gorm:"column:title;type:text;size:65535;" json:"title"`
Description string `gorm:"column:description;type:text;size:65535;" json:"description"`
Created time.Time `gorm:"column:created;type:timestamp;default:CURRENT_TIMESTAMP;" json:"created"`
Created time.Time `gorm:"column:created;type:timestamp;default:current_timestamp();" json:"created"`
Signature null.String `gorm:"column:signature;type:text;size:65535;" json:"signature"`
Silent int32 `gorm:"column:silent;type:tinyint;default:0;" json:"silent"`
}
Expand Down
2 changes: 1 addition & 1 deletion server/model/notification_confirmation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type NotificationConfirmation struct {
Notification int64 `gorm:"primary_key;column:notification;type:int;" json:"notification"`
Device int64 `gorm:"primary_key;column:device;type:int;" json:"device"`
Sent int32 `gorm:"column:sent;type:tinyint;default:0;" json:"sent"`
Created time.Time `gorm:"column:created;type:timestamp;default:CURRENT_TIMESTAMP;" json:"created"`
Created time.Time `gorm:"column:created;type:timestamp;default:current_timestamp();" json:"created"`
Received null.Time `gorm:"column:received;type:timestamp;" json:"received"`
}

Expand Down

0 comments on commit 8a8ef67

Please sign in to comment.