--
--


-- Started on 2026-05-21 17:23:38

SET transaction_timeout = 0;
SELECT pg_catalog.set_config('search_path', '', false);



--
-- TOC entry 246 (class 1259 OID 17152)
-- Name: area_master; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.area_master (
    area_id integer NOT NULL,
    city_id integer,
    area_name character varying(120),
    delivery_available boolean DEFAULT true,
    standard_delivery boolean DEFAULT true,
    paid_delivery boolean DEFAULT false,
    delivery_charge numeric(10,2) DEFAULT 0,
    estimated_standard_days integer DEFAULT 1,
    estimated_paid_days integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.area_master OWNER TO postgres;

CREATE SEQUENCE public.area_master_area_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.area_master_area_id_seq OWNER TO postgres;

ALTER SEQUENCE public.area_master_area_id_seq OWNED BY public.area_master.area_id;


CREATE TABLE public.branches (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    location character varying(255),
    gst_number character varying(20),
    phone character varying(15),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.branches OWNER TO postgres;

CREATE SEQUENCE public.branches_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.branches_id_seq OWNER TO postgres;

ALTER SEQUENCE public.branches_id_seq OWNED BY public.branches.id;


CREATE TABLE public.cart (
    id integer NOT NULL,
    customer_id integer,
    product_id integer,
    quantity integer DEFAULT 1,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    prod_id integer,
    variant_id integer
);

ALTER TABLE public.cart OWNER TO postgres;

CREATE SEQUENCE public.cart_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.cart_id_seq OWNER TO postgres;

ALTER SEQUENCE public.cart_id_seq OWNED BY public.cart.id;


CREATE TABLE public.categories (
    cat_id integer NOT NULL,
    cat_name character varying(120) NOT NULL,
    domain_name character varying(120),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    domain text,
    cat_discount numeric(5,2) DEFAULT 0,
    cat_price_change numeric DEFAULT 0
);

ALTER TABLE public.categories OWNER TO postgres;

CREATE SEQUENCE public.categories_cat_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.categories_cat_id_seq OWNER TO postgres;

ALTER SEQUENCE public.categories_cat_id_seq OWNED BY public.categories.cat_id;


CREATE TABLE public.city_master (
    city_id integer NOT NULL,
    city_name character varying(120),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.city_master OWNER TO postgres;

CREATE SEQUENCE public.city_master_city_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.city_master_city_id_seq OWNER TO postgres;

ALTER SEQUENCE public.city_master_city_id_seq OWNED BY public.city_master.city_id;


CREATE TABLE public.customer (
    customer_id integer NOT NULL,
    customer_name character varying(120) NOT NULL,
    email character varying(150) NOT NULL,
    mobile character varying(20) NOT NULL,
    address text NOT NULL,
    password character varying(255),
    role character varying(20) DEFAULT 'customer'::character varying,
    points integer DEFAULT 0,
    customer_type character varying(20) DEFAULT 'online'::character varying
);

ALTER TABLE public.customer OWNER TO postgres;

CREATE TABLE public.customer_address (
    address_id integer NOT NULL,
    customer_id integer,
    address text,
    area_id integer,
    city_id integer,
    is_default boolean DEFAULT false,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    name character varying(120),
    phone character varying(20),
    subarea character varying(150),
    pincode character varying(20),
    instruction text
);

ALTER TABLE public.customer_address OWNER TO postgres;

CREATE SEQUENCE public.customer_address_address_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.customer_address_address_id_seq OWNER TO postgres;

ALTER SEQUENCE public.customer_address_address_id_seq OWNED BY public.customer_address.address_id;


CREATE SEQUENCE public.customer_customer_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.customer_customer_id_seq OWNER TO postgres;

ALTER SEQUENCE public.customer_customer_id_seq OWNED BY public.customer.customer_id;


CREATE TABLE public.order_items (
    order_item_id integer NOT NULL,
    order_id integer,
    product_id integer,
    quantity numeric(10,2),
    price numeric(10,2),
    prod_name character varying(255),
    variant_display character varying(255),
    mrp_price numeric,
    discount_percent numeric,
    discount_amount numeric
);

ALTER TABLE public.order_items OWNER TO postgres;

CREATE SEQUENCE public.order_items_order_item_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.order_items_order_item_id_seq OWNER TO postgres;

ALTER SEQUENCE public.order_items_order_item_id_seq OWNED BY public.order_items.order_item_id;


CREATE TABLE public.order_status_history (
    id integer NOT NULL,
    order_id integer,
    status character varying(50),
    changed_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.order_status_history OWNER TO postgres;

CREATE SEQUENCE public.order_status_history_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.order_status_history_id_seq OWNER TO postgres;

ALTER SEQUENCE public.order_status_history_id_seq OWNED BY public.order_status_history.id;


CREATE TABLE public.orders (
    order_id integer NOT NULL,
    customer_id integer,
    total_amount numeric(10,2),
    status character varying(50),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    address_id integer,
    items_total numeric(10,2),
    total_price numeric(10,2),
    delivery_method character varying(20),
    delivery_charge numeric(10,2),
    estimated_delivery_date date,
    estimated_delivery_days integer,
    payment_method character varying(20),
    delivery_instruction text,
    order_status character varying(50),
    payment_status character varying(50),
    delivery_address_json jsonb,
    stripe_payment_intent_id character varying(255),
    shop_id integer NOT NULL
);

ALTER TABLE public.orders OWNER TO postgres;

CREATE SEQUENCE public.orders_order_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.orders_order_id_seq OWNER TO postgres;

ALTER SEQUENCE public.orders_order_id_seq OWNED BY public.orders.order_id;


CREATE TABLE public.product_images (
    id integer NOT NULL,
    product_id integer NOT NULL,
    image_url text NOT NULL,
    sort_order integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.product_images OWNER TO postgres;

CREATE SEQUENCE public.product_images_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.product_images_id_seq OWNER TO postgres;

ALTER SEQUENCE public.product_images_id_seq OWNED BY public.product_images.id;


CREATE TABLE public.product_shop_stock (
    id integer NOT NULL,
    prod_id integer,
    variant_id integer,
    shop_id integer,
    quantity numeric(10,2) DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.product_shop_stock OWNER TO postgres;

CREATE SEQUENCE public.product_shop_stock_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.product_shop_stock_id_seq OWNER TO postgres;

ALTER SEQUENCE public.product_shop_stock_id_seq OWNED BY public.product_shop_stock.id;


CREATE TABLE public.product_variants (
    variant_id integer NOT NULL,
    product_id integer NOT NULL,
    variant_label character varying(180),
    variant_value numeric(12,3),
    variant_unit_type character varying(60),
    variant_unit character varying(40),
    variant_sku character varying(120),
    variant_barcode character varying(120),
    variant_mrp numeric(12,2) DEFAULT 0,
    variant_discount_percent numeric(8,2) DEFAULT 0,
    variant_price numeric(12,2) DEFAULT 0,
    variant_offer_price numeric(12,2),
    variant_offer_start date,
    variant_offer_end date,
    variant_quantity numeric(12,2) DEFAULT 0,
    variant_weight numeric(12,3),
    variant_final_price numeric(12,2),
    is_default boolean DEFAULT false,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.product_variants OWNER TO postgres;

CREATE SEQUENCE public.product_variants_variant_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.product_variants_variant_id_seq OWNER TO postgres;

ALTER SEQUENCE public.product_variants_variant_id_seq OWNED BY public.product_variants.variant_id;


CREATE SEQUENCE public.products_prod_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.products_prod_id_seq OWNER TO postgres;


CREATE TABLE public.products (
    prod_id integer DEFAULT nextval('public.products_prod_id_seq'::regclass) CONSTRAINT products_id_not_null NOT NULL,
    prod_name character varying(255) CONSTRAINT products_name_not_null NOT NULL,
    scanner_id character varying(50),
    category character varying(100),
    sub_category character varying(100),
    domain character varying(100),
    prod_sell_price numeric(10,2) CONSTRAINT products_price_not_null NOT NULL,
    prod_discount numeric(10,2) DEFAULT 0,
    prod_quantity integer DEFAULT 0,
    unit character varying(20) DEFAULT 'pcs'::character varying,
    prod_images character varying(500),
    hsn_code character varying(20) DEFAULT '0000'::character varying,
    gst_rate numeric(5,2) DEFAULT 18.00,
    branch_id integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    cat_id integer,
    sub_cat_id integer,
    prod_desc text,
    prod_brand character varying(150),
    prod_model_number character varying(150),
    prod_color character varying(100),
    prod_material character varying(150),
    prod_country_id_of_origin character varying(120),
    prod_warranty character varying(120),
    prod_special_features text,
    prod_storage_instructions text,
    prod_is_dangerous boolean DEFAULT false,
    prod_require_battery boolean DEFAULT false,
    prod_contains_battery boolean DEFAULT false,
    batch_no character varying(120),
    prod_mfg_date date,
    prod_exp_date date,
    prod_import_date date,
    prod_manufacturer character varying(180),
    product_type character varying(20) DEFAULT 'single'::character varying,
    prod_base_price numeric(10,2),
    prod_profit_margin numeric(10,2),
    prod_barcode character varying(100),
    prod_weight numeric(10,2),
    prod_shipping_weight numeric(10,2),
    prod_dimen_lxwxh_mm character varying(100),
    prod_size character varying(100),
    prod_packer_name character varying(255),
    prod_generic_name character varying(255),
    prod_importer_name character varying(255),
    offer_price numeric(10,2),
    offer_start date,
    offer_end date,
    prod_is_active boolean DEFAULT true,
    is_price_locked boolean DEFAULT false,
    prod_added_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    prod_modified_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.products OWNER TO postgres;

CREATE SEQUENCE public.products_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.products_id_seq OWNER TO postgres;

ALTER SEQUENCE public.products_id_seq OWNED BY public.products.prod_id;


CREATE TABLE public.shop_service_area (
    service_area_id integer NOT NULL,
    shop_id integer,
    city_id integer,
    area_id integer,
    is_available boolean DEFAULT true,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.shop_service_area OWNER TO postgres;

CREATE SEQUENCE public.shop_service_area_service_area_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.shop_service_area_service_area_id_seq OWNER TO postgres;

ALTER SEQUENCE public.shop_service_area_service_area_id_seq OWNED BY public.shop_service_area.service_area_id;


CREATE TABLE public.shops (
    shop_id integer NOT NULL,
    shop_name character varying(255),
    shop_address text,
    city_id integer,
    area_id integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.shops OWNER TO postgres;

CREATE SEQUENCE public.shops_shop_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.shops_shop_id_seq OWNER TO postgres;

ALTER SEQUENCE public.shops_shop_id_seq OWNED BY public.shops.shop_id;


CREATE TABLE public.sub_categories (
    sub_cat_id integer NOT NULL,
    cat_id integer NOT NULL,
    sub_cat_name character varying(120) NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    sub_cat_discount numeric(5,2) DEFAULT 0,
    sub_cat_price_change numeric DEFAULT 0
);

ALTER TABLE public.sub_categories OWNER TO postgres;

CREATE SEQUENCE public.sub_categories_sub_cat_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.sub_categories_sub_cat_id_seq OWNER TO postgres;

ALTER SEQUENCE public.sub_categories_sub_cat_id_seq OWNED BY public.sub_categories.sub_cat_id;


CREATE VIEW public.subcategories AS
 SELECT sub_cat_id,
    cat_id,
    sub_cat_name,
    created_at
   FROM public.sub_categories;

ALTER VIEW public.subcategories OWNER TO postgres;


CREATE TABLE public.users (
    id integer NOT NULL,
    username character varying(100) NOT NULL,
    password character varying(255) NOT NULL,
    branch_id integer,
    role character varying(20) DEFAULT 'user'::character varying,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.users OWNER TO postgres;

CREATE SEQUENCE public.users_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.users_id_seq OWNER TO postgres;

ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;


CREATE TABLE public.variant_shop_stock (
    id integer NOT NULL,
    variant_id integer NOT NULL,
    branch_id integer NOT NULL,
    quantity numeric(12,2) DEFAULT 0,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.variant_shop_stock OWNER TO postgres;

CREATE SEQUENCE public.variant_shop_stock_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.variant_shop_stock_id_seq OWNER TO postgres;

ALTER SEQUENCE public.variant_shop_stock_id_seq OWNED BY public.variant_shop_stock.id;


CREATE TABLE public.wishlist (
    id integer NOT NULL,
    customer_id integer,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    prod_id integer NOT NULL
);

ALTER TABLE public.wishlist OWNER TO postgres;

CREATE SEQUENCE public.wishlist_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE public.wishlist_id_seq OWNER TO postgres;

ALTER SEQUENCE public.wishlist_id_seq OWNED BY public.wishlist.id;


-- DEFAULT values (link sequences to columns)
ALTER TABLE ONLY public.area_master ALTER COLUMN area_id SET DEFAULT nextval('public.area_master_area_id_seq'::regclass);
ALTER TABLE ONLY public.branches ALTER COLUMN id SET DEFAULT nextval('public.branches_id_seq'::regclass);
ALTER TABLE ONLY public.cart ALTER COLUMN id SET DEFAULT nextval('public.cart_id_seq'::regclass);
ALTER TABLE ONLY public.categories ALTER COLUMN cat_id SET DEFAULT nextval('public.categories_cat_id_seq'::regclass);
ALTER TABLE ONLY public.city_master ALTER COLUMN city_id SET DEFAULT nextval('public.city_master_city_id_seq'::regclass);
ALTER TABLE ONLY public.customer ALTER COLUMN customer_id SET DEFAULT nextval('public.customer_customer_id_seq'::regclass);
ALTER TABLE ONLY public.customer_address ALTER COLUMN address_id SET DEFAULT nextval('public.customer_address_address_id_seq'::regclass);
ALTER TABLE ONLY public.order_items ALTER COLUMN order_item_id SET DEFAULT nextval('public.order_items_order_item_id_seq'::regclass);
ALTER TABLE ONLY public.order_status_history ALTER COLUMN id SET DEFAULT nextval('public.order_status_history_id_seq'::regclass);
ALTER TABLE ONLY public.orders ALTER COLUMN order_id SET DEFAULT nextval('public.orders_order_id_seq'::regclass);
ALTER TABLE ONLY public.product_images ALTER COLUMN id SET DEFAULT nextval('public.product_images_id_seq'::regclass);
ALTER TABLE ONLY public.product_shop_stock ALTER COLUMN id SET DEFAULT nextval('public.product_shop_stock_id_seq'::regclass);
ALTER TABLE ONLY public.product_variants ALTER COLUMN variant_id SET DEFAULT nextval('public.product_variants_variant_id_seq'::regclass);
ALTER TABLE ONLY public.shop_service_area ALTER COLUMN service_area_id SET DEFAULT nextval('public.shop_service_area_service_area_id_seq'::regclass);
ALTER TABLE ONLY public.shops ALTER COLUMN shop_id SET DEFAULT nextval('public.shops_shop_id_seq'::regclass);
ALTER TABLE ONLY public.sub_categories ALTER COLUMN sub_cat_id SET DEFAULT nextval('public.sub_categories_sub_cat_id_seq'::regclass);
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
ALTER TABLE ONLY public.variant_shop_stock ALTER COLUMN id SET DEFAULT nextval('public.variant_shop_stock_id_seq'::regclass);
ALTER TABLE ONLY public.wishlist ALTER COLUMN id SET DEFAULT nextval('public.wishlist_id_seq'::regclass);


-- =============================================
-- DATA
-- =============================================

-- area_master
COPY public.area_master (area_id, city_id, area_name, delivery_available, standard_delivery, paid_delivery, delivery_charge, estimated_standard_days, estimated_paid_days, created_at) FROM stdin;
1	1	Deira	t	t	t	15.00	2	1	2026-04-20 15:19:15.88061
2	1	Bur Dubai	t	t	f	0.00	2	0	2026-04-20 15:19:15.88061
3	2	Mussafah	t	t	t	20.00	3	1	2026-04-20 15:19:15.88061
\.

-- branches
COPY public.branches (id, name, location, gst_number, phone, created_at) FROM stdin;
1	Main Branch	Chennai	33ABCDE1234F1Z5	9876543210	2026-04-10 07:49:50.013574
3	Second Branch	Coimbatore	33XYZAB5678K2Z6	9123456780	2026-04-10 07:51:29.144933
2	another one	Chennai	33ABCDE1234F1Z5	9876543210	2026-04-10 07:51:29.144933
\.

-- cart
COPY public.cart (id, customer_id, product_id, quantity, created_at, prod_id, variant_id) FROM stdin;
227	21	89	1	2026-05-15 02:31:54.808432	\N	177
214	16	69	3	2026-05-14 20:31:10.97064	\N	127
211	15	85	2	2026-05-14 18:17:34.257851	\N	130
\.

-- categories
COPY public.categories (cat_id, cat_name, domain_name, created_at, domain, cat_discount, cat_price_change) FROM stdin;
1	Dairy	Food	2026-04-10 14:01:12.124722	dairy & eggs	0.00	0
3	Vegetables	Food	2026-04-13 17:58:04.977933	produce	0.00	0
4	Fruits	Food	2026-04-13 17:58:04.977933	produce	4.50	0
\.

-- city_master
COPY public.city_master (city_id, city_name, created_at) FROM stdin;
1	Dubai	2026-04-20 15:18:42.17672
2	Abu Dhabi	2026-04-20 15:18:42.17672
3	Sharjah	2026-04-20 15:18:42.17672
\.

-- customer
COPY public.customer (customer_id, customer_name, email, mobile, address, password, role, points, customer_type) FROM stdin;
7	sathan	sathan@gmail.com	8060464755	erode	\N	customer	94	pos
9	selvarajdeepankumar	selvarajdeepan@gmail.co	6474789119	bhavani	\N	customer	244	pos
8	ravikumar	deepankumar@gmail.com	9095199364	Dubai\n	\N	customer	288	pos
11	naveen	naveen@gmail.com	8046475598	erode	\N	customer	287	pos
2	kumar	deepankumar1@gmail.com	9789441712	milk street	$2b$10$lthnjLh77DfK2sussHmdgOFw4CFsx6NLxSRnlQRC1DrffSbxwmyZ2	customer	0	online
1	Deepankumar Selvaraj	selvarajdeepankumar@gmail.com	6374789119	Dubai\n	$2b$10$9S29JX/gDErfsXenDsBdseKmzpxC4/kKEDhXaFQWoCOeFcqaHMGmy	customer	748	online
12	kumaran	deepankumar77@gmail.com	9898989898	erode	$2b$10$Rzb1ON.swzNbXMt38PTB/e4edD0aHaW0g5CBWXVV7OWxv9.K7dCw2	customer	0	online
20	arun	arun@gmail.com	7373737375	erode	\N	customer	100	pos
21	saravanan	saravana@gmail.com	7777777777	saravana@gmail.com	$2b$10$ps8YucoseRUKpkCD8LBeh.YwAImVpaQXHP47bxrITtCgTpnD/pu5q	customer	0	online
\.

-- customer_address
COPY public.customer_address (address_id, customer_id, address, area_id, city_id, is_default, created_at, name, phone, subarea, pincode, instruction) FROM stdin;
1	1	milk street	1	1	f	2026-04-20 15:38:18.310132	Deepankumar Selvaraj	9898989898		638301	in front of gate
2	2	milk street	1	1	t	2026-05-14 06:59:00.538854	Deepankumar Selvaraj	8760464755		638301	in my home
\.

-- order_items
COPY public.order_items (order_item_id, order_id, product_id, quantity, price, prod_name, variant_display, mrp_price, discount_percent, discount_amount) FROM stdin;
11	18	15	1.00	37.25	Tomato12	1.000 kg	\N	\N	\N
1	2	14	1.00	315.00	apple	1.000 kg	300.00	50	150.00
2	2	14	2.00	350.00	apple		300.00	50	300.00
4	12	14	2.00	350.00	apple		300.00	50	300.00
5	13	14	1.00	315.00	apple	1.000 kg	300.00	50	150.00
6	14	14	6.00	350.00	apple		300.00	50	900.00
7	15	14	1.00	350.00	apple		300.00	50	150.00
8	16	14	1.00	350.00	apple		300.00	50	150.00
9	17	14	2.00	350.00	apple		300.00	50	300.00
10	18	14	1.00	142.50	apple	1.000 kg	300.00	50	150.00
12	19	14	1.00	142.50	apple	1.000 kg	300.00	50	150.00
13	20	14	3.00	142.50	apple	1.000 kg	300.00	50	450.00
14	21	14	4.00	142.50	apple	1.000 kg	300.00	50	600.00
15	22	14	1.00	142.50	apple	1.000 kg	300.00	50	150.00
16	23	14	2.00	142.50	apple	1.000 kg	300.00	50	300.00
17	24	14	3.00	142.50	apple	1.000 kg	300.00	50	450.00
18	25	14	6.00	142.50	apple	1.000 kg	300.00	50	900.00
19	26	15	4.00	36.10	Tomato12	1.000 kg	40	0	0
20	27	14	4.00	142.50	apple	1.000 kg	300	50	600
21	28	14	5.00	142.50	apple	1.000 kg	300	50	750
22	29	15	2.00	36.10	Tomato12	1.000 kg	40	6	7.8
23	30	14	1.00	279.30	apple	1.000 kg	300	2	20.7
24	31	14	1.00	294.00	apple	1.000 kg	300	2	6
25	32	14	1.00	294.00	apple	1.000 kg	300	2	6
26	33	15	1.00	40.39	Tomato12	1.000 kg	40	1	0
27	34	14	1.00	294.00	apple	1.000 kg	300	2	6
28	35	14	1.00	294.00	apple	1.000 kg	300	2	6
29	36	16	1.00	38.00	apple	1 kg	40	0	2
30	37	16	1.00	38.00	apple	1 kg	40	0	2
31	38	14	1.00	294.00	apple	1 kg	300	2	6
32	39	14	1.00	346.92	apple	1 kg	300	2	0
33	40	16	1.00	38.00	apple	1 kg	40	0	2
34	41	76	1.00	147.00	Mango		150	2	3
35	42	76	1.00	148.50	Mango	Default Variant	150	1	1.5
36	43	58	1.00	45.00	Carrot	Default Variant	45	0	0
37	44	79	1.00	11.11	Sapota	Default Variant	8	1	0
38	45	77	1.00	9.00	Pineapple	Default Variant	9	1	0
39	45	79	1.00	11.00	Sapota	Default Variant	8	1	0
40	46	78	1.00	26.00	Dragon Fruit	Default Variant	26	1	0
41	47	77	1.00	12.00	Pineapple	\N	\N	\N	1
42	48	78	1.00	26.00	Dragon Fruit	\N	\N	\N	1
44	54	74	1.00	10.50	Mosambi	\N	\N	\N	2
45	60	78	1.00	26.00	Dragon Fruit	Default Variant	26	1	0
46	63	84	1.00	6.69	royal Apple		7.5	3	0.81
47	64	73	7.00	11.50	Orange	\N	\N	\N	1
48	64	72	1.00	66.50	Guava	\N	\N	\N	0
49	65	78	1.00	26.00	Dragon Fruit	\N	\N	\N	1
56	70	73	13.00	11.50	Orange	\N	\N	\N	1
57	70	72	1.00	66.50	Guava	\N	\N	\N	0
58	71	73	1.00	11.50	Orange	\N	\N	\N	1
59	71	74	1.00	10.50	Mosambi	\N	\N	\N	1
60	71	77	6.00	12.00	Pineapple	\N	\N	\N	1
61	71	76	4.00	18.00	Mango	\N	\N	\N	1
62	71	72	1.00	66.50	Guava	\N	\N	\N	0
63	72	78	13.00	26.00	Dragon Fruit	\N	\N	\N	1
64	73	77	21.00	12.00	Pineapple	\N	\N	\N	1
65	74	76	7.00	18.00	Mango	\N	\N	\N	1
66	75	67	1.00	5.50	Radish	Default Variant	5.5	0	0
67	76	69	1.00	8.50	Banana	Default Variant	8.5	1	0
68	77	69	2.00	8.50	Banana	\N	\N	\N	1
69	78	69	3.00	8.50	Banana	Default Variant	8.5	1	0
70	79	69	1.00	8.50	Banana	\N	\N	\N	1
71	80	69	4.00	8.50	Banana	Default Variant	8.5	1	0
72	81	69	4.00	8.50	Banana	Default Variant	8.5	1	0
73	83	69	3.00	8.50	Banana	Default Variant	8.5	1	0
74	84	69	1.00	8.50	Banana	Default Variant	8.5	1	0
75	88	69	3.00	8.50	Banana	Default Variant	8.5	1	0
76	89	69	2.00	8.50	Banana	Default Variant	8.5	1	0
77	95	73	1.00	11.50	Orange	\N	\N	\N	1
78	96	69	1.00	8.50	Banana	Default Variant	8.5	1	0
79	97	69	1.00	8.50	Banana	Default Variant	8.5	1	0
80	98	69	1.00	8.50	Banana	Default Variant	8.5	1	0
81	99	69	2.00	8.50	Banana	Default Variant	8.5	1	0
83	101	69	1.00	8.41	Banana		8.5	1	0.09
84	101	69	4.00	8.41	Banana	Default Variant	8.5	1	0.36
85	102	71	18.00	6.50	Watermelon	\N	\N	\N	1
86	102	65	7.00	3.00	Mint	\N	\N	\N	0
87	102	66	5.00	7.00	Beetroot	\N	\N	\N	0
88	102	70	9.00	9.00	Papaya	\N	\N	\N	1
89	104	73	7.00	11.50	Orange	\N	\N	\N	1
90	105	69	7.00	8.50	Banana	1 kg	8.5	1	0
91	108	69	3.00	8.50	Banana	1 kg	8.5	1	0
92	109	69	7.00	8.50	Banana	Default Variant	8.5	1	0
93	115	69	2.00	8.50	Banana	\N	\N	\N	1
94	116	69	1.00	8.50	Banana	Default Variant	8.5	1	0
95	122	68	3.00	14.00	Apple	\N	\N	\N	1
96	123	69	1.00	8.50	Banana	Default Variant	8.5	1	0
97	124	69	1.00	8.50	Banana	\N	\N	\N	1
102	126	69	1.00	8.50	Banana - Default Variant	\N	\N	\N	0
103	126	58	1.00	7.50	Carrot - Default Variant	\N	\N	\N	0
104	126	55	1.00	50.00	Brinjal - 1.000 kg	\N	\N	\N	0
111	130	55	1.00	90.25	Brinjal - 2 kg	\N	\N	\N	5
112	130	57	1.00	9.50	Bitter Gourd - Default Variant	\N	\N	\N	0
113	131	62	7.00	5.50	Cabbage - Default Variant	\N	\N	\N	0
114	132	64	10.00	3.00	Coriander - Default Variant	\N	\N	\N	0
115	132	61	2.00	7.00	Cauliflower - Default Variant	\N	\N	\N	0
116	132	58	2.00	7.50	Carrot - Default Variant	\N	\N	\N	0
117	132	55	2.00	50.00	Brinjal - 1.000 kg	\N	\N	\N	0
118	132	55	1.00	90.25	Brinjal - 2 kg	\N	\N	\N	5
119	133	55	5.00	50.00	Brinjal - 1.000 kg	\N	\N	\N	0
120	134	69	2.00	8.50	Banana	Default Variant	8.5	1	0
121	135	69	1.00	8.50	Banana - Default Variant	\N	\N	\N	0
122	136	69	2.00	8.50	Banana	Default Variant	8.5	1	0
123	137	55	8.00	48.00	Brinjal	5 kg	50	0	16
125	139	59	1.00	8.82	Beans - 2 kg	\N	\N	\N	2
126	139	68	1.00	14.00	Apple - kg	\N	\N	\N	0
127	139	57	1.00	9.50	Bitter Gourd - Default Variant	\N	\N	\N	0
128	139	55	5.00	50.00	Brinjal - 1.000 kg	\N	\N	\N	0
129	139	61	1.00	7.00	Cauliflower - Default Variant	\N	\N	\N	0
130	140	70	1.00	9.00	Papaya	Default Variant	9	1	0
131	141	79	1.00	14.00	Sapota	Default Variant	14	1	0
132	142	64	3.00	3.00	Coriander	Default Variant	3	0	0
133	143	77	1.00	12.00	Pineapple	Default Variant	12	1	0
134	144	59	19.00	8.56	Beans	2 kg	9	0	8.36
135	144	69	14.00	8.50	Banana - 1 kg	3 kg	8.5	1	0
137	146	69	1.00	8.50	Banana - 1 kg	3 kg	8.5	1	0
138	147	69	8.00	8.50	Banana - 1 kg	2 kg	8.5	1	0
139	148	57	7.00	9.50	Bitter Gourd - Default Variant	\N	\N	\N	0
140	148	68	4.00	14.00	Apple - kg	\N	\N	\N	0
141	148	66	3.00	7.00	Beetroot - Default Variant	\N	\N	\N	0
142	148	55	3.00	90.25	Brinjal - 2 kg	\N	\N	\N	5
143	149	55	5.00	90.25	Brinjal - 2 kg	\N	\N	\N	5
144	150	55	2.00	90.25	Brinjal - 2 kg	\N	\N	\N	5
145	151	55	4.00	50.00	Brinjal - 1.000 kg	\N	\N	\N	0
146	152	85	8.00	37.24	Royal Apple - Default Variant	2 kg	38	0	6.08
147	153	69	2.00	8.50	Banana - 1 kg	2 kg	8.5	1	0
148	154	69	1.00	15.52	Banana - 1 kg	2 kg	8.5	1	0
149	155	69	1.00	15.37	Banana - 1 kg	2 kg	8.5	1	0
155	161	69	1.00	15.37	Banana - 1 kg - 2 kg	\N	\N	\N	2
156	162	69	1.00	15.37	Banana - 1 kg - 2 kg	\N	\N	\N	2
157	163	55	2.00	50.00	Brinjal - 1.000 kg	\N	\N	\N	0
158	164	68	2.00	13.37	Apple	kg	14	4.5	1.26
159	165	68	1.00	14.00	Apple - kg	\N	\N	\N	0
160	166	90	2.00	17.48	tomato17	2 kg	9.5	0	0
161	167	90	1.00	17.48	tomato17	2 kg	9.5	0	0
162	168	59	1.00	11.64	Beans - 1kg	2 kg	9	3	0
163	169	59	1.00	12.00	Beans - 1kg - 2 kg	\N	\N	\N	0
\.

-- order_status_history
COPY public.order_status_history (id, order_id, status, changed_at) FROM stdin;
1	17	Delivered	2026-04-23 09:36:13.291236
2	17	Confirmed	2026-04-23 19:00:14.327944
3	20	Confirmed	2026-04-24 18:03:19.657184
4	21	Delivered	2026-04-27 11:38:04.093295
5	21	Confirmed	2026-04-27 11:55:09.998171
6	21	Dispatched	2026-04-27 15:25:18.934233
7	41	Cancelled	2026-05-05 15:54:58.207941
8	47	Delivered	2026-05-08 17:46:17.075127
\.

-- orders (partial - data from the dump)
COPY public.orders (order_id, customer_id, total_amount, status, created_at, address_id, items_total, total_price, delivery_method, delivery_charge, estimated_delivery_date, estimated_delivery_days, payment_method, delivery_instruction, order_status, payment_status, delivery_address_json, stripe_payment_intent_id, shop_id) FROM stdin;
47	\N	11.00	Delivered	2026-05-08 16:39:27.894897	\N	\N	11.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
54	\N	8.50	Completed	2026-05-10 23:59:56.041788	\N	\N	8.50	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
64	\N	140.00	Completed	2026-05-11 13:15:18.626499	\N	\N	140.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
70	\N	203.00	Completed	2026-05-11 15:09:28.017285	\N	\N	203.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Deepankumar Selvaraj", "email": "selvarajdeepankumar@gmail.com", "phone": "", "address": "milk street", "is_billing": true}	\N	1
73	\N	231.00	Completed	2026-05-11 18:27:52.282305	\N	\N	231.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "ravi", "email": "ravikumar@gmail.com", "phone": "63747891199789441712", "address": "Dubai\\n", "is_billing": true}	\N	1
76	1	8.50	Placed	2026-05-12 08:33:56.053485	1	8.50	8.50	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
79	\N	7.50	Completed	2026-05-12 08:36:40.461468	\N	\N	7.50	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
88	1	25.50	Placed	2026-05-12 16:26:48.574576	1	25.50	25.50	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
96	1	8.50	Placed	2026-05-12 18:45:48.500231	1	8.50	8.50	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
99	1	17.00	Placed	2026-05-12 19:01:57.063153	1	17.00	17.00	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
102	\N	227.00	Completed	2026-05-12 19:14:07.355982	\N	\N	227.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "ravikumar", "email": "deepankumar@gmail.com", "phone": "9095199364", "address": "Dubai\\n", "is_billing": true}	\N	1
105	1	59.50	Placed	2026-05-13 12:53:57.570214	1	59.50	59.50	standard	0.00	2026-05-15	2	cod	in front of gate	placed	pending_cod	\N	\N	1
108	1	25.50	Placed	2026-05-13 13:01:27.505777	1	25.50	25.50	standard	0.00	2026-05-15	2	cod	in front of gate	placed	pending_cod	\N	\N	1
115	\N	15.00	Completed	2026-05-13 13:17:59.588075	\N	\N	15.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
123	1	8.50	Placed	2026-05-13 13:49:38.526722	1	8.50	8.50	standard	0.00	2026-05-15	2	cod	in front of gate	placed	pending_cod	\N	\N	1
130	\N	94.75	Completed	2026-05-13 16:48:53.274883	\N	\N	94.75	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "sathan", "email": "sathan@gmail.com", "phone": "8060464755", "address": "erode", "is_billing": true}	\N	1
132	\N	244.25	Completed	2026-05-13 16:53:13.1154	\N	\N	244.25	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "selvarajdeepankumar", "email": "selvarajdeepan@gmail.co", "phone": "6474789119", "address": "bhavani", "is_billing": true}	\N	1
134	1	17.00	Placed	2026-05-13 19:00:13.486354	1	17.00	17.00	standard	0.00	2026-05-15	2	cod	in front of gate	placed	pending_cod	\N	\N	1
136	1	17.00	Placed	2026-05-13 19:03:02.448852	1	17.00	17.00	standard	0.00	2026-05-15	2	cod	in front of gate	placed	pending_cod	\N	\N	1
140	2	9.00	Placed	2026-05-14 06:59:02.847589	2	9.00	9.00	standard	0.00	2026-05-16	2	cod	in my home	placed	pending_cod	\N	\N	1
142	1	9.00	Placed	2026-05-14 07:05:47.883653	1	9.00	9.00	standard	0.00	2026-05-16	2	cod	in front of gate	placed	pending_cod	\N	\N	1
144	2	281.64	Placed	2026-05-14 15:27:24.639208	2	281.64	281.64	standard	0.00	2026-05-16	2	cod	in my home	placed	pending_cod	\N	\N	1
146	2	8.50	Placed	2026-05-14 15:56:21.371961	2	8.50	8.50	standard	0.00	2026-05-16	2	cod	in my home	placed	pending_cod	\N	\N	1
148	\N	399.25	Completed	2026-05-14 18:00:13.359559	\N	\N	399.25	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "palani", "email": "palani@gmail.com", "phone": "7373737373", "address": "erode", "is_billing": true}	\N	1
150	\N	170.50	Completed	2026-05-14 20:21:18.784628	\N	\N	170.50	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "palani", "email": "palani@gmail.com", "phone": "7373737373", "address": "erode", "is_billing": true}	\N	1
152	1	297.92	Placed	2026-05-14 20:26:07.367876	1	297.92	297.92	standard	0.00	2026-05-16	2	cod	in front of gate	placed	pending_cod	\N	\N	1
154	1	15.52	Pending	2026-05-15 00:45:35.07465	1	15.52	15.52	standard	0.00	2026-05-16	2	card	in front of gate	pending	pending_payment	\N	pi_3TX4jLJJrNVIQVKq0q9VNx4r	1
162	\N	13.37	Completed	2026-05-15 01:30:58.289013	\N	\N	13.37	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
164	1	26.74	Placed	2026-05-15 09:31:32.183014	1	26.74	26.74	standard	0.00	2026-05-17	2	cod	in front of gate	placed	pending_cod	\N	\N	1
166	1	34.96	Placed	2026-05-15 10:34:14.152408	1	34.96	34.96	standard	0.00	2026-05-17	2	cod	in front of gate	placed	pending_cod	\N	\N	1
168	1	11.64	Placed	2026-05-15 19:15:48.305679	1	11.64	11.64	standard	0.00	2026-05-17	2	cod	in front of gate	placed	pending_cod	\N	\N	1
2	1	1015.00	Placed	2026-04-20 15:46:02.516757	1	1015.00	1015.00	standard	0.00	2026-04-22	2	cod	in front of gate	placed	pending_cod	\N	\N	1
12	1	700.00	Confirmed	2026-04-20 17:05:44.189054	1	700.00	700.00	standard	0.00	2026-04-22	2	card	in front of gate	confirmed	paid	\N	pi_3TOG7AJJrNVIQVKq0yvDC4ld	1
48	\N	25.00	Completed	2026-05-08 17:46:46.277349	\N	\N	25.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
60	1	26.00	Placed	2026-05-11 00:39:07.358654	1	26.00	26.00	standard	0.00	2026-05-12	2	cod	in front of gate	placed	pending_cod	\N	\N	1
65	\N	25.00	Completed	2026-05-11 14:24:07.652553	\N	\N	25.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
71	\N	220.50	Completed	2026-05-11 15:10:29.337278	\N	\N	220.50	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Deepankumar Selvaraj", "email": "selvarajdeepankumar@gmail.com", "phone": "6374789119", "address": "milk street", "is_billing": true}	\N	1
74	\N	119.00	Completed	2026-05-11 18:30:21.953009	\N	\N	119.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "ravi", "email": "ravikumar@gmail.com", "phone": "63747891199789441712", "address": "Dubai\\n", "is_billing": true}	\N	1
77	\N	15.00	Completed	2026-05-12 08:34:40.636353	\N	\N	15.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
80	1	34.00	Placed	2026-05-12 09:33:27.724318	1	34.00	34.00	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
83	1	25.50	Placed	2026-05-12 09:57:03.263075	1	25.50	25.50	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
89	1	17.00	Placed	2026-05-12 16:28:13.773516	1	17.00	17.00	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
97	1	8.50	Placed	2026-05-12 18:52:05.517246	1	8.50	8.50	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
109	1	59.50	Placed	2026-05-13 13:02:15.486612	1	59.50	59.50	standard	0.00	2026-05-15	2	cod	in front of gate	placed	pending_cod	\N	\N	1
116	1	8.50	Placed	2026-05-13 13:18:20.726513	1	8.50	8.50	standard	0.00	2026-05-15	2	cod	in front of gate	placed	pending_cod	\N	\N	1
16	1	350.00	Pending	2026-04-20 19:23:30.073988	1	350.00	350.00	standard	0.00	2026-04-22	2	card	in front of gate	pending	pending_payment	\N	pi_3TOIGUJJrNVIQVKq0Q3l89Cx	1
14	1	2115.00	Confirmed	2026-04-20 17:56:37.127445	1	2100.00	2115.00	paid	15.00	2026-04-21	1	card	in front of gate	confirmed	paid	\N	pi_3TOHJoJJrNVIQVKq0DjN9s4Q	1
13	1	315.00	Placed	2026-04-20 17:19:27.777064	1	315.00	315.00	standard	0.00	2026-04-22	2	cod	in front of gate	placed	pending_cod	\N	\N	1
15	1	350.00	Placed	2026-04-20 19:07:11.738019	1	350.00	350.00	standard	0.00	2026-04-22	2	cod	in front of gate	placed	pending_cod	\N	\N	1
17	1	700.00	Delivered	2026-04-23 09:29:20.019619	1	700.00	700.00	standard	0.00	2026-04-25	2	cod	in front of gate	delivered	paid	\N	\N	1
18	1	179.75	Confirmed	2026-04-23 09:35:46.601979	1	179.75	179.75	standard	0.00	2026-04-25	2	cod	in front of gate	confirmed	pending_cod	\N	\N	1
19	1	142.50	Placed	2026-04-23 19:00:48.573083	1	142.50	142.50	standard	0.00	2026-04-25	2	cod	in front of gate	placed	pending_cod	\N	\N	1
20	1	427.50	Confirmed	2026-04-24 17:58:28.280048	1	427.50	427.50	standard	0.00	2026-04-26	2	cod	in front of gate	confirmed	pending_cod	\N	\N	1
21	1	570.00	Dispatched	2026-04-27 11:24:21.286558	1	570.00	570.00	standard	0.00	2026-04-29	2	cod	in front of gate	dispatched	pending_cod	\N	\N	1
22	1	142.50	Placed	2026-04-27 11:56:46.808987	1	142.50	142.50	standard	0.00	2026-04-29	2	cod	in front of gate	placed	pending_cod	\N	\N	1
23	1	285.00	Placed	2026-04-28 12:25:57.680791	1	285.00	285.00	standard	0.00	2026-04-30	2	cod	in front of gate	placed	pending_cod	\N	\N	1
24	1	427.50	Placed	2026-04-28 18:15:10.095017	1	427.50	427.50	standard	0.00	2026-04-30	2	cod	in front of gate	placed	pending_cod	\N	\N	1
25	1	855.00	Placed	2026-04-28 18:20:00.851631	1	855.00	855.00	standard	0.00	2026-04-30	2	cod	in front of gate	placed	pending_cod	\N	\N	1
26	1	144.40	Placed	2026-04-28 18:24:55.100266	1	144.40	144.40	standard	0.00	2026-04-30	2	cod	in front of gate	placed	pending_cod	\N	\N	1
27	1	570.00	Placed	2026-04-28 18:27:38.574403	1	570.00	570.00	standard	0.00	2026-04-30	2	cod	in front of gate	placed	pending_cod	\N	\N	1
28	1	712.50	Placed	2026-04-28 18:29:02.591985	1	712.50	712.50	standard	0.00	2026-04-30	2	cod	in front of gate	placed	pending_cod	\N	\N	1
29	1	72.20	Placed	2026-04-29 08:52:07.977131	1	72.20	72.20	standard	0.00	2026-05-01	2	cod	in front of gate	placed	pending_cod	\N	\N	1
30	1	279.30	Placed	2026-04-29 09:00:28.462027	1	279.30	279.30	standard	0.00	2026-05-01	2	cod	in front of gate	placed	pending_cod	\N	\N	1
31	1	294.00	Placed	2026-04-29 09:04:35.474745	1	294.00	294.00	standard	0.00	2026-05-01	2	cod	in front of gate	placed	pending_cod	\N	\N	1
32	1	294.00	Placed	2026-04-29 09:06:14.617396	1	294.00	294.00	standard	0.00	2026-05-01	2	cod	in front of gate	placed	pending_cod	\N	\N	1
33	1	40.39	Placed	2026-04-29 09:10:43.685068	1	40.39	40.39	standard	0.00	2026-05-01	2	cod	in front of gate	placed	pending_cod	\N	\N	1
34	1	294.00	Placed	2026-04-29 09:14:15.127499	1	294.00	294.00	standard	0.00	2026-05-01	2	cod	in front of gate	placed	pending_cod	\N	\N	1
35	1	294.00	Placed	2026-04-29 09:16:29.503965	1	294.00	294.00	standard	0.00	2026-05-01	2	cod	in front of gate	placed	pending_cod	\N	\N	1
36	\N	38.00	Completed	2026-04-29 10:18:27.082406	\N	\N	38.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
37	\N	38.00	Completed	2026-04-29 10:20:32.064905	\N	\N	38.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
38	1	294.00	Placed	2026-04-30 08:29:44.013619	1	294.00	294.00	standard	0.00	2026-05-02	2	cod	in front of gate	placed	pending_cod	\N	\N	1
39	1	346.92	Placed	2026-04-30 08:34:55.558093	1	346.92	346.92	standard	0.00	2026-05-02	2	cod	in front of gate	placed	pending_cod	\N	\N	1
40	\N	38.00	Completed	2026-04-30 09:39:08.386388	\N	\N	38.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
41	\N	147.00	Cancelled	2026-05-05 15:00:23.165768	\N	\N	147.00	Walk-in	\N	\N	\N	Cash	\N	cancelled	paid	{"name": "naveen", "email": "naveen@gmail.com", "phone": "8046475598", "address": "erode", "is_billing": true}	\N	1
42	\N	148.50	Completed	2026-05-05 15:59:05.673697	\N	\N	148.50	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "naveen", "email": "naveen@gmail.com", "phone": "8046475598", "address": "erode", "is_billing": true}	\N	1
43	\N	45.00	Completed	2026-05-06 08:33:32.960621	\N	\N	45.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
44	\N	11.11	Completed	2026-05-06 08:39:29.278677	\N	\N	11.11	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
45	\N	20.00	Completed	2026-05-06 08:45:01.748461	\N	\N	20.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
46	\N	26.00	Completed	2026-05-07 08:52:55.001453	\N	\N	26.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
49	\N	8.50	Completed	2026-05-08 19:11:09.879286	\N	\N	8.50	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
63	\N	6.69	Completed	2026-05-11 13:01:05.665854	\N	\N	6.69	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
72	\N	338.00	Completed	2026-05-11 18:20:01.289432	\N	\N	338.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "arun", "email": "arun@gmail.com", "phone": "7373737375", "address": "erode", "is_billing": true}	\N	1
75	\N	5.50	Completed	2026-05-12 08:07:55.706088	\N	\N	5.50	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
81	1	34.00	Placed	2026-05-12 09:39:23.454573	1	34.00	34.00	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
84	1	8.50	Placed	2026-05-12 10:05:08.073497	1	8.50	8.50	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
95	1	11.50	Placed	2026-05-12 18:37:48.021485	1	11.50	11.50	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
98	1	8.50	Placed	2026-05-12 18:59:22.748286	1	8.50	8.50	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
101	1	42.05	Placed	2026-05-12 19:09:43.148584	1	42.05	42.05	standard	0.00	2026-05-14	2	cod	in front of gate	placed	pending_cod	\N	\N	1
104	\N	80.50	Completed	2026-05-12 19:16:55.773024	\N	\N	80.50	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
122	\N	42.00	Completed	2026-05-13 13:45:07.773696	\N	\N	42.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
124	1	8.50	Placed	2026-05-13 14:32:17.049	1	8.50	8.50	standard	0.00	2026-05-15	2	cod	in front of gate	placed	pending_cod	\N	\N	1
126	1	66.00	Placed	2026-05-13 14:46:51.889963	1	66.00	66.00	standard	0.00	2026-05-15	2	cod	in front of gate	placed	pending_cod	\N	\N	1
131	\N	38.50	Completed	2026-05-13 16:51:30.459376	\N	\N	38.50	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
133	\N	250.00	Completed	2026-05-13 17:02:53.990637	\N	\N	250.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
135	1	8.50	Placed	2026-05-13 19:00:32.490836	1	8.50	8.50	standard	0.00	2026-05-15	2	cod	in front of gate	placed	pending_cod	\N	\N	1
137	\N	384.00	Completed	2026-05-13 20:03:26.649963	\N	\N	384.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
139	1	97.32	Placed	2026-05-14 06:40:43.783853	1	97.32	97.32	standard	0.00	2026-05-16	2	cod	in front of gate	placed	pending_cod	\N	\N	1
141	\N	14.00	Completed	2026-05-14 07:00:21.454893	\N	\N	14.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
143	\N	9.00	Completed	2026-05-14 07:07:09.977944	\N	\N	9.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
147	\N	68.00	Completed	2026-05-14 15:57:14.960694	\N	\N	68.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
149	\N	451.25	Completed	2026-05-14 20:10:55.218027	\N	\N	451.25	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "palani", "email": "palani@gmail.com", "phone": "7373737373", "address": "erode", "is_billing": true}	\N	1
151	\N	200.00	Completed	2026-05-14 20:23:27.131604	\N	\N	200.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
153	1	17.00	Placed	2026-05-14 20:28:04.879768	1	17.00	17.00	standard	0.00	2026-05-16	2	cod	in front of gate	placed	pending_cod	\N	\N	1
155	1	15.37	Pending	2026-05-15 01:04:59.800485	1	15.37	15.37	standard	0.00	2026-05-16	2	card	in front of gate	pending	pending_payment	\N	pi_3TX4v3JJrNVIQVKq07pAK2Oo	1
161	1	15.37	Placed	2026-05-15 01:29:35.281407	1	15.37	15.37	standard	0.00	2026-05-17	2	cod	in front of gate	placed	pending_cod	\N	\N	1
163	\N	100.00	Completed	2026-05-15 04:02:20.279898	\N	\N	100.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
165	\N	14.00	Completed	2026-05-15 09:32:29.640394	\N	\N	14.00	Walk-in	\N	\N	\N	Cash	\N	completed	paid	{"name": "Walking Customer", "email": "", "phone": "", "address": "", "is_billing": true}	\N	1
167	1	17.48	Placed	2026-05-15 10:35:32.697082	1	17.48	17.48	standard	0.00	2026-05-17	2	cod	in front of gate	placed	pending_cod	\N	\N	1
169	1	12.00	Placed	2026-05-15 19:20:09.394046	1	12.00	12.00	standard	0.00	2026-05-17	2	cod	in front of gate	placed	pending_cod	\N	\N	1
\.

-- Primary key constraints
ALTER TABLE ONLY public.area_master ADD CONSTRAINT area_master_pkey PRIMARY KEY (area_id);
ALTER TABLE ONLY public.branches ADD CONSTRAINT branches_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.cart ADD CONSTRAINT cart_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.categories ADD CONSTRAINT categories_pkey PRIMARY KEY (cat_id);
ALTER TABLE ONLY public.city_master ADD CONSTRAINT city_master_pkey PRIMARY KEY (city_id);
ALTER TABLE ONLY public.customer ADD CONSTRAINT customer_pkey PRIMARY KEY (customer_id);
ALTER TABLE ONLY public.customer_address ADD CONSTRAINT customer_address_pkey PRIMARY KEY (address_id);
ALTER TABLE ONLY public.order_items ADD CONSTRAINT order_items_pkey PRIMARY KEY (order_item_id);
ALTER TABLE ONLY public.order_status_history ADD CONSTRAINT order_status_history_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.orders ADD CONSTRAINT orders_pkey PRIMARY KEY (order_id);
ALTER TABLE ONLY public.product_images ADD CONSTRAINT product_images_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.product_shop_stock ADD CONSTRAINT product_shop_stock_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.product_variants ADD CONSTRAINT product_variants_pkey PRIMARY KEY (variant_id);
ALTER TABLE ONLY public.products ADD CONSTRAINT products_pkey PRIMARY KEY (prod_id);
ALTER TABLE ONLY public.shop_service_area ADD CONSTRAINT shop_service_area_pkey PRIMARY KEY (service_area_id);
ALTER TABLE ONLY public.shops ADD CONSTRAINT shops_pkey PRIMARY KEY (shop_id);
ALTER TABLE ONLY public.sub_categories ADD CONSTRAINT sub_categories_pkey PRIMARY KEY (sub_cat_id);
ALTER TABLE ONLY public.users ADD CONSTRAINT users_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.variant_shop_stock ADD CONSTRAINT variant_shop_stock_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.wishlist ADD CONSTRAINT wishlist_pkey PRIMARY KEY (id);

-- Update sequences to correct values
SELECT setval('public.area_master_area_id_seq', (SELECT COALESCE(MAX(area_id), 1) FROM public.area_master));
SELECT setval('public.branches_id_seq', (SELECT COALESCE(MAX(id), 1) FROM public.branches));
SELECT setval('public.cart_id_seq', (SELECT COALESCE(MAX(id), 1) FROM public.cart));
SELECT setval('public.categories_cat_id_seq', (SELECT COALESCE(MAX(cat_id), 1) FROM public.categories));
SELECT setval('public.city_master_city_id_seq', (SELECT COALESCE(MAX(city_id), 1) FROM public.city_master));
SELECT setval('public.customer_customer_id_seq', (SELECT COALESCE(MAX(customer_id), 1) FROM public.customer));
SELECT setval('public.customer_address_address_id_seq', (SELECT COALESCE(MAX(address_id), 1) FROM public.customer_address));
SELECT setval('public.order_items_order_item_id_seq', (SELECT COALESCE(MAX(order_item_id), 1) FROM public.order_items));
SELECT setval('public.order_status_history_id_seq', (SELECT COALESCE(MAX(id), 1) FROM public.order_status_history));
SELECT setval('public.orders_order_id_seq', (SELECT COALESCE(MAX(order_id), 1) FROM public.orders));
SELECT setval('public.product_images_id_seq', (SELECT COALESCE(MAX(id), 1) FROM public.product_images));
SELECT setval('public.product_shop_stock_id_seq', (SELECT COALESCE(MAX(id), 1) FROM public.product_shop_stock));
SELECT setval('public.product_variants_variant_id_seq', (SELECT COALESCE(MAX(variant_id), 1) FROM public.product_variants));
SELECT setval('public.products_prod_id_seq', 200);
SELECT setval('public.shop_service_area_service_area_id_seq', (SELECT COALESCE(MAX(service_area_id), 1) FROM public.shop_service_area));
SELECT setval('public.shops_shop_id_seq', (SELECT COALESCE(MAX(shop_id), 1) FROM public.shops));
SELECT setval('public.sub_categories_sub_cat_id_seq', (SELECT COALESCE(MAX(sub_cat_id), 1) FROM public.sub_categories));
SELECT setval('public.users_id_seq', (SELECT COALESCE(MAX(id), 1) FROM public.users));
SELECT setval('public.variant_shop_stock_id_seq', (SELECT COALESCE(MAX(id), 1) FROM public.variant_shop_stock));
SELECT setval('public.wishlist_id_seq', (SELECT COALESCE(MAX(id), 1) FROM public.wishlist));
