I regretfully learned that I cannot define a foreign key for the Text[] type. but I need to keep the ids of other tables in a list and I have to do this with a foreign key restriction. At least so far I have no other point of view.
Do you think there is a method where I can use the foreign key restriction in json or array?
CREATE TABLE category(
category_id INT GENERATED ALWAYS AS IDENTITY,
category_name VARCHAR(210) NOT NULL,
category_description TEXT,
constraint pk_category primary key (category_id),
constraint u_category_name unique (category_name)
);
CREATE TABLE checkpoint_item(
checkpoint_id INT GENERATED ALWAYS AS IDENTITY,
checkpoint_item_name VARCHAR(210),
checkpoint_description TEXT,
constraint pk_checkpoint_item primary key (checkpoint_id),
constraint u_checkpoint_item_name unique (checkpoint_item_name)
);
Do you think there is a method where I can use the foreign key restriction in json or array?
CREATE TABLE process(
process_id INT GENERATED ALWAYS AS IDENTITY,
fk_category_id INTEGER,
fk_chekcpoint_item_id TEXT [],
FOREIGN KEY(fk_category_id) REFERENCES category(category_id) ON DELETE CASCADE,
FOREIGN KEY(fk_checkpoint_item_id) REFERENCES checkpoint_item(checkpoint_id) ON DELETE CASCADE
);