diff options
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/categories.rs | 4 | ||||
-rw-r--r-- | src/db/incomes.rs | 4 | ||||
-rw-r--r-- | src/db/payments.rs | 9 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/db/categories.rs b/src/db/categories.rs index 05b1323..0e2a28c 100644 --- a/src/db/categories.rs +++ b/src/db/categories.rs @@ -60,9 +60,9 @@ pub async fn create(pool: &SqlitePool, c: &Create) -> Option<i64> { let res = sqlx::query( r#" INSERT INTO - categories(name, color, created_at) + categories(name, color) VALUES - (?, ?, datetime()) + (?, ?) "#, ) .bind(c.name.clone()) diff --git a/src/db/incomes.rs b/src/db/incomes.rs index cbbfce7..5f44398 100644 --- a/src/db/incomes.rs +++ b/src/db/incomes.rs @@ -133,9 +133,9 @@ pub async fn create(pool: &SqlitePool, i: &Create) -> Option<i64> { let res = sqlx::query( r#" INSERT INTO - incomes(user_id, date, amount, created_at) + incomes(user_id, date, amount) VALUES - (?, ?, ?, datetime()) + (?, ?, ?) "#, ) .bind(i.user_id) diff --git a/src/db/payments.rs b/src/db/payments.rs index 0197375..35e7f68 100644 --- a/src/db/payments.rs +++ b/src/db/payments.rs @@ -257,9 +257,9 @@ pub async fn create(pool: &SqlitePool, p: &payment::Create) -> Option<i64> { let res = sqlx::query( r#" INSERT INTO - payments(name, cost, user_id, category_id, date, frequency, created_at) + payments(name, cost, user_id, category_id, date, frequency) VALUES - (?, ?, ?, ?, ?, ?, datetime()) + (?, ?, ?, ?, ?, ?) "#, ) .bind(p.name.clone()) @@ -443,15 +443,14 @@ ON pub async fn create_monthly_payments(pool: &SqlitePool) -> () { let query = r#" INSERT INTO - payments(name, cost, user_id, category_id, date, frequency, created_at) + payments(name, cost, user_id, category_id, date, frequency) SELECT name, cost, user_id, category_id, date() AS date, - 'Punctual' AS frequency, - datetime() AS created_at + 'Punctual' AS frequency FROM payments WHERE |