Skip to content

Commit

Permalink
update migrations with frozen string literal comment and other hound …
Browse files Browse the repository at this point in the history
…sniffs
  • Loading branch information
yuenmichelle1 committed Aug 1, 2023
1 parent fe8b489 commit 8c5300c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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!
Expand Down
Original file line number Diff line number Diff line change
@@ -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!
Expand Down
Original file line number Diff line number Diff line change
@@ -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!
Expand Down
Original file line number Diff line number Diff line change
@@ -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!
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 8c5300c

Please sign in to comment.