From 1243d19e5560c80ab69089347615fb8957f9a88f Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Thu, 22 Oct 2020 09:51:02 +0500 Subject: [PATCH] Add table `reports` --- .../2020-10-22-044127_create_reports/down.sql | 3 +++ .../2020-10-22-044127_create_reports/up.sql | 22 +++++++++++++++++++ src/schema.rs | 11 ++++++++++ 3 files changed, 36 insertions(+) create mode 100644 migrations/2020-10-22-044127_create_reports/down.sql create mode 100644 migrations/2020-10-22-044127_create_reports/up.sql diff --git a/migrations/2020-10-22-044127_create_reports/down.sql b/migrations/2020-10-22-044127_create_reports/down.sql new file mode 100644 index 0000000..0b38933 --- /dev/null +++ b/migrations/2020-10-22-044127_create_reports/down.sql @@ -0,0 +1,3 @@ +-- This file should undo anything in `up.sql` + +DROP TABLE reports; diff --git a/migrations/2020-10-22-044127_create_reports/up.sql b/migrations/2020-10-22-044127_create_reports/up.sql new file mode 100644 index 0000000..5616ce8 --- /dev/null +++ b/migrations/2020-10-22-044127_create_reports/up.sql @@ -0,0 +1,22 @@ +-- Your SQL goes here + +CREATE TABLE reports ( + id SERIAL PRIMARY KEY, + datetime TIMESTAMP NOT NULL, + party VARCHAR NOT NULL, + amount VARCHAR NOT NULL, + download VARCHAR NOT NULL +); + +-- Insert data + +INSERT INTO reports (datetime, party, amount, download) VALUES + ('2019-02-01', 'Namecheap, Inc.', '-$9.06', '/database_files/namecheap-order-42319180.pdf'), + ('2019-12-01', 'Namecheap, Inc.', '-$13.16', '/database_files/namecheap-order-51346327.pdf'), + ('2020-03-01', 'DigitalOcean LLC', '-$36.00', '/database_files/DigitalOcean Invoice 2020 Mar (4455684-414728758).pdf'), + ('2020-04-01', 'DigitalOcean LLC', '-$14.76', '/database_files/DigitalOcean Invoice 2020 Apr (4455684-415657724).pdf'), + ('2020-05-01', 'DigitalOcean LLC', '-$12.00', '/database_files/DigitalOcean Invoice 2020 May (4455684-416077081).pdf'), + ('2020-06-01', 'DigitalOcean LLC', '-$19.27', '/database_files/DigitalOcean Invoice 2020 Jun (4455684-417055952).pdf'), + ('2020-07-01', 'DigitalOcean LLC', '-$22.85', '/database_files/DigitalOcean Invoice 2020 Jul (4455684-417777310).pdf'), + ('2020-08-01', 'DigitalOcean LLC', '-$24.00', '/database_files/DigitalOcean Invoice 2020 Aug (4455684-418606400).pdf'), + ('2020-09-01', 'DigitalOcean LLC', '-$24.00', '/database_files/DigitalOcean Invoice 2020 Sep (4455684-419361545).pdf'); diff --git a/src/schema.rs b/src/schema.rs index a2758c3..d10a791 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -36,6 +36,16 @@ table! { } } +table! { + reports (id) { + id -> Int4, + datetime -> Timestamp, + party -> Varchar, + amount -> Varchar, + download -> Varchar, + } +} + table! { users (id) { id -> Int4, @@ -49,5 +59,6 @@ allow_tables_to_appear_in_same_query!( employee_contacts, employee_infos, employees, + reports, users, );