diff --git a/Gemfile.lock b/Gemfile.lock index e2c1dd73..5dce67dc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -119,6 +119,7 @@ GEM nokogiri (1.7.2) mini_portile2 (~> 2.1.0) pdf-core (0.7.0) + pg (0.20.0) prawn (2.2.2) pdf-core (~> 0.7.0) ttfunk (~> 1.5) @@ -252,6 +253,7 @@ DEPENDENCIES kaminari! listen (~> 3.0.5) mysql2 (>= 0.3.18, < 0.5) + pg prawn prawn-table puma (~> 3.0) diff --git a/config/application.rb b/config/application.rb index 90f088bd..2a47de48 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,9 +13,6 @@ module SXRestaurants # -- all .rb files in that directory are automatically loaded. config.active_record.time_zone_aware_types = [:datetime, :time] config.active_job.queue_adapter = :sidekiq - - # config.generators do |g| - # g.orm :active_record, primary_key_type: :uuid - # end + end end diff --git a/db/migrate/20170403135121_create_customers.rb b/db/migrate/20170403135121_create_customers.rb index 76e9894a..17c104cd 100644 --- a/db/migrate/20170403135121_create_customers.rb +++ b/db/migrate/20170403135121_create_customers.rb @@ -1,6 +1,7 @@ class CreateCustomers < ActiveRecord::Migration[5.0] def change - create_table :customers do |t| + create_table :customers, :id => false, :primary_key => :customer_id do |t| + t.string :customer_id, :limit => 16, :null => false, :index => true, :unique => true #custom foreign_key to prevent conflict during sync t.string :name, :null => false t.string :company t.string :contact_no diff --git a/db/migrate/20170403135934_create_orders.rb b/db/migrate/20170403135934_create_orders.rb index d318386e..7fe7eb12 100644 --- a/db/migrate/20170403135934_create_orders.rb +++ b/db/migrate/20170403135934_create_orders.rb @@ -1,10 +1,11 @@ class CreateOrders < ActiveRecord::Migration[5.0] def change - create_table :orders do |t| + create_table :orders, :id => false, :primary_key => :order_id do |t| + t.string :order_id, :limit => 16, :null => false, :index => true, :unique => true #custom foreign_key to prevent conflict during sync t.datetime :date, :null => false t.string :source, :null => false, :default => "emenu" t.string :order_type, :null => false, :default => "dine-in" - t.references :customer, foreign_key: true + t.string :customer_id, foreign_key: true, :limit => 16 t.integer :item_count, :null => false, :default => 0 t.integer :quantity_count, :null => false, :default => 0 t.string :status, :null => false, :default => "new" diff --git a/db/migrate/20170403140820_create_order_items.rb b/db/migrate/20170403140820_create_order_items.rb index 847381a4..45a0f8fa 100644 --- a/db/migrate/20170403140820_create_order_items.rb +++ b/db/migrate/20170403140820_create_order_items.rb @@ -1,7 +1,8 @@ class CreateOrderItems < ActiveRecord::Migration[5.0] def change - create_table :order_items do |t| - t.references :order, foreign_key: true, :null => false + create_table :order_items, :id => false, :primary_key => :order_items_id do |t| + t.string :order_items_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing + t.string :order_id, foreign_key: true, :null => false, :limit => 16 t.string :order_item_status, :null => false, :default => "new" t.string :item_order_by #person who order this t.string :item_code, :null => false diff --git a/db/migrate/20170403155531_create_cashier_login_logs.rb b/db/migrate/20170403155531_create_cashier_login_logs.rb index b12f258f..176c5cae 100644 --- a/db/migrate/20170403155531_create_cashier_login_logs.rb +++ b/db/migrate/20170403155531_create_cashier_login_logs.rb @@ -1,6 +1,8 @@ class CreateCashierLoginLogs < ActiveRecord::Migration[5.0] def change - create_table :cashier_login_logs do |t| + create_table :cashier_login_logs, :id => false, :primary_key => :cashier_login_log_id do |t| + t.string :cashier_login_log_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing + t.references :cashier_terminal, foreign_key: true t.references :employee, foreign_key: true t.datetime :login_at, :null => false diff --git a/db/migrate/20170403160742_create_sales.rb b/db/migrate/20170403160742_create_sales.rb index 4780a788..8d653421 100644 --- a/db/migrate/20170403160742_create_sales.rb +++ b/db/migrate/20170403160742_create_sales.rb @@ -1,13 +1,15 @@ class CreateSales < ActiveRecord::Migration[5.0] def change - create_table :sales do |t| + create_table :sales, :id => false, :primary_key => :sale_id do |t| + t.string :sale_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing + t.integer :cashier_id, :index => true t.string :cashier_name t.string :requested_by, :null => false t.datetime :requested_at, :null => false t.string :receipt_no, :null => false t.datetime :receipt_date, :null => false - t.references :customer, foreign_key: true + t.string :customer_id, foreign_key: true, :limit => 16 t.string :payment_status, :null => false, :default => "outstanding" t.string :sale_status, :null => false, :default => "new" t.decimal :total_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00 diff --git a/db/migrate/20170403161857_create_sale_items.rb b/db/migrate/20170403161857_create_sale_items.rb index 7f4533e3..7f58c5bb 100644 --- a/db/migrate/20170403161857_create_sale_items.rb +++ b/db/migrate/20170403161857_create_sale_items.rb @@ -1,7 +1,8 @@ class CreateSaleItems < ActiveRecord::Migration[5.0] def change - create_table :sale_items do |t| - t.references :sale, foreign_key: true + create_table :sale_items, :id => false, :primary_key => :sale_item_id do |t| + t.string :sale_item_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing + t.string :sale_id, foreign_key: true, :limit => 16 t.string :product_code, :null => false t.string :product_name, :null => false t.string :remark diff --git a/db/migrate/20170403163219_create_sale_taxes.rb b/db/migrate/20170403163219_create_sale_taxes.rb index c52e4117..d12ab367 100644 --- a/db/migrate/20170403163219_create_sale_taxes.rb +++ b/db/migrate/20170403163219_create_sale_taxes.rb @@ -1,7 +1,9 @@ class CreateSaleTaxes < ActiveRecord::Migration[5.0] def change - create_table :sale_taxes do |t| - t.references :sale, foreign_key: true + create_table :sale_taxes, :id => false, :primary_key => :sale_tax_id do |t| + t.string :sale_tax_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing + + t.string :sale_id, foreign_key: true, :limit => 16 t.string :tax_name, :null => false t.decimal :tax_rate, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.decimal :tax_payable_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00 diff --git a/db/migrate/20170403163734_create_sale_payments.rb b/db/migrate/20170403163734_create_sale_payments.rb index 3da5cb17..fc625e44 100644 --- a/db/migrate/20170403163734_create_sale_payments.rb +++ b/db/migrate/20170403163734_create_sale_payments.rb @@ -1,13 +1,15 @@ class CreateSalePayments < ActiveRecord::Migration[5.0] def change - create_table :sale_payments do |t| - t.references :sale, foreign_key: true + create_table :sale_payments, :id => false, :primary_key => :sale_payment_id do |t| + t.string :sale_payment_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing + + t.string :sale_id, foreign_key: true, :limit => 16 t.string :payment_method, :null => false, :default => "cash" t.decimal :payment_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.decimal :outstanding_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.string :payment_reference t.string :payment_status, :null => false, :default => "new" - + t.timestamps end end diff --git a/db/migrate/20170403174029_create_sale_orders.rb b/db/migrate/20170403174029_create_sale_orders.rb index 50923ac2..420e4b13 100644 --- a/db/migrate/20170403174029_create_sale_orders.rb +++ b/db/migrate/20170403174029_create_sale_orders.rb @@ -1,8 +1,10 @@ class CreateSaleOrders < ActiveRecord::Migration[5.0] def change - create_table :sale_orders do |t| - t.references :sale, foreign_key: true - t.references :order, foreign_key: true + create_table :sale_orders, :id => false, :primary_key => :sale_order_id do |t| + t.string :sale_order_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing + + t.string :sale, foreign_key: true,:limit => 16 + t.string :order, foreign_key: true, :limit => 16 t.timestamps end diff --git a/db/migrate/20170403174111_create_sale_audits.rb b/db/migrate/20170403174111_create_sale_audits.rb index 1880478b..38af14ab 100644 --- a/db/migrate/20170403174111_create_sale_audits.rb +++ b/db/migrate/20170403174111_create_sale_audits.rb @@ -1,7 +1,9 @@ class CreateSaleAudits < ActiveRecord::Migration[5.0] def change - create_table :sale_audits do |t| - t.references :sale, foreign_key: true + create_table :sale_audits, :id => false, :primary_key => :sale_audit_id do |t| + t.string :sale_audit_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing + + t.string :sale_id, foreign_key: true, :limit => 16 t.string :action, :null => false t.datetime :action_at, :null => false t.string :action_by, :null => false diff --git a/db/migrate/20170404034234_create_bookings.rb b/db/migrate/20170404034234_create_bookings.rb index a67e7a30..a9e7c21f 100644 --- a/db/migrate/20170404034234_create_bookings.rb +++ b/db/migrate/20170404034234_create_bookings.rb @@ -1,6 +1,8 @@ class CreateBookings < ActiveRecord::Migration[5.0] def change - create_table :bookings do |t| + create_table :bookings, :id => false, :primary_key => :booking_id do |t| + t.string :booking_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing + t.references :dining_facility, foreign_key: true t.string :type, :null => false, :default => "Table" t.datetime :checkin_at, :null => false @@ -10,7 +12,8 @@ class CreateBookings < ActiveRecord::Migration[5.0] t.datetime :reserved_at t.string :reserved_by t.string :booking_status, :null => false, :default => "new" - t.references :sale, foreign_key: true + t.string :sale_id, foreign_key: true, :limit => 16 + t.string :customer_id, foreign_key: true, :limit => 16 t.timestamps end diff --git a/db/migrate/20170414090001_create_assigned_order_items.rb b/db/migrate/20170414090001_create_assigned_order_items.rb index e617adea..a0f79262 100644 --- a/db/migrate/20170414090001_create_assigned_order_items.rb +++ b/db/migrate/20170414090001_create_assigned_order_items.rb @@ -1,9 +1,10 @@ class CreateAssignedOrderItems < ActiveRecord::Migration[5.0] def change - create_table :assigned_order_items do |t| + create_table :assigned_order_items, :id => false, :primary_key => :assigned_order_item_id do |t| + t.string :assigned_order_item_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing t.string :item_code, :null => false, :index => true t.references :order_queue_station, foreign_key: true - t.references :order, foreign_key: true + t.string :order_id, foreign_key: true, :limit => 16 t.boolean :print_status t.boolean :delivery_status diff --git a/db/migrate/20170414110918_create_booking_orders.rb b/db/migrate/20170414110918_create_booking_orders.rb index 9a28a5af..50277de9 100644 --- a/db/migrate/20170414110918_create_booking_orders.rb +++ b/db/migrate/20170414110918_create_booking_orders.rb @@ -1,8 +1,10 @@ class CreateBookingOrders < ActiveRecord::Migration[5.0] def change - create_table :booking_orders do |t| - t.references :booking, foreign_key: true - t.references :order, foreign_key: true + create_table :booking_orders, :id => false, :primary_key => :booking_order_id do |t| + t.string :booking_order_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing + + t.string :booking, foreign_key: true, :limit => 16 + t.string :order, foreign_key: true, :limit => 16 t.timestamps end diff --git a/redis-stable.tar.gz b/redis-stable.tar.gz deleted file mode 100644 index 47c49f3b..00000000 Binary files a/redis-stable.tar.gz and /dev/null differ