commit 3112abc875dcb26b2d8629c0601995324902cb67
parent 4490b161595277ad127261e5554f59b926760f0d
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Wed, 20 Dec 2023 22:28:18 -0500
can reorder tables
Diffstat:
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/cmd/dkf/migrations/156.sql b/cmd/dkf/migrations/156.sql
@@ -0,0 +1,4 @@
+-- +migrate Up
+ALTER TABLE poker_tables ADD COLUMN idx INTEGER NOT NULL DEFAULT 0;
+
+-- +migrate Down
diff --git a/pkg/database/tablePokerTables.go b/pkg/database/tablePokerTables.go
@@ -9,6 +9,7 @@ import (
type PokerTable struct {
ID int64
+ IDX int64
Slug string
Name string
MinBuyIn PokerChip
@@ -18,7 +19,7 @@ type PokerTable struct {
}
func (d *DkfDB) GetPokerTables() (out []PokerTable, err error) {
- err = d.db.Find(&out).Error
+ err = d.db.Order("idx ASC, id").Find(&out).Error
return
}