Skip to content

Instantly share code, notes, and snippets.

@5A5K1A
Created March 20, 2017 12:07
Show Gist options
  • Save 5A5K1A/eb0d42413e3c8b2c0bcc9cb00609d59e to your computer and use it in GitHub Desktop.
Save 5A5K1A/eb0d42413e3c8b2c0bcc9cb00609d59e to your computer and use it in GitHub Desktop.
SQL query to create the `zichtnews` database with `comments` table (https://github.com/5A5K1A/zichtnieuws)
-- Create database: `prefix_zichtnieuws`
CREATE DATABASE IF NOT EXISTS `prefix_zichtnieuws` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `prefix_zichtnieuws`;
-- Create table `comments` including it's structure
DROP TABLE IF EXISTS `comments`;
CREATE TABLE IF NOT EXISTS `comments` (
`ID` bigint(20) unsigned NOT NULL,
`post_id` bigint(20) NOT NULL,
`author_name` varchar(100) NOT NULL,
`author_email` varchar(100) NOT NULL,
`comment` longtext NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Set Primary key index for table `comments`
ALTER TABLE `comments` ADD PRIMARY KEY (`ID`);
-- Set AUTO_INCREMENT on ID for table `comments`
ALTER TABLE `comments` MODIFY `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment