Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Consolidate engine migrations and collapse host User into CoPlan::User#35

Merged
HamptonMakes merged 1 commit intomainfrom
collapse-user-and-engine-migrations
Feb 27, 2026
Merged

Consolidate engine migrations and collapse host User into CoPlan::User#35
HamptonMakes merged 1 commit intomainfrom
collapse-user-and-engine-migrations

Conversation

@HamptonMakes
Copy link
Collaborator

What

  • Replace 18 host migrations + 1 partial engine migration with a single engine migration (create_coplan_schema) that creates all 10 coplan_* tables from scratch. New hosts just install the engine and migrate — no more ghost tables or rename dependencies.

  • Remove host User model entirely. CoPlan::User is now the single user model with email added for Slack DM support.

  • Update SessionsController, ApplicationController, CoPlan auth callback, SlackNotificationJob, ActiveAdmin, seeds, and specs to use CoPlan::User directly.

  • Root route → plans#index instead of dashboard#show.

  • Add "My Plans" / "All Plans" filter to plans index page.

Why

A fresh hosted CoPlan couldn't run migrations — the engine only had a migration for coplan_users, so all other tables (including coplan_api_tokens) were missing. The host migrations assumed pre-existing tables to rename, which don't exist on a new deploy.

Testing

bundle exec rspec — 386 examples, 0 failures.

- Replace 18 host migrations + 1 partial engine migration with a single
  engine migration (create_coplan_schema) that creates all 10 coplan_*
  tables from scratch. New hosts just install the engine and migrate.

- Remove host User model entirely. CoPlan::User is now the single user
  model with email added for Slack DM support.

- Update SessionsController, ApplicationController, CoPlan auth callback,
  SlackNotificationJob, ActiveAdmin, seeds, and specs to use CoPlan::User.

- Root route now points to plans#index instead of dashboard#show.

- Add 'My Plans' / 'All Plans' filter to plans index page.

Amp-Thread-ID: https://ampcode.com/threads/T-019ca0be-66f9-715f-8d94-944467f13298
Co-authored-by: Amp <[email protected]>
@HamptonMakes HamptonMakes force-pushed the collapse-user-and-engine-migrations branch from 15b9dc2 to 70e6720 Compare February 27, 2026 20:47
@HamptonMakes HamptonMakes merged commit eaecca9 into main Feb 27, 2026
3 checks passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 15b9dc2232

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1,173 @@
class CreateCoplanSchema < ActiveRecord::Migration[8.1]

Choose a reason for hiding this comment

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

P1 Badge Use a new migration version for consolidated schema

This migration reuses version 20260226200000, which was already used by the deleted create_coplan_users migration; hosts that already ran that old version will have 20260226200000 recorded in schema_migrations, so db:migrate will skip this new consolidated migration entirely and never create/add the new schema pieces (including coplan_users.email and the other tables), leaving upgraded installs broken.

Useful? React with 👍 / 👎.

ActiveAdmin.register User do
permit_params :email, :name, :role
ActiveAdmin.register CoPlan::User, as: "User" do
permit_params :name, :email, :admin

Choose a reason for hiding this comment

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

P2 Badge Permit external_id in ActiveAdmin user params

CoPlan::User now validates external_id as required, but this ActiveAdmin resource only permits :name, :email, and :admin; creating a user from /admin/users/new will submit without external_id and fail validation, so the admin UI's user creation path is effectively broken.

Useful? React with 👍 / 👎.

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.

1 participant