diff --git a/db/migrate/20230725185947_create_daily_group_classifications_count_and_time.rb b/db/migrate/20230725185947_create_daily_group_classifications_count_and_time.rb index 2830260..02d441e 100644 --- a/db/migrate/20230725185947_create_daily_group_classifications_count_and_time.rb +++ b/db/migrate/20230725185947_create_daily_group_classifications_count_and_time.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateDailyGroupClassificationsCountAndTime < ActiveRecord::Migration[7.0] # we have to disable the migration transaction because creating materialized views within it is not allowed. disable_ddl_transaction! diff --git a/db/migrate/20230725193600_create_daily_group_project_classification_count_and_time.rb b/db/migrate/20230725193600_create_daily_group_project_classification_count_and_time.rb index f95760a..f4bbe00 100644 --- a/db/migrate/20230725193600_create_daily_group_project_classification_count_and_time.rb +++ b/db/migrate/20230725193600_create_daily_group_project_classification_count_and_time.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateDailyGroupProjectClassificationCountAndTime < ActiveRecord::Migration[7.0] # we have to disable the migration transaction because creating materialized views within it is not allowed. disable_ddl_transaction! diff --git a/db/migrate/20230725194157_create_daily_group_workflow_classification_count_and_time.rb b/db/migrate/20230725194157_create_daily_group_workflow_classification_count_and_time.rb index 0c6bc7b..9ca5629 100644 --- a/db/migrate/20230725194157_create_daily_group_workflow_classification_count_and_time.rb +++ b/db/migrate/20230725194157_create_daily_group_workflow_classification_count_and_time.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateDailyGroupWorkflowClassificationCountAndTime < ActiveRecord::Migration[7.0] # we have to disable the migration transaction because creating materialized views within it is not allowed. disable_ddl_transaction! diff --git a/db/migrate/20230725194325_create_daily_group_user_classification_count_and_time.rb b/db/migrate/20230725194325_create_daily_group_user_classification_count_and_time.rb index 605b2cc..6f58c5a 100644 --- a/db/migrate/20230725194325_create_daily_group_user_classification_count_and_time.rb +++ b/db/migrate/20230725194325_create_daily_group_user_classification_count_and_time.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateDailyGroupUserClassificationCountAndTime < ActiveRecord::Migration[7.0] # we have to disable the migration transaction because creating materialized views within it is not allowed. disable_ddl_transaction! @@ -6,7 +8,8 @@ class CreateDailyGroupUserClassificationCountAndTime < ActiveRecord::Migration[7 ## Even though the view are very similar we cannot query from just daily_user_classification_count_and_time to get stats info of that user for that group. ## Reason being: ## A) daily_user_classification_count_and_time does not consider when a user has joined a group. - ## (So if we queried for all time for the user group, the user's old classifications [when he/she/they were not part of the group] would be counted towards the user group) [Vice versa if a user LEAVES a user group] + ## (So if we queried for all time for the user group, the user's old classifications [when he/she/they were not part of the group] would be counted towards the user group) + ## [Vice versa if a user LEAVES a user group] ## B) On the flip side, we cannot query from just daily_group_classification_count_and_time_per_user, because not every user belongs to a group. def change execute <<~SQL diff --git a/db/migrate/20230801163815_create_daily_group_user_project_count_and_time.rb b/db/migrate/20230801163815_create_daily_group_user_project_count_and_time.rb index bcda0c7..0d8caf3 100644 --- a/db/migrate/20230801163815_create_daily_group_user_project_count_and_time.rb +++ b/db/migrate/20230801163815_create_daily_group_user_project_count_and_time.rb @@ -3,12 +3,14 @@ class CreateDailyGroupUserProjectCountAndTime < ActiveRecord::Migration[7.0] # we have to disable the migration transaction because creating materialized views within it is not allowed. disable_ddl_transaction! - ## We should note that this view looks very similar to the daily_user_classification_count_and_time_per_project (where the columns of that table are day, user_id, classification_count, total_session_time, project_id). + ## We should note that this view looks very similar to the daily_user_classification_count_and_time_per_project + ## (where the columns of that table are day, user_id, classification_count, total_session_time, project_id). ## The only difference between this view and daily_user_classification_count_and_time_per_project is that we are grouping by user_group_id (i.e. user_group_id is a column in this view). ## Even though the views are very similar we cannot query from just daily_user_classification_count_and_time_per_project to get stats info of that user for that group. ## Reason being: ## A) daily_user_classification_count_and_time_per_project does not consider WHEN a user has joined a group. - ## (So if we queried for all time for the user group, the user's old classifications [when he/she/they were not part of the group] would be counted towards the user group) [Vice versa if a user LEAVES a user group] + ## (So if we queried for all time for the user group, the user's old classifications [when he/she/they were not part of the group] would be counted towards the user group) + ## [Vice versa if a user LEAVES a user group] ## B) On the flip side, we cannot query from just daily_group_classification_count_and_time_per_user_per_prject when querying for just user stats, because not every user belongs to a group. def change execute <<~SQL diff --git a/db/migrate/20230801163827_create_daily_group_user_workflow_count_and_time.rb b/db/migrate/20230801163827_create_daily_group_user_workflow_count_and_time.rb index b36cf38..368938b 100644 --- a/db/migrate/20230801163827_create_daily_group_user_workflow_count_and_time.rb +++ b/db/migrate/20230801163827_create_daily_group_user_workflow_count_and_time.rb @@ -1,12 +1,16 @@ +# frozen_string_literal: true + class CreateDailyGroupUserWorkflowCountAndTime < ActiveRecord::Migration[7.0] # we have to disable the migration transaction because creating materialized views within it is not allowed. disable_ddl_transaction! - ## We should note that this view looks very similar to the daily_user_classification_count_and_time_per_workflow (where the columns of that table are day, user_id, classification_count, total_session_time, workflow_id). + ## We should note that this view looks very similar to the daily_user_classification_count_and_time_per_workflow + ## (where the columns of that table are day, user_id, classification_count, total_session_time, workflow_id). ## The only difference between this view and daily_user_classification_count_and_time_per_workflow is that we are grouping by user_group_id (i.e. user_group_id is a column in this view). ## Even though the views are very similar we cannot query from just daily_user_classification_count_and_time_per_workflow to get stats info of that user for that group. ## Reason being: ## A) daily_user_classification_count_and_time_per_workflow does not consider WHEN a user has joined a group. - ## (So if we queried for all time for the user group, the user's old classifications [when he/she/they were not part of the group] would be counted towards the user group) [Vice versa if a user LEAVES a user group] + ## (So if we queried for all time for the user group, the user's old classifications [when he/she/they were not part of the group] would be counted towards the user group) + ## [Vice versa if a user LEAVES a user group] ## B) On the flip side, we cannot query from just daily_group_classification_count_and_time_per_user_per_workflow when querying for just user stats, because not every user belongs to a group. def change execute <<~SQL