<?php
// Создание таблиц для хранения кликов по кнопкам и связанным таблицам
run_query("CREATE TABLE IF NOT EXISTS `" . $config['table_prefix'] . "activity_reltables` (
             `id` int(11) NOT NULL AUTO_INCREMENT,
             `user_id` int(11) NOT NULL,
             `table_id` int(11) NOT NULL,
             `rel_table` int(11) NOT NULL,
             `rel_field` int(11) NOT NULL,
             `clicks` int(11) NOT NULL,
             `last_click` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
             PRIMARY KEY (`id`),
             KEY `user_id` (`user_id`),
             KEY `table_id` (`table_id`),
             KEY `rel_table` (`rel_table`),
             KEY `rel_field` (`rel_field`)
             ) ENGINE=" . $config['db_engine']);

run_query("CREATE TABLE IF NOT EXISTS `" . $config['table_prefix'] . "activity_buttons` (
             `id` int(11) NOT NULL AUTO_INCREMENT,
             `user_id` int(11) NOT NULL,
             `table_id` int(11) NOT NULL,
             `button_id` int(11) NOT NULL,
             `button_sys` varchar(255) CHARACTER SET utf8 NOT NULL,
             `clicks` int(11) NOT NULL,
             `last_click` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
             PRIMARY KEY (`id`),
             KEY `user_id` (`user_id`),
             KEY `table_id` (`table_id`),
             KEY `button_id` (`button_id`)
             ) ENGINE=" . $config['db_engine']);
?>