Skip to content

Commit

Permalink
Merge e962f16 into bc4d6cb
Browse files Browse the repository at this point in the history
  • Loading branch information
pellaea committed Mar 7, 2024
2 parents bc4d6cb + e962f16 commit e2dc1e3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
5 changes: 1 addition & 4 deletions app/models/translation_string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ class TranslationString < AbstractModel
# table_name: "translation_string_versions",
if: :update_version?
)
non_versioned_columns.push(
"language_id",
"tag"
)
non_versioned_columns.push("tag")

# Called to determine whether or not to create a new version.
# Aggregate changes by the same user for up to a day.
Expand Down
14 changes: 14 additions & 0 deletions db/migrate/20240307020000_add_language_to_trans_str_versions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class AddLanguageToTransStrVersions < ActiveRecord::Migration[7.1]
def up
add_column :translation_string_versions, :language_id, :integer
TranslationString.connection.execute %(
UPDATE translation_string_versions tsv
JOIN translation_strings ts ON tsv.translation_string_id = ts.id
SET tsv.language_id = ts.language_id
)
end

def down
remove_column :translation_string_versions, :language_id
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_03_03_021205) do
ActiveRecord::Schema[7.1].define(version: 2024_03_07_020000) do
create_table "api_keys", id: :integer, charset: "utf8mb3", force: :cascade do |t|
t.datetime "created_at", precision: nil
t.datetime "last_used", precision: nil
Expand Down Expand Up @@ -624,6 +624,7 @@
t.text "text"
t.datetime "updated_at", precision: nil
t.integer "user_id"
t.integer "language_id"
end

create_table "translation_strings", id: :integer, charset: "utf8mb3", force: :cascade do |t|
Expand Down

0 comments on commit e2dc1e3

Please sign in to comment.