Skip to content

Instantly share code, notes, and snippets.

@predominant
Created November 3, 2012 05:16
Show Gist options
  • Save predominant/4006133 to your computer and use it in GitHub Desktop.
Save predominant/4006133 to your computer and use it in GitHub Desktop.
Database Structure for CakePHP Workshop at PHP Matsuri 2012
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
`id` char(36) NOT NULL,
`name` varchar(100) NOT NULL,
`description` text NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `images`;
CREATE TABLE `images` (
`id` char(36) NOT NULL,
`name` varchar(255) NOT NULL,
`size` int(11) NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
`id` char(36) NOT NULL,
`user_id` char(36) NOT NULL,
`total` float(10,2) NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `orders_products`;
CREATE TABLE `orders_products` (
`id` char(36) NOT NULL,
`order_id` char(36) NOT NULL,
`product_id` char(36) NOT NULL,
`price` float(10,2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `products`;
CREATE TABLE `products` (
`id` char(36) NOT NULL,
`name` varchar(200) NOT NULL,
`description` text NOT NULL,
`category_id` char(36) NOT NULL,
`price` float(10,2) NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `products_images`;
CREATE TABLE `products_images` (
`id` char(36) NOT NULL,
`image_id` char(36) NOT NULL,
`product_id` char(36) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` char(36) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(128) NOT NULL,
`role` varchar(15) NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment