File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -281,3 +281,5 @@ cython_debug/
281
281
sql /trees_trees_2022-11-09T12-28-18.sql
282
282
sql /trees_bezirk_mitte_table_2022-11-08T16-32-58.sql
283
283
sql /* .dump
284
+ # user specific cursor rules
285
+ .cursor /rules /*
Original file line number Diff line number Diff line change @@ -168,6 +168,40 @@ npm test
168
168
169
169
On CI the Supabase is started automagically. See [ .github/workflows/tests.yml] ( .github/workflows/tests.yml )
170
170
171
+
172
+ ## Database Caveats
173
+
174
+ To not hardcode values in the edge functions we are using materialized views.
175
+
176
+ - ` most_frequent_tree_species `
177
+ - ` total_tree_species_count `
178
+ - ` waterings_with_location `
179
+
180
+ In case you need to restore the data from a backup you need to disable the triggers first.
181
+
182
+ ``` sql
183
+ ALTER TABLE trees DISABLE TRIGGER tg_refresh_trees_count_mv;
184
+ ALTER TABLE trees DISABLE TRIGGER tg_refresh_most_frequent_tree_species_mv;
185
+ ALTER TABLE trees DISABLE TRIGGER tg_refresh_total_tree_species_count_mv;
186
+ ```
187
+
188
+ After restore is done, refresh the materialized views and re-enable our specific triggers.
189
+
190
+ ``` sql
191
+ -- Manually refresh all materialized views
192
+ REFRESH MATERIALIZED VIEW CONCURRENTLY total_tree_species_count;
193
+ REFRESH MATERIALIZED VIEW CONCURRENTLY most_frequent_tree_species;
194
+ REFRESH MATERIALIZED VIEW CONCURRENTLY trees_count;
195
+
196
+ -- Re-enable our specific triggers
197
+ ALTER TABLE trees ENABLE TRIGGER tg_refresh_trees_count_mv;
198
+ ALTER TABLE trees ENABLE TRIGGER tg_refresh_most_frequent_tree_species_mv;
199
+ ALTER TABLE trees ENABLE TRIGGER tg_refresh_total_tree_species_count_mv;
200
+ ```
201
+
202
+
203
+
204
+
171
205
## Contributors ✨
172
206
173
207
Thanks goes to these wonderful people ([ emoji key] ( https://allcontributors.org/docs/en/emoji-key ) ):
Original file line number Diff line number Diff line change 7
7
"test" : " jest --runInBand" ,
8
8
"lint" : " eslint ./**/*.ts " ,
9
9
"format" : " prettier ./**/*.ts --write" ,
10
- "dev:supabase:functions" : " supabase functions serve --env-file .env" ,
10
+ "dev:supabase:functions" : " supabase functions serve --no-verify-jwt -- env-file supabase/ .env" ,
11
11
"supabase:types:local" : " supabase gen types --local > src/database.ts"
12
12
},
13
13
"engines" : {
You can’t perform that action at this time.
0 commit comments