mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 04:12:13 +00:00
PL/pg SQL: improve README => add requirements
This commit is contained in:
parent
06e425cc2b
commit
d2588417f5
@ -1,9 +1,25 @@
|
|||||||
|
# Requirements
|
||||||
|
You'll need:
|
||||||
|
- PostgreSQL database, version >= 11 because PROCEDURE keyword isn't supported before [version 11](https://www.postgresql.org/docs/11/release-11.html)
|
||||||
|
- OS user with local connection privilege to database on standard 5432 port
|
||||||
|
|
||||||
|
To use remote / local dockerized database, add ``` --host --port --username``` parameters to plsql invocation.
|
||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
Create database structure: psql -f ./structure/create.sql
|
In shell:
|
||||||
Load code into database psql -f ./code/update_quality.sql -d gilded_rose
|
- create database: ```createdb gilded_rose```
|
||||||
Load test data into database: psql -f ./test/data/load.sql -d gilded_rose
|
- create item table (structure): ```psql -d gilded_rose -f ./structure/create.sql```
|
||||||
Execute: CALL update_quality();
|
- load code into database: ```psql -d gilded_rose -f ./code/update_quality.sql ```
|
||||||
Check results: SELECT * FROM items;
|
|
||||||
|
If you get this message```LINE 1: CREATE OR REPLACE PROCEDURE public.update_quality()```, your PostgreSQL version may under 11, consider upgrading.
|
||||||
|
|
||||||
|
# Interactive run
|
||||||
|
In shell:
|
||||||
|
- load test data into database: ```psql -d gilded_rose -f ./test/data/load.sql```
|
||||||
|
- connect to CLI: ```psql -d gilded_rose```
|
||||||
|
- check item state: ```SELECT * FROM item;```
|
||||||
|
- execute item update: ```CALL update_quality();```
|
||||||
|
- check item state: ```SELECT * FROM item;```
|
||||||
|
|
||||||
# Test
|
# Test
|
||||||
No test code provided, only a sample of test data
|
No test code provided, only a sample of test data
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
CREATE DATABASE gilded_rose;
|
|
||||||
|
|
||||||
\connect gilded_rose;
|
|
||||||
|
|
||||||
CREATE TABLE item (
|
CREATE TABLE item (
|
||||||
name CHARACTER VARYING(100) NOT NULL,
|
name CHARACTER VARYING(100) NOT NULL,
|
||||||
sellIn INTEGER,
|
sellIn INTEGER,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user