added address table, super awesome - bunch of gitea workflow options - "Processed Flyers" made better
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m1s
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m1s
This commit is contained in:
@@ -19,6 +19,28 @@
|
||||
-- ============================================================================
|
||||
-- PART 2: TABLES
|
||||
-- ============================================================================
|
||||
-- 0. NEW TABLE: A centralized table for storing all physical addresses.
|
||||
CREATE TABLE IF NOT EXISTS public.addresses (
|
||||
address_id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
||||
address_line_1 TEXT NOT NULL,
|
||||
address_line_2 TEXT,
|
||||
city TEXT NOT NULL,
|
||||
province_state TEXT NOT NULL,
|
||||
postal_code TEXT NOT NULL,
|
||||
country TEXT NOT NULL,
|
||||
latitude NUMERIC(9, 6),
|
||||
longitude NUMERIC(9, 6),
|
||||
location GEOGRAPHY(Point, 4326),
|
||||
created_at TIMESTAMPTZ DEFAULT now() NOT NULL,
|
||||
updated_at TIMESTAMPTZ DEFAULT now() NOT NULL
|
||||
);
|
||||
COMMENT ON TABLE public.addresses IS 'A centralized table for storing all physical addresses for users and stores.';
|
||||
COMMENT ON COLUMN public.addresses.latitude IS 'The geographic latitude.';
|
||||
COMMENT ON COLUMN public.addresses.longitude IS 'The geographic longitude.';
|
||||
COMMENT ON COLUMN public.addresses.location IS 'A PostGIS geography type for efficient spatial queries.';
|
||||
CREATE INDEX IF NOT EXISTS addresses_location_idx ON public.addresses USING GIST (location);
|
||||
|
||||
|
||||
-- 1. Users table for authentication.
|
||||
CREATE TABLE IF NOT EXISTS public.users (
|
||||
user_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
@@ -236,28 +258,7 @@ COMMENT ON TABLE public.store_locations IS 'Stores physical locations of stores
|
||||
CREATE INDEX IF NOT EXISTS idx_store_locations_store_id ON public.store_locations(store_id);
|
||||
-- Add a GIST index for efficient geographic queries.
|
||||
-- This requires the postgis extension.
|
||||
-- CREATE INDEX IF NOT EXISTS store_locations_geo_idx ON public.store_locations USING GIST (location);
|
||||
|
||||
-- NEW TABLE: A centralized table for storing all physical addresses.
|
||||
CREATE TABLE IF NOT EXISTS public.addresses (
|
||||
address_id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
||||
address_line_1 TEXT NOT NULL,
|
||||
address_line_2 TEXT,
|
||||
city TEXT NOT NULL,
|
||||
province_state TEXT NOT NULL,
|
||||
postal_code TEXT NOT NULL,
|
||||
country TEXT NOT NULL,
|
||||
latitude NUMERIC(9, 6),
|
||||
longitude NUMERIC(9, 6),
|
||||
location GEOGRAPHY(Point, 4326),
|
||||
created_at TIMESTAMPTZ DEFAULT now() NOT NULL,
|
||||
updated_at TIMESTAMPTZ DEFAULT now() NOT NULL
|
||||
);
|
||||
COMMENT ON TABLE public.addresses IS 'A centralized table for storing all physical addresses for users and stores.';
|
||||
COMMENT ON COLUMN public.addresses.latitude IS 'The geographic latitude.';
|
||||
COMMENT ON COLUMN public.addresses.longitude IS 'The geographic longitude.';
|
||||
COMMENT ON COLUMN public.addresses.location IS 'A PostGIS geography type for efficient spatial queries.';
|
||||
CREATE INDEX IF NOT EXISTS addresses_location_idx ON public.addresses USING GIST (location);
|
||||
CREATE INDEX IF NOT EXISTS store_locations_geo_idx ON public.store_locations USING GIST (location);
|
||||
|
||||
-- 13. For aggregated, historical price data for master items.
|
||||
CREATE TABLE IF NOT EXISTS public.item_price_history (
|
||||
|
||||
Reference in New Issue
Block a user