update rake to shop_create

This commit is contained in:
Thein Lin Kyaw
2020-01-17 15:53:34 +06:30
parent 0e9b6f7c4b
commit 0df7357cc9
5 changed files with 80 additions and 69 deletions

View File

@@ -1,6 +1,11 @@
namespace :manual_data do
desc "Add Manual Data"
task :add, [:shop_code] => :environment do |t, args|
namespace :shop do
desc "Create shop and seed data"
task :create, [:name, :shop_code, :client_name, :client_code, :address, :phone_no] => :environment do |t, args|
ActiveRecord::Base.connection.execute("INSERT INTO shops (logo, name, shop_code, subdomain, client_name, client_code, address, township, city, state, country, phone_no, reservation_no, license, activated_at, license_data, base_currency, cloud_url, cloud_token, owner_token, id_prefix, is_rounding_adj, quick_sale_summary, calc_tax_order, show_account_info, note, created_at, updated_at)
VALUES (NULL, '#{args.name}', '#{args.shop_code}', '#{args.name}-#{args.shop_code}', '#{args.client_name}', '#{args.client_code}', '#{args.address}', '', '', '', '', '#{args.phone_no}', '111', '', CURRENT_TIMESTAMP(), 'test', '111', NULL, NULL, NULL, '111', 0, 0, 0, 1, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP())")
logger.info " Shop created for #{args.name}-#{args.shop_code}"
gateway_communication_type =Lookup.create([{lookup_type:'gateway_communication_type',name: 'API',value: 'api',shop_code: args.shop_code},
{lookup_type:'gateway_communication_type',name: 'USB',value: 'usb',shop_code: args.shop_code}])
puts " Finished gateway_communication_type Set Up Data"