chore: document legacy openneo_id migrations and update references
This commit completes the database consolidation cleanup by documenting the historical migrations and updating all references to reflect the single-database architecture. Changes: - db/openneo_id_migrate/README.md: Created comprehensive documentation explaining the history of the separate database and why these migrations are preserved but no longer runnable - db/openneo_id_schema.rb: Deleted (no longer needed) - README.md: Updated to reflect single-database architecture - Removed mentions of "two databases" - Updated "OpenNeo ID Database" section to "Authentication Architecture" - Added reference to historical context in db/openneo_id_migrate/README.md - deploy/setup.yml: Removed openneo_id database creation and privileges for future deployments - db/migrate/20240401124200_increase_username_length.rb: Updated comment to note this was historically paired with an openneo_id migration The codebase now fully reflects the consolidated single-database architecture. The legacy migration files in db/openneo_id_migrate/ are preserved for historical reference only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
2c21269a16
commit
9ba94f9f4b
5 changed files with 50 additions and 50 deletions
16
README.md
16
README.md
|
|
@ -11,7 +11,7 @@ DTI is a Rails application with a React-based outfit editor, backed by MySQL dat
|
||||||
### Core Components
|
### Core Components
|
||||||
|
|
||||||
- **Rails backend** (Ruby 3.4, Rails 8.0): Serves web pages, API endpoints, and manages data
|
- **Rails backend** (Ruby 3.4, Rails 8.0): Serves web pages, API endpoints, and manages data
|
||||||
- **MySQL databases**: Primary database (`openneo_impress`) + legacy auth database (`openneo_id`)
|
- **MySQL database**: Single database (`openneo_impress`) containing all application and authentication data
|
||||||
- **React outfit editor**: Embedded in `app/javascript/wardrobe-2020/`, provides the main customization UI
|
- **React outfit editor**: Embedded in `app/javascript/wardrobe-2020/`, provides the main customization UI
|
||||||
- **Modeling system**: Crowdsources pet/item appearance data by fetching from Neopets APIs when users load their pets
|
- **Modeling system**: Crowdsources pet/item appearance data by fetching from Neopets APIs when users load their pets
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@ app/
|
||||||
```
|
```
|
||||||
config/
|
config/
|
||||||
├── routes.rb # All Rails routes
|
├── routes.rb # All Rails routes
|
||||||
├── database.yml # Multi-database setup (main + openneo_id)
|
├── database.yml # Database configuration
|
||||||
└── environments/
|
└── environments/
|
||||||
└── *.rb # Env-specific config (incl. impress_2020_origin)
|
└── *.rb # Env-specific config (incl. impress_2020_origin)
|
||||||
```
|
```
|
||||||
|
|
@ -117,7 +117,7 @@ config/
|
||||||
|
|
||||||
- **Backend**: Ruby on Rails (Ruby 3.4, Rails 8.0)
|
- **Backend**: Ruby on Rails (Ruby 3.4, Rails 8.0)
|
||||||
- **Frontend**: Mix of Rails views (Turbo/HAML) and React (for outfit editor)
|
- **Frontend**: Mix of Rails views (Turbo/HAML) and React (for outfit editor)
|
||||||
- **Database**: MySQL (two databases: `openneo_impress`, `openneo_id`)
|
- **Database**: MySQL (`openneo_impress`)
|
||||||
- **Styling**: CSS, Sass (moving toward modern Rails conventions)
|
- **Styling**: CSS, Sass (moving toward modern Rails conventions)
|
||||||
- **External Integrations**:
|
- **External Integrations**:
|
||||||
- **Neopets.com**: Legacy Flash/AMF protocol for pet appearance data (modeling)
|
- **Neopets.com**: Legacy Flash/AMF protocol for pet appearance data (modeling)
|
||||||
|
|
@ -129,11 +129,15 @@ config/
|
||||||
|
|
||||||
## Development Notes
|
## Development Notes
|
||||||
|
|
||||||
### OpenNeo ID Database
|
### Authentication Architecture
|
||||||
|
|
||||||
The `openneo_id` database is a legacy from when authentication was a separate service ("OpenNeo ID") meant to unify auth across multiple OpenNeo projects. DTI was the only project that succeeded, so the apps were merged—but the database split remains for now.
|
Authentication data lives in the `auth_users` table (managed by the `AuthUser` model). This was historically in a separate `openneo_id` database (a legacy from when "OpenNeo ID" was envisioned as a service to unify auth across multiple OpenNeo projects). As of November 2025, the databases have been consolidated into a single database for simplicity.
|
||||||
|
|
||||||
**Implication**: Rails is configured for multi-database mode. User auth models live in `auth_user.rb` and connect to `openneo_id`.
|
User accounts are split across two related tables:
|
||||||
|
- `auth_users` - Authentication data (passwords, email, OAuth connections) via Devise
|
||||||
|
- `users` - Application data (points, closet settings, etc.)
|
||||||
|
|
||||||
|
These are linked via `User.remote_id` → `AuthUser.id`. See `db/openneo_id_migrate/README.md` for the historical context.
|
||||||
|
|
||||||
### Rails/React Hybrid
|
### Rails/React Hybrid
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
class IncreaseUsernameLength < ActiveRecord::Migration[7.1]
|
class IncreaseUsernameLength < ActiveRecord::Migration[7.1]
|
||||||
def change
|
def change
|
||||||
# NOTE: This is paired with a migration to the `openneo_id` database, too!
|
# NOTE: This was originally paired with a migration to the legacy `openneo_id`
|
||||||
|
# database (see db/openneo_id_migrate/20240401124406_increase_username_length.rb).
|
||||||
|
# As of November 2025, the databases have been consolidated.
|
||||||
reversible do |direction|
|
reversible do |direction|
|
||||||
direction.up {
|
direction.up {
|
||||||
change_column :users, :name, :string, limit: 30, null: false
|
change_column :users, :name, :string, limit: 30, null: false
|
||||||
|
|
|
||||||
35
db/openneo_id_migrate/README.md
Normal file
35
db/openneo_id_migrate/README.md
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
# Legacy openneo_id Database Migrations
|
||||||
|
|
||||||
|
These migrations are kept for historical reference only. They were applied to the separate `openneo_id` database before it was consolidated into the main `openneo_impress` database in November 2025.
|
||||||
|
|
||||||
|
## What happened?
|
||||||
|
|
||||||
|
Originally, Dress to Impress used two separate MySQL databases:
|
||||||
|
- `openneo_impress` - Main application data (items, outfits, closets, etc.)
|
||||||
|
- `openneo_id` - Authentication data (user accounts, passwords, OAuth)
|
||||||
|
|
||||||
|
This split was a legacy from when "OpenNeo ID" was envisioned as a separate authentication service that would unify login across multiple OpenNeo projects. Since DTI was the only successful project, we consolidated the databases.
|
||||||
|
|
||||||
|
## Migration details
|
||||||
|
|
||||||
|
On **November 2, 2025**, the `openneo_id.users` table was copied to `openneo_impress.auth_users`, preserving all data and IDs. The `openneo_id` database was then removed from production.
|
||||||
|
|
||||||
|
See the main migrations directory for:
|
||||||
|
- `20251102064247_copy_auth_users_table_to_main_database.rb` - The migration that copied the data
|
||||||
|
|
||||||
|
## Can these migrations be run?
|
||||||
|
|
||||||
|
**No.** These migrations reference the `openneo_id` database which no longer exists. They are preserved purely as documentation of how the authentication schema evolved over time.
|
||||||
|
|
||||||
|
## Migration history
|
||||||
|
|
||||||
|
1. `20230807005748_add_remember_created_at_to_users.rb` - Added Devise rememberable feature
|
||||||
|
2. `20240313200849_add_omniauth_fields_to_users.rb` - Added NeoPass OAuth support
|
||||||
|
3. `20240315020053_allow_null_email_and_password_for_users.rb` - Made email/password optional for OAuth users
|
||||||
|
4. `20240401124406_increase_username_length.rb` - Increased username limit from 20 to 30 chars
|
||||||
|
5. `20240407135246_add_neo_pass_email_to_users.rb` - Added neopass_email field
|
||||||
|
6. `20240408120359_add_unique_index_for_omniauth_to_users.rb` - Added unique constraint for provider+uid
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
For current authentication schema, see `db/schema.rb` and look for the `auth_users` table.
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
# This file is auto-generated from the current state of the database. Instead
|
|
||||||
# of editing this file, please use the migrations feature of Active Record to
|
|
||||||
# incrementally modify your database, and then regenerate this schema definition.
|
|
||||||
#
|
|
||||||
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
||||||
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
||||||
# be faster and is potentially less error prone than running all of your
|
|
||||||
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
||||||
# migrations use external dependencies or application code.
|
|
||||||
#
|
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2024_04_08_120359) do
|
|
||||||
create_table "users", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_general_ci", force: :cascade do |t|
|
|
||||||
t.string "name", limit: 30, null: false
|
|
||||||
t.string "encrypted_password", limit: 64
|
|
||||||
t.string "email", limit: 50
|
|
||||||
t.string "password_salt", limit: 32
|
|
||||||
t.string "reset_password_token"
|
|
||||||
t.integer "sign_in_count", default: 0
|
|
||||||
t.datetime "current_sign_in_at", precision: nil
|
|
||||||
t.datetime "last_sign_in_at", precision: nil
|
|
||||||
t.string "current_sign_in_ip"
|
|
||||||
t.string "last_sign_in_ip"
|
|
||||||
t.integer "failed_attempts", default: 0
|
|
||||||
t.string "unlock_token"
|
|
||||||
t.datetime "locked_at", precision: nil
|
|
||||||
t.datetime "created_at", precision: nil
|
|
||||||
t.datetime "updated_at", precision: nil
|
|
||||||
t.datetime "reset_password_sent_at", precision: nil
|
|
||||||
t.datetime "remember_created_at"
|
|
||||||
t.string "provider"
|
|
||||||
t.string "uid"
|
|
||||||
t.string "neopass_email"
|
|
||||||
t.index ["email"], name: "index_users_on_email", unique: true
|
|
||||||
t.index ["provider", "uid"], name: "index_users_on_provider_and_uid", unique: true
|
|
||||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
|
||||||
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -419,19 +419,18 @@
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
name:
|
name:
|
||||||
- openneo_impress
|
- openneo_impress
|
||||||
- openneo_id
|
|
||||||
|
|
||||||
- name: Create MySQL user openneo_impress
|
- name: Create MySQL user openneo_impress
|
||||||
community.mysql.mysql_user:
|
community.mysql.mysql_user:
|
||||||
name: openneo_impress
|
name: openneo_impress
|
||||||
password: "{{ mysql_user_password }}"
|
password: "{{ mysql_user_password }}"
|
||||||
priv: "openneo_impress.*:ALL,openneo_id.*:ALL"
|
priv: "openneo_impress.*:ALL"
|
||||||
|
|
||||||
- name: Create MySQL user impress2020
|
- name: Create MySQL user impress2020
|
||||||
community.mysql.mysql_user:
|
community.mysql.mysql_user:
|
||||||
name: impress2020
|
name: impress2020
|
||||||
password: "{{ mysql_user_password_2020 }}"
|
password: "{{ mysql_user_password_2020 }}"
|
||||||
priv: "openneo_impress.*:ALL,openneo_id.*:ALL"
|
priv: "openneo_impress.*:ALL"
|
||||||
|
|
||||||
- name: Create the Neopets Media Archive data directory
|
- name: Create the Neopets Media Archive data directory
|
||||||
file:
|
file:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue