-- MetaApp Database Export
-- Generated: 2026-05-25 05:30:35


-- -------------------------------
-- Table: campaign_insights
-- -------------------------------

CREATE TABLE "campaign_insights" ("id" integer primary key autoincrement not null, "campaign_id" integer not null, "date" date not null, "impressions" numeric not null default '0', "reach" numeric not null default '0', "clicks" integer not null default '0', "spend" numeric not null default '0', "cpm" numeric, "cpc" numeric, "ctr" numeric, "frequency" numeric, "conversions" integer not null default '0', "leads" integer not null default '0', "video_views" integer not null default '0', "engagements" integer not null default '0', "created_at" datetime, "updated_at" datetime, foreign key("campaign_id") references "campaigns"("id") on delete cascade);

-- No data in this table

-- -------------------------------
-- Table: campaigns
-- -------------------------------

CREATE TABLE "campaigns" ("id" integer primary key autoincrement not null, "company_id" integer not null, "name" varchar not null, "platform" varchar check ("platform" in ('Facebook', 'Instagram', 'Google', 'LinkedIn')) not null, "objective" varchar check ("objective" in ('Leads', 'Traffic', 'Sales')) not null, "start_date" date not null, "end_date" date, "total_budget" numeric not null default '0', "daily_budget" numeric not null default '0', "status" varchar check ("status" in ('Running', 'Paused', 'Completed')) not null default 'Running', "notes" text, "created_at" datetime, "updated_at" datetime, "meta_campaign_id" varchar, "auto_sync" tinyint(1) not null default '0', "last_synced_at" datetime, foreign key("company_id") references "companies"("id") on delete cascade);

INSERT INTO campaigns ("id", "company_id", "name", "platform", "objective", "start_date", "end_date", "total_budget", "daily_budget", "status", "notes", "created_at", "updated_at", "meta_campaign_id", "auto_sync", "last_synced_at") VALUES
('1', '1', 'CRM Application Reel 17-03', 'Facebook', 'Leads', '2026-03-17 00:00:00', NULL, '0', '37000', 'Running', 'Imported from Meta Ads Manager', '2026-03-23 09:47:49', '2026-03-24 08:44:56', '120244984347810483', '1', '2026-03-24 08:44:56'),
('2', '1', 'Website Development insta - 02-02', 'Facebook', 'Leads', '2026-02-02 00:00:00', NULL, '0', '45000', 'Paused', 'Imported from Meta Ads Manager', '2026-03-23 09:47:49', '2026-03-24 08:44:58', '120242829307020483', '1', '2026-03-24 08:44:58'),
('3', '1', 'Web reel 26-01', 'Facebook', 'Leads', '2026-01-26 00:00:00', NULL, '0', '45000', 'Paused', 'Imported from Meta Ads Manager', '2026-03-23 09:47:49', '2026-03-24 08:45:01', '120242515372870483', '1', '2026-03-24 08:45:01'),
('4', '1', 'Reel Web development', 'Facebook', 'Leads', '2026-01-25 00:00:00', NULL, '0', '0', 'Paused', 'Imported from Meta Ads Manager', '2026-03-23 09:47:49', '2026-03-24 08:45:02', '120242486561630483', '1', '2026-03-24 08:45:02'),
('5', '1', 'Website Develoment - WhataApp', 'Facebook', 'Traffic', '2025-06-23 00:00:00', NULL, '0', '0', 'Paused', 'Imported from Meta Ads Manager', '2026-03-23 09:47:49', '2026-03-24 08:45:04', '120229969216260483', '1', '2026-03-24 08:45:04'),
('6', '1', 'Website development Service -AD (17-06-2025)', 'Facebook', 'Leads', '2025-06-18 00:00:00', NULL, '0', '0', 'Paused', 'Imported from Meta Ads Manager', '2026-03-23 09:47:49', '2026-03-24 08:45:06', '120229576875770483', '1', '2026-03-24 08:45:06'),
('7', '1', 'AC Service App 20-05', 'Facebook', 'Leads', '2025-05-30 00:00:00', NULL, '0', '0', 'Paused', 'Imported from Meta Ads Manager', '2026-03-23 09:47:49', '2026-03-24 08:45:08', '120228273171510483', '1', '2026-03-24 08:45:08'),
('8', '1', 'Plumbing application 29-05-2025', 'Facebook', 'Leads', '2025-05-29 00:00:00', NULL, '0', '0', 'Paused', 'Imported from Meta Ads Manager', '2026-03-23 09:47:49', '2026-03-24 08:45:10', '120228243294480483', '1', '2026-03-24 08:45:10'),
('9', '1', 'APP Development Service - May 29', 'Facebook', 'Leads', '2025-05-29 00:00:00', NULL, '0', '0', 'Paused', 'Imported from Meta Ads Manager', '2026-03-23 09:47:49', '2026-03-24 08:45:12', '120228220821700483', '1', '2026-03-24 08:45:12'),
('10', '1', 'IT Campaign 29-04', 'Facebook', 'Leads', '2025-04-29 00:00:00', NULL, '0', '0', 'Paused', 'Imported from Meta Ads Manager', '2026-03-23 09:47:49', '2026-03-24 08:45:14', '120225839741400483', '1', '2026-03-24 08:45:14'),
('11', '1', 'App Development 26-04-25', 'Facebook', 'Leads', '2025-04-28 00:00:00', NULL, '0', '0', 'Paused', 'Imported from Meta Ads Manager', '2026-03-23 09:47:49', '2026-03-24 08:45:16', '120225559107050483', '1', '2026-03-24 08:45:16');

-- -------------------------------
-- Table: companies
-- -------------------------------

CREATE TABLE "companies" ("id" integer primary key autoincrement not null, "name" varchar not null, "contact_person" varchar not null, "phone" varchar not null, "email" varchar not null, "business_type" varchar, "notes" text, "status" varchar check ("status" in ('Active', 'Inactive')) not null default 'Active', "created_at" datetime, "updated_at" datetime);

INSERT INTO companies ("id", "name", "contact_person", "phone", "email", "business_type", "notes", "status", "created_at", "updated_at") VALUES
('1', 'Imported from Meta', 'Auto Import', '', '', 'Auto Import', 'Created automatically from Meta API import', 'Active', '2026-03-23 09:46:16', '2026-03-23 09:46:16');

-- -------------------------------
-- Table: daily_budgets
-- -------------------------------

CREATE TABLE "daily_budgets" ("id" integer primary key autoincrement not null, "campaign_id" integer not null, "date" date not null, "daily_budget" numeric not null default '0', "amount_spent" numeric not null default '0', "remaining_budget" numeric not null default '0', "notes" text, "created_at" datetime, "updated_at" datetime, "impressions" integer not null default '0', "clicks" integer not null default '0', "cpm" numeric, "cpc" numeric, "ctr" numeric, "reach" numeric, "frequency" numeric, "conversions" integer not null default '0', "video_views" integer not null default '0', "engagements" integer not null default '0', foreign key("campaign_id") references "campaigns"("id") on delete cascade);

INSERT INTO daily_budgets ("id", "campaign_id", "date", "daily_budget", "amount_spent", "remaining_budget", "notes", "created_at", "updated_at", "impressions", "clicks", "cpm", "cpc", "ctr", "reach", "frequency", "conversions", "video_views", "engagements") VALUES
('1', '1', '2026-03-18 00:00:00', '370', '381.45', '-11.45', NULL, '2026-03-23 09:53:41', '2026-03-23 09:53:41', '1853', '25', '205.8553696708', '15.258', '1.3491635186185', '1693', '1.094507', '0', '0', '0'),
('2', '1', '2026-03-19 00:00:00', '370', '235.78', '134.22', NULL, '2026-03-23 09:53:41', '2026-03-23 09:53:41', '487', '8', '484.14784394251', '29.4725', '1.6427104722793', '440', '1.106818', '0', '0', '0'),
('3', '1', '2026-03-20 00:00:00', '370', '1.42', '368.58', NULL, '2026-03-23 09:53:41', '2026-03-23 09:53:41', '54', '1', '26.296296296296', '1.42', '1.8518518518519', '54', '1', '0', '0', '0'),
('4', '1', '2026-03-21 00:00:00', '370', '625.66', '-255.66', NULL, '2026-03-23 09:53:41', '2026-03-23 09:53:41', '25061', '110', '24.965484218507', '5.6878181818182', '0.43892901320777', '21853', '1.146799', '0', '0', '0'),
('5', '1', '2026-03-22 00:00:00', '370', '9.92', '360.08', NULL, '2026-03-23 09:53:41', '2026-03-23 09:53:41', '228', '0', '43.508771929825', '0', '0', '223', '1.022422', '0', '0', '0');

-- -------------------------------
-- Table: failed_jobs
-- -------------------------------

CREATE TABLE "failed_jobs" ("id" integer primary key autoincrement not null, "uuid" varchar not null, "connection" text not null, "queue" text not null, "payload" text not null, "exception" text not null, "failed_at" datetime not null default CURRENT_TIMESTAMP);

-- No data in this table

-- -------------------------------
-- Table: lead_followups
-- -------------------------------

CREATE TABLE "lead_followups" ("id" integer primary key autoincrement not null, "lead_id" integer not null, "followup_date" date not null, "followup_notes" text, "next_followup_date" date, "status" varchar check ("status" in ('Pending', 'Completed', 'Cancelled')) not null default 'Pending', "created_at" datetime, "updated_at" datetime, foreign key("lead_id") references "leads"("id") on delete cascade);

-- No data in this table

-- -------------------------------
-- Table: leads
-- -------------------------------

CREATE TABLE "leads" ("id" integer primary key autoincrement not null, "campaign_id" integer not null, "name" varchar not null, "phone" varchar not null, "email" varchar, "city" varchar, "date_received" date not null, "status" varchar check ("status" in ('New', 'Contacted', 'Interested', 'Not Interested', 'Converted')) not null default 'New', "notes" text, "created_at" datetime, "updated_at" datetime, "meta_lead_id" varchar, foreign key("campaign_id") references "campaigns"("id") on delete cascade);

INSERT INTO leads ("id", "campaign_id", "name", "phone", "email", "city", "date_received", "status", "notes", "created_at", "updated_at", "meta_lead_id") VALUES
('37', '1', 'Meta Lead 1', '', '', '', '2026-03-22 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('38', '1', 'Meta Lead 2', '', '', '', '2026-03-22 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('39', '1', 'Meta Lead 3', '', '', '', '2026-03-21 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('40', '1', 'Meta Lead 4', '', '', '', '2026-03-18 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('41', '1', 'Meta Lead 5', '', '', '', '2026-03-18 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('42', '1', 'Meta Lead 6', '', '', '', '2026-03-16 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('43', '1', 'Meta Lead 7', '', '', '', '2026-03-21 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('44', '1', 'Meta Lead 8', '', '', '', '2026-03-18 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('45', '1', 'Meta Lead 9', '', '', '', '2026-03-17 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('46', '1', 'Meta Lead 10', '', '', '', '2026-03-21 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('47', '1', 'Meta Lead 11', '', '', '', '2026-03-21 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('48', '1', 'Meta Lead 12', '', '', '', '2026-03-17 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('49', '1', 'Meta Lead 13', '', '', '', '2026-03-19 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('50', '1', 'Meta Lead 14', '', '', '', '2026-03-17 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('51', '1', 'Meta Lead 15', '', '', '', '2026-03-23 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('52', '1', 'Meta Lead 16', '', '', '', '2026-03-23 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('53', '1', 'Meta Lead 17', '', '', '', '2026-03-18 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL),
('54', '1', 'Meta Lead 18', '', '', '', '2026-03-23 11:10:06', 'New', 'Synced from Meta WhatsApp Conversations', '2026-03-23 11:10:06', '2026-03-23 11:10:06', NULL);

-- -------------------------------
-- Table: migrations
-- -------------------------------

CREATE TABLE "migrations" ("id" integer primary key autoincrement not null, "migration" varchar not null, "batch" integer not null);

INSERT INTO migrations ("id", "migration", "batch") VALUES
('1', '2014_10_12_000000_create_users_table', '1'),
('2', '2014_10_12_100000_create_password_reset_tokens_table', '1'),
('3', '2019_08_19_000000_create_failed_jobs_table', '1'),
('4', '2019_12_14_000001_create_personal_access_tokens_table', '1'),
('5', '2024_01_01_000001_create_companies_table', '1'),
('6', '2024_01_01_000002_create_campaigns_table', '1'),
('7', '2024_01_01_000003_create_daily_budgets_table', '1'),
('8', '2024_01_01_000004_create_leads_table', '1'),
('9', '2024_01_01_000005_create_lead_followups_table', '1'),
('10', '2024_03_12_000001_add_meta_fields', '1'),
('11', '2024_03_12_000002_add_more_insights_fields', '1');

-- -------------------------------
-- Table: password_reset_tokens
-- -------------------------------

CREATE TABLE "password_reset_tokens" ("email" varchar not null, "token" varchar not null, "created_at" datetime, primary key ("email"));

-- No data in this table

-- -------------------------------
-- Table: personal_access_tokens
-- -------------------------------

CREATE TABLE "personal_access_tokens" ("id" integer primary key autoincrement not null, "tokenable_type" varchar not null, "tokenable_id" integer not null, "name" varchar not null, "token" varchar not null, "abilities" text, "last_used_at" datetime, "expires_at" datetime, "created_at" datetime, "updated_at" datetime);

-- No data in this table

-- -------------------------------
-- Table: sqlite_sequence
-- -------------------------------

CREATE TABLE sqlite_sequence(name,seq);

INSERT INTO sqlite_sequence ("name", "seq") VALUES
('migrations', '11'),
('users', '1'),
('companies', '1'),
('campaigns', '11'),
('daily_budgets', '5'),
('campaign_insights', '1'),
('leads', '54');

-- -------------------------------
-- Table: users
-- -------------------------------

CREATE TABLE "users" ("id" integer primary key autoincrement not null, "name" varchar not null, "email" varchar not null, "email_verified_at" datetime, "password" varchar not null, "remember_token" varchar, "created_at" datetime, "updated_at" datetime);

INSERT INTO users ("id", "name", "email", "email_verified_at", "password", "remember_token", "created_at", "updated_at") VALUES
('1', 'Admin', 'admin@gmail.com', NULL, '$2y$10$UIxgOCJmYjnHSWNbh9PgPeT7GQpL89MiX.uZ/z6L8ocg5.BsmkkT2', NULL, '2026-03-23 09:37:36', '2026-03-23 09:37:36');
