From 5c8ffc2630e0cf56da2ede963ff8daf84291271f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Wed, 28 May 2025 18:39:25 +0400 Subject: [PATCH] Add editable contents table --- app/models/editable_content.rb | 4 ++++ .../20250528092931_create_editable_contents.rb | 13 +++++++++++++ db/schema.rb | 12 +++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 app/models/editable_content.rb create mode 100644 db/migrate/20250528092931_create_editable_contents.rb diff --git a/app/models/editable_content.rb b/app/models/editable_content.rb new file mode 100644 index 0000000..2bd5560 --- /dev/null +++ b/app/models/editable_content.rb @@ -0,0 +1,4 @@ +class EditableContent < ApplicationRecord + validates :key, presence: true, + uniqueness: { scope: :path } +end diff --git a/db/migrate/20250528092931_create_editable_contents.rb b/db/migrate/20250528092931_create_editable_contents.rb new file mode 100644 index 0000000..0fac11e --- /dev/null +++ b/db/migrate/20250528092931_create_editable_contents.rb @@ -0,0 +1,13 @@ +class CreateEditableContents < ActiveRecord::Migration[8.0] + def change + create_table :editable_contents do |t| + t.string :path + t.string :key + t.string :lang, default: "en" + t.text :content + t.boolean :rich_text, default: false + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index b7746ac..b9dd900 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_05_27_113805) do +ActiveRecord::Schema[8.0].define(version: 2025_05_28_092931) do create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false @@ -64,6 +64,16 @@ ActiveRecord::Schema[8.0].define(version: 2025_05_27_113805) do t.index ["user_id"], name: "index_donations_on_user_id" end + create_table "editable_contents", force: :cascade do |t| + t.string "path" + t.string "key" + t.string "lang", default: "en" + t.text "content" + t.boolean "rich_text", default: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "flipper_features", force: :cascade do |t| t.string "key", null: false t.datetime "created_at", null: false