(
vendor_category_id serial4 NOT NULL,
vendor_id int4 NULL,
category_id int4 NULL,
vendor_category_commission int4 NULL,
CONSTRAINT vendor_category_pkey PRIMARY KEY (vendor_category_id),
CONSTRAINT fk_tbl_vendor_category_tbl_category_foreignkey FOREIGN KEY (category_id) REFERENCES public.category(category_id) ON DELETE CASCADE,
CONSTRAINT fk_tbl_vendor_category_tbl_vendor_foreignkey FOREIGN KEY (vendor_id) REFERENCES public.vendor(vendor_id) ON DELETE CASCADE
);
```
but when I dump it I get something like this
--
-- Name: vendor_category; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.vendor_category (
vendor_category_id integer NOT NULL,
vendor_id integer,
category_id integer,
vendor_category_commission integer
);
--
-- Name: vendor_category_vendor_category_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.vendor_category_vendor_category_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: vendor_category_vendor_category_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.vendor_category_vendor_category_id_seq OWNED BY public.vendor_category.vendor_category_id;
why is that?
This is internal implementation of serual
This is because serial field type create sequence in db structure, Serial is sytax sugar for it
Обсуждают сегодня