From 58b2ea5abef8ad9c2c809699f23f20a38e77ed25 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Tue, 20 Jan 2026 06:23:26 +0300 Subject: [PATCH 1/4] initial boilerplate for data dumps (mirror Metasmoke) --- app/controllers/dumps_controller.rb | 2 ++ app/helpers/dumps_helper.rb | 2 ++ app/views/dumps/index.htrml.erb | 0 db/migrate/20260120032240_create_dumps.rb | 7 +++++++ test/controllers/dumps_controller_test.rb | 7 +++++++ 5 files changed, 18 insertions(+) create mode 100644 app/controllers/dumps_controller.rb create mode 100644 app/helpers/dumps_helper.rb create mode 100644 app/views/dumps/index.htrml.erb create mode 100644 db/migrate/20260120032240_create_dumps.rb create mode 100644 test/controllers/dumps_controller_test.rb diff --git a/app/controllers/dumps_controller.rb b/app/controllers/dumps_controller.rb new file mode 100644 index 000000000..80f2b2669 --- /dev/null +++ b/app/controllers/dumps_controller.rb @@ -0,0 +1,2 @@ +class DumpsController < ApplicationController +end diff --git a/app/helpers/dumps_helper.rb b/app/helpers/dumps_helper.rb new file mode 100644 index 000000000..d71fdb018 --- /dev/null +++ b/app/helpers/dumps_helper.rb @@ -0,0 +1,2 @@ +module DumpsHelper +end diff --git a/app/views/dumps/index.htrml.erb b/app/views/dumps/index.htrml.erb new file mode 100644 index 000000000..e69de29bb diff --git a/db/migrate/20260120032240_create_dumps.rb b/db/migrate/20260120032240_create_dumps.rb new file mode 100644 index 000000000..e657514e4 --- /dev/null +++ b/db/migrate/20260120032240_create_dumps.rb @@ -0,0 +1,7 @@ +class CreateDumps < ActiveRecord::Migration[7.2] + def change + create_table :dumps do |t| + t.timestamps + end + end +end diff --git a/test/controllers/dumps_controller_test.rb b/test/controllers/dumps_controller_test.rb new file mode 100644 index 000000000..957059ef6 --- /dev/null +++ b/test/controllers/dumps_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class DumpsControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end From 88fd12def355ada55a0252d39fe9079aca482eed Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Tue, 20 Jan 2026 08:31:06 +0300 Subject: [PATCH 2/4] dups should have a required title & optional comment --- db/migrate/20260120032240_create_dumps.rb | 3 +++ db/schema.rb | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/db/migrate/20260120032240_create_dumps.rb b/db/migrate/20260120032240_create_dumps.rb index e657514e4..6e0053bf9 100644 --- a/db/migrate/20260120032240_create_dumps.rb +++ b/db/migrate/20260120032240_create_dumps.rb @@ -1,6 +1,9 @@ class CreateDumps < ActiveRecord::Migration[7.2] def change create_table :dumps do |t| + t.string :title, null: false + t.string :comment + t.timestamps end end diff --git a/db/schema.rb b/db/schema.rb index 07e7a08a1..aa124a96e 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[7.2].define(version: 2025_12_21_142105) do +ActiveRecord::Schema[7.2].define(version: 2026_01_20_032240) do create_table "abilities", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.bigint "community_id" t.string "name" @@ -267,6 +267,13 @@ t.index ["user_id"], name: "index_complaints_on_user_id" end + create_table "dumps", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| + t.string "title", null: false + t.string "comment" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "email_logs", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "log_type" t.string "destination" From 59978295422fcdfb47714a4a9faa9fe3b6dc97fb Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Tue, 20 Jan 2026 08:31:53 +0300 Subject: [PATCH 3/4] initial boilerplate for data dump model --- app/models/dump.rb | 3 +++ test/fixtures/dumps.yml | 11 +++++++++++ test/models/dump_test.rb | 7 +++++++ 3 files changed, 21 insertions(+) create mode 100644 app/models/dump.rb create mode 100644 test/fixtures/dumps.yml create mode 100644 test/models/dump_test.rb diff --git a/app/models/dump.rb b/app/models/dump.rb new file mode 100644 index 000000000..10ac3960e --- /dev/null +++ b/app/models/dump.rb @@ -0,0 +1,3 @@ +class Dump < ApplicationRecord + has_one_attached :file +end diff --git a/test/fixtures/dumps.yml b/test/fixtures/dumps.yml new file mode 100644 index 000000000..d7a332924 --- /dev/null +++ b/test/fixtures/dumps.yml @@ -0,0 +1,11 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the "{}" from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/models/dump_test.rb b/test/models/dump_test.rb new file mode 100644 index 000000000..3c9dab9a3 --- /dev/null +++ b/test/models/dump_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class DumpTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From 8fca596f8220cc167c73ff01ce625af186f4f7c7 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Tue, 20 Jan 2026 09:01:01 +0300 Subject: [PATCH 4/4] first data dump fixtures (fixing tests) --- test/fixtures/dumps.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/test/fixtures/dumps.yml b/test/fixtures/dumps.yml index d7a332924..f6a49061e 100644 --- a/test/fixtures/dumps.yml +++ b/test/fixtures/dumps.yml @@ -1,11 +1,8 @@ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -# This model initially had no columns defined. If you add columns to the -# model remove the "{}" from the fixture names and add the columns immediately -# below each fixture, per the syntax in the comments below -# -one: {} -# column: value -# -two: {} -# column: value +without_comment: + title: Data dump without a comment + +with_comment: + title: Data dump with comment + comment: we decided to include a helpful comment this time