pull down to refresh

Since you're talking about refactoring, is there a better way to make DB updates than with Prisma migrations?
It can get very hard to follow since tables get defined and redefined in migration files instead of in one place. I checked and Prisma says you can't define a materialized view in the schema, so that's kinda sucky. But even things like custom functions... do they need to be defined in migration files? I may be asking for too much here...
30 sats \ 0 replies \ @k00b 22h
Yep, views and store procedures have to be defined in migrations sadly. sndev psql can help you inspect stuff pretty well though.
stackernews=# \dv
                  List of relations
 Schema |            Name             | Type | Owner 
--------+-----------------------------+------+-------
 public | all_days                    | view | sn
 public | all_months                  | view | sn
 public | days                        | view | sn
 public | hot_score_constants         | view | sn
 public | last_24_hours               | view | sn
 public | today                       | view | sn
 public | zap_rank_constants          | view | sn
 public | zap_rank_personal_constants | view | sn
(8 rows)

stackernews=# \dm
                        List of relations
 Schema |            Name             |       Type        | Owner 
--------+-----------------------------+-------------------+-------
 public | all_days                    | view              | sn
 public | all_months                  | view              | sn
 public | days                        | view              | sn
 public | hot_score_constants         | view              | sn
 public | hot_score_view              | materialized view | sn
 public | item_growth_days            | materialized view | sn
 public | item_growth_hours           | materialized view | sn
 public | item_growth_months          | materialized view | sn
 public | last_24_hours               | view              | sn
 public | reg_growth_days             | materialized view | sn
 public | reg_growth_hours            | materialized view | sn
 public | reg_growth_months           | materialized view | sn
 public | rewards_days                | materialized view | sn
 public | rewards_today               | materialized view | sn
 public | sat_rank_tender_view        | materialized view | sn
 public | sat_rank_wwm_view           | materialized view | sn
 public | spender_growth_days         | materialized view | sn
 public | spender_growth_hours        | materialized view | sn
 public | spender_growth_months       | materialized view | sn
 public | spending_growth_days        | materialized view | sn
 public | spending_growth_hours       | materialized view | sn
 public | spending_growth_months      | materialized view | sn
 public | stackers_growth_days        | materialized view | sn
 public | stackers_growth_hours       | materialized view | sn
 public | stackers_growth_months      | materialized view | sn
 public | stacking_growth_days        | materialized view | sn
 public | stacking_growth_hours       | materialized view | sn
 public | stacking_growth_months      | materialized view | sn
 public | sub_stats_days              | materialized view | sn
 public | sub_stats_hours             | materialized view | sn
 public | sub_stats_months            | materialized view | sn
 public | today                       | view              | sn
 public | user_stats_days             | materialized view | sn
 public | user_stats_hours            | materialized view | sn
 public | user_stats_months           | materialized view | sn
 public | user_values_days            | materialized view | sn
 public | user_values_today           | materialized view | sn
 public | zap_rank_constants          | view              | sn
 public | zap_rank_personal_constants | view              | sn
 public | zap_rank_personal_view      | materialized view | sn
 public | zap_rank_tender_view        | materialized view | sn
 public | zap_rank_wwm_view           | materialized view | sn
(42 rows)
Then, I'll usually just search in primsa for them. I'll be going through and deleting some of these unused views soon. I'll create a doc for them all while I'm doing that.
reply