/*@
<h2>SQL Init For Amp Simple Slider Table</h2>

NOTE: This sql file is counting on a string replace of "prefix_"
before being ran. Ideally being ran with $wpdb and a str_replace("table_prefix_", $wpdb->prefix, $contents).

<strong>Table: prefix_simple_slides</strong>
<strong>Columns:</strong>
<ul>
<li><strong>ID - bigint(20):</strong> Part of the primary key, controls the order of the slides.</li>
<li><strong>SliderID - bigint(20):</strong> Part of the primary key, is also a FK that points to the post record that the slide is tied to.</li>
<li><strong>Content - Text:</strong> content for the individual slide</li>
<li><strong>ContentAlignment - varchar(6):</strong> Horizontal placement of the content.</li>
<li><strong>ButtonOne - varchar(255):</strong> Content, Link and target settings seperated by ";"</li>
<li><strong>ButtonTwo - varchar(255):</strong> Content, Link and target settings seperated by ";"</li>
<li><strong>ButtonAlignment - varchar(6):</strong> Horizontal placement of the buttons within the content constraints</li>
<li><strong>BackgroundID - bigint(20):</strong> FK that points to the post record for the background image selected.</li>
<li><strong>BackgroundAlignment - varchar(20):</strong> The focal point setting for the background. Either an X;Y rule or a generic background position rule seperated by ";"</li>
<li><strong>Constraint - Float:</strong> Custom content constraint, this is a percentage that at max the content of the slide will take up within the slider constraints.</li>
</ul>
@*/
ALTER TABLE prefix_posts ENGINE = InnoDB;

create table prefix_simple_sliders(
	`ID` bigint(20) unsigned not null,
	`Constraint` varchar(20),
	`Ratio` varchar(20),
	`Arrows` Boolean,
	`ArrowPrev` varchar(255),
	`ArrowNext` varchar(255),
	`ArrowColor` varchar(50),
	`Dots` Boolean,
	`DotThumbnails` Boolean,
	`DotColor` varchar(50),
	`TransitionTime` int(10),
	primary key (ID)
);

ALTER TABLE prefix_simple_sliders ENGINE = InnoDB;

ALTER TABLE prefix_simple_sliders
ADD CONSTRAINT FK_prefix_Slider_Post_ID
FOREIGN KEY (ID) REFERENCES prefix_posts(ID)
ON DELETE CASCADE;

create table prefix_simple_slides(
	`ID` bigint(20) unsigned not null,
	`SliderID` bigint(20) unsigned not null,
	`ColumnCount` int(1) unsigned default 1,
	`ColumnWidth1` VARCHAR(255) default '100',
	`ColumnWidth2` VARCHAR(255),
	`ColumnWidth3` VARCHAR(255),
	`Content` Text,
	`Content2` Text,
	`Content3` Text,
	`ContentBackground` varchar(50),
	`ContentBackground2` varchar(50),
	`ContentBackground3` varchar(50),
	`ContentColor` varchar(50),
	`ContentColor2` varchar(50),
	`ContentColor3` varchar(50),
	`ContentAlignment` varchar(6) default 'Center',
	`ButtonOne` varchar(255),
	`ButtonOne2` varchar(255),
	`ButtonOne3` varchar(255),
	`ButtonTwo` varchar(255),
	`ButtonTwo2` varchar(255),
	`ButtonTwo3` varchar(255),
	`ButtonThree` varchar(255),
	`ButtonThree2` varchar(255),
	`ButtonThree3` varchar(255),
	`ButtonAlignment` varchar(6) default 'Center',
	`ButtonAlignment2` varchar(6) default 'Center',
	`ButtonAlignment3` varchar(6) default 'Center',
	`BackgroundID` bigint(20) unsigned,
	`YouTubeID` varchar(255), 
	`BackgroundAlignment` varchar(100) default 'Center;Center',
	`BackgroundOverlay` varchar(50),
	`BackgroundOverlayAdv` varchar(255),
	`Constraint` float,
	`ConstraintMobile` float,
	`SlideLink` varchar(255),
	primary key (ID, SliderID)
);

ALTER TABLE prefix_simple_slides ENGINE = InnoDB;

ALTER TABLE prefix_simple_slides
ADD CONSTRAINT FK_prefix_SliderID
FOREIGN KEY (SliderID) REFERENCES prefix_posts(ID)
ON DELETE CASCADE;

ALTER TABLE prefix_simple_slides
ADD CONSTRAINT FK_prefix_BackgroundID
FOREIGN KEY (BackgroundID) REFERENCES prefix_posts(ID)
ON DELETE SET NULL;
