`forced_ads_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`forced_ads_ad_url` VARCHAR( 255 ) NULL DEFAULT NULL ,
`forced_ads_click_url` VARCHAR( 255 ) NOT NULL ,
-`forced_ads_width` SMALLINT( 3 ) NULL DEFAULT NULL ,
-`forced_ads_height` SMALLINT( 3 ) NULL DEFAULT NULL ,
+`forced_ads_width` SMALLINT( 3 ) UNSIGNED NULL DEFAULT NULL ,
+`forced_ads_height` SMALLINT( 3 ) UNSIGNED NULL DEFAULT NULL ,
`forced_ads_alt_text` VARCHAR( 255 ) NULL DEFAULT NULL ,
`forced_ads_framebreaker` ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'Y',
-`forced_ads_counter_views` BIGINT( 20 ) NOT NULL DEFAULT 0,
-`forced_ads_counter_clicks` BIGINT( 20 ) NOT NULL DEFAULT 0,
-`forced_ads_reload_lock` BIGINT( 20 ) NOT NULL DEFAULT 0,
-`forced_ads_min_stay` BIGINT( 20 ) NOT NULL DEFAULT 0,
+`forced_ads_views_counter` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT 0,
+`forced_ads_clicks_counter` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT 0,
+`forced_ads_reload_lock` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT 0,
+`forced_ads_min_stay` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY ( `forced_ads_id` )
) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Ads Data'");
addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns`');
addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_campaigns` (
`forced_campaign_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
-`forced_ads_id` BIGINT( 20 ) UNSIGNED NOT NULL ,
`forced_campaign_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
`forced_campaign_status` ENUM( 'ACTIVE', 'PENDING', 'EXPIRED', 'LOCKED' ) NOT NULL DEFAULT 'PENDING',
`forced_campaign_lock_reason` VARCHAR( 255 ) NULL DEFAULT NULL ,
`forced_campaign_lock_timetstamp` TIMESTAMP NULL DEFAULT NULL ,
`forced_campaign_expired` TIMESTAMP NULL DEFAULT NULL ,
-`forced_campaign_ordered_clicks` BIGINT( 20 ) NOT NULL DEFAULT 0,
+`forced_campaign_ordered_clicks` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT 0,
`forced_campaign_costs_api` FLOAT( 20 , 5 ) UNSIGNED NULL DEFAULT NULL,
`forced_campaign_price_api` FLOAT( 20 , 5 ) UNSIGNED NULL DEFAULT NULL,
`forced_costs_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL,
-INDEX ( `forced_ads_id` ),
INDEX ( `forced_costs_id` ),
PRIMARY KEY ( `forced_campaign_id` )
) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaign Data'");
- // - Campaigns<->User
+ // - Campaigns <-> Ads
+ addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_ads`');
+ addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_campaigns_ads` (
+`forced_campaign_ads_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
+`forced_campaign_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
+`forced_ads_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
+UNIQUE `ads_campaign` ( `forced_campaign_id` , `forced_ads_id` ),
+PRIMARY KEY ( `forced_campaign_ads_id` )
+) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Forced Campaigns<->Ads'");
+
+ // - Campaigns <-> User
addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_user`');
addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_forced_campaigns_user` (
`forced_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
-`forced_campaign_id` BIGINT( 20 ) UNSIGNED NOT NULL ,
+`forced_campaign_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
`forced_user_id` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
`forced_user_type` ENUM( 'MEMBER', 'SPONSOR', 'ADMIN', 'API' ) NULL DEFAULT NULL ,
UNIQUE `forced_campaign_user` ( `forced_campaign_id` , `forced_user_id` , `forced_user_type` ),
// SQL commands to run
addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_ads`');
addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns`');
+ addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_ads`');
addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_campaigns_user`');
addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_forced_costs`');
break;