I'm working on a project where I need to modify the PostgreSQL table structure to handle multiple delivery modes for an ordering system.
I have a table named seller with columns like id, user_id, store_name, etc.
Current State:
I currently have a delivery_mode column, but I need to allow for scenarios where a station can support both air freight, sea fright or only one of those.
For example, 1st scenario: seller1 sells clothes, the only delivery mode available for this store is air freight. So, when the customer orders, the only delivery mode available is air freight.
2nd scenario: seller2 sells phones, the delivery mode available for this store are air freight and sea freight. So, when the customer orders, the customer may choose using a select with values of either air freight and sea freight
Objective:
I want to modify the table structure to accommodate multiple delivery modes (air freight and sea freight) while adhering to the relational model.
Options Considered:
I've considered using an array or JSONB column for delivery_mode.
Question: What is the best way to modify the table to handle multiple delivery modes in a relational database?
SQL Schema
create table
public.seller (
id uuid not null default uuid_generate_v4 (),
store_name text not null,
address text not null,
user_id uuid not null,
delivery_mode text null,
//rest of the fields
constraint seller pkey primary key (id),
) tablespace pg_default;