From 5854bd88e16c3d4319b70e3dfbbd28a2581f526e Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Feb 2018 10:53:29 +0630 Subject: [PATCH 1/9] update liscense file --- app/controllers/application_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e66d7700..0966a573 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -38,11 +38,11 @@ class ApplicationController < ActionController::Base end else # check for license file - # if check_license - # current_license(ENV["SX_PROVISION_URL"]) - # else - # redirect_to activate_path - # end + if check_license + current_license(ENV["SX_PROVISION_URL"]) + else + redirect_to activate_path + end end end From 839fb144366b6b5affaa24cd540dfb5f91bb14ee Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Feb 2018 11:34:06 +0630 Subject: [PATCH 2/9] update inventory --- app/views/layouts/_left_sidebar.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_left_sidebar.html.erb b/app/views/layouts/_left_sidebar.html.erb index 57f05179..9bffd4d7 100755 --- a/app/views/layouts/_left_sidebar.html.erb +++ b/app/views/layouts/_left_sidebar.html.erb @@ -68,12 +68,12 @@ <% end %> <% if can? :menage, Inventory %> - + <%end%>
  • <%= t :backend %>
  • From 5ef5ff4fbefa68eafbb6dfbf9246da181cec68c6 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 13 Feb 2018 13:29:19 +0630 Subject: [PATCH 3/9] add column to existing table and new table for second display images --- .../20180213050551_add_image_path_to_employees.rb | 9 +++++++++ .../20180213050631_add_image_path_to_customers.rb | 9 +++++++++ ...180213052206_add_image_path_to_commissioners.rb | 9 +++++++++ db/migrate/20180213053009_create_display_images.rb | 14 ++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 db/migrate/20180213050551_add_image_path_to_employees.rb create mode 100644 db/migrate/20180213050631_add_image_path_to_customers.rb create mode 100644 db/migrate/20180213052206_add_image_path_to_commissioners.rb create mode 100644 db/migrate/20180213053009_create_display_images.rb diff --git a/db/migrate/20180213050551_add_image_path_to_employees.rb b/db/migrate/20180213050551_add_image_path_to_employees.rb new file mode 100644 index 00000000..bb26e888 --- /dev/null +++ b/db/migrate/20180213050551_add_image_path_to_employees.rb @@ -0,0 +1,9 @@ +class AddImagePathToEmployees < ActiveRecord::Migration[5.1] + def change + add_column :employees, :image_path, :string + end + + def down + remove_column :image_path + end +end diff --git a/db/migrate/20180213050631_add_image_path_to_customers.rb b/db/migrate/20180213050631_add_image_path_to_customers.rb new file mode 100644 index 00000000..11eecdc0 --- /dev/null +++ b/db/migrate/20180213050631_add_image_path_to_customers.rb @@ -0,0 +1,9 @@ +class AddImagePathToCustomers < ActiveRecord::Migration[5.1] + def change + add_column :customers, :image_path, :string + end + + def down + remove_column :image_path + end +end diff --git a/db/migrate/20180213052206_add_image_path_to_commissioners.rb b/db/migrate/20180213052206_add_image_path_to_commissioners.rb new file mode 100644 index 00000000..f61dce61 --- /dev/null +++ b/db/migrate/20180213052206_add_image_path_to_commissioners.rb @@ -0,0 +1,9 @@ +class AddImagePathToCommissioners < ActiveRecord::Migration[5.1] + def change + add_column :commissioners, :image_path, :string + end + + def down + remove_column :image_path + end +end diff --git a/db/migrate/20180213053009_create_display_images.rb b/db/migrate/20180213053009_create_display_images.rb new file mode 100644 index 00000000..f40a9179 --- /dev/null +++ b/db/migrate/20180213053009_create_display_images.rb @@ -0,0 +1,14 @@ +class CreateDisplayImages < ActiveRecord::Migration[5.1] + def change + create_table :display_images do |t| + t.integer :shop_id + t.binary :image + t.string :created_by + t.timestamps + end + end + + def down + drop_table :display_images + end +end From 22a9e75efa7c245c43ee65cd9a77890203ddeab0 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Feb 2018 15:12:09 +0630 Subject: [PATCH 4/9] update license and sym_master --- app/controllers/origami/home_controller.rb | 3 ++ app/controllers/sym_control_controller.rb | 6 ++-- app/models/license.rb | 20 +++++++----- config/license.yml | 15 --------- config/shops.json | 10 +----- db/sym_master.sql | 37 ++++++++++++++++++++++ 6 files changed, 56 insertions(+), 35 deletions(-) delete mode 100644 config/license.yml diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index bf4008a2..c40dbe43 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -80,6 +80,9 @@ class Origami::HomeController < BaseOrigamiController @order_items.push(item) end accounts = @customer.tax_profiles + puts accounts.to_json + puts "sssssssssss" + puts @customer.tax_profiles @account_arr =[] accounts.each do |acc| account = TaxProfile.find(acc) diff --git a/app/controllers/sym_control_controller.rb b/app/controllers/sym_control_controller.rb index bbd4a087..8ef6fd78 100644 --- a/app/controllers/sym_control_controller.rb +++ b/app/controllers/sym_control_controller.rb @@ -3,7 +3,7 @@ class SymControlController < BaseController http_basic_authenticate_with name: "vip", password: "!abcABC01" def run - sym_path = "/home/yan/symmetric/" + sym_path = File.expand_path("~/symmetric/") check_sym_proc_str = `#{"sudo service SymmetricDS status"}` # Check Sym Installed # if sym_install_status[1] == "false" @@ -12,13 +12,13 @@ class SymControlController < BaseController if check_sym_proc_str.include? "Active: active (running)" || "Active: active (exited)" #"Server is already running" # Create Sym Table - check_sym_table = system("sudo " + sym_path + "bin/symadmin --engine sx create-sym-tables") + check_sym_table = system("sudo " + sym_path + "/bin/symadmin --engine sx create-sym-tables") if check_sym_table sym_sql = Rails.root + "db/sym_master.sql" if File.exist? (sym_sql) # Import Sym Sql to db and start sym - run_sym_sql = system("sudo " + sym_path + "bin/dbimport --engine sx " + sym_sql.to_s) + run_sym_sql = system("sudo " + sym_path + "/bin/dbimport --engine sx " + sym_sql.to_s) stop_sym = system("sudo service SymmetricDS stop") run_sym = system("sudo service SymmetricDS start") if run_sym diff --git a/app/models/license.rb b/app/models/license.rb index 8c22f478..d025e349 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -1,7 +1,7 @@ class License include HTTParty - base_uri "provision.zsai.ws/api" + base_uri "connect.smartsales.dev/api" attr_accessor :name, :address_1, :address_2, :township, :city, :country, :email, :phone, :fax, :logo, :subdomain, :plan_activation_date, :plan_next_renewal_date, :plan_max_products,:plan_max_customers, :plan_active_connections, @@ -118,8 +118,11 @@ class License response = create_license_file(@activate) if(response[:status]) - sym_path = "/home/yan/symmetric/" + #sym_path = "/home/user/symmetric/" + sym_path = File.expand_path("~/symmetric/") + response = create_symmetric_config(sym_path, db_host, db_schema, db_user, db_password) + if(response[:status]) response = run_symmetric(sym_path) end @@ -183,7 +186,7 @@ class License if File.exist?("config/license.yml") File.open("config/license.yml").each do |line| - if line.include? (key_name) + if line.include? (key_name) decrypted_line_array = line.split(": ") decrypted_line = AESCrypt.decrypt_data(decode_str(decrypted_line_array[1]), decode_str(key), decode_str(iv), ENV['CIPHER_TYPE']) end @@ -325,7 +328,7 @@ class License if File.directory? (sym_location) begin # sx properties create - f = File.open(sym_location + "engines/sx.properties", "w") + f = File.open(sym_location + "/engines/sx.properties", "w") f.write("engine.name=sx\n") f.write("db.driver=com.mysql.jdbc.Driver\n") f.write("db.url=jdbc:mysql://#{db_host}/#{db_schema}?tinyInt1isBit=false\n") @@ -344,14 +347,15 @@ class License f.close # read from license file - shop_name = read_license_no_decrypt("shop_name") + # shop_name = read_license_no_decrypt("shop_name") + shop_name = "cloud" dbhost = read_license("dbhost") dbschema = read_license("dbschema") dbusername = read_license("dbusername") dbpassword = read_license("dbpassword") # shop properties create - f = File.open(sym_location + "engines/#{shop_name}.properties", "w") + f = File.open(sym_location + "/engines/#{shop_name}.properties", "w") f.write("engine.name=#{shop_name}\n") f.write("db.driver=com.mysql.jdbc.Driver\n") f.write("db.url=jdbc:mysql://#{dbhost}/#{dbschema}?tinyInt1isBit=false\n") @@ -390,13 +394,13 @@ class License sym_run_status = check_sym_running(check_sym_proc_str, sym_path) if sym_run_status # Create Sym Table - check_sym_table = system("sudo " + sym_path + "bin/symadmin --engine sx create-sym-tables") + check_sym_table = system("sudo " + sym_path + "/bin/symadmin --engine sx create-sym-tables") if check_sym_table sym_sql = Rails.root + "db/sym_master.sql" if File.exist? (sym_sql) # Import Sym Sql to db and start sym - run_sym_sql = system("sudo " + sym_path + "bin/dbimport --engine sx " + sym_sql.to_s) + run_sym_sql = system("sudo " + sym_path + "/bin/dbimport --engine sx " + sym_sql.to_s) stop_sym = system("sudo service SymmetricDS stop") run_sym = system("sudo service SymmetricDS start") if run_sym diff --git a/config/license.yml b/config/license.yml deleted file mode 100644 index 8018a685..00000000 --- a/config/license.yml +++ /dev/null @@ -1,15 +0,0 @@ -iv_key: Te5NfpxT9IjB5ulefoRdoQ== -shop_name: bitp7 -email: devops@code2lab.com -telephone: 9999999 -fax: 99999999 -address: Perl Condo -dbhost: AAOoOhyuwUXWkBB7cev2vg== -dbschema: nZtG9/bJ9BoQ3y8RvSsH1w== -dbusername: Bahz/G6Xbn0kFw5vH/fS+Q== -dbpassword: T45gSYq8IB2BL9o9spFmIg== -api_token: DAJQdcHsSwXjxAbcvzWYjXTARdiAskWbw -app_token: PsVJxxAhQHKjqLFGOnWdIIsBHoLsMdPBhZLpM -plan_sku: W1evmpMVHjjXvXBLPW+jJA== -renewable_date: 2bDU6cDr2LRMJpeeCM9ZvQ== -plan_name: aaVvUh6fGhIbUDWoR3awq4qkDVk3rH2Fuydc0ZuKMqA= diff --git a/config/shops.json b/config/shops.json index f48d28c5..268c73f0 100644 --- a/config/shops.json +++ b/config/shops.json @@ -1,11 +1,3 @@ { - "data": [ - { - "lookup": "osaka1-7.zsai.ws", - "value": { - "key": "wwF9Zx9q/LfxSDqSNHYXvfu1eGsBqFEFXoXqGWrEirA=\n", - "iv": "l1rUEZFcPNHrTHWgaODkYQ==\n" - } - } - ] + "data": [] } diff --git a/db/sym_master.sql b/db/sym_master.sql index 0e57b601..4a181439 100755 --- a/db/sym_master.sql +++ b/db/sym_master.sql @@ -117,6 +117,10 @@ delete from sym_node; (trigger_id,source_table_name,channel_id,last_update_time,create_time) values('customers','customers','setting',current_timestamp,current_timestamp); + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('tax_profiles','customers','setting',current_timestamp,current_timestamp); + # Create Trigger for Dining Channel insert into sym_trigger @@ -279,6 +283,14 @@ delete from sym_node; (trigger_id,source_table_name,channel_id,last_update_time,create_time) values('surveys','surveys','sale',current_timestamp,current_timestamp); + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('card_sale_trans','card_sale_trans','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('card_settle_trans','card_settle_trans','sale',current_timestamp,current_timestamp); + # Create Trigger for OQS Channel insert into sym_trigger @@ -351,6 +363,10 @@ delete from sym_node; (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('customers','cloud_2_sx', 100, current_timestamp, current_timestamp); + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('tax_profiles','cloud_2_sx', 100, current_timestamp, current_timestamp); + # Setting Channel # From Master to cloud insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) @@ -380,6 +396,10 @@ delete from sym_node; (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('customers','sx_2_cloud', 100, current_timestamp, current_timestamp); + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('tax_profiles','sx_2_cloud', 100, current_timestamp, current_timestamp); + #End Setting Channel # Dining Channel # From cloud to SX @@ -661,6 +681,14 @@ delete from sym_node; (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('surveys','cloud_2_sx', 200, current_timestamp, current_timestamp); + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_sale_trans','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_settle_trans','cloud_2_sx', 200, current_timestamp, current_timestamp); + # Sale Channel # From SX to cloud insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) @@ -709,6 +737,15 @@ delete from sym_node; insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('surveys','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_sale_trans','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_settle_trans','sx_2_cloud', 200, current_timestamp, current_timestamp); + # End Sale Channel # Oqs Channel # From cloud to Sx From 1b1ab323287df876c72d1d8d9db0d22d29ca0ce5 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 13 Feb 2018 16:55:28 +0630 Subject: [PATCH 5/9] update sym_master --- db/sym_master.sql | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/db/sym_master.sql b/db/sym_master.sql index 0e57b601..4a181439 100755 --- a/db/sym_master.sql +++ b/db/sym_master.sql @@ -117,6 +117,10 @@ delete from sym_node; (trigger_id,source_table_name,channel_id,last_update_time,create_time) values('customers','customers','setting',current_timestamp,current_timestamp); + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('tax_profiles','customers','setting',current_timestamp,current_timestamp); + # Create Trigger for Dining Channel insert into sym_trigger @@ -279,6 +283,14 @@ delete from sym_node; (trigger_id,source_table_name,channel_id,last_update_time,create_time) values('surveys','surveys','sale',current_timestamp,current_timestamp); + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('card_sale_trans','card_sale_trans','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('card_settle_trans','card_settle_trans','sale',current_timestamp,current_timestamp); + # Create Trigger for OQS Channel insert into sym_trigger @@ -351,6 +363,10 @@ delete from sym_node; (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('customers','cloud_2_sx', 100, current_timestamp, current_timestamp); + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('tax_profiles','cloud_2_sx', 100, current_timestamp, current_timestamp); + # Setting Channel # From Master to cloud insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) @@ -380,6 +396,10 @@ delete from sym_node; (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('customers','sx_2_cloud', 100, current_timestamp, current_timestamp); + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('tax_profiles','sx_2_cloud', 100, current_timestamp, current_timestamp); + #End Setting Channel # Dining Channel # From cloud to SX @@ -661,6 +681,14 @@ delete from sym_node; (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('surveys','cloud_2_sx', 200, current_timestamp, current_timestamp); + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_sale_trans','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_settle_trans','cloud_2_sx', 200, current_timestamp, current_timestamp); + # Sale Channel # From SX to cloud insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) @@ -709,6 +737,15 @@ delete from sym_node; insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('surveys','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_sale_trans','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_settle_trans','sx_2_cloud', 200, current_timestamp, current_timestamp); + # End Sale Channel # Oqs Channel # From cloud to Sx From 086d5a730658b59c82442d3246cad0ed60cebb38 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 14 Feb 2018 13:59:28 +0630 Subject: [PATCH 6/9] update symn for display images --- db/sym_master.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/db/sym_master.sql b/db/sym_master.sql index 4a181439..89abaf5b 100755 --- a/db/sym_master.sql +++ b/db/sym_master.sql @@ -121,6 +121,10 @@ delete from sym_node; (trigger_id,source_table_name,channel_id,last_update_time,create_time) values('tax_profiles','customers','setting',current_timestamp,current_timestamp); + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('display_images','customers','setting',current_timestamp,current_timestamp); + # Create Trigger for Dining Channel insert into sym_trigger @@ -367,6 +371,10 @@ delete from sym_node; (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('tax_profiles','cloud_2_sx', 100, current_timestamp, current_timestamp); + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('display_images','cloud_2_sx', 100, current_timestamp, current_timestamp); + # Setting Channel # From Master to cloud insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) @@ -400,6 +408,10 @@ delete from sym_node; (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('tax_profiles','sx_2_cloud', 100, current_timestamp, current_timestamp); + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('display_images','sx_2_cloud', 100, current_timestamp, current_timestamp); + #End Setting Channel # Dining Channel # From cloud to SX From 91aa21666624074459efaa69a0f22472e917d913 Mon Sep 17 00:00:00 2001 From: phyusin Date: Wed, 14 Feb 2018 14:20:20 +0630 Subject: [PATCH 7/9] check booking sale id is null for all order --- app/controllers/origami/home_controller.rb | 14 ++++++++++---- app/controllers/origami/orders_controller.rb | 14 ++++++++++---- app/controllers/origami/rooms_controller.rb | 14 ++++++++++---- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index bf4008a2..b4b63515 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -38,15 +38,21 @@ class Origami::HomeController < BaseOrigamiController if !order.order_items.empty? if !@order_items_count.key?(booking.dining_facility_id) @order_items_count.store(booking.dining_facility_id, order.order_items.count) + else + @order_items_count[booking.dining_facility_id] += order.order_items.count end end end end else - sale = Sale.find(booking.sale_id) - if sale.sale_status !='completed' - if !@order_items_count.key?(booking.dining_facility_id) - @order_items_count.store(booking.dining_facility_id, sale.sale_items.count) + if !booking.sale_id.nil? + sale = Sale.find(booking.sale_id) + if sale.sale_status !='completed' + if !@order_items_count.key?(booking.dining_facility_id) + @order_items_count.store(booking.dining_facility_id, sale.sale_items.count) + else + @order_items_count[booking.dining_facility_id] += sale.sale_items.count + end end end end diff --git a/app/controllers/origami/orders_controller.rb b/app/controllers/origami/orders_controller.rb index f4b11fc5..ec2f58ba 100755 --- a/app/controllers/origami/orders_controller.rb +++ b/app/controllers/origami/orders_controller.rb @@ -24,15 +24,21 @@ class Origami::OrdersController < BaseOrigamiController if !order.order_items.empty? if !@order_items_count.key?(booking.dining_facility_id) @order_items_count.store(booking.dining_facility_id, order.order_items.count) + else + @order_items_count[booking.dining_facility_id] += order.order_items.count end end end end else - sale = Sale.find(booking.sale_id) - if sale.sale_status !='completed' - if !@order_items_count.key?(booking.dining_facility_id) - @order_items_count.store(booking.dining_facility_id, sale.sale_items.count) + if !booking.sale_id.nil? + sale = Sale.find(booking.sale_id) + if sale.sale_status !='completed' + if !@order_items_count.key?(booking.dining_facility_id) + @order_items_count.store(booking.dining_facility_id, sale.sale_items.count) + else + @order_items_count[booking.dining_facility_id] += sale.sale_items.count + end end end end diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb index 7ffac1f0..68cb8798 100755 --- a/app/controllers/origami/rooms_controller.rb +++ b/app/controllers/origami/rooms_controller.rb @@ -34,15 +34,21 @@ class Origami::RoomsController < BaseOrigamiController if !order.order_items.empty? if !@order_items_count.key?(booking.dining_facility_id) @order_items_count.store(booking.dining_facility_id, order.order_items.count) + else + @order_items_count[booking.dining_facility_id] += order.order_items.count end end end end else - sale = Sale.find(booking.sale_id) - if sale.sale_status !='completed' - if !@order_items_count.key?(booking.dining_facility_id) - @order_items_count.store(booking.dining_facility_id, sale.sale_items.count) + if !booking.sale_id.nil? + sale = Sale.find(booking.sale_id) + if sale.sale_status !='completed' + if !@order_items_count.key?(booking.dining_facility_id) + @order_items_count.store(booking.dining_facility_id, sale.sale_items.count) + else + @order_items_count[booking.dining_facility_id] += sale.sale_items.count + end end end end From a4ec4bf7c766f2df7ae826d7d7dd246bd00d506f Mon Sep 17 00:00:00 2001 From: phyusin Date: Wed, 14 Feb 2018 14:39:48 +0630 Subject: [PATCH 8/9] db/sym_master.sql --- db/sym_master.sql | 781 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 781 insertions(+) create mode 100755 db/sym_master.sql diff --git a/db/sym_master.sql b/db/sym_master.sql new file mode 100755 index 00000000..0e57b601 --- /dev/null +++ b/db/sym_master.sql @@ -0,0 +1,781 @@ +-- +-- Licensed to JumpMind Inc under one or more contributor +-- license agreements. See the NOTICE file distributed +-- with this work for additional information regarding +-- copyright ownership. JumpMind Inc licenses this file +-- to you under the GNU General Public License, version 3.0 (GPLv3) +-- (the "License"); you may not use this file except in compliance +-- with the License. +-- +-- You should have received a copy of the GNU General Public License, +-- version 3.0 (GPLv3) along with this library; if not, see +-- . +-- +-- Unless required by applicable law or agreed to in writing, +-- software distributed under the License is distributed on an +-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +-- KIND, either express or implied. See the License for the +-- specific language governing permissions and limitations +-- under the License. +-- + +------------------------------------------------------------------------------ +-- Sample Data +------------------------------------------------------------------------------ +-- insert into item (item_id, name) values (11000001, 'Yummy Gum'); +-- insert into item_selling_price (item_id, cloud_id, price, cost) values (11000001, '001',0.20, 0.10); +-- insert into item_selling_price (item_id, cloud_id, price, cost) values (11000001, '002',0.30, 0.20); + +-- insert into sale_transaction (tran_id, store_id, workstation, day, seq) +-- values (900, '001', '3', '2012-12-01', 90); +-- insert into sale_return_line_item (tran_id, item_id, price, quantity, returned_quantity) +-- values (900, 11000001, 0.20, 1, 0); + +------------------------------------------------------------------------------ +-- Sample Symmetric Configuration +------------------------------------------------------------------------------ + +delete from sym_trigger_router; +delete from sym_trigger; +delete from sym_router; +delete from sym_channel where channel_id in ('orders', 'order_items'); +delete from sym_node_group_link; +delete from sym_node_group; +delete from sym_node_host; +delete from sym_node_identity; +delete from sym_node_security; +delete from sym_node; + + +# Create Channels for logically grouped tables + # For Initial Data Faster by bulk + update sym_channel set data_loader_type='mysql_bulk', max_batch_size=100000, max_data_to_route=100000 + where channel_id = 'reload'; + + insert into sym_channel + (channel_id, processing_order, max_batch_size, enabled, description) + values('setting', 1, 100000, 1, 'All Settings'); + + insert into sym_channel + (channel_id, processing_order, max_batch_size, enabled, description) + values('dining', 1, 100000, 1, 'sale_transactional data from register and back office'); + + insert into sym_channel + (channel_id, processing_order, max_batch_size, enabled, description) + values('commission', 1, 100000, 1, 'Commission ,Commissioners ,Products and Promotion'); + + insert into sym_channel + (channel_id, processing_order, max_batch_size, enabled, description) + values('menu', 1, 100000, 1, 'Item and pricing data'); + + insert into sym_channel + (channel_id, processing_order, max_batch_size, enabled, description) + values('order', 1, 100000, 1, 'Item and pricing data'); + + insert into sym_channel + (channel_id, processing_order, max_batch_size, enabled, description) + values('sale', 1, 100000, 1, 'Sale data'); + + insert into sym_channel + (channel_id, processing_order, max_batch_size, enabled, description) + values('oqs', 1, 100000, 1, 'OQS and cashier temenal'); + +# Create Node Groups and Links + insert into sym_node_group (node_group_id) values ('sx'); + insert into sym_node_group (node_group_id) values ('cloud'); + + insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('sx', 'cloud', 'W'); + insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('cloud', 'sx', 'P'); + +# Create Trigger for Setting Channel + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('lookups','lookups','setting',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('membership_actions','membership_actions','setting',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('membership_settings','membership_settings','setting',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('payment_method_settings','payment_method_settings','setting',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('print_settings','print_settings','setting',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('shops','shops','setting',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('customers','customers','setting',current_timestamp,current_timestamp); + +# Create Trigger for Dining Channel + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('zones','zones','dining',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('dining_charges','dining_charges','dining',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('dining_facilities','dining_facilities','dining',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('dining_queues','dining_queues','dining',current_timestamp,current_timestamp); + +# Create Trigger for Commission Channel + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('commissioners','commissioners','commission',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('commissions','commissions','commission',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('employees','employees','commission',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('in_duties','in_duties','commission',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('inventory_definitions','inventory_definitions','commission',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('product_commissions','product_commissions','commission',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('products','products','commission',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('promotion_products','promotion_products','commission',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('promotions','promotions','commission',current_timestamp,current_timestamp); + +# Create Trigger for Menu Channel + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('accounts','accounts','menu',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('menu_item_attributes','menu_item_attributes','menu',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('menu_item_options','menu_item_options','menu',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('menus','menus','menu',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('menu_categories','menu_categories','menu',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('menu_items','menu_items','menu',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('menu_item_instances','menu_item_instances','menu',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('item_sets','item_sets','menu',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('menu_item_sets','menu_item_sets','menu',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('menu_instance_item_sets','menu_instance_item_sets','menu',current_timestamp,current_timestamp); + +# Create Trigger for Order Channel + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('orders','orders','order',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('order_items','order_items','order',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('bookings','bookings','order',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('booking_orders','booking_orders','order',current_timestamp,current_timestamp); + +# Create Trigger for Sale Channel + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('sales','sales','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('sale_items','sale_items','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('sale_audits','sale_audits','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('sale_orders','sale_orders','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('sale_payments','sale_payments','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('sale_taxes','sale_taxes','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('payment_journals','payment_journals','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('shift_sales','shift_sales','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('stock_check_items','stock_check_items','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('stock_checks','stock_checks','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('stock_journals','stock_journals','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('surveys','surveys','sale',current_timestamp,current_timestamp); + +# Create Trigger for OQS Channel + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('assigned_order_items','assigned_order_items','oqs',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('cashier_terminals','cashier_terminals','oqs',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('cashier_terminal_by_zones','cashier_terminal_by_zones','oqs',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('cashier_login_logs','cashier_login_logs','oqs',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('order_queue_process_by_zones','order_queue_process_by_zones','oqs',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('order_queue_stations','order_queue_stations','oqs',current_timestamp,current_timestamp); + + +# Create Routers for Nodes + insert into sym_router + (router_id,source_node_group_id,target_node_group_id,router_type,create_time,last_update_time) + values('sx_2_cloud', 'sx', 'cloud', 'default',current_timestamp, current_timestamp); + + insert into sym_router + (router_id,source_node_group_id,target_node_group_id,router_type,sync_on_delete,create_time,last_update_time) + values('cloud_2_sx', 'cloud', 'sx', 'default',0,current_timestamp, current_timestamp); + +-- insert into sym_router +-- (router_id,source_node_group_id,target_node_group_id,router_type,router_expression,create_time,last_update_time) +-- values('sx_2_one_cloud', 'sx', 'cloud', 'column','cloud_ID=:EXTERNAL_ID or OLD_cloud_ID=:EXTERNAL_ID',current_timestamp, current_timestamp); + + +# Add triggers for tables with router + +# Setting Channel # From cloud to Master + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('lookups','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('membership_actions','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('membership_settings','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('payment_method_settings','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('print_settings','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('shops','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('customers','cloud_2_sx', 100, current_timestamp, current_timestamp); + +# Setting Channel # From Master to cloud + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('lookups','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('membership_actions','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('membership_settings','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('payment_method_settings','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('print_settings','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('shops','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('customers','sx_2_cloud', 100, current_timestamp, current_timestamp); + +#End Setting Channel + +# Dining Channel # From cloud to SX + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('zones','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('dining_charges','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('dining_facilities','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('dining_queues','cloud_2_sx', 100, current_timestamp, current_timestamp); + +# Dining Channel # From SX to cloud + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('zones','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('dining_charges','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('dining_facilities','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('dining_queues','sx_2_cloud', 100, current_timestamp, current_timestamp); + +#end Dining Channel + +# Commission/Promotion/Product Channel # From cloud to SX + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('commissioners','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('commissions','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('employees','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('in_duties','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('inventory_definitions','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('product_commissions','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('products','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('promotion_products','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('promotions','cloud_2_sx', 100, current_timestamp, current_timestamp); + +# Commission/Promotion/Product Channel # From SX to cloud + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('commissioners','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('commissions','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('employees','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('in_duties','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('inventory_definitions','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('product_commissions','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('products','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('promotion_products','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('promotions','sx_2_cloud', 100, current_timestamp, current_timestamp); + +#end Commission/Promotion/Product Channel + +# Menu Channel # From cloud to SX + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('accounts','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_item_attributes','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_item_options','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menus','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_categories','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_items','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_item_instances','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('item_sets','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_item_sets','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_instance_item_sets','cloud_2_sx', 100, current_timestamp, current_timestamp); + +# Menu Channel # From SX to cloud + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('accounts','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_item_attributes','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_item_options','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menus','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_categories','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_items','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_item_instances','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('item_sets','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_item_sets','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('menu_instance_item_sets','sx_2_cloud', 100, current_timestamp, current_timestamp); +#End Menu Channel + +# Order Channel # From cloud to Sx + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('orders','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('order_items','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('bookings','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('booking_orders','cloud_2_sx', 200, current_timestamp, current_timestamp); + +# Order Channel # From SX to cloud + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('orders','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('order_items','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('bookings','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('booking_orders','sx_2_cloud', 200, current_timestamp, current_timestamp); +# End Order Channel + +# Sale Channel # From cloud to Sx + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sales','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sale_items','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sale_audits','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sale_orders','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sale_payments','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sale_taxes','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('payment_journals','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('shift_sales','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('stock_check_items','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('stock_checks','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('stock_journals','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('surveys','cloud_2_sx', 200, current_timestamp, current_timestamp); + +# Sale Channel # From SX to cloud + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sales','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sale_items','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sale_audits','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sale_orders','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sale_payments','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('sale_taxes','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('payment_journals','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('shift_sales','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('stock_check_items','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('stock_checks','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('stock_journals','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('surveys','sx_2_cloud', 200, current_timestamp, current_timestamp); +# End Sale Channel + +# Oqs Channel # From cloud to Sx + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('assigned_order_items','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('cashier_terminals','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('cashier_terminal_by_zones','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('cashier_login_logs','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('order_queue_process_by_zones','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('order_queue_stations','cloud_2_sx', 200, current_timestamp, current_timestamp); + +# Oqs Channel # From SX to cloud + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('assigned_order_items','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('cashier_terminals','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('cashier_terminal_by_zones','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('cashier_login_logs','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('order_queue_process_by_zones','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('order_queue_stations','sx_2_cloud', 200, current_timestamp, current_timestamp); +# End Oqs Channel + + +insert into sym_node (node_id,node_group_id,external_id,sync_enabled,sync_url,schema_version,symmetric_version,database_type,database_version,heartbeat_time,timezone_offset,batch_to_send_count,batch_in_error_count,created_at_node_id) + values ('000','sx','000',1,null,null,null,null,null,current_timestamp,null,0,0,'000'); +insert into sym_node (node_id,node_group_id,external_id,sync_enabled,sync_url,schema_version,symmetric_version,database_type,database_version,heartbeat_time,timezone_offset,batch_to_send_count,batch_in_error_count,created_at_node_id) + values ('001','cloud','001',1,null,null,null,null,null,current_timestamp,null,0,0,'000'); +-- insert into sym_node (node_id,node_group_id,external_id,sync_enabled,sync_url,schema_version,symmetric_version,database_type,database_version,heartbeat_time,timezone_offset,batch_to_send_count,batch_in_error_count,created_at_node_id) +-- values ('002','cloud','002',1,null,null,null,null,null,current_timestamp,null,0,0,'000'); + + +insert into sym_node_security (node_id,node_password,registration_enabled,registration_time,initial_load_enabled,initial_load_time,created_at_node_id) + values ('000','acd36ce830d1fda466eec921433f38',0,current_timestamp,1,current_timestamp,'000'); +insert into sym_node_security (node_id,node_password,registration_enabled,registration_time,initial_load_enabled,initial_load_time,created_at_node_id) + values ('001','acd36ce830d1fda466eec921433f38',1,null,1,null,'000'); +-- insert into sym_node_security (node_id,node_password,registration_enabled,registration_time,initial_load_enabled,initial_load_time,created_at_node_id) +-- values ('002','acd36ce830d1fda466eec921433f38',1,null,1,null,'000'); + +insert into sym_node_identity values ('000'); From 867148a03885727772f9ee96d69d4b16e6f56f37 Mon Sep 17 00:00:00 2001 From: phyusin Date: Wed, 14 Feb 2018 14:45:14 +0630 Subject: [PATCH 9/9] db/sym_master.sql --- db/sym_master.sql | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/db/sym_master.sql b/db/sym_master.sql index 0e57b601..89abaf5b 100755 --- a/db/sym_master.sql +++ b/db/sym_master.sql @@ -117,6 +117,14 @@ delete from sym_node; (trigger_id,source_table_name,channel_id,last_update_time,create_time) values('customers','customers','setting',current_timestamp,current_timestamp); + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('tax_profiles','customers','setting',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('display_images','customers','setting',current_timestamp,current_timestamp); + # Create Trigger for Dining Channel insert into sym_trigger @@ -279,6 +287,14 @@ delete from sym_node; (trigger_id,source_table_name,channel_id,last_update_time,create_time) values('surveys','surveys','sale',current_timestamp,current_timestamp); + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('card_sale_trans','card_sale_trans','sale',current_timestamp,current_timestamp); + + insert into sym_trigger + (trigger_id,source_table_name,channel_id,last_update_time,create_time) + values('card_settle_trans','card_settle_trans','sale',current_timestamp,current_timestamp); + # Create Trigger for OQS Channel insert into sym_trigger @@ -351,6 +367,14 @@ delete from sym_node; (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('customers','cloud_2_sx', 100, current_timestamp, current_timestamp); + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('tax_profiles','cloud_2_sx', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('display_images','cloud_2_sx', 100, current_timestamp, current_timestamp); + # Setting Channel # From Master to cloud insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) @@ -380,6 +404,14 @@ delete from sym_node; (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('customers','sx_2_cloud', 100, current_timestamp, current_timestamp); + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('tax_profiles','sx_2_cloud', 100, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('display_images','sx_2_cloud', 100, current_timestamp, current_timestamp); + #End Setting Channel # Dining Channel # From cloud to SX @@ -661,6 +693,14 @@ delete from sym_node; (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('surveys','cloud_2_sx', 200, current_timestamp, current_timestamp); + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_sale_trans','cloud_2_sx', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_settle_trans','cloud_2_sx', 200, current_timestamp, current_timestamp); + # Sale Channel # From SX to cloud insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) @@ -709,6 +749,15 @@ delete from sym_node; insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time) values('surveys','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_sale_trans','sx_2_cloud', 200, current_timestamp, current_timestamp); + + insert into sym_trigger_router + (trigger_id,router_id,initial_load_order,last_update_time,create_time) + values('card_settle_trans','sx_2_cloud', 200, current_timestamp, current_timestamp); + # End Sale Channel # Oqs Channel # From cloud to Sx