More views and no longer dropping schema

This commit is contained in:
2025-11-12 21:36:00 +00:00
parent 4826c4a744
commit 5002528eae

View File

@@ -2,11 +2,11 @@
-- Cleanup schema public first. -- Cleanup schema public first.
DROP SCHEMA IF EXISTS public CASCADE; ---DROP SCHEMA IF EXISTS public CASCADE;
-- Recreate schema public. -- Recreate schema public.
CREATE SCHEMA public; CREATE SCHEMA public if not exists;
-- Set ownership to meta_user -- Set ownership to meta_user
ALTER SCHEMA public OWNER TO meta_user; ALTER SCHEMA public OWNER TO meta_user;
@@ -25,6 +25,7 @@ CREATE EXTENSION IF NOT EXISTS timescaledb;
-- This table stores account mappings and identifiers -- This table stores account mappings and identifiers
-- Data is loaded from metadata.yaml file -- Data is loaded from metadata.yaml file
CREATE TABLE IF NOT EXISTS public.account_metadata ( CREATE TABLE IF NOT EXISTS public.account_metadata (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
label VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL,
@@ -382,7 +383,7 @@ SELECT
avg(ctr) as ctr avg(ctr) as ctr
FROM ads_insights FROM ads_insights
group by time, account_id, adset_id, campaign_id group by time, account_id, adset_id, campaign_id;
DROP VIEW IF EXISTS g_account_insights CASCADE; DROP VIEW IF EXISTS g_account_insights CASCADE;