Test





Rideshare Registration

Rideshare Registration












CREATE TABLE users (
user_id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
profile_photo VARCHAR(255),
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
mobile_number VARCHAR(15) NOT NULL,
address VARCHAR(255) NOT NULL,
profile_type ENUM(‘rider’, ‘driver’) NOT NULL,
approved_driver BOOLEAN,
car_model VARCHAR(255),
vehicle_type VARCHAR(50),
number_plate VARCHAR(20),
saved_payment_details VARCHAR(255)
);
CREATE TABLE rides (
ride_id SERIAL PRIMARY KEY,
rider_id INT REFERENCES users(user_id),
driver_id INT REFERENCES users(user_id),
distance_miles INT NOT NULL,
cost DECIMAL(8, 2) NOT NULL,
scheduled_datetime TIMESTAMP,
status ENUM(‘requested’, ‘confirmed’, ‘completed’, ‘canceled’) NOT NULL
);
CREATE TABLE reviews (
review_id SERIAL PRIMARY KEY,
ride_id INT REFERENCES rides(ride_id),
reviewer_id INT REFERENCES users(user_id),
review_text TEXT,
rating INT CHECK (rating >= 1 AND rating <= 5) NOT NULL );