-- public.store definition

-- Drop table

-- DROP TABLE public.store;

CREATE TABLE public.store (
	id int8 GENERATED BY DEFAULT AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL,
	"name" text NULL,
	address text NULL,
	client_id int4 NULL,
	created_by uuid NULL,
	updated_by uuid NULL,
	updated_at timestamptz DEFAULT '2024-03-10 05:22:11.031302+00'::timestamp with time zone NOT NULL,
	created_at timestamptz DEFAULT '2024-03-10 05:22:11.031302+00'::timestamp with time zone NOT NULL,
	gps text NULL,
	lat text NULL,
	region text NULL,
	channel text NULL,
	store_code text NULL,
	suburb text NULL,
	banner text NULL,
	google_link text NULL,
	town text NULL,
	"location" text NULL,
	file text NULL,
	"row" int8 NULL,
	sheetname text NULL,
	active_products int8 NULL,
	avail_old int4 NULL,
	visibility int4 NULL,
	channel_image text NULL,
	issue_data jsonb NULL,
	oos int4 NULL,
	negative_stock int4 NULL,
	soh_no_sales int4 NULL,
	no_sales_100_days int4 NULL,
	seven_day_cover int4 NULL,
	total_soh int4 NULL,
	non_issues int4 NULL,
	optimul int4 NULL,
	products_count int8 NULL,
	availability numeric NULL,
	updated_issues int8 NULL,
	CONSTRAINT sites_pkey PRIMARY KEY (id),
	CONSTRAINT store_id_key UNIQUE (id)
);





-- public.store foreign keys

ALTER TABLE public.store ADD CONSTRAINT sites_client_id_fkey FOREIGN KEY (client_id) REFERENCES public.client(id);
ALTER TABLE public.store ADD CONSTRAINT sites_client_id_fkey1 FOREIGN KEY (client_id) REFERENCES public.client(id);
ALTER TABLE public.store ADD CONSTRAINT sites_client_id_fkey2 FOREIGN KEY (client_id) REFERENCES public.client(id);
ALTER TABLE public.store ADD CONSTRAINT sites_client_id_fkey3 FOREIGN KEY (client_id) REFERENCES public.client(id);
ALTER TABLE public.store ADD CONSTRAINT sites_client_id_fkey4 FOREIGN KEY (client_id) REFERENCES public.client(id);