Skip to content

Instantly share code, notes, and snippets.

@ChinnakornP
Created September 20, 2018 15:24
Show Gist options
  • Save ChinnakornP/41d9999584d7d0c5626efbc69ab32cb2 to your computer and use it in GitHub Desktop.
Save ChinnakornP/41d9999584d7d0c5626efbc69ab32cb2 to your computer and use it in GitHub Desktop.
CREATE TABLE `orders` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`total_price` DECIMAL(18,2) NOT NULL ,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `order_line_items` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`order_id` int(10) unsigned NOT NULL,
`product_id` int(10) unsigned NOT NULL,
`price` int(10),
`discount` int(10),
`amount` int(10),
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `products` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` DECIMAL(18,2) NOT NULL UNIQUE ,
`total` int(10) NOT NULL
`price` decimal(18,2) NOT NULL
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `product_stocks` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`product_id` DECIMAL(18,2) NOT NULL UNIQUE ,
`type` VARCHAR(20) NOT NULL,
`amount` VARCHAR(20) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment