You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE TABLE public."UserToken" (
id serial NOT NULL DEFAULT nextval('"UserToken_id_seq"'::regclass),
token varchar,
"userId" int4,
CONSTRAINT "UserToken_pkey" PRIMARY KEY (id)
);
CREATE TABLE public."User" (
id serial NOT NULL DEFAULT nextval('"User_id_seq"'::regclass),
email varchar NOT NULL,
password_hash varchar,
first_name varchar,
last_name varchar,
role varchar NOT NULL,
"language" varchar,
api_key varchar,
active bool NOT NULL,
confirmed timestamptz,
created timestamptz,
modified timestamptz,
CONSTRAINT "User_pkey" PRIMARY KEY (id)
);
So "userId" column created as regular int4, but there is no foreignKey. The use of foreign keys is the basic concept of relational databases, it's required for data integrity.
The text was updated successfully, but these errors were encountered:
vladimiry
changed the title
PostgreSQL, relationships - regular column created instead of foreign key column
PostgreSQL, relationships - regular column created but there is no foreign key
Jan 11, 2015
Code example:
Got DDLs:
So "userId" column created as regular int4, but there is no foreignKey. The use of foreign keys is the basic concept of relational databases, it's required for data integrity.
The text was updated successfully, but these errors were encountered: