Files
itflow/admin/database_updates/4.4.7.php

26 lines
1.2 KiB
PHP

<?php
/*
* ITFlow - Database update to version 4.4.7 (from 4.4.6)
* Included by admin/database_updates.php - do not access directly
*
* Assets linked to each other (functions/asset_link.php) - a label printer and the knife unit on
* it, a server and its disk shelf: asset_links, one row from each side of a link, so either reads
* it the same. A link goes when either asset is deleted.
*
* Re-runnable: the table is made only where it isn't there.
*/
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS `asset_links` (
`asset_id` int(11) NOT NULL,
`linked_asset_id` int(11) NOT NULL,
`asset_link_created_by` int(11) NOT NULL DEFAULT 0,
`asset_link_created_at` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`asset_id`,`linked_asset_id`),
KEY `asset_links_linked` (`linked_asset_id`),
CONSTRAINT `asset_links_asset` FOREIGN KEY (`asset_id`) REFERENCES `assets` (`asset_id`) ON DELETE CASCADE,
CONSTRAINT `asset_links_linked_asset` FOREIGN KEY (`linked_asset_id`) REFERENCES `assets` (`asset_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;");