Skip to content

Commit

Permalink
Merge pull request #259 from systemli/Adjust-Database-Table-Name
Browse files Browse the repository at this point in the history
🗃️ Adjust Database Table Name
  • Loading branch information
0x46616c6b authored Oct 22, 2023
2 parents 66793e4 + c37d3a9 commit 2f11138
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
6 changes: 2 additions & 4 deletions internal/legacy/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ func (m *Migration) Do() error {
},
},
Location: storage.TickerLocation{
CreatedAt: oldTicker.CreationDate,
UpdatedAt: time.Now(),
Lat: oldTicker.Location.Lat,
Lon: oldTicker.Location.Lon,
Lat: oldTicker.Location.Lat,
Lon: oldTicker.Location.Lon,
},
}

Expand Down
1 change: 0 additions & 1 deletion internal/storage/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import "gorm.io/gorm"
func MigrateDB(db *gorm.DB) error {
return db.AutoMigrate(
&Ticker{},
&TickerInformation{},
&TickerMastodon{},
&TickerTelegram{},
&User{},
Expand Down
12 changes: 4 additions & 8 deletions internal/storage/ticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ type Ticker struct {
Description string
Active bool
Information TickerInformation `gorm:"embedded"`
Location TickerLocation `gorm:"embedded"`
Telegram TickerTelegram
Mastodon TickerMastodon
Location TickerLocation `gorm:"embedded"`
Users []User `gorm:"many2many:user_tickers;"`
Users []User `gorm:"many2many:ticker_users;"`
}

func NewTicker() Ticker {
Expand Down Expand Up @@ -93,10 +93,6 @@ func (m *TickerMastodon) Reset() {
}

type TickerLocation struct {
ID int `gorm:"primaryKey"`
CreatedAt time.Time
UpdatedAt time.Time
TickerID int
Lat float64
Lon float64
Lat float64
Lon float64
}
2 changes: 1 addition & 1 deletion internal/storage/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type User struct {
Email string `storm:"unique"`
EncryptedPassword string
IsSuperAdmin bool
Tickers []Ticker `gorm:"many2many:user_tickers;"`
Tickers []Ticker `gorm:"many2many:ticker_users;"`
}

func NewUser(email, password string) (User, error) {
Expand Down

0 comments on commit 2f11138

Please sign in to comment.