Guest User

Untitled

a guest
Jan 27th, 2020
76
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Order < Sequel::Model(:orders)
  2.     many_to_one :order_products, key: :order_id, class: :OrderProduct
  3. end
  4.  
  5. # Table: orders
  6. # Columns:
  7. #  id               | integer                     | PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
  8. #  currency         | text                        |
  9. #  customer_name    | text                        |
  10. #  customer_email   | text                        |
  11. #  customer_dob     | timestamp without time zone |
  12. #  status           | text                        |
  13. #  billing_address  | text                        |
  14. #  shipping_address | text                        |
  15. #  payment          | text                        |
  16. #  number           | text                        |
  17. # Indexes:
  18. #  orders_pkey | PRIMARY KEY btree (id)
  19. # Referenced By:
  20. #  order_products | order_products_order_id_fkey | (order_id) REFERENCES orders(id) ON DELETE CASCADE
  21.  
  22. class OrderProduct < Sequel::Model(:order_products)
  23.     many_to_one :orders, key: :order_id, class: :Order
  24. end
  25.  
  26. # Table: order_products
  27. # Columns:
  28. #  id       | integer          | PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
  29. #  name     | text             |
  30. #  sku      | text             |
  31. #  type     | text             |
  32. #  price    | double precision |
  33. #  quantity | double precision |
  34. #  order_id | integer          |
  35. # Indexes:
  36. #  order_products_pkey | PRIMARY KEY btree (id)
  37. # Foreign key constraints:
  38. #  order_products_order_id_fkey | (order_id) REFERENCES orders(id) ON DELETE CASCADE
RAW Paste Data