[devices/models] fix last seen db type

This commit is contained in:
Aleksandr Soloshenko 2024-02-28 09:40:04 +07:00
parent 962278903a
commit 43beb9d6e9
2 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE `devices`
ADD `last_seen` datetime NOT NULL;
ADD `last_seen` datetime(3) NOT NULL;
-- +goose StatementEnd
-- +goose StatementBegin
UPDATE `devices`

View File

@ -34,7 +34,7 @@ type Device struct {
AuthToken string `gorm:"not null;uniqueIndex;type:char(21)"`
PushToken *string `gorm:"type:varchar(256)"`
LastSeen time.Time `gorm:"type:datetime;autoCreateTime"`
LastSeen time.Time `gorm:"not null;autocreatetime:false;default:CURRENT_TIMESTAMP(3)"`
UserID string `gorm:"not null;type:varchar(32)"`