From 41f01f49614a1885ffe373e7eaeb7033fb4a3a58 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 3 Jul 2019 17:21:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 1 + db/migrate/20190703090511_add_index_for_shixun_services.rb | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 db/migrate/20190703090511_add_index_for_shixun_services.rb diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 5a1773a10..2c4f2a7d1 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -180,6 +180,7 @@ class ShixunsController < ApplicationController end # 同步配置 + logger.info("########-shixun_service_configs_count: #{@shixun.shixun_service_configs.pluck(:id, :shixun_id)}") @shixun.shixun_service_configs.each do |config| ShixunServiceConfig.create!(:shixun_id => @new_shixun.id, :cpu_limit => config.cpu_limit, diff --git a/db/migrate/20190703090511_add_index_for_shixun_services.rb b/db/migrate/20190703090511_add_index_for_shixun_services.rb new file mode 100644 index 000000000..3e6dd3703 --- /dev/null +++ b/db/migrate/20190703090511_add_index_for_shixun_services.rb @@ -0,0 +1,5 @@ +class AddIndexForShixunServices < ActiveRecord::Migration[5.2] + def change + add_index :shixun_service_configs, [:shixun_id, :mirror_repository_id], unique: true, name: "shixun_id_mirror_id_unique" + end +end