some more re-org + fixes
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 2m17s
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 2m17s
This commit is contained in:
@@ -28,6 +28,8 @@ CREATE TABLE IF NOT EXISTS public.activity_log (
|
||||
action TEXT NOT NULL,
|
||||
display_text TEXT NOT NULL,
|
||||
icon TEXT,
|
||||
activity_type TEXT,
|
||||
entity_id TEXT,
|
||||
details JSONB,
|
||||
created_at TIMESTAMPTZ DEFAULT now() NOT NULL,
|
||||
updated_at TIMESTAMPTZ DEFAULT now() NOT NULL
|
||||
@@ -85,9 +87,6 @@ CREATE TABLE IF NOT EXISTS public.flyers (
|
||||
);
|
||||
COMMENT ON TABLE public.flyers IS 'Stores metadata for each processed flyer, linking it to a store and its validity period.';
|
||||
CREATE INDEX IF NOT EXISTS idx_flyers_store_id ON public.flyers(store_id);
|
||||
-- Add a composite index to optimize queries that filter by active date ranges and store.
|
||||
-- This is particularly useful for the recalculate_price_history_on_flyer_item_delete trigger.
|
||||
CREATE INDEX IF NOT EXISTS idx_flyers_valid_dates_store ON public.flyers(valid_from, valid_to, store_id);
|
||||
COMMENT ON COLUMN public.flyers.file_name IS 'The original name of the uploaded flyer file (e.g., "flyer_week_1.pdf").';
|
||||
COMMENT ON COLUMN public.flyers.image_url IS 'The public URL of the primary flyer image stored in Supabase Storage.';
|
||||
COMMENT ON COLUMN public.flyers.checksum IS 'A SHA-256 hash of the original file content to prevent duplicate processing.';
|
||||
@@ -503,7 +502,6 @@ CREATE TABLE IF NOT EXISTS public.recipe_tags (
|
||||
);
|
||||
COMMENT ON TABLE public.recipe_tags IS 'A linking table to associate multiple tags with a single recipe.';
|
||||
CREATE INDEX IF NOT EXISTS idx_recipe_tags_recipe_id ON public.recipe_tags(recipe_id);
|
||||
-- This index is crucial for functions that find recipes based on tags.
|
||||
CREATE INDEX IF NOT EXISTS idx_recipe_tags_tag_id ON public.recipe_tags(tag_id);
|
||||
|
||||
-- 31. Store a predefined list of kitchen appliances.
|
||||
@@ -764,7 +762,6 @@ CREATE TABLE IF NOT EXISTS public.user_dietary_restrictions (
|
||||
updated_at TIMESTAMPTZ DEFAULT now() NOT NULL
|
||||
);
|
||||
COMMENT ON TABLE public.user_dietary_restrictions IS 'Connects users to their selected dietary needs and allergies.';
|
||||
-- This index is crucial for functions that filter recipes based on user diets/allergies.
|
||||
CREATE INDEX IF NOT EXISTS idx_user_dietary_restrictions_user_id ON public.user_dietary_restrictions(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_user_dietary_restrictions_restriction_id ON public.user_dietary_restrictions(restriction_id);
|
||||
|
||||
@@ -790,7 +787,6 @@ CREATE TABLE IF NOT EXISTS public.user_follows (
|
||||
CONSTRAINT cant_follow_self CHECK (follower_id <> following_id)
|
||||
);
|
||||
COMMENT ON TABLE public.user_follows IS 'Stores user following relationships to build a social graph.';
|
||||
-- This index is crucial for efficiently generating a user's activity feed.
|
||||
CREATE INDEX IF NOT EXISTS idx_user_follows_follower_id ON public.user_follows(follower_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_user_follows_following_id ON public.user_follows(following_id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user