DEV: Properly reset column information before seeding.

This commit is contained in:
Guo Xiang Tan 2020-06-17 13:23:45 +08:00
parent 52580605d8
commit 3e888cbb5d
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20
2 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,8 @@
# frozen_string_literal: true
# fix any bust caches post initial migration
ActiveRecord::Base.public_send(:subclasses).each { |m| m.reset_column_information }
ActiveRecord::Base.connection.tables.each do |table|
table.classify.constantize.reset_column_information rescue nil
end
SiteSetting.refresh!

View File

@ -1,12 +1,8 @@
# frozen_string_literal: true
require 'seed_data/topics'
User.reset_column_information
Topic.reset_column_information
Post.reset_column_information
if !Rails.env.test?
require 'seed_data/topics'
topics_exist = Topic.where(<<~SQL).exists?
id NOT IN (
SELECT topic_id