feat: implement SEO improvements, listing profiles, service images, and towns serviced
This commit is contained in:
67
schema.sql
67
schema.sql
@@ -54,6 +54,11 @@ CREATE TABLE listings (
|
||||
county_id INTEGER NOT NULL,
|
||||
town VARCHAR(100),
|
||||
url VARCHAR(255),
|
||||
logo_url VARCHAR(255),
|
||||
banner_url VARCHAR(255),
|
||||
facebook_url VARCHAR(255),
|
||||
instagram_url VARCHAR(255),
|
||||
google_business_url VARCHAR(255),
|
||||
user_id INTEGER NOT NULL,
|
||||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
last_edited TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
|
||||
@@ -90,3 +95,65 @@ CREATE TABLE stats_prices (
|
||||
price DOUBLE PRECISION NOT NULL,
|
||||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Boiler/HVAC service companies (separate from fuel price listings)
|
||||
CREATE TABLE service_listings (
|
||||
id SERIAL PRIMARY KEY,
|
||||
company_name VARCHAR(255) NOT NULL,
|
||||
is_active BOOLEAN DEFAULT true,
|
||||
twenty_four_hour BOOLEAN DEFAULT false, -- 24/7 emergency coverage
|
||||
emergency_service BOOLEAN DEFAULT false, -- emergency same-day response
|
||||
town VARCHAR(100),
|
||||
county_id INTEGER NOT NULL,
|
||||
phone VARCHAR(20),
|
||||
website VARCHAR(255),
|
||||
email VARCHAR(255),
|
||||
description TEXT, -- short description of services offered
|
||||
licensed_insured BOOLEAN DEFAULT false, -- licensed and insured
|
||||
service_area VARCHAR(255), -- e.g. "All of Middlesex County", "Greater Boston"
|
||||
years_experience INTEGER, -- years in business
|
||||
logo_url VARCHAR(255),
|
||||
banner_url VARCHAR(255),
|
||||
facebook_url VARCHAR(255),
|
||||
instagram_url VARCHAR(255),
|
||||
google_business_url VARCHAR(255),
|
||||
user_id INTEGER NOT NULL,
|
||||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
last_edited TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Run this to create the table if not exists (after initial schema is deployed):
|
||||
-- CREATE TABLE IF NOT EXISTS service_listings ( ... same as above ... );
|
||||
|
||||
-- Subscription tracking (one per company, auto-created with 1-year trial)
|
||||
CREATE TABLE subscriptions (
|
||||
id SERIAL PRIMARY KEY,
|
||||
company_id INTEGER NOT NULL UNIQUE,
|
||||
trial_start DATE NOT NULL DEFAULT CURRENT_DATE,
|
||||
trial_end DATE NOT NULL DEFAULT (CURRENT_DATE + INTERVAL '1 year'),
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'trial',
|
||||
plan VARCHAR(50),
|
||||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Admin-managed site-wide banners
|
||||
CREATE TABLE banners (
|
||||
id SERIAL PRIMARY KEY,
|
||||
message TEXT NOT NULL,
|
||||
is_active BOOLEAN DEFAULT true,
|
||||
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE listing_towns (
|
||||
id SERIAL PRIMARY KEY,
|
||||
listing_id INTEGER NOT NULL REFERENCES listings(id) ON DELETE CASCADE,
|
||||
town VARCHAR(100) NOT NULL,
|
||||
UNIQUE(listing_id, town)
|
||||
);
|
||||
|
||||
CREATE TABLE service_listing_towns (
|
||||
id SERIAL PRIMARY KEY,
|
||||
service_listing_id INTEGER NOT NULL REFERENCES service_listings(id) ON DELETE CASCADE,
|
||||
town VARCHAR(100) NOT NULL,
|
||||
UNIQUE(service_listing_id, town)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user