/*
 Navicat Premium Data Transfer

 Source Server         : smallcubed
 Source Server Type    : MySQL
 Source Server Version : 50627
 Source Host           : mysql.smallcubed.com
 Source Database       : release

 Target Server Type    : MySQL
 Target Server Version : 50627
 File Encoding         : utf-8

 Date: 04/20/2016 06:55:19 AM
*/

USE `release`;

-- ----------------------------
--  Table structure for `release_information`
-- ----------------------------
CREATE TABLE `release_information` (
  `product` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `version` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `build` mediumint(6) NOT NULL,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `release_html` text COLLATE utf8_unicode_ci,
  `release_json` text COLLATE utf8_unicode_ci,
  `file_name` varchar(256) COLLATE utf8_unicode_ci,
  `min_os` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `build_type` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `git_commit` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
  `git_branch` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
  KEY `date` (`date`),
  KEY `status_index` (`build_type`) USING BTREE,
  KEY `git_branch` (`git_branch`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


-- Changes for SmallCubed Feed Endpoint (27 Oct 2020)

ALTER TABLE `release_information`
  ADD COLUMN `file_url` VARCHAR(256) DEFAULT '' AFTER `file_name`,
  ADD COLUMN `signature` VARCHAR(100) DEFAULT '' AFTER `git_branch`,
  ADD COLUMN `identifier` VARCHAR(30) DEFAULT '' AFTER `signature`,
  ADD COLUMN `dest_name` VARCHAR(50) DEFAULT '' AFTER `identifier`,
  ADD KEY `code` (`code`),
  ADD KEY `build` (`build`);


--  Changes for Feed Endpoint change ( 23 Nov 2020)

ALTER TABLE `release`.`release_information`
	MODIFY COLUMN `git_commit` VARCHAR(64),
	ADD COLUMN `major_version` FLOAT DEFAULT 0 AFTER `version`;
  
UPDATE `release`.`release_information`
	SET `major_version` = CONVERT(SUBSTR(`version`, 1, (LOCATE('.', `version`) - 1)), UNSIGNED INTEGER)
	WHERE `version` IS NOT NULL;
  
  
--  Changes for Feed Endpoint change with Sparkle ( 24 Dec 2023)

ALTER TABLE `release`.`release_information`
	ADD COLUMN `file_size` INT(13) DEFAULT 0 AFTER `file_url`;
  
--  Changes for Big, Long branch names ( 19 March 2024)

ALTER TABLE `release`.`release_information`
	MODIFY COLUMN `git_branch` VARCHAR(100) COLLATE utf8_unicode_ci DEFAULT NULL;
  
