Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

What is the goal of this PR and why is this important?

This PR completely replaces the Project model and related components with Organization naming throughout the codebase. This change was needed because Projects were actually a form of Organization, but this wasn't realized initially when the system was designed.

How did you approach the change?

The migration involved a comprehensive rename across the entire application:

Database Layer:

  • Created migration to rename tables: projectsorganizations, project_statusesorganization_statuses, project_obligationsorganization_obligations, project_usersorganization_users
  • Updated all foreign key columns and indexes across related tables (community_news, monthly_reports, reports, stories, story_ideas, workshop_logs)

Application Layer:

  • Renamed all models: ProjectOrganization, ProjectStatusOrganizationStatus, ProjectObligationOrganizationObligation, ProjectUserOrganizationUser
  • Renamed all controllers: ProjectsControllerOrganizationsController, ProjectStatusesControllerOrganizationStatusesController, ProjectUsersControllerOrganizationUsersController
  • Updated all decorators to match new naming
  • Updated routes configuration
  • Updated all model associations in related models (User, Report, CommunityNews, StoryIdea, Story, WorkshopLog)

Views and UI:

  • Renamed view directories and updated all view files
  • Updated shared partials and form fields
  • Updated users and facilitators controllers that reference organizations

Testing and Data:

  • Updated all factory files for RSpec
  • Renamed and updated all spec files (models, requests, routing, decorators, views)
  • Updated rake tasks in lib/tasks/dev.rake (renamed import_projects to import_organizations) and lib/tasks/story_data.rake
  • Updated seed files in db/seeds/dummy_dev_seeds.rb to use Organization references

Files Deleted:

  • Removed old Project models, controllers, and decorators after creating Organization equivalents

Anything else to add?

  • Old migrations in db/archived/ directory were intentionally left unchanged as they are historical records
  • The migration uses helper methods to safely rename indexes only if they exist
  • All active code now consistently uses Organization terminology
  • After this PR is merged, the migration will need to be run to update the database schema
Original prompt

This section details on the original issue you should resolve

<issue_title>Migrate Projects data to Organizations</issue_title>
<issue_description>- delete Project CRUD

  • migrate Project data into Organization table

(we didn't realize Projects were a form of Organization when we started)</issue_description>

<agent_instructions>please write a PR to fully replace Project with Organization, including renaming the database table</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@maebeale I think at this point we want to instead move our Organization stuff into Project. Then after all prod data is imported, rename Project to Organization. @maebeale @copilot please write a PR to fully replace Project with Organization, including renaming the database table

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits February 3, 2026 19:44
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
@maebeale maebeale force-pushed the copilot/migrate-projects-to-organizations branch from bb1d686 to cacbfeb Compare February 4, 2026 01:27
@maebeale maebeale marked this pull request as ready for review February 4, 2026 01:27
@maebeale
Copy link
Collaborator

maebeale commented Feb 4, 2026

@copilot can you find any more examples in the code that still refer to Project, ProjectStatus, ProjectObligation (ignoring old migrations) ?

Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 4, 2026

@copilot can you find any more examples in the code that still refer to Project, ProjectStatus, ProjectObligation (ignoring old migrations) ?

Found and updated the remaining references in commit 52c7584:

Files updated:

  • lib/tasks/story_data.rake - Changed project_id to organization_id
  • lib/tasks/dev.rake - Renamed import_projects task to import_organizations and updated create_project method to create_organization with Project.Organization. and project_status_idorganization_status_id
  • db/seeds/dummy_dev_seeds.rb - Changed Project.all.sample.id to Organization.all.sample.id in CommunityNews, StoryIdea, and Story seed data

Ignored references:

  • db/archived/ directory migrations (as requested) - these contain old ProjectStatus, ProjectObligation, and ProjectUser references but are archived migrations

All active code now uses Organization, OrganizationStatus, OrganizationObligation, and OrganizationUser.

Copilot AI changed the title [WIP] Migrate projects data to organizations and rename table Migrate projects data to organizations and rename table Feb 4, 2026
@maebeale maebeale requested a review from jmilljr24 February 4, 2026 02:58
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.

Migrate Projects data to Organizations

2 participants