Skip to content

Commit

Permalink
SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Jun 27, 2024
1 parent 222f104 commit ca90c22
Show file tree
Hide file tree
Showing 11 changed files with 1,124 additions and 237 deletions.
30 changes: 8 additions & 22 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
on: pull_request
name: Review
jobs:
markdownlint:
runs-on: ubuntu-20.04
name: markdownlint
markdown-coding-standards:
name: Markdown coding standards
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn packages
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Yarn install
uses: actions/setup-node@v2
with:
node-version: '16'
- run: yarn install
- name: markdownlint
run: yarn coding-standards-check/markdownlint
uses: actions/checkout@v4

- name: Coding standards
run: |
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md'
19 changes: 19 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"default": true,
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
"line-length": {
"line_length": 120,
"code_blocks": false,
"tables": false
},
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
"no-duplicate-heading": {
"siblings_only": true
},
"no-inline-html": {
"allowed_elements": [
"code",
"kbd"
]
}
}
12 changes: 0 additions & 12 deletions .markdownlintrc

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Coding standards

```sh
docker run --tty --interactive --rm --volume ${PWD}:/app --workdir /app node:18 yarn install
docker run --tty --interactive --rm --volume ${PWD}:/app --workdir /app node:18 yarn coding-standards-check
```shell
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md' --fix
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint --ignore vendor --ignore LICENSE.md '**/*.md'
```
14 changes: 0 additions & 14 deletions package.json

This file was deleted.

1,044 changes: 1,044 additions & 0 deletions sql/.docker/dumps/northwind.sql

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions sql/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=itk-dev-workshop-sql
13 changes: 13 additions & 0 deletions sql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SQL for begyndere

``` shell
# Start the show
docker compose up --pull always --detach
# Connect to database
docker compose exec mariadb mariadb --user=db --password=db db
```

``` shell
docker compose exec --no-TTY mariadb mariadb --table --user=db --password=db db <<< 'SHOW TABLES'
docker compose exec --no-TTY mariadb mariadb --table --user=db --password=db db < examples/select-customers.sql
```
23 changes: 23 additions & 0 deletions sql/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
services:
mariadb:
image: mariadb:lts
# image: itkdev/mariadb:latest
restart: always
volumes:
# https://hub.docker.com/_/mariadb#:~:text=Initializing%20the%20database%20contents
- .docker/dumps:/docker-entrypoint-initdb.d
environment:
# https://mariadb.com/kb/en/mariadb-server-docker-official-image-environment-variables/
- MARIADB_ROOT_PASSWORD=password
- MARIADB_USER=db
- MARIADB_PASSWORD=db
- MARIADB_DATABASE=db
# https://mariadb.com/kb/en/using-healthcheck-sh/
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
start_period: 10s
interval: 10s
timeout: 5s
retries: 3
ports:
- "3306:3306"
13 changes: 13 additions & 0 deletions sql/examples/select-customers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SELECT
*
FROM
Customers
LIMIT 10
;

SELECT
*
FROM
Customers
LIMIT 1
\G
186 changes: 0 additions & 186 deletions yarn.lock

This file was deleted.

0 comments on commit ca90c22

Please sign in to comment.