https://github.com/soat-fiap/bmb.database
Manages the database schema and related files for the BMB application. It includes SQL scripts for creating tables, inserting data, and updating the schema, along with Terraform configurations to manage the database infrastructure, ensuring consistency and ease of deployment.
https://github.com/soat-fiap/bmb.database
aws aws-aurora fiap sql terraform
Last synced: 3 months ago
JSON representation
Manages the database schema and related files for the BMB application. It includes SQL scripts for creating tables, inserting data, and updating the schema, along with Terraform configurations to manage the database infrastructure, ensuring consistency and ease of deployment.
- Host: GitHub
- URL: https://github.com/soat-fiap/bmb.database
- Owner: soat-fiap
- Created: 2024-07-24T14:09:33.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-12-04T13:41:20.000Z (7 months ago)
- Last Synced: 2025-01-29T07:31:20.458Z (5 months ago)
- Topics: aws, aws-aurora, fiap, sql, terraform
- Language: HCL
- Homepage:
- Size: 740 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bmb.database
[](https://github.com/soat-fiap/bmb.database/actions/workflows/terraform.yaml)
## Project Overview
This project contains the database schema and related files for the BMB application. The schema is defined using SQL scripts and managed with Terraform.
## Folder Structure
```
/bmb.database/
├── README.md
├── main.tf
├── variables.tf
├── outputs.tf
├── terraform.tfvars
└── scripts/
├── create_table_script.sql
```## Dependencies
- [VPC](https://github.com/soat-fiap/bmb.infra)## Getting Started
To get started with this project, ensure you have Terraform installed. Then, initialize and apply the Terraform configuration:
```sh
terraform init
terraform apply
```## ERD
```mermaid
erDiagram
Products {
char(36) Id
varchar(100) Name
varchar(200) Description
int Category
decimal(10) Price
varchar(1000) Images
}
Orders {
char(36) Id
char(36) CustomerId
char(36) PaymentId
int Status
datetime Created
datetime Updated
varchar(7) TrackingCode
}
OrderItems {
char(36) OrderId
char(36) ProductId
varchar(200) ProductName
decimal UnitPrice
int Quantity
}
Orders ||--|{ OrderItems : "contains"
Products ||--o{ OrderItems : "included in"
```## No more Customers table
The Customers table was removed from the schema as we've integrated Amazon Cognito for user management. This leverages a robust, existing solution for the generic subdomain of user/customer management.## Why MySql?
I've decided to use MySQL as the database for the fast-food ordering system following the reasons below:* **Simplicity:**
* Easy installation, configuration, and management, ideal for both the development team and the production environment.
* Familiar and widely used SQL syntax, simplifying query writing and maintenance.
* **Performance:**
* High performance for **TRANSACTIONAL OPERATIONS**, ensuring fast processing of orders and payments, even during peak hours.
* Efficient query optimization and indexing features for quick response times.
* **Reliability:**
* Data integrity features and ACID properties (Atomicity, Consistency, Isolation, Durability) guarantee information consistency and security.
* **Cost-effectiveness:**
* Open-source solution with no licensing costs, making it an affordable option for the project.
* Extensive user community and comprehensive documentation readily available online.* **Aurora Serverless**
- I've also chosed to use Aurora Serverless, so I can take advantage of all serverless features like no need fo managing database servers, updates, patching and of course availability andscalability
## This repo on the infrastructure