https://github.com/kenken64/ibfb12022-workshop24
https://github.com/kenken64/ibfb12022-workshop24
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kenken64/ibfb12022-workshop24
- Owner: kenken64
- Created: 2023-02-02T17:31:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-03T05:32:54.000Z (over 2 years ago)
- Last Synced: 2025-04-24T03:39:48.698Z (about 2 months ago)
- Language: Java
- Size: 102 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Workshop 24
```
CREATE SCHEMA `shensang` ;
``````
CREATE TABLE `purchase_order` (
`order_id` char(8) NOT NULL,
`notes` text,
`order_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`customer_name` varchar(128) DEFAULT NULL,
`shipping_address` varchar(128) DEFAULT NULL,
`tax` decimal(2,2) DEFAULT '0.05',
PRIMARY KEY (`order_id`)
)```
```
CREATE TABLE `line_item` (
`item_id` int NOT NULL AUTO_INCREMENT,
`product` varchar(64) NOT NULL,
`quantity` int DEFAULT '1',
`order_id` char(8) NOT NULL,
`unit_price` decimal(3,2) DEFAULT NULL,
`discount` decimal(2,2) DEFAULT '0.10',
PRIMARY KEY (`item_id`),
KEY `fk_order_id_idx` (`order_id`),
CONSTRAINT `fk_order_id` FOREIGN KEY (`order_id`) REFERENCES `purchase_order` (`order_id`)
)```
```
ALTER TABLE `shensang`.`purchase_order`
CHANGE COLUMN `tax` `tax` DECIMAL(2,2) NULL DEFAULT 0.05 ;
``````
ALTER TABLE `shensang`.`purchase_order`
CHANGE COLUMN `notes` `notes` TEXT NULL ;
```## Configure Spring Boot App connect to Railway MySQL
1. Make sure pom uses the latest MySQL Connector J driver```
com.mysql
mysql-connector-j
runtime```
2. Make sure the application.properties setup with the following attributes```
spring.datasource.url=${MYSQL_APP_URL}
spring.datasource.username=${MYSQL_APP_USER}
spring.datasource.password=${MYSQL_APP_PASSWORD}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
```3. Configure Railway App instance with the following env variables
