-
-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolving relationships #8
Comments
Can you please post your database schema here. Maybe just the product and category table definition. |
Sharing the SQL statements that were used to create the tables. CREATE TABLE public.product (
id bigint NOT NULL,
name public.citext NOT NULL,
created_date timestamp with time zone DEFAULT now() NOT NULL,
category_id bigint NOT NULL,
brand_id bigint,
hsn bigint DEFAULT 0 NOT NULL,
active boolean DEFAULT true NOT NULL,
description text
);
ALTER TABLE ONLY public.product
ADD CONSTRAINT product_brand_id_fkey FOREIGN KEY (brand_id) REFERENCES public.category(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
ALTER TABLE ONLY public.product
ADD CONSTRAINT product_category_id_fkey FOREIGN KEY (category_id) REFERENCES public.category(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
CREATE TABLE public.category (
id bigint NOT NULL,
name public.citext NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
parent_id bigint,
image_url text,
type text DEFAULT 'CATEGORY'::text NOT NULL,
description text
);
|
I think your category table is missing a unique constraint. I don't want to assume here. |
I have an unique constraint, rather two on that table. ALTER TABLE ONLY public.category
ADD CONSTRAINT category_name_key UNIQUE (name);
ALTER TABLE ONLY public.category
ADD CONSTRAINT category_name_type_key UNIQUE (name, type);
ALTER TABLE ONLY public.category
ADD CONSTRAINT category_pkey PRIMARY KEY (id);
Sorry that these were missed. |
Can you send the full database schema?
|
https://gist.github.com/arvindkhadri/e3afec66793e6a74ad00c463ca25cadd That has the complete schema. |
So I've created an s.sql from this db schema psql -d mydb < s.sql added some records
and I get this doc data |
Closing as no reply on this. |
PGSync version:
1.0.1
Postgres version:
11.6
Elasticsearch version:
7.6.1
Redis version:
Python version:
3.7
Problem Description:
I have defined a schema which is being consumed by pgsync, but there is a field which returns
null
in al cases.Here is the schema.json
category
always returnsnull
. Also the tableproduct
has two columns which have relationship withcategory
table.Please advice.
The text was updated successfully, but these errors were encountered: