Created
March 10, 2021 21:52
-
-
Save geshan/87f97f8b6332ab9acdda39605dadffa2 to your computer and use it in GitHub Desktop.
Markdium-Node.js MySQL Transaction: a step-by-step tutorial with a real-life example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE `product` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, | |
| `sku` char(6) COLLATE utf8_unicode_ci NOT NULL, | |
| `price` int(11) NOT NULL COMMENT 'in cents', | |
| `quantity` int(11) NOT NULL, | |
| `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
| PRIMARY KEY (`id`), | |
| UNIQUE INDEX `sku` (`sku` ASC) VISIBLE | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; | |
| CREATE TABLE `sales_order` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `items` text COLLATE utf8_unicode_ci NOT NULL, | |
| `total` int(11) NOT NULL, | |
| `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment