Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add audit and council district triggers to feature_school_beacons table #1427

Merged
merged 14 commits into from
Sep 26, 2024

Conversation

chiaberry
Copy link
Member

@chiaberry chiaberry commented Sep 23, 2024

Associated issues

cityofaustin/atd-data-tech#19105

Testing

local because of db changes, use a copy of production

Steps to test:

  1. To test update audit fields with dynamic parent table name, find a project updated a while back. Add a school beacon to the map. Save. Check that your project is now top of the list on the project list view, or run this to confirm the updated at time has changed
select project_id, project_name, updated_at from project_list_view plv where plv.project_id = [your id]
  1. To test set_updated_at(), open the beacon you added in step one, and update the description. Look at the school beacons table, and you will see your beacon has an updated_at timestamp. Since there are so few beacons, I find it enough to just check the table:
select * from feature_school_beacons
  1. To test council district, put a beacon in a district that you recognize. (the beacon at 1903 Ohlen road for example is in district 4). You will not see the council district updated on the summary page, that will be handled in a future PR. But you can see the council district here:
select fcd.id, council_district_id, fsb.beacon_name, mpc.project_id from features_council_districts fcd 
left join feature_school_beacons fsb on fcd.feature_id  = fsb.id
left join moped_proj_components mpc on mpc.project_component_id = fsb.component_id
where mpc.project_id = [your project]
  1. After you have done your changes above, you can see the activity log event invocations in the console:
    http://localhost:9695/console/events/data/activity_log_feature_school_beacons/logs
    The entries on the activity tab are sourced from the moped proj components table.

Ship list

@chiaberry chiaberry added the WIP Work in progress label Sep 23, 2024
Copy link
Collaborator

@mddilley mddilley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the migration up and down, and I was able to see the audit fields populate and update as expected in the feature, project component, and project levels. 🚢 🚀😎

@@ -178,7 +178,7 @@ export const getFeatureChangesFromComponentForm = (
} else if (newSchoolBeaconKnackId) {
if (
previousSchoolBeacon &&
newSchoolBeaconKnackId !== previousSchoolBeacon.id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! 🙏 this is making me question why we didn't go with Knack id for signals too, but I think that signal_id has shown to be reliable for them.

Copy link
Member

@johnclary johnclary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep—it works great!

in order to test the updated_at on the beacon feature, i had to edit the component and pick a different beacon. this caused the original beacon feature to become deleted, thus triggering the update trigger. i don't think there's any other way to edit a beacon feature besides that 🔍

i love seeing these trigger functions get attached to a new table—nice!! 🚢 🚢 🚢 🚢

Add feature_school_beacons to component feature database views
@chiaberry chiaberry merged commit 2744f1b into 18533-school-zone-beacons Sep 26, 2024
1 check passed
Copy link
Contributor

@mateoclarke mateoclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to get the ./hasura-cluster replicate command working with Mike's help getting access to the Read Replica. Still having issues connecting my local Moped DB to TablePlus but I was able to execute the SQL commands and test the functionality as described using the Hasura Console Raw Table page in the browser. 👍

@chiaberry chiaberry deleted the 19105-school-beacon-triggers branch October 24, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants