hackforla / peopledepot

A project to setup a datastore for people and projects at HackforLA. The link below takes you to the code documentation
https://hackforla.github.io/peopledepot/
GNU General Public License v2.0
7 stars 26 forks source link

Create Table: permission_history #37

Open Neecolaa opened 2 years ago

Neecolaa commented 2 years ago

Dependency

Overview

We need to create the permission_history table so that we can update a shared data store across hackforla.org, vrms, civictechjobs, and tables (onboarding) project.

Details

A table and a model are the same thing

Action Items

Resources/Instructions

Description

When a permission is overwritten in #22 a record of it will be stored in this table instead of being deleted.

All records that have dateEnded from the Permission table will be moved here 1:12 AM Pacific Time

Data Fields

  1. Copied from spreadsheet and checked off according to ERD. (unchecked items indicate a mismatch between ERD and spreadsheet, which requires a review)

    • [x] (PK) id - int - Record Id
    • [x] (FK) user_id - int - Record Id
    • [x] (FK) project_id - int - Record Id
    • [x] (FK) permission_type_id - int
    • [x] (FK) practice_area_id - int - Record Id
    • [x] granted - timestamp
    • [x] ended - timestamp
    • [x] (FK) created_by - int - User ID of who first granted the permission
    • [x] (FK) updated_by - int - User ID of who last changed the permission
  2. In ERD only (having items here indicates a mismatch, which requires a review)

    • None

Associated Tables

  1. Copied from spreadsheet and checked off according to ERD. (unchecked items indicate a mismatch between ERD and spreadsheet, which requires a review)

    • [x] permission_type (many-to-one)
    • [x] practice_area (many-to-one)
    • [x] project (many-to-one)
    • [x] user (many-to-one)
  2. In ERD only (having items here indicates a mismatch, which requires a review)

    • None
Neecolaa commented 2 years ago

The permission table has the created_by and updated_by fields, but permission_history does not. They will be added to the ERD and the spreadsheet because both fields are useful when looking through the history:

created_by and updated_by are both foreign keys containing user ids. If a permission isn't what it should be, we can use these values to figure out who to ask.

Neecolaa commented 1 year ago

ERD/SS To-do: replace role_id with practice_area_id

remove relationship between role and permission_history tables

add relationship between practice_area and permission_history tables

Discussion for these changes happened here: https://github.com/hackforla/peopledepot/discussions/170