INSERT INTO `ma_DLibraryCategory` (`id`, `title`, `alias`, `sorter`) VALUES
(7, 'Vendor RFP', 'vendor-rfp', 35);

INSERT INTO `ma_DPageItemType` (`id`, `type`, `title`, `sorter`) VALUES
(57, 'Library\\VendorRfp\\', 'Vendor RFP', 620);

ALTER TABLE `ma_Library` ADD `userId` int(10) unsigned DEFAULT NULL AFTER `sendTo`;
ALTER TABLE `ma_Library`
ADD CONSTRAINT `ma_Library_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `ma_User` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;


INSERT INTO `ma_SettingsCategory` (`id`, `name`, `system`, `sorter`) VALUES (NULL, 'Library', 'n', '120');

SET @categoryId := (SELECT id FROM ma_SettingsCategory WHERE name = 'Library');

INSERT INTO `ma_Settings` (`name`, `idCategory`, `fieldType`, `label`, `value`, `options`, `description`, `required`, `system`, `sorter`, `added`, `changed`) VALUES
('deleteRfpAfterDays', @categoryId, 'numeric', 'Automatically delete RFP files older than', '90', '', '', 'y', 'n', 0, NOW(), NOW());

INSERT INTO `ma_SettingsOptions` (`id`, `name`, `variable`, `value`, `type`, `sorter`) VALUES
(null, 'deleteRfpAfterDays', 'append', 'days', 'string', NULL),
(null, 'deleteRfpAfterDays', 'negative', '0', 'int', NULL),
(null, 'deleteRfpAfterDays', 'precision', '0', 'int', NULL);
