A platform for community discussion. Free, open, simple.
DEV: update to patched discourse-seed-fu (#18493)
Krzysztof Kotlareke6b5b6eae348
diff --git a/Gemfile b/Gemfileindex baca43e5b26..ba96d9a8fd4 100644--- a/Gemfile+++ b/Gemfile@@ -39,7 +39,7 @@ gem 'sprockets', '3.7.2'# allows us to precompile all our templates in the unicorn mastergem 'actionview_precompiler', require: false-gem 'seed-fu'+gem 'discourse-seed-fu'gem 'mail', git: 'https://github.com/discourse/mail.git'gem 'mini_mime'diff --git a/Gemfile.lock b/Gemfile.lockindex 7347c11499d..e7977f67d04 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -127,6 +127,9 @@ GEMrailties (>= 3.1)discourse-ember-source (3.12.2.3)discourse-fonts (0.0.9)+ discourse-seed-fu (2.3.12)+ activerecord (>= 3.1)+ activesupport (>= 3.1)discourse_dev_assets (0.0.4)faker (~> 2.16)literate_randomizer@@ -437,9 +440,6 @@ GEMsprockets (> 3.0)sprockets-railstilt- seed-fu (2.3.9)- activerecord (>= 3.1)- activesupport (>= 3.1)selenium-webdriver (4.5.0)childprocess (>= 0.5, < 5.0)rexml (~> 3.2, >= 3.2.5)@@ -545,6 +545,7 @@ DEPENDENCIESdiscourse-ember-rails (= 0.18.6)discourse-ember-source (~> 3.12.2)discourse-fonts+ discourse-seed-fudiscourse_dev_assetsemail_reply_trimmerember-handlebars-template (= 0.8.0)@@ -628,7 +629,6 @@ DEPENDENCIESsanitizesassc (= 2.0.1)sassc-rails- seed-fuselenium-webdrivershoulda-matcherssidekiqdiff --git a/lib/freedom_patches/seed_fu.rb b/lib/freedom_patches/seed_fu.rbdeleted file mode 100644index b24241b3d73..00000000000--- a/lib/freedom_patches/seed_fu.rb+++ /dev/null@@ -1,19 +0,0 @@-# frozen_string_literal: true--SeedFu::Seeder.prepend(Module.new do- def update_id_sequence- max_seeded_id = @data.filter_map { |d| d["id"] }.max- seq = @model_class.connection.execute(<<~SQL)- SELECT last_value- FROM #{@model_class.sequence_name}- SQL- last_seq_value = seq.first["last_value"]-- if max_seeded_id && last_seq_value < max_seeded_id- # Update the sequence to start from the highest existing id- @model_class.connection.reset_pk_sequence!(@model_class.table_name)- else- # The sequence is already higher than any of our seeded ids - better not touch it- end- end-end)diff --git a/spec/lib/freedom_patches/seed_fu_spec.rb b/spec/lib/freedom_patches/seed_fu_spec.rbdeleted file mode 100644index 12ba1dd745f..00000000000--- a/spec/lib/freedom_patches/seed_fu_spec.rb+++ /dev/null@@ -1,17 +0,0 @@-# frozen_string_literal: true--RSpec.describe "seed-fu patch" do- it "does not modify a sequence on an existing table" do- u = User.create!(username: "test1", email: "[email protected]")- uid1 = u.id- UserDestroyer.new(Discourse.system_user).destroy(u)-- SeedFu.quiet = true- SeedFu.seed-- # Ensure sequence was not reset. A new user should have- # id one greater than the last user- u2 = User.create!(username: "test1", email: "[email protected]")- expect(u2.id).to eq(uid1 + 1)- end-end