#!/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
