change bug
This commit is contained in:
parent
a50470b14b
commit
efad719de0
|
@ -13,10 +13,8 @@ class Project < ApplicationRecord
|
||||||
belongs_to :ignore, optional: true
|
belongs_to :ignore, optional: true
|
||||||
belongs_to :license, optional: true
|
belongs_to :license, optional: true
|
||||||
belongs_to :owner, class_name: 'User', foreign_key: :user_id
|
belongs_to :owner, class_name: 'User', foreign_key: :user_id
|
||||||
# belongs_to :project_category, optional: true , :counter_cache => true
|
belongs_to :project_category, optional: true , :counter_cache => true
|
||||||
# belongs_to :project_language, optional: true , :counter_cache => true
|
belongs_to :project_language, optional: true , :counter_cache => true
|
||||||
belongs_to :project_category, optional: true
|
|
||||||
belongs_to :project_language, optional: true
|
|
||||||
has_many :project_trends, dependent: :destroy
|
has_many :project_trends, dependent: :destroy
|
||||||
has_many :watchers, as: :watchable, dependent: :destroy
|
has_many :watchers, as: :watchable, dependent: :destroy
|
||||||
has_many :fork_users, dependent: :destroy
|
has_many :fork_users, dependent: :destroy
|
||||||
|
|
|
@ -17,17 +17,5 @@ class AddIndexForProjectLanguageAndCategory < ActiveRecord::Migration[5.2]
|
||||||
puts "#######____update_project_language_id____##############{k}"
|
puts "#######____update_project_language_id____##############{k}"
|
||||||
ProjectLanguage.update_counters(k, projects_count: v)
|
ProjectLanguage.update_counters(k, projects_count: v)
|
||||||
end
|
end
|
||||||
|
|
||||||
# project_categories = ProjectCategory.select(:id, :projects_count).includes(:projects)
|
|
||||||
# project_categories.each do |i|
|
|
||||||
# puts "#######____update_project_category_id____##############{i.id}"
|
|
||||||
# ProjectCategory.reset_counters(i.id, :projects)
|
|
||||||
# end
|
|
||||||
|
|
||||||
# project_languages = ProjectLanguage.select(:id, :projects_count).includes(:projects)
|
|
||||||
# project_languages.each do |i|
|
|
||||||
# puts "#######____update_project_language_id____##############{i.id}"
|
|
||||||
# ProjectLanguage.reset_counters(i.id, :projects)
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
class ChangeProjectCategoryLanguageIdDefault < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
execute "ALTER TABLE project_languages MODIFY COLUMN id INT AUTO_INCREMENT;"
|
||||||
|
execute "ALTER TABLE project_categories MODIFY COLUMN id INT AUTO_INCREMENT;"
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue