added import for category products

This commit is contained in:
Adrian Hinz 2018-04-22 00:05:01 +02:00
parent 95b5732512
commit a90aee5f27
2 changed files with 22 additions and 1 deletions

View File

@ -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

View File

@ -1,5 +1,4 @@
#!/usr/bin/env ruby
# encoding: UTF-8
ENV["RAILS_ENV"] ||= "development"
require File.dirname(__FILE__) + "/../config/environment"