diff --git a/sevenkeys/database/operations/inserts.go b/sevenkeys/database/operations/inserts.go deleted file mode 100644 index 11683c5..0000000 --- a/sevenkeys/database/operations/inserts.go +++ /dev/null @@ -1,33 +0,0 @@ -package operations - -import ( - "database/sql" -) - -func InsertCardStorageLocation(db *sql.DB, cardPrintingId string, isFoil bool, storageBox string, source string) error { - var lastPosition int - getLastPositionQuery := `SELECT Position FROM CardStorageLocation WHERE StorageBox = ? ORDER BY Position DESC LIMIT 1;` - err := db.QueryRow(getLastPositionQuery, storageBox).Scan(&lastPosition) - - var nextPosition int - if err == sql.ErrNoRows { - nextPosition = 1 - } else { - nextPosition = lastPosition + 1 - } - - insertQuery := `INSERT INTO CardStorageLocation - (CardPrintingId, IsFoil, StorageBox, Source, Position) - VALUES (?, ?, ?, ?, ?);` - insert, err := db.Prepare(insertQuery) - if err != nil { - return err - } - - _, err = insert.Exec(cardPrintingId, isFoil, storageBox, source, nextPosition) - if err != nil { - return err - } - - return nil -}