This commit is contained in:
Adrian Hinz 2018-04-22 00:08:01 +02:00
parent a90aee5f27
commit 986e6cdeb4
1 changed files with 17 additions and 22 deletions

View File

@ -1,22 +1,17 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
ENV['RAILS_ENV'] ||= 'development' ENV['RAILS_ENV'] ||= 'development'
require File.dirname(__FILE__) + '/../config/environment' require File.dirname(__FILE__) + '/../config/environment'
# import categories data from old presta shop
# import categories data from old presta shop # category_products from prestashop datapase
class PsCategoryProduct < ApplicationRecord
# category_products from prestashop datapase self.table_name = 'ps_category_product'
class PsCategoryProduct < ApplicationRecord establish_connection :prestashop_old
self.table_name = 'ps_category_product' end
establish_connection :prestashop_old # Catgories_Products in new database
end class CategoriesProduct < ApplicationRecord
end
# Catgories_Products in new database pcps = PsCategoryProduct.all
class CategoriesProduct < ApplicationRecord pcps.each do |pcp|
end CategoriesProduct.create(category_id: pcp.id_category,
product_id: pcp.id_product)
pcps = PsCategoryProduct.all end
pcps.each do |pcp|
CategoriesProduct.create(category_id: pcp.id_category,
product_id: pcp.id_product)
end