Fix existing user records with now-renamed pt locale (#12092)
				
					
				
			Fix #12082
This commit is contained in:
		
							
								
								
									
										11
									
								
								db/migrate/20191007013357_update_pt_locales.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								db/migrate/20191007013357_update_pt_locales.rb
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  | class UpdatePtLocales < ActiveRecord::Migration[5.2] | ||||||
|  |   disable_ddl_transaction! | ||||||
|  |  | ||||||
|  |   def up | ||||||
|  |     User.where(locale: 'pt').in_batches.update_all(locale: 'pt-PT') | ||||||
|  |   end | ||||||
|  |  | ||||||
|  |   def down | ||||||
|  |     User.where(locale: 'pt-PT').in_batches.update_all(locale: 'pt') | ||||||
|  |   end | ||||||
|  | end | ||||||
							
								
								
									
										26
									
								
								db/schema.rb
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								db/schema.rb
									
									
									
									
									
								
							| @@ -10,7 +10,7 @@ | |||||||
| # | # | ||||||
| # It's strongly recommended that you check this file into your version control system. | # It's strongly recommended that you check this file into your version control system. | ||||||
|  |  | ||||||
| ActiveRecord::Schema.define(version: 2019_10_01_213028) do | ActiveRecord::Schema.define(version: 2019_10_07_013357) do | ||||||
|  |  | ||||||
|   # These are extensions that must be enabled in order to support this database |   # These are extensions that must be enabled in order to support this database | ||||||
|   enable_extension "plpgsql" |   enable_extension "plpgsql" | ||||||
| @@ -693,6 +693,30 @@ ActiveRecord::Schema.define(version: 2019_10_01_213028) do | |||||||
|     t.index ["tag_id", "status_id"], name: "index_statuses_tags_on_tag_id_and_status_id", unique: true |     t.index ["tag_id", "status_id"], name: "index_statuses_tags_on_tag_id_and_status_id", unique: true | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |   create_table "stream_entries", force: :cascade do |t| | ||||||
|  |     t.bigint "activity_id" | ||||||
|  |     t.string "activity_type" | ||||||
|  |     t.datetime "created_at", null: false | ||||||
|  |     t.datetime "updated_at", null: false | ||||||
|  |     t.boolean "hidden", default: false, null: false | ||||||
|  |     t.bigint "account_id" | ||||||
|  |     t.index ["account_id", "activity_type", "id"], name: "index_stream_entries_on_account_id_and_activity_type_and_id" | ||||||
|  |     t.index ["activity_id", "activity_type"], name: "index_stream_entries_on_activity_id_and_activity_type" | ||||||
|  |   end | ||||||
|  |  | ||||||
|  |   create_table "subscriptions", force: :cascade do |t| | ||||||
|  |     t.string "callback_url", default: "", null: false | ||||||
|  |     t.string "secret" | ||||||
|  |     t.datetime "expires_at" | ||||||
|  |     t.boolean "confirmed", default: false, null: false | ||||||
|  |     t.datetime "created_at", null: false | ||||||
|  |     t.datetime "updated_at", null: false | ||||||
|  |     t.datetime "last_successful_delivery_at" | ||||||
|  |     t.string "domain" | ||||||
|  |     t.bigint "account_id", null: false | ||||||
|  |     t.index ["account_id", "callback_url"], name: "index_subscriptions_on_account_id_and_callback_url", unique: true | ||||||
|  |   end | ||||||
|  |  | ||||||
|   create_table "tags", force: :cascade do |t| |   create_table "tags", force: :cascade do |t| | ||||||
|     t.string "name", default: "", null: false |     t.string "name", default: "", null: false | ||||||
|     t.datetime "created_at", null: false |     t.datetime "created_at", null: false | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user