-- ADD NEW COLUMNS TO NEWSLETTERMEMBERS
ALTER TABLE `newslettermembers`
    ADD `GUID` VARCHAR(255) NOT NULL AFTER `IDLNK`,
    ADD `Auth` Text NOT NULL AFTER `DateAdded`;

-- ADD NEW TABLE NEWSLETTERCATEGORIES
CREATE TABLE `newslettercategories` (
  `IDLNK` int(11) NOT NULL,
  `User_ID_LNK` int(11) NOT NULL,
  `Category` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

ALTER TABLE `newslettercategories`
  ADD PRIMARY KEY (`IDLNK`);

ALTER TABLE `newslettercategories`
  MODIFY `IDLNK` int(11) NOT NULL AUTO_INCREMENT;

-- ADD CATEGORIES COLUMN TO NEWS TABLE
ALTER TABLE `news` ADD `Categories` VARCHAR(255) NOT NULL AFTER `Content`;

-- ADD MAILOUT CATEGORIES FIELD TO SITE CONFIG
INSERT INTO `config` (`Friendly_Name`, `Config`, `Setting`, `Description`, `Type`, `WJPS`) VALUES
('News Mailout Categories', 'NEWSMAILOUTCATEGORIES', '1:Group1;2:Group2;3:Group3', 'Categories Users can opt to sign up for when registering for News Mailouts.', 'text', 1);

