parent
d6dc81692a
commit
ba91e20f85
@ -0,0 +1 @@
|
||||
$(".salesman-customer-list-container").html("<%= j(render partial: 'admins/salesman_customers/shared/list') %>")
|
@ -0,0 +1,10 @@
|
||||
class AddUniqIndexToSalesmanChannel < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
sql = %Q(delete from salesman_channels where (salesman_id, school_id) in
|
||||
(select * from (select salesman_id, school_id from salesman_channels group by salesman_id, school_id having count(*) > 1) a)
|
||||
and id not in (select * from (select min(id) from salesman_channels group by salesman_id, school_id having count(*) > 1 order by id) b))
|
||||
ActiveRecord::Base.connection.execute sql
|
||||
|
||||
add_index :salesman_channels, [:salesman_id, :school_id], unique: true
|
||||
end
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
class AddUniqIndexToSalesmanCustomer < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
sql = %Q(delete from salesman_customers where (salesman_id, user_id) in
|
||||
(select * from (select salesman_id, user_id from salesman_customers group by salesman_id, user_id having count(*) > 1) a)
|
||||
and id not in (select * from (select min(id) from salesman_customers group by salesman_id, user_id having count(*) > 1 order by id) b))
|
||||
ActiveRecord::Base.connection.execute sql
|
||||
|
||||
add_index :salesman_customers, [:salesman_id, :user_id], unique: true
|
||||
end
|
||||
end
|
Loading…
Reference in new issue