DEV: update to patched discourse-seed-fu (#18493)

Original seed-fu was cloned and patched with David's fix 576b69a368
This commit is contained in:
Krzysztof Kotlarek 2022-10-07 09:16:04 +11:00 committed by GitHub
parent d507151508
commit e6b5b6eae3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 41 deletions

View File

@ -39,7 +39,7 @@ gem 'sprockets', '3.7.2'
# allows us to precompile all our templates in the unicorn master
gem 'actionview_precompiler', require: false
gem 'seed-fu'
gem 'discourse-seed-fu'
gem 'mail', git: 'https://github.com/discourse/mail.git'
gem 'mini_mime'

View File

@ -127,6 +127,9 @@ GEM
railties (>= 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 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
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 @@ DEPENDENCIES
discourse-ember-rails (= 0.18.6)
discourse-ember-source (~> 3.12.2)
discourse-fonts
discourse-seed-fu
discourse_dev_assets
email_reply_trimmer
ember-handlebars-template (= 0.8.0)
@ -628,7 +629,6 @@ DEPENDENCIES
sanitize
sassc (= 2.0.1)
sassc-rails
seed-fu
selenium-webdriver
shoulda-matchers
sidekiq

View File

@ -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)

View File

@ -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: "test1@example.com")
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: "test1@example.com")
expect(u2.id).to eq(uid1 + 1)
end
end