--source include/have_innodb.inc
|
|
SET optimizer_use_condition_selectivity = 2;
|
|
CREATE TABLE `engine4_event_membership` (
|
`resource_id` int(11) unsigned NOT NULL,
|
`user_id` int(11) unsigned NOT NULL,
|
`active` tinyint(1) NOT NULL DEFAULT '0',
|
`resource_approved` tinyint(1) NOT NULL DEFAULT '0',
|
`user_approved` tinyint(1) NOT NULL DEFAULT '0',
|
`message` text COLLATE utf8_unicode_ci,
|
`rsvp` tinyint(3) NOT NULL DEFAULT '3',
|
`title` text COLLATE utf8_unicode_ci,
|
`behalf_guid` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
|
`additional_member_count` int(11) NOT NULL DEFAULT '1',
|
`come_with_count` int(11) NOT NULL DEFAULT '0',
|
PRIMARY KEY (`resource_id`,`user_id`),
|
KEY `REVERSE` (`user_id`),
|
KEY `BEHALF` (`behalf_guid`),
|
KEY `BEHALF_COMPOUND` (`resource_id`,`user_id`,`behalf_guid`)
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
CREATE TABLE `engine4_event_events` (
|
`event_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`title` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
|
`description` text COLLATE utf8_unicode_ci NOT NULL,
|
`user_id` int(11) unsigned NOT NULL,
|
`parent_type` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
|
`parent_id` int(11) unsigned NOT NULL,
|
`search` tinyint(1) NOT NULL DEFAULT '1',
|
`creation_date` datetime NOT NULL,
|
`modified_date` datetime NOT NULL,
|
`starttime` datetime NOT NULL,
|
`endtime` datetime NOT NULL,
|
`host` varchar(115) COLLATE utf8_unicode_ci NOT NULL,
|
`location` varchar(115) COLLATE utf8_unicode_ci NOT NULL,
|
`view_count` int(11) unsigned NOT NULL DEFAULT '0',
|
`member_count` int(11) unsigned NOT NULL DEFAULT '0',
|
`approval` tinyint(1) NOT NULL DEFAULT '0',
|
`invite` tinyint(1) NOT NULL DEFAULT '0',
|
`photo_id` int(11) unsigned NOT NULL,
|
`category_id` int(11) unsigned NOT NULL DEFAULT '0',
|
`is_private` tinyint(1) DEFAULT '0',
|
`person` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
`phone` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
`country` int(11) NOT NULL DEFAULT '0',
|
`region` int(11) NOT NULL DEFAULT '0',
|
`city` int(11) NOT NULL DEFAULT '0',
|
`adress` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
`website` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
`short_info` text COLLATE utf8_unicode_ci NOT NULL,
|
`membership_privacy` enum('no_confirm','confirm','invite') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'no_confirm',
|
`membership_no_confirm` enum('all','friends','parent_members','friends_and_parent_members','nobody') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'all',
|
`unique_name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
|
`region_part` int(11) NOT NULL DEFAULT '0',
|
PRIMARY KEY (`event_id`),
|
UNIQUE KEY `PROFILE_ADRESS` (`unique_name`),
|
KEY `user_id` (`user_id`),
|
KEY `parent_type` (`parent_type`,`parent_id`),
|
KEY `starttime` (`starttime`),
|
KEY `search` (`search`)
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
CREATE TABLE `engine4_activity_reposts` (
|
`repost_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`user_id` int(11) unsigned NOT NULL,
|
`subject_type` varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
|
`subject_id` int(11) unsigned NOT NULL,
|
`object_type` varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
|
`object_id` int(11) unsigned NOT NULL,
|
`params` text COLLATE utf8_unicode_ci,
|
`date` datetime NOT NULL,
|
`order` int(11) NOT NULL DEFAULT '0',
|
`autoposted` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
`is_private` int(1) NOT NULL DEFAULT '0',
|
PRIMARY KEY (`repost_id`),
|
UNIQUE KEY `BETWEEN` (`subject_type`,`subject_id`,`object_type`,`object_id`,`is_private`),
|
KEY `SUBJECT` (`subject_type`,`subject_id`),
|
KEY `OBJECT` (`object_type`,`object_id`)
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
SELECT
|
COUNT(1) AS `zend_paginator_row_count`
|
FROM
|
(
|
(
|
SELECT
|
`engine4_event_events`.*,
|
0 AS is_reposted
|
FROM
|
`engine4_event_events`
|
WHERE
|
((engine4_event_events.is_private = 0)) AND
|
((event_id in (SELECT
|
`engine4_event_membership`.`resource_id`
|
FROM
|
`engine4_event_membership`
|
WHERE
|
(user_id = 127994) AND (active = 1)
|
)
|
))
|
)
|
|
UNION
|
|
(
|
SELECT
|
`engine4_event_events`.*,
|
repost_id AS is_reposted
|
FROM
|
`engine4_activity_reposts` INNER JOIN `engine4_event_events`
|
WHERE
|
(engine4_activity_reposts.object_type = 'event') AND
|
(engine4_activity_reposts.object_id = engine4_event_events.event_id) AND
|
(engine4_activity_reposts.is_private = 0) AND
|
(engine4_activity_reposts.subject_id = 127994) AND
|
(engine4_activity_reposts.subject_type in ('user'))
|
)
|
) AS `t`;
|