hackforla / hackforla/peopledepot

Update Table: Add "core_" prefix to `project_affiliate_xref` and `project_stack_element_xref ` table names in db

Open
#497 5 comments 0 reactions 1 assignee Claimed by @fyliu View on GitHub
feature: update table good first issue PII: FALSE role: back end s: PD team size: 0.5pt
Dominant language
Python
Stars
14
Forks
37
Avg merge
9d 15h
Merged PRs (30d)
5

Description

### Overview

We need to update the `project_affiliate_xref` table model to set the db table name to `core_project_affiliate_xref`, because that's the naming convention for all the other tables.

#### Details

- The initial model issue: #65
- Discussion leading to this change is here: See screenshot below where all other tables start with `core_`


screenshot

![Image](https://github.com/user-attachments/assets/6c72f41f-a9d7-4988-a248-ab8a9842a217)

- Do this by renaming the `db_table` lines in `models.py`

### Action Items

- Update existing Django model

- [x] set the database table name to core_project_affiliate_xref and core_project_stack_element_xref in `models.py`
- [x] generate migration file
- [x] verify the table name by regenerating the `table-descriptions.csv` file

### Resources
- Spreadsheet: [PD: Table and field explanations, Current Field Permission tab](https://docs.google.com/spreadsheets/d/1x_zZ8JLS2hO-zG0jUocOJmX16jh-DF5dccrd_OEGNZ0/edit?gid=749942651)
- There's a script that generates the table descriptions file in `./scripts/`
- [generate a schema table definition](https://github.com/hackforla/peopledepot/issues/378#issuecomment-2493062821)

### Final DB table names after the change

Details

```
List of relations
Schema | Name | Type | Owner
--------+---------------------------------------+-------+--------------
public | auth_group | table | people_depot
public | auth_group_permissions | table | people_depot
public | auth_permission | table | people_depot
public | core_accomplishment | table | people_depot
public | core_affiliate | table | people_depot
public | core_checktype | table | people_depot
public | core_event | table | people_depot
public | core_eventtype | table | people_depot
public | core_faq | table | people_depot
public | core_faqviewed | table | people_depot
public | core_leadershiptype | table | people_depot
public | core_location | table | people_depot
public | core_modernjobtitle | table | people_depot
public | core_organization | table | people_depot
public | core_permissiontype | table | people_depot
public | core_practicearea | table | people_depot
public | core_programarea | table | people_depot
public | core_project | table | people_depot
public | core_project_affiliate_xref | table | people_depot
public | core_project_project_leads | table | people_depot
public | core_project_stack_element_xref | table | people_depot
public | core_projectprogramareaxref | table | people_depot
public | core_projectsdgxref | table | people_depot
public | core_projectstatus | table | people_depot
public | core_projecturl | table | people_depot
public | core_referrer | table | people_depot
public | core_referrertype | table | people_depot
public | core_sdg | table | people_depot
public | core_sdgtargetindicator | table | people_depot
public | core_skill | table | people_depot
public | core_socbroad | table | people_depot
public | core_socdetailed | table | people_depot
public | core_socmajor | table | people_depot
public | core_socminor | table | people_depot
public | core_stackelement | table | people_depot
public | core_stackelementtype | table | people_depot
public | core_urlstatustype | table | people_depot
public | core_urltype | table | people_depot
public | core_user | table | people_depot
public | core_user_groups | table | people_depot
public | core_user_practice_area_secondary | table | people_depot
public | core_user_practice_area_target_intake | table | people_depot
public | core_user_user_permissions | table | people_depot
public | core_usercheck | table | people_depot
public | core_useremploymenthistory | table | people_depot
public | core_userpermission | table | people_depot
public | core_userstatustype | table | people_depot
public | core_win | table | people_depot
public | core_win_practice_areas | table | people_depot
public | core_win_teams | table | people_depot
public | core_wintype | table | people_depot
public | django_admin_log | table | people_depot
public | django_content_type | table | people_depot
public | django_migrations | table | people_depot
public | django_session | table | people_depot
(55 rows)
```

[table-descriptions.csv](https://github.com/user-attachments/files/27784214/table-descriptions.csv)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.