change the name of project to News Nexus and Complete the project perfectly
I'll complete the News Nexus project with all the requested features including save functionality, email subscriptions, and database integration.
First, let's create the additional database tables we need:
-- Create saved articles table
CREATE TABLE IF NOT EXISTS saved_articles (
id SERIAL PRIMARY KEY,
user_email VARCHAR(255) NOT NULL,
article_title VARCHAR(500) NOT NULL,
article_description TEXT,
article_url VARCHAR(1000) NOT NULL,
article_image_url VARCHAR(1000),
article_source VARCHAR(255),
article_author VARCHAR(255),
article_published_at TIMESTAMP,
saved_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_email) REFERENCES users(email) ON DELETE CASCADE,
UNIQUE(user_email, article_url)
);The SQL code block failed to execute. The error was: SQL execution error: relation "users" does not exist.
Let me create the users table first, then the saved articles table:
-- Create users table for email subscriptions
CREATE TABLE IF NOT EXISTS users (
id SERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
subscribed BOOLEAN DEFAULT true,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);