Switch FLOAT types to DOUBLE in the database

SQLite has no NUMERIC(8,3) type, which it should acutally be.
Switch to DOUBLE, because FLOAT maps to f32 which is not supported
by GraphQL.
This commit is contained in:
Paul van Tilburg 2019-07-09 12:15:03 +02:00
parent 33c9520d5d
commit 0b7471467e
5 changed files with 20 additions and 20 deletions

View File

@ -5,7 +5,7 @@ CREATE TABLE customers (
"address_street" VARCHAR(255) NOT NULL,
"email" VARCHAR(255) NOT NULL,
"financial_contact" VARCHAR(255) NOT NULL,
"hourly_rate" FLOAT,
"hourly_rate" DOUBLE,
"name" VARCHAR(255) NOT NULL,
"phone" VARCHAR(255) NOT NULL,
"short_name" VARCHAR(255) NOT NULL,

View File

@ -1,12 +1,12 @@
CREATE TABLE tasks (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"customer_id" INTEGER NOT NULL,
"fixed_cost" FLOAT,
"hourly_rate" FLOAT,
"fixed_cost" DOUBLE,
"hourly_rate" DOUBLE,
"invoice_comment" VARCHAR(255) NOT NULL,
"invoice_id" INTEGER,
"name" VARCHAR(255) NOT NULL,
"vat_rate" FLOAT NOT NULL,
"vat_rate" DOUBLE NOT NULL,
"created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
)

View File

@ -23,7 +23,7 @@ pub struct Customer {
/// The name of the financial contact person/department
pub financial_contact: String,
/// The default hourly rate (if applicable)
pub hourly_rate: Option<f32>,
pub hourly_rate: Option<f64>,
/// The official (long) name
pub name: String,
/// The phone number
@ -55,7 +55,7 @@ pub struct NewCustomer {
/// The name of the financial contact person/department
pub financial_contact: String,
/// The default hourly rate (if applicable)
pub hourly_rate: Option<f32>,
pub hourly_rate: Option<f64>,
/// The official (long) name
pub name: String,
/// The phone number

View File

@ -18,9 +18,9 @@ pub struct Task {
/// The ID of the associated customer
pub customer_id: i32,
/// The fixed cost of the task (if applicable)
pub fixed_cost: Option<f32>,
pub fixed_cost: Option<f64>,
/// The hourly rate of the task (if applicable)
pub hourly_rate: Option<f32>,
pub hourly_rate: Option<f64>,
/// An extra comment for on the invoice
pub invoice_comment: String,
/// The associated invoice (if billed)
@ -28,7 +28,7 @@ pub struct Task {
/// The name/description
pub name: String,
/// The VAT rate (at time of billing)
pub vat_rate: f32,
pub vat_rate: f64,
/// The time of creation
pub created_at: NaiveDateTime,
/// The time of last update
@ -45,9 +45,9 @@ pub struct NewTask {
/// The ID of the associated customer
pub customer_id: i32,
/// The fixed cost of the task (if applicable)
pub fixed_cost: Option<f32>,
pub fixed_cost: Option<f64>,
/// The hourly rate of the task (if applicable)
pub hourly_rate: Option<f32>,
pub hourly_rate: Option<f64>,
/// An extra comment for on the invoice
pub invoice_comment: String,
/// The associated invoice (if billed)
@ -55,5 +55,5 @@ pub struct NewTask {
/// The name/description
pub name: String,
/// The VAT rate (at time of billing)
pub vat_rate: f32,
pub vat_rate: f64,
}

View File

@ -181,10 +181,10 @@ table! {
financial_contact -> Text,
/// The `hourly_rate` column of the `customers` table.
///
/// Its SQL type is `Nullable<Float>`.
/// Its SQL type is `Nullable<Double>`.
///
/// (Automatically generated by Diesel.)
hourly_rate -> Nullable<Float>,
hourly_rate -> Nullable<Double>,
/// The `name` column of the `customers` table.
///
/// Its SQL type is `Text`.
@ -299,16 +299,16 @@ table! {
customer_id -> Integer,
/// The `fixed_cost` column of the `tasks` table.
///
/// Its SQL type is `Nullable<Float>`.
/// Its SQL type is `Nullable<Double>`.
///
/// (Automatically generated by Diesel.)
fixed_cost -> Nullable<Float>,
fixed_cost -> Nullable<Double>,
/// The `hourly_rate` column of the `tasks` table.
///
/// Its SQL type is `Nullable<Float>`.
/// Its SQL type is `Nullable<Double>`.
///
/// (Automatically generated by Diesel.)
hourly_rate -> Nullable<Float>,
hourly_rate -> Nullable<Double>,
/// The `invoice_comment` column of the `tasks` table.
///
/// Its SQL type is `Text`.
@ -329,10 +329,10 @@ table! {
name -> Text,
/// The `vat_rate` column of the `tasks` table.
///
/// Its SQL type is `Float`.
/// Its SQL type is `Double`.
///
/// (Automatically generated by Diesel.)
vat_rate -> Float,
vat_rate -> Double,
/// The `created_at` column of the `tasks` table.
///
/// Its SQL type is `Timestamp`.