-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1409 from cityofaustin/18533-school-zone-beacons
Make school zone beacons from open dataset available to choose in components form
- Loading branch information
Showing
28 changed files
with
1,410 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
moped-database/migrations/1725983667950_add_beacons_asset_table/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
DROP TABLE feature_school_beacons; | ||
|
||
DELETE FROM feature_layers WHERE internal_table IN ('feature_school_beacons') |
30 changes: 30 additions & 0 deletions
30
moped-database/migrations/1725983667950_add_beacons_asset_table/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CREATE TABLE public.feature_school_beacons ( | ||
school_zone_beacon_id text NOT NULL, | ||
beacon_id text NOT NULL, | ||
knack_id text NOT NULL, | ||
location_name text NOT NULL, | ||
zone_name text NOT NULL, | ||
beacon_name text NOT NULL, | ||
geography geography('MULTIPOINT') NOT NULL, | ||
created_at timestamptz NOT NULL DEFAULT now(), | ||
created_by_user_id int4 NULL, | ||
updated_by_user_id int4 NULL, | ||
updated_at timestamptz DEFAULT now() | ||
) inherits (features); | ||
|
||
|
||
ALTER TABLE feature_school_beacons | ||
ADD CONSTRAINT fk_feature_school_beacons_created_by FOREIGN KEY (created_by_user_id) REFERENCES moped_users(user_id), | ||
ADD CONSTRAINT fk_feature_school_beacons_updated_by FOREIGN KEY (updated_by_user_id) REFERENCES moped_users(user_id); | ||
|
||
-- Adding comments for audit fields | ||
COMMENT ON COLUMN feature_school_beacons.created_at IS 'Timestamp of when the school beacon feature was created'; | ||
COMMENT ON COLUMN feature_school_beacons.created_by_user_id IS 'User ID of the creator of the school beacon feature'; | ||
COMMENT ON COLUMN feature_school_beacons.updated_by_user_id IS 'User ID of the last updater of the school beacon feature'; | ||
COMMENT ON COLUMN feature_school_beacons.updated_at IS 'Timestamp of the last update of the school beacon feature'; | ||
|
||
-- Adding comments for feature_school_beacons constraints | ||
COMMENT ON CONSTRAINT fk_feature_school_beacons_created_by ON feature_school_beacons IS 'Foreign key constraint linking created_by_user_id to moped_users table.'; | ||
COMMENT ON CONSTRAINT fk_feature_school_beacons_updated_by ON feature_school_beacons IS 'Foreign key constraint linking updated_by_user_id to moped_users table.'; | ||
|
||
INSERT INTO feature_layers (id, internal_table, reference_layer_primary_key_column) values (6, 'feature_school_beacons', 'school_zone_beacon_id'); |
6 changes: 6 additions & 0 deletions
6
moped-database/migrations/1726048331776_update_school_beacon_asset_feature_layer/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- revert asset layer for school zone beacons | ||
UPDATE moped_components | ||
SET | ||
asset_feature_layer_id = NULL | ||
WHERE | ||
component_subtype = 'School Zone Beacon'; |
6 changes: 6 additions & 0 deletions
6
moped-database/migrations/1726048331776_update_school_beacon_asset_feature_layer/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- set asset layer for school beacon to signals | ||
UPDATE moped_components | ||
SET | ||
asset_feature_layer_id = 6 | ||
WHERE | ||
component_subtype = 'School Zone Beacon'; |
5 changes: 5 additions & 0 deletions
5
moped-database/migrations/1726852807615_school_beacon_triggers/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DROP TRIGGER IF EXISTS update_feature_school_beacons_council_district ON feature_school_beacons; | ||
|
||
DROP TRIGGER IF EXISTS feature_school_beacons_parent_audit_log_trigger ON feature_school_beacons; | ||
|
||
DROP TRIGGER IF EXISTS set_feature_school_beacons_updated_at ON feature_school_beacons; |
20 changes: 20 additions & 0 deletions
20
moped-database/migrations/1726852807615_school_beacon_triggers/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
CREATE TRIGGER update_feature_school_beacons_council_district BEFORE INSERT OR UPDATE ON | ||
feature_school_beacons FOR EACH ROW EXECUTE FUNCTION update_council_district(); | ||
COMMENT ON TRIGGER update_feature_school_beacons_council_district ON feature_school_beacons IS | ||
'Trigger to insert record in feature_council_district table connecting feature_id with corresponding council district id'; | ||
|
||
|
||
-- Trigger for feature_school_beacons table | ||
CREATE TRIGGER feature_school_beacons_parent_audit_log_trigger | ||
AFTER INSERT OR UPDATE ON feature_school_beacons | ||
FOR EACH ROW | ||
EXECUTE FUNCTION update_audit_fields_with_dynamic_parent_table_name("moped_proj_components", "project_component_id", "component_id"); | ||
COMMENT ON TRIGGER feature_school_beacons_parent_audit_log_trigger ON feature_school_beacons IS 'Trigger to update parent project and component audit fields'; | ||
|
||
|
||
CREATE TRIGGER set_feature_school_beacons_updated_at | ||
BEFORE INSERT OR UPDATE ON feature_school_beacons | ||
FOR EACH ROW | ||
EXECUTE FUNCTION public.set_updated_at(); | ||
|
||
COMMENT ON TRIGGER set_feature_school_beacons_updated_at ON public.feature_school_beacons IS 'Trigger to set updated_at timestamp for each insert or update on feature_school_beacons'; |
Oops, something went wrong.