remove versioning

This commit is contained in:
2026-01-23 14:00:18 +01:00
parent 396e649960
commit faf87fe44f
9 changed files with 15 additions and 73 deletions
-1
View File
@@ -4,7 +4,6 @@ class Entry < ApplicationRecord
has_many :suggested_meanings, dependent: :destroy
has_many :comments, as: :commentable, dependent: :destroy
has_many :entry_versions, dependent: :destroy
enum :category, %i[word phrase proper_name title reference other]
-6
View File
@@ -1,6 +0,0 @@
class EntryVersion < ApplicationRecord
belongs_to :entry
belongs_to :user
validates :changes_made, presence: true
end
-1
View File
@@ -14,7 +14,6 @@ class User < ApplicationRecord
class_name: "SuggestedMeaning",
foreign_key: :reviewed_by_id,
dependent: :nullify
has_many :entry_versions, dependent: :nullify
has_many :comments, dependent: :nullify
enum :role, %i[contributor reviewer admin]
-1
View File
@@ -40,7 +40,6 @@ Rails.application.routes.draw do
end
resources :suggested_meanings
resources :comments, only: [:create, :update, :destroy]
resources :entry_versions, only: [:index, :show]
resources :supported_languages, only: [:index, :show]
resources :users
end
@@ -0,0 +1,14 @@
class DropEntryVersions < ActiveRecord::Migration[8.1]
def change
drop_table :entry_versions do |t|
t.text :changes_made
t.string :change_type
t.datetime :created_at, null: false
t.integer :entry_id, null: false
t.datetime :updated_at, null: false
t.integer :user_id
t.index [ :entry_id ], name: "index_entry_versions_on_entry_id"
t.index [ :user_id ], name: "index_entry_versions_on_user_id"
end
end
end
+1 -9
View File
@@ -16,15 +16,6 @@ FOREIGN KEY ("user_id")
);
CREATE INDEX "index_comments_on_user_id" ON "comments" ("user_id") /*application='SanastoWiki'*/;
CREATE INDEX "index_comments_on_commentable" ON "comments" ("commentable_type", "commentable_id") /*application='SanastoWiki'*/;
CREATE TABLE IF NOT EXISTS "entry_versions" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "entry_id" integer NOT NULL, "user_id" integer NOT NULL, "changes_made" json NOT NULL, "change_type" varchar, "created_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_be24c8cfa1"
FOREIGN KEY ("entry_id")
REFERENCES "entries" ("id")
, CONSTRAINT "fk_rails_aaeb10db8b"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
);
CREATE INDEX "index_entry_versions_on_entry_id" ON "entry_versions" ("entry_id") /*application='SanastoWiki'*/;
CREATE INDEX "index_entry_versions_on_user_id" ON "entry_versions" ("user_id") /*application='SanastoWiki'*/;
CREATE TABLE IF NOT EXISTS "supported_languages" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "code" varchar NOT NULL, "name" varchar NOT NULL, "native_name" varchar NOT NULL, "sort_order" integer DEFAULT 0 NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL);
CREATE UNIQUE INDEX "index_supported_languages_on_code" ON "supported_languages" ("code") /*application='SanastoWiki'*/;
CREATE TABLE IF NOT EXISTS "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "password_digest" varchar NOT NULL, "name" varchar, "role" integer DEFAULT 0 NOT NULL, "primary_language" varchar, "invitation_token" varchar, "invitation_sent_at" datetime(6), "invitation_accepted_at" datetime(6), "invited_by_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_ae14a5013f"
@@ -90,6 +81,7 @@ BEGIN
END;
CREATE TABLE IF NOT EXISTS "setup_states" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "installed" boolean DEFAULT FALSE NOT NULL, "installed_at" datetime(6), "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL);
INSERT INTO "schema_migrations" (version) VALUES
('20260123125325'),
('20260122131000'),
('20260122130000'),
('20260122124151'),
-6
View File
@@ -50,12 +50,6 @@
- [ ] **Comment threading** (optional: replies to comments)
- [ ] **Comment notifications** for entry contributors
### History & Audit
- [ ] **Entry version tracking** (record all changes in `entry_versions`)
- [ ] **View edit history** on entry page
- [ ] **Diff view** showing what changed
- [ ] **Revert to previous version** (admin/reviewer only)
## User Management
- [x] **Setup** adds the first user
-13
View File
@@ -1,13 +0,0 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
entry: one
user: admin_user
changes_made: "{}"
change_type: MyString
two:
entry: two
user: contributor_user
changes_made: "{}"
change_type: MyString
-36
View File
@@ -1,36 +0,0 @@
require "test_helper"
class EntryVersionTest < ActiveSupport::TestCase
test "should be valid with all attributes" do
version = EntryVersion.new(
entry: entries(:one),
user: users(:admin_user),
changes_made: { "fi" => "uusi sana" }
)
assert version.valid?
end
test "should be invalid without changes_made" do
version = EntryVersion.new(
entry: entries(:one),
user: users(:admin_user)
)
assert_not version.valid?
end
test "should be invalid without an entry" do
version = EntryVersion.new(
user: users(:admin_user),
changes_made: { "fi" => "uusi sana" }
)
assert_not version.valid?
end
test "should be invalid without a user" do
version = EntryVersion.new(
entry: entries(:one),
changes_made: { "fi" => "uusi sana" }
)
assert_not version.valid?
end
end