Carry a store's configuration in the registry record
A store's `config.json` lived in a repository the desktop client fetched over HTTP, which made a store's behaviour depend on a second thing existing and staying reachable. The registry already answers what a store *is*; it now answers how it behaves too, in the same shape that file had, so this record is the one source of truth and a store can be configured from the admin alone. `storeRepositoryUrl` stays, demoted to a pointer for a person — where the store's own repository is, when it has one. Clients released before this field still fetch a `config.json` from it, so nothing has to move at once. The column is nullable because a store that configures nothing is still a store: the client falls back to the engine's built-in defaults, which need only a name and a catalog. The admin edits it as JSON text through a pair of accessors, so the column holds real JSON and invalid input comes back with the text kept and a message rather than a 500. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
class CarryTheStoreConfigInTheRegistry < ActiveRecord::Migration[8.1]
|
||||
# The store's own configuration moves into this record.
|
||||
#
|
||||
# It used to live as a `config.json` in a repository the client fetched over HTTP,
|
||||
# which made a store's behaviour depend on a second thing existing and staying
|
||||
# reachable. The registry already answers what a store *is*; carrying how it behaves
|
||||
# in the same record makes this the one source of truth, and lets a store exist with
|
||||
# no repository at all — which is the ordinary case now that the store engine ships
|
||||
# inside the client.
|
||||
#
|
||||
# Nullable, because a store that configures nothing is still a store: the client
|
||||
# falls back to the engine's built-in defaults, which need only a name and a catalog.
|
||||
def change
|
||||
add_column :stores, :config, :json
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_08_18_120000) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_08_19_000001) do
|
||||
create_table "admin_users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "deleted_at", precision: 3
|
||||
@@ -283,6 +283,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_08_18_120000) do
|
||||
|
||||
create_table "stores", id: { type: :bigint, unsigned: true }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.string "catalog_url", null: false
|
||||
t.json "config"
|
||||
t.datetime "created_at", precision: 3, null: false
|
||||
t.datetime "deleted_at", precision: 3
|
||||
t.string "name", null: false
|
||||
|
||||
Reference in New Issue
Block a user