Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Order < Sequel::Model(:orders)
- many_to_one :order_products, key: :order_id, class: :OrderProduct
- end
- # Table: orders
- # Columns:
- # id | integer | PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
- # currency | text |
- # customer_name | text |
- # customer_email | text |
- # customer_dob | timestamp without time zone |
- # status | text |
- # billing_address | text |
- # shipping_address | text |
- # payment | text |
- # number | text |
- # Indexes:
- # orders_pkey | PRIMARY KEY btree (id)
- # Referenced By:
- # order_products | order_products_order_id_fkey | (order_id) REFERENCES orders(id) ON DELETE CASCADE
- class OrderProduct < Sequel::Model(:order_products)
- many_to_one :orders, key: :order_id, class: :Order
- end
- # Table: order_products
- # Columns:
- # id | integer | PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
- # name | text |
- # sku | text |
- # type | text |
- # price | double precision |
- # quantity | double precision |
- # order_id | integer |
- # Indexes:
- # order_products_pkey | PRIMARY KEY btree (id)
- # Foreign key constraints:
- # order_products_order_id_fkey | (order_id) REFERENCES orders(id) ON DELETE CASCADE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement