<?php
// Добавляем столбец owner_id для поддержки множества субадминистраторов
$result = run_query("SHOW COLUMNS FROM `" . $config['table_prefix'] . "format` LIKE 'owner_id'");
if (!sql_fetch_assoc($result)) {
    run_query("ALTER TABLE `" . $config['table_prefix'] . "format` ADD `owner_id` INT(11) NOT NULL DEFAULT 0");
}

$result = run_query("SHOW COLUMNS FROM `" . $config['table_prefix'] . "filters` LIKE 'owner_id'");
if (!sql_fetch_assoc($result)) {
    run_query("ALTER TABLE `" . $config['table_prefix'] . "filters` ADD `owner_id` INT(11) NOT NULL DEFAULT 0");
}

$result = run_query("SHOW COLUMNS FROM `" . $config['table_prefix'] . "forms` LIKE 'owner_id'");
if (!sql_fetch_assoc($result)) {
    run_query("ALTER TABLE `" . $config['table_prefix'] . "forms` ADD `owner_id` INT(11) NOT NULL DEFAULT 0");
}

$result = run_query("SHOW COLUMNS FROM `" . $config['table_prefix'] . "tips` LIKE 'owner_id'");
if (!sql_fetch_assoc($result)) {
    run_query("ALTER TABLE `" . $config['table_prefix'] . "tips` ADD `owner_id` INT(11) NOT NULL DEFAULT 0");
}

$result = run_query("SHOW COLUMNS FROM `" . $config['table_prefix'] . "questionare` LIKE 'owner_id'");
if (!sql_fetch_assoc($result)) {
    run_query("ALTER TABLE `" . $config['table_prefix'] . "questionare` ADD `owner_id` INT(11) NOT NULL DEFAULT 0");
}
?>