CREATE TABLE IF NOT EXISTS records_qualifications ( id BIGSERIAL PRIMARY KEY NOT NULL, user_id BIGINT NOT NULL, qualification_id BIGINT NOT NULL, author_id BIGINT NOT NULL, created_at BIGINT NOT NULL, CONSTRAINT fk_user FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE, CONSTRAINT fk_author FOREIGN KEY(author_id) REFERENCES users(id) ON DELETE SET NULL, CONSTRAINT fk_qualification FOREIGN KEY (qualification_id) REFERENCES qualifications(id) ON DELETE CASCADE );