added import for category products
This commit is contained in:
parent
95b5732512
commit
a90aee5f27
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env ruby
|
||||
ENV['RAILS_ENV'] ||= 'development'
|
||||
require File.dirname(__FILE__) + '/../config/environment'
|
||||
|
||||
# import categories data from old presta shop
|
||||
|
||||
# category_products from prestashop datapase
|
||||
class PsCategoryProduct < ApplicationRecord
|
||||
self.table_name = 'ps_category_product'
|
||||
establish_connection :prestashop_old
|
||||
end
|
||||
|
||||
# Catgories_Products in new database
|
||||
class CategoriesProduct < ApplicationRecord
|
||||
end
|
||||
|
||||
pcps = PsCategoryProduct.all
|
||||
|
||||
pcps.each do |pcp|
|
||||
CategoriesProduct.create(category_id: pcp.id_category,
|
||||
product_id: pcp.id_product)
|
||||
end
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/env ruby
|
||||
# encoding: UTF-8
|
||||
|
||||
ENV["RAILS_ENV"] ||= "development"
|
||||
require File.dirname(__FILE__) + "/../config/environment"
|
||||
|
|
|
|||
Loading…
Reference in New Issue