diff --git a/bin/import_category_product_from_ps.rb b/bin/import_category_product_from_ps.rb new file mode 100644 index 0000000..af347ef --- /dev/null +++ b/bin/import_category_product_from_ps.rb @@ -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 diff --git a/bin/import_images_from_ps.rb b/bin/import_images_from_ps.rb index 1ccf13d..e1ab940 100644 --- a/bin/import_images_from_ps.rb +++ b/bin/import_images_from_ps.rb @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -# encoding: UTF-8 ENV["RAILS_ENV"] ||= "development" require File.dirname(__FILE__) + "/../config/environment"