Change db format a little

This commit is contained in:
Sebastiaan de Schaetzen 2025-05-17 16:08:05 +02:00
parent 238aedb5c9
commit d9521fc59b
2 changed files with 5 additions and 3 deletions

View File

@ -114,7 +114,7 @@ func (db *Db) CreateAllowance(userId int, allowance *CreateAllowanceRequest) (in
defer tx.MustRollback() defer tx.MustRollback()
// Insert the new allowance // Insert the new allowance
err = tx.Query("insert into allowances (user_id, name, target, progress, weight) values (?, ?, ?, 0, ?)"). err = tx.Query("insert into allowances (user_id, name, target, weight) values (?, ?, ?, ?)").
Bind(userId, allowance.Name, allowance.Target, allowance.Weight). Bind(userId, allowance.Name, allowance.Target, allowance.Weight).
Exec() Exec()

View File

@ -1,7 +1,9 @@
create table users create table users
( (
id integer primary key, id integer primary key,
name text not null name text not null,
weight real not null default 1.0,
balance integer not null default 0
) strict; ) strict;
create table history create table history
@ -18,7 +20,7 @@ create table allowances
user_id integer not null, user_id integer not null,
name text not null, name text not null,
target integer not null, target integer not null,
progress integer not null, progress integer not null default 0,
weight real not null weight real not null
); );