My Original tables are:
CREATE TABLE authors (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL
);
CREATE TABLE author_details (
id SERIAL PRIMARY KEY,
bio TEXT,
email VARCHAR(255),
website VARCHAR(255),
profile_picture BYTEA,
author_id INTEGER NOT NULL REFERENCES authors(id) ON DELETE CASCADE
);
CREATE TABLE posts (
id SERIAL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
tag TEXT[],
body TEXT NOT NULL,
author_id INTEGER NOT NULL REFERENCES authors(id) ON DELETE CASCADE
);
Could you help me to change the tag column of posts to array of inters which will points to another tag_details such as
CREATE TABLE tags_details (
id SERIAL PRIMARY KEY,
name: VARCHAR(255) NOT NULL,
description TEXT,
);
And modify posts table to limit the tag column reference to tag_details id.