stephencweiss / matilda

See your time in a whole new way. Small, lightweight, magical.
MIT License
1 stars 0 forks source link

Create database for Budget side of Matilda #3

Closed stephencweiss closed 5 years ago

stephencweiss commented 5 years ago

W,W,W

Matilda will need a place to store a user's budget for their time.

DoD

stephencweiss commented 5 years ago

Using Sequelize models, the database tables have been created.

matilda=# \d
                          List of relations
 Schema |              Name               |   Type   |     Owner
--------+---------------------------------+----------+---------------
 public | budget_items                    | table    | matilda_admin
 public | budget_items_budget_item_id_seq | sequence | matilda_admin
 public | budgets                         | table    | matilda_admin
 public | budgets_budget_id_seq           | sequence | matilda_admin
 public | users                           | table    | matilda_admin
 public | users_user_id_seq               | sequence | matilda_admin
(6 rows)

matilda=# \d budget_items;
                                          Table "public.budget_items"
     Column      |     Type      | Collation | Nullable |                       Default
-----------------+---------------+-----------+----------+------------------------------------------------------
 budget_item_id  | integer       |           | not null | nextval('budget_items_budget_item_id_seq'::regclass)
 hours_allocated | numeric(10,2) |           |          |
 budget_id       | integer       |           |          |
Indexes:
    "budget_items_pkey" PRIMARY KEY, btree (budget_item_id)

matilda=# \d budgets;
                                         Table "public.budgets"
  Column   |          Type          | Collation | Nullable |                  Default
-----------+------------------------+-----------+----------+--------------------------------------------
 budget_id | integer                |           | not null | nextval('budgets_budget_id_seq'::regclass)
 category  | character varying(255) |           |          |
 owner_id  | integer                |           | not null |
Indexes:
    "budgets_pkey" PRIMARY KEY, btree (budget_id, owner_id)
Foreign-key constraints:
    "budgets_owner_id_fkey" FOREIGN KEY (owner_id) REFERENCES users(user_id)

matilda=# \d users
                                           Table "public.users"
     Column      |          Type          | Collation | Nullable |                Default
-----------------+------------------------+-----------+----------+----------------------------------------
 user_id         | integer                |           | not null | nextval('users_user_id_seq'::regclass)
 email           | character varying(255) |           |          |
 first_name      | character varying(255) |           |          |
 last_name       | character varying(255) |           |          |
 salted_password | character varying(255) |           |          |
 salt            | character varying(255) |           |          |
Indexes:
    "users_pkey" PRIMARY KEY, btree (user_id)
Referenced by:
    TABLE "budgets" CONSTRAINT "budgets_owner_id_fkey" FOREIGN KEY (owner_id) REFERENCES users(user_id)
stephencweiss commented 5 years ago

image Database successfully seeded

stephencweiss commented 5 years ago

Addressed with the PR #4