Skip to content

Consolidating references to storage apps table - #44995

Merged
maureensturgeon merged 5 commits into
stagingfrom
maureen/consolidate-storage-apps-refs
Mar 25, 2022
Merged

Consolidating references to storage apps table#44995
maureensturgeon merged 5 commits into
stagingfrom
maureen/consolidate-storage-apps-refs

Conversation

@maureensturgeon

@maureensturgeon maureensturgeon commented Feb 23, 2022

Copy link
Copy Markdown
Contributor

The changes here remove direct references to the storage apps table in pegasus and replace them with references to methods in storage_apps.rb. This is in preparation to move the table into dashboard DB and rename it projects. Minimizing the number of places that we reference the table name makes this transition easier.

(Swap out behind the flag started here: #45476)

Links

Testing story

Tested that project pages, creating a new project and project-backed levels still work as expected.

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@maureensturgeon
maureensturgeon force-pushed the maureen/consolidate-storage-apps-refs branch from ccfa4da to 5ecfeea Compare March 23, 2022 19:39
@maureensturgeon
maureensturgeon marked this pull request as ready for review March 24, 2022 19:12
@maureensturgeon
maureensturgeon requested a review from a team March 24, 2022 19:16
:storage_apps__value___value,
:storage_apps__project_type___project_type,
:storage_apps__published_at___published_at,
storage_apps_fields = prefix_storage_app_fields(%w(id___id storage_id___storage_id value___value project_type___project_type published_at___published_at))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly curious, why was this change needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this so that it'd be easier to swap out the table name prefix from storage_apps to projects

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I find this a bit harder to read but hopefully this will all go away very soon so this looks good to me for now. Ship it!

Comment thread dashboard/app/models/user.rb Outdated
where(storage_id: user_storage_id).
map(:id)
user_storage_apps = StorageApps.new(user_storage_id)
channel_ids = user_storage_apps.get_all_storage_ids

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename channel_ids to reduce confusion here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Another perfect example of where the use of the term "channel" is confusing. I'll swap this out now, but I have another ticket https://codedotorg.atlassian.net/browse/LP-2272 where I intend to do a more focused sweep of the names we're using

StorageApps.table.where(id: ids)
end

def self.table

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much additional work is it to make this private? (I'm guessing projects_list is going to biggest pain here, ok to defer until later but I think we'll want to make this private at some point.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally in the future we'll be using an ActiveRecord model for queries and we won't need to explicitly reference the table

@maureensturgeon
maureensturgeon merged commit b606368 into staging Mar 25, 2022
@maureensturgeon
maureensturgeon deleted the maureen/consolidate-storage-apps-refs branch March 25, 2022 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants