1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
CREATE TABLE IF NOT EXISTS `adgroup_keyword` (
`keyword_google_id` int(10) unsigned NOT NULL,
`adgroup_google_id` int(10) unsigned NOT NULL,
`status_id` int(10) unsigned NOT NULL,
`matching_id` int(10) unsigned NOT NULL,
`keyword_name` varchar(100) default NULL,
PRIMARY KEY (`keyword_google_id`,`adgroup_google_id`),
KEY `adgroup_keyword_FKIndex1` (`matching_id`),
KEY `adgroup_keyword_FKIndex2` (`status_id`),
KEY `adgroup_keyword_FKIndex3` (`adgroup_google_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `adgroup_keyword_report_daily` (
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
`adgroup_google_id` int(15) unsigned NOT NULL,
`keyword_google_id` int(15) unsigned NOT NULL,
`min_CPC` float default NULL,
`max_CPC` float default NULL,
`impression` int(10) unsigned default NULL,
`clicks` int(10) unsigned default NULL,
`avg_pos` float default NULL,
`cost` decimal(10,4) default NULL,
PRIMARY KEY (`timestamp`,`adgroup_google_id`,`keyword_google_id`),
KEY `adgroup_keyword_report_daily_FKIndex1` (`keyword_google_id`,`adgroup_google_id`),
KEY `adgroup_google_id` (`adgroup_google_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `adgroup_keyword_report_daily`
ADD CONSTRAINT `adgroup_keyword_report_daily_ibfk_5` FOREIGN KEY (`keyword_google_id`) REFERENCES `adgroup_keyword` (`keyword_google_id`),
ADD CONSTRAINT `adgroup_keyword_report_daily_ibfk_1` FOREIGN KEY (`keyword_google_id`, `adgroup_google_id`) REFERENCES `adgroup_keyword` (`keyword_google_id`, `adgroup_google_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `adgroup_keyword_report_daily_ibfk_4` FOREIGN KEY (`adgroup_google_id`) REFERENCES `adgroup_keyword` (`adgroup_google_id`); |
Partager