-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
64 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Define variables | ||
TAG=ghcr.io/cciuenf/rinha-backend-2024-q1 | ||
|
||
# Default target | ||
all: build | ||
|
||
# Build the Docker image | ||
build: | ||
docker build -t $(TAG) . | ||
|
||
# Run the application | ||
run: | ||
docker compose down && docker build -t $(TAG) . && docker compose up | ||
|
||
# Publish the Docker image | ||
publish: | ||
docker build -t $(TAG) . && docker push $(TAG) | ||
|
||
# Use .PHONY to specify that these are not file names | ||
.PHONY: build run publish |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
CREATE TABLE customers ( | ||
id SERIAL PRIMARY KEY, | ||
name VARCHAR(50) NOT NULL, | ||
max_limit INTEGER NOT NULL, | ||
balance INTEGER CHECK (balance >= -max_limit) NOT NULL | ||
); | ||
|
||
CREATE TABLE transactions( | ||
id SERIAL PRIMARY KEY, | ||
value INTEGER NOT NULL, | ||
customer_id INTEGER REFERENCES customers(id), | ||
type VARCHAR(1) CHECK (type IN ('c', 'd')) NOT NULL, | ||
description VARCHAR(10) NOT NULL, | ||
created_at TIMESTAMP DEFAULT now() NOT NULL | ||
); | ||
|
||
DO $$ | ||
BEGIN | ||
INSERT INTO customers (name, max_limit, balance) | ||
VALUES | ||
('o barato sai caro', 1000 * 100, 0), | ||
('zan corp ltda', 800 * 100, 0), | ||
('les cruders', 10000 * 100, 0), | ||
('padaria joia de cocaia', 100000 * 100, 0), | ||
('kid mais', 5000 * 100, 0); | ||
END; | ||
$$; |
This file contains 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
This file contains 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