Add ability to translate server rules (#34494)
This commit is contained in:
		
							
								
								
									
										16
									
								
								db/migrate/20250520204643_create_rule_translations.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								db/migrate/20250520204643_create_rule_translations.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
class CreateRuleTranslations < ActiveRecord::Migration[8.0]
 | 
			
		||||
  def change
 | 
			
		||||
    create_table :rule_translations do |t|
 | 
			
		||||
      t.text :text, null: false, default: ''
 | 
			
		||||
      t.text :hint, null: false, default: ''
 | 
			
		||||
      t.string :language, null: false
 | 
			
		||||
      t.references :rule, null: false, foreign_key: { on_delete: :cascade }, index: false
 | 
			
		||||
 | 
			
		||||
      t.timestamps
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    add_index :rule_translations, [:rule_id, :language], unique: true
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										13
									
								
								db/schema.rb
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								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_20_192024) do
 | 
			
		||||
ActiveRecord::Schema[8.0].define(version: 2025_05_20_204643) do
 | 
			
		||||
  # These are extensions that must be enabled in order to support this database
 | 
			
		||||
  enable_extension "pg_catalog.plpgsql"
 | 
			
		||||
 | 
			
		||||
@@ -962,6 +962,16 @@ ActiveRecord::Schema[8.0].define(version: 2025_05_20_192024) do
 | 
			
		||||
    t.index ["target_account_id"], name: "index_reports_on_target_account_id"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  create_table "rule_translations", force: :cascade do |t|
 | 
			
		||||
    t.text "text", default: "", null: false
 | 
			
		||||
    t.text "hint", default: "", null: false
 | 
			
		||||
    t.string "language", null: false
 | 
			
		||||
    t.bigint "rule_id", null: false
 | 
			
		||||
    t.datetime "created_at", null: false
 | 
			
		||||
    t.datetime "updated_at", null: false
 | 
			
		||||
    t.index ["rule_id", "language"], name: "index_rule_translations_on_rule_id_and_language", unique: true
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  create_table "rules", force: :cascade do |t|
 | 
			
		||||
    t.integer "priority", default: 0, null: false
 | 
			
		||||
    t.datetime "deleted_at", precision: nil
 | 
			
		||||
@@ -1406,6 +1416,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_05_20_192024) do
 | 
			
		||||
  add_foreign_key "reports", "accounts", column: "target_account_id", name: "fk_eb37af34f0", on_delete: :cascade
 | 
			
		||||
  add_foreign_key "reports", "accounts", name: "fk_4b81f7522c", on_delete: :cascade
 | 
			
		||||
  add_foreign_key "reports", "oauth_applications", column: "application_id", on_delete: :nullify
 | 
			
		||||
  add_foreign_key "rule_translations", "rules", on_delete: :cascade
 | 
			
		||||
  add_foreign_key "scheduled_statuses", "accounts", on_delete: :cascade
 | 
			
		||||
  add_foreign_key "session_activations", "oauth_access_tokens", column: "access_token_id", name: "fk_957e5bda89", on_delete: :cascade
 | 
			
		||||
  add_foreign_key "session_activations", "users", name: "fk_e5fda67334", on_delete: :cascade
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user