-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set building number on views to strings
- Loading branch information
Showing
5 changed files
with
71 additions
and
30 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
20 changes: 20 additions & 0 deletions
20
supabase/migrations/20240605091301_building-number-string-views.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 @@ | ||
do $$ | ||
declare buildings_latest_states_def text; | ||
declare spaces_latest_states_def text; | ||
declare exec_text_one text; | ||
declare exec_text_two text; | ||
begin | ||
buildings_latest_states_def := pg_get_viewdef('buildings_latest_states'); | ||
drop materialized view buildings_latest_states; | ||
spaces_latest_states_def := pg_get_viewdef('spaces_latest_states'); | ||
drop materialized view spaces_latest_states; | ||
|
||
alter table "public"."access_points_latest_states" alter column "building_number" set data type text using "building_number"::text; | ||
|
||
exec_text_one := format('create view buildings_latest_states as %s', | ||
buildings_latest_states_def); | ||
execute exec_text_one; | ||
exec_text_two := format('create view spaces_latest_states as %s', | ||
spaces_latest_states_def); | ||
execute exec_text_two; | ||
end $$; |
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