Skip to content

Commit

Permalink
support crdb (#16)
Browse files Browse the repository at this point in the history
* support crdb

* fix action
  • Loading branch information
Lupennat committed Dec 27, 2023
1 parent 72d65a8 commit 59bc7ac
Show file tree
Hide file tree
Showing 19 changed files with 2,336 additions and 5,142 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [18.x, 16.x, 14.x]
database-type: [postgres11, postgres12, postgres13, postgres14, postgres15]
node-version: [18.x, 16.x]
database-type: [crdb221, crdb222, crdb231, postgres12, postgres13, postgres14, postgres15, postgres16]

steps:
- uses: actions/checkout@v3
Expand All @@ -33,7 +33,7 @@ jobs:
"${{ matrix.database-type }}"
- name: Run npm install
run: npm install
run: npm ci

- name: Initialize Database
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [18.x, 16.x, 14.x]
database-type: [postgres15]
node-version: [18.x, 16.x]
database-type: [postgres16]

steps:
- uses: actions/checkout@v3
Expand All @@ -33,7 +33,7 @@ jobs:
"${{ matrix.database-type }}"
- name: Run npm install
run: npm install
run: npm ci

- name: Initialize Database
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "14.x"
node-version: "16.x"
registry-url: "https://registry.npmjs.org"

- name: Install deps
run: npm install
run: npm ci
env:
CI: true

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project from 1.0.0 forward will be documented in thi
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.7.0] - 2023-12-27

### Added

- Support for cockroachdb

## [1.6.0] - 2023-03-23

### Changed
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

# Lupdo-postgres

[Lupdo](https://www.npmjs.com/package/lupdo) Driver For PostgreSql.
[Lupdo](https://www.npmjs.com/package/lupdo) Driver For PostgreSql and CockroachDB.

## Supported Databases

- [postgreSql](https://www.postgresql.org/) (v11,v12,v13,v14,v15)
- [postgreSql](https://www.postgresql.org/) (v12,v13,v14,v15,v16)
- [CockroachDB](https://www.cockroachlabs.com/) (v22.1,v22.2,v23.1)

## Third Party Library

Expand Down Expand Up @@ -97,7 +98,7 @@ Lupdo-postgres support numeric parameter with syntax `?`, you can escape it usin

## Kill Connection

Lupdo-postgres support kill query.
Lupdo-postgres support kill query (only for Postgress Database not CockroachDB).

## Postgres Returing

Expand Down
134 changes: 109 additions & 25 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,91 @@
version: '3'
services:
postgres11:
image: postgis/postgis:11-3.3-alpine
command: '-c full_page_writes=off -c fsync=off -c synchronous_commit=off'
services:
crdb221:
image: cockroachdb/cockroach:latest-v22.1
ports:
- '25431:5432'
- "26258:26257"
- "8085:8080"
command: start-single-node --insecure
environment:
- PGUSER=ludpo
- PGPASSWORD=lupdos3cRet
- PGDATABASE=test_db
- POSTGRES_USER=lupdo
- POSTGRES_PASSWORD=lupdos3cRet
- POSTGRES_DB=test_db
- COCKROACH_DATABASE=test_db
- COCKROACH_USER=lupdo
volumes:
- ./src/__tests__/data/pg11.sql:/docker-entrypoint-initdb.d/init.sql
- ./src/__tests__/data/crdb.sql:/docker-entrypoint-initdb.d/init.sql

waitcrdb221:
image: cockroachdb/cockroach:latest-v22.1
links:
- crdb221
depends_on:
- crdb221
environment:
- COCKROACH_DATABASE=test_db
- COCKROACH_USER=lupdo
- COCKROACH_HOST=crdb221
- COCKROACH_INSECURE=true
entrypoint:
- bash
- -c
- 'until cockroach sql --execute "SELECT 1"; do sleep 5; done'

crdb222:
image: cockroachdb/cockroach:latest-v22.2
ports:
- "26259:26257"
- "8086:8080"
command: start-single-node --insecure
environment:
- COCKROACH_DATABASE=test_db
- COCKROACH_USER=lupdo
volumes:
- ./src/__tests__/data/crdb.sql:/docker-entrypoint-initdb.d/init.sql

waitcrdb222:
image: cockroachdb/cockroach:latest-v22.2
links:
- crdb222
depends_on:
- crdb222
environment:
- COCKROACH_DATABASE=test_db
- COCKROACH_USER=lupdo
- COCKROACH_HOST=crdb222
- COCKROACH_INSECURE=true
entrypoint:
- bash
- -c
- 'until cockroach sql --execute "SELECT 1"; do sleep 5; done'

waitpostgres11:
image: postgis/postgis:11-3.3-alpine
crdb231:
image: cockroachdb/cockroach:latest-v23.1
ports:
- "26260:26257"
- "8087:8080"
command: start-single-node --insecure
environment:
- COCKROACH_DATABASE=test_db
- COCKROACH_USER=lupdo
volumes:
- ./src/__tests__/data/crdb23.sql:/docker-entrypoint-initdb.d/init.sql

waitcrdb231:
image: cockroachdb/cockroach:latest-v23.1
links:
- postgres11
- crdb231
depends_on:
- postgres11
- crdb231
environment:
- COCKROACH_DATABASE=test_db
- COCKROACH_USER=lupdo
- COCKROACH_HOST=crdb231
- COCKROACH_INSECURE=true
entrypoint:
- bash
- -c
- 'until /usr/local/bin/psql postgres://lupdo:lupdos3cRet@postgres11/test_db -c "SELECT 1"; do sleep 5; done'
- 'until cockroach sql --execute "SELECT 1"; do sleep 5; done'

postgres12:
image: postgis/postgis:12-3.3-alpine
image: postgis/postgis:12-3.4-alpine
command: '-c full_page_writes=off -c fsync=off -c synchronous_commit=off'
ports:
- '25432:5432'
Expand All @@ -42,7 +100,7 @@ services:
- ./src/__tests__/data/pg11.sql:/docker-entrypoint-initdb.d/init.sql

waitpostgres12:
image: postgis/postgis:12-3.3-alpine
image: postgis/postgis:12-3.4-alpine
links:
- postgres12
depends_on:
Expand All @@ -53,7 +111,7 @@ services:
- 'until /usr/local/bin/psql postgres://lupdo:lupdos3cRet@postgres12/test_db -c "SELECT 1"; do sleep 5; done'

postgres13:
image: postgis/postgis:13-3.3-alpine
image: postgis/postgis:13-3.4-alpine
command: '-c full_page_writes=off -c fsync=off -c synchronous_commit=off'
ports:
- '25433:5432'
Expand All @@ -68,7 +126,7 @@ services:
- ./src/__tests__/data/pg13.sql:/docker-entrypoint-initdb.d/init.sql

waitpostgres13:
image: postgis/postgis:13-3.3-alpine
image: postgis/postgis:13-3.4-alpine
links:
- postgres13
depends_on:
Expand All @@ -79,7 +137,7 @@ services:
- 'until /usr/local/bin/psql postgres://lupdo:lupdos3cRet@postgres13/test_db -c "SELECT 1"; do sleep 5; done'

postgres14:
image: postgis/postgis:14-3.3-alpine
image: postgis/postgis:14-3.4-alpine
command: '-c full_page_writes=off -c fsync=off -c synchronous_commit=off'
ports:
- '25434:5432'
Expand All @@ -94,7 +152,7 @@ services:
- ./src/__tests__/data/pg13.sql:/docker-entrypoint-initdb.d/init.sql

waitpostgres14:
image: postgis/postgis:14-3.3-alpine
image: postgis/postgis:14-3.4-alpine
links:
- postgres14
depends_on:
Expand All @@ -105,7 +163,7 @@ services:
- 'until /usr/local/bin/psql postgres://lupdo:lupdos3cRet@postgres14/test_db -c "SELECT 1"; do sleep 5; done'

postgres15:
image: postgis/postgis:15-3.3-alpine
image: postgis/postgis:15-3.4-alpine
command: '-c full_page_writes=off -c fsync=off -c synchronous_commit=off'
ports:
- '25435:5432'
Expand All @@ -120,7 +178,7 @@ services:
- ./src/__tests__/data/pg13.sql:/docker-entrypoint-initdb.d/init.sql

waitpostgres15:
image: postgis/postgis:15-3.3-alpine
image: postgis/postgis:15-3.4-alpine
links:
- postgres15
depends_on:
Expand All @@ -129,3 +187,29 @@ services:
- bash
- -c
- 'until /usr/local/bin/psql postgres://lupdo:lupdos3cRet@postgres15/test_db -c "SELECT 1"; do sleep 5; done'

postgres16:
image: postgis/postgis:16-3.4-alpine
command: '-c full_page_writes=off -c fsync=off -c synchronous_commit=off'
ports:
- '25436:5432'
environment:
- PGUSER=ludpo
- PGPASSWORD=lupdos3cRet
- PGDATABASE=test_db
- POSTGRES_USER=lupdo
- POSTGRES_PASSWORD=lupdos3cRet
- POSTGRES_DB=test_db
volumes:
- ./src/__tests__/data/pg13.sql:/docker-entrypoint-initdb.d/init.sql

waitpostgres16:
image: postgis/postgis:16-3.4-alpine
links:
- postgres16
depends_on:
- postgres16
entrypoint:
- bash
- -c
- 'until /usr/local/bin/psql postgres://lupdo:lupdos3cRet@postgres16/test_db -c "SELECT 1"; do sleep 5; done'

0 comments on commit 59bc7ac

Please sign in to comment.