Browse Source

remove old dist stuff

master
peter 2 years ago
parent
commit
72b735bf01

+ 2
- 2
.drone.yml View File

@@ -43,9 +43,9 @@ steps:
43 43
   - git config --global user.email "${DRONE_COMMIT_AUTHOR_EMAIL}"
44 44
   - git config --global user.name "${DRONE_COMMIT_AUTHOR}"
45 45
   - git clone https://gitea.frontblock.me/fb-dist/${DRONE_REPO_NAME}.git
46
-  - mv ./${DRONE_REPO_NAME}/.git .
46
+  - mv ./${DRONE_REPO_NAME}/.git ./bak
47 47
   - rm -rf ./${DRONE_REPO_NAME}/*
48
-  - mv .git ./${DRONE_REPO_NAME} 
48
+  - mv ./bak ./${DRONE_REPO_NAME}/.git 
49 49
   - cp -r ./dist/* ./${DRONE_REPO_NAME}
50 50
   - cp -r ./static ./${DRONE_REPO_NAME}
51 51
   - cd ./${DRONE_REPO_NAME}

+ 1188
- 0
bak/CHANGELOG.md
File diff suppressed because it is too large
View File


+ 182
- 0
bak/CONTRIBUTING.md View File

@@ -0,0 +1,182 @@
1
+## How to contribute to Knex.js
2
+
3
+- Make changes in the `/lib` directory. 
4
+
5
+- Before sending a pull request for a feature or bug fix, be sure to have
6
+  [tests](https://github.com/tgriesser/knex/tree/master/test). Every pull request that changes the queries should have
7
+  also **integration tests which are ran against real database** (in addition to unit tests which checks which kind of queries
8
+  are being created).
9
+
10
+- Use the same coding style as the rest of the
11
+  [codebase](https://github.com/tgriesser/knex/blob/master/knex.js).
12
+
13
+- All pull requests should be made to the `master` branch.
14
+
15
+- Pull request description should have link to corresponding PR of documentation branch.
16
+
17
+- All pull requests that modify the public API should be updated in [types/index.d.ts](https://github.com/tgriesser/knex/blob/master/types/index.d.ts)
18
+
19
+## Documentation
20
+
21
+Documentation is no longer maintained in knex master repository. All the documentation pull requests should be sent to https://github.com/knex/documentation
22
+
23
+Documentation pull requests should not be merged before knex version which has the new documented feature is released.
24
+
25
+## I would like to add support for new dialect to knex, is it possible?
26
+
27
+Currently there are already way too many dialects supported in `knex` and instead of adding new dialect to central codebase, all the dialects should be moved to separate npm packages out from `knex` core library with their respective maintainers and test suites.
28
+
29
+So if you like to write your own dialect, you can just inherit own dialect from knex base classes and use it by passing dilaect to knex in knex configuration (https://runkit.com/embed/90b3cpyr4jh2):
30
+
31
+```js
32
+// simple dialect overriding sqlite3 dialect to use sqlite3-offline driver
33
+require('sqlite3-offline');
34
+const Knex = require('knex');
35
+
36
+const Dialect = require(`knex/lib/dialects/sqlite3/index.js`);
37
+Dialect.prototype._driver = () => require('sqlite3-offline');
38
+
39
+const knex = Knex({
40
+  client: Dialect,
41
+  connection: ':memory:',
42
+});
43
+
44
+console.log(knex.select(knex.raw(1)).toSQL());
45
+
46
+await knex.schema.createTable('fooobar', (t) => {
47
+  t.bigincrements('id');
48
+  t.string('data');
49
+});
50
+await knex('fooobar').insert({ data: 'nomnom' });
51
+
52
+console.log('Gimme all the data:', await knex('fooobar'));
53
+```
54
+
55
+## What is minimal code to reproduce bug and why I have to provide that when I can just tell whats the problem is
56
+
57
+Writing minimal reproduction code for the problem is time-consuming and sometimes it is also really hard, for
58
+example when the original code where the bug happens is written using express or mocha. So why is it necessary
59
+for me to commit so much time to it when the problem is in `knex`? Contributors should be grateful that I reported
60
+the bug I found.
61
+
62
+The point of runnable code to reproduce the problem is to easily verify that there really is a problem and that the one
63
+who did the report did nothing wrong (surprisingly often problem is in the user code). So instead of just description
64
+what to do the complete code encourages devs to actually test out that problem exists and start solving it and it
65
+saves lots of time.
66
+
67
+tl;dr list:
68
+
69
+1. Actually in most of the cases developer already figures out what was the problem when writing the minimal test case
70
+   or if there was problem how stuff was initialized or how async code was written it is easy to point out the problem.
71
+
72
+2. It motivates developer to actually try out if the bug really exist by not having to figure out from incomplete example
73
+   environment in which and how bug actually manifests.
74
+
75
+3. There are currently very few people fixing knex issues and if one has to put easily 15-30 minutes time to issue just
76
+   to see that I cannot reproduce this issue it just wastes development hours that were available for improving knex.
77
+
78
+Test case should initialize needed tables, insert needed data and fail...
79
+
80
+```
81
+const knex = require('knex')({
82
+  client: 'pg',
83
+  connection: 'postgres:///knex_test'
84
+});
85
+
86
+async function main() {
87
+  await knex.schema.createTable(...);
88
+  await knex('table').insert({foo: 'bar}');
89
+  await knex.destroy();
90
+}
91
+
92
+main();
93
+```
94
+
95
+Usually issues without reproduction code available are just closed and if the same issue is reported multiple
96
+times maybe someone looks into it.
97
+
98
+One easy way to setup database for your reproduction is to use database from knex's docker-compose setup (npm run db:start) and by checking the connection settings from tests' `test/knexfile.js`.
99
+
100
+## Integration Tests
101
+
102
+### The Easy Way
103
+
104
+By default, Knex runs tests against sqlite3, postgresql, mysql, mysql2, mssql and oracledb drivers. All databases can be initialized and ran with docker.
105
+
106
+Docker databases can be started and initialized and started with:
107
+
108
+```bash
109
+npm run db:start
110
+```
111
+
112
+and stopped with:
113
+
114
+```bash
115
+npm run db:stop
116
+```
117
+
118
+### Installing support for oracledb
119
+
120
+Oracle has started providing precompiled driver libs for all the platforms, which makes it viable to run oracle tests also locally against oracledb running in docker.
121
+
122
+Check message when running
123
+
124
+```bash
125
+npm install oracledb
126
+```
127
+
128
+and download driver library binary packages and unzip it to ~/lib directory.
129
+
130
+### Specifying Databases
131
+
132
+You can optionally specify which dialects to test using the `DB` environment variable. Values should be space separated and can include:
133
+
134
+- mysql
135
+- mysql2
136
+- postgres
137
+- sqlite3
138
+- oracledb
139
+- mssql
140
+
141
+```bash
142
+$ DB='postgres mysql' npm test
143
+```
144
+
145
+### Custom Configuration
146
+
147
+If you'd like to override the database configuration (to use a different host, for example), you can override the path to the [default test configuration](https://github.com/tgriesser/knex/blob/master/test/knexfile.js) using the `KNEX_TEST` environment variable.
148
+
149
+```bash
150
+$ KNEX_TEST='./path/to/my/config.js' npm test
151
+```
152
+
153
+### Creating Postgres User
154
+
155
+If you are running tests agains own local database one might need to setup test user and databse for knex to connect.
156
+
157
+To create a new user, login to Postgres and use the following queries to add the user. This assumes you've already created the `knex_test` database.
158
+
159
+```
160
+CREATE ROLE postgres WITH LOGIN PASSWORD '';
161
+GRANT ALL PRIVILEGES ON DATABASE "knex_test" TO postgres;
162
+```
163
+
164
+Once this is done, check it works by attempting to login:
165
+
166
+```
167
+psql -h localhost -U postgres -d knex_test
168
+```
169
+
170
+## Want to be Collaborator?
171
+
172
+There is always room for more collaborators. Be active on resolving github issues / sending pull requests / reviewing code and we will ask you to join.
173
+
174
+### Etiquette (/ˈɛtᵻkɛt/ or /ˈɛtᵻkɪt/, French: [e.ti.kɛt])
175
+
176
+Make pull requests for your changes, do not commit directly to master (release stuff like fixing changelog are ok though).
177
+
178
+All the pull requests must be peer reviewed by other collaborator, so don't merge your request before that. If there is no response ping others.
179
+
180
+If you are going to add new feature to knex (not just a bugfix) it should be discussed first with others to agree on details.
181
+
182
+Join Gitter chat if you feel to chat outside of github issues.

+ 22
- 0
bak/LICENSE View File

@@ -0,0 +1,22 @@
1
+Copyright (c) 2013-present Tim Griesser
2
+
3
+Permission is hereby granted, free of charge, to any person
4
+obtaining a copy of this software and associated documentation
5
+files (the "Software"), to deal in the Software without
6
+restriction, including without limitation the rights to use,
7
+copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+copies of the Software, and to permit persons to whom the
9
+Software is furnished to do so, subject to the following
10
+conditions:
11
+
12
+The above copyright notice and this permission notice shall be
13
+included in all copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+OTHER DEALINGS IN THE SOFTWARE.

+ 93
- 0
bak/README.md View File

@@ -0,0 +1,93 @@
1
+# [knex.js](http://knexjs.org)
2
+
3
+[![npm version](http://img.shields.io/npm/v/knex.svg)](https://npmjs.org/package/knex)
4
+[![npm downloads](https://img.shields.io/npm/dm/knex.svg)](https://npmjs.org/package/knex)
5
+[![Build Status](https://travis-ci.org/tgriesser/knex.svg?branch=master)](https://travis-ci.org/tgriesser/knex)
6
+[![Coverage Status](https://coveralls.io/repos/tgriesser/knex/badge.svg?branch=master)](https://coveralls.io/r/tgriesser/knex?branch=master)
7
+[![Dependencies Status](https://david-dm.org/tgriesser/knex.svg)](https://david-dm.org/tgriesser/knex)
8
+[![Gitter chat](https://badges.gitter.im/tgriesser/knex.svg)](https://gitter.im/tgriesser/knex)
9
+[![Language Grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/tgriesser/knex.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/tgriesser/knex/context:javascript)
10
+
11
+> **A SQL query builder that is _flexible_, _portable_, and _fun_ to use!**
12
+
13
+A batteries-included, multi-dialect (MSSQL, MySQL, PostgreSQL, SQLite3, Oracle (including Oracle Wallet Authentication)) query builder for
14
+Node.js, featuring:
15
+
16
+- [transactions](http://knexjs.org/#Transactions)
17
+- [connection pooling](http://knexjs.org/#Installation-pooling)
18
+- [streaming queries](http://knexjs.org/#Interfaces-Streams)
19
+- both a [promise](http://knexjs.org/#Interfaces-Promises) and [callback](http://knexjs.org/#Interfaces-Callbacks) API
20
+- a [thorough test suite](https://travis-ci.org/tgriesser/knex)
21
+- the ability to [run in the Browser](http://knexjs.org/#Installation-browser)
22
+
23
+Node.js versions 8+ are supported.
24
+
25
+[Read the full documentation to get started!](http://knexjs.org)  
26
+[Or check out our Recipes wiki to search for solutions to some specific problems](https://github.com/tgriesser/knex/wiki/Recipes)  
27
+If upgrading from older version, see [Upgrading instructions](https://github.com/tgriesser/knex/blob/master/UPGRADING.md)
28
+
29
+For support and questions, join the `#bookshelf` channel on freenode IRC
30
+
31
+For an Object Relational Mapper, see:
32
+
33
+- http://bookshelfjs.org
34
+- https://github.com/Vincit/objection.js
35
+
36
+To see the SQL that Knex will generate for a given query, see: [Knex Query Lab](http://michaelavila.com/knex-querylab/)
37
+
38
+## Examples
39
+
40
+We have several examples [on the website](http://knexjs.org). Here is the first one to get you started:
41
+
42
+```js
43
+const knex = require('knex')({
44
+  dialect: 'sqlite3',
45
+  connection: {
46
+    filename: './data.db',
47
+  },
48
+});
49
+
50
+// Create a table
51
+knex.schema
52
+  .createTable('users', function(table) {
53
+    table.increments('id');
54
+    table.string('user_name');
55
+  })
56
+
57
+  // ...and another
58
+  .createTable('accounts', function(table) {
59
+    table.increments('id');
60
+    table.string('account_name');
61
+    table
62
+      .integer('user_id')
63
+      .unsigned()
64
+      .references('users.id');
65
+  })
66
+
67
+  // Then query the table...
68
+  .then(function() {
69
+    return knex('users').insert({ user_name: 'Tim' });
70
+  })
71
+
72
+  // ...and using the insert id, insert into the other table.
73
+  .then(function(rows) {
74
+    return knex('accounts').insert({ account_name: 'knex', user_id: rows[0] });
75
+  })
76
+
77
+  // Query both of the rows.
78
+  .then(function() {
79
+    return knex('users')
80
+      .join('accounts', 'users.id', 'accounts.user_id')
81
+      .select('users.user_name as user', 'accounts.account_name as account');
82
+  })
83
+
84
+  // .map over the results
85
+  .map(function(row) {
86
+    console.log(row);
87
+  })
88
+
89
+  // Finally, add a .catch handler for the promise chain
90
+  .catch(function(e) {
91
+    console.error(e);
92
+  });
93
+```

+ 203
- 0
bak/package.json View File

@@ -0,0 +1,203 @@
1
+{
2
+  "_from": "knex@0.19.2",
3
+  "_id": "knex@0.19.2",
4
+  "_inBundle": false,
5
+  "_integrity": "sha512-TVYvlp2esS4LjjJSz8XuE48bPJq4N3lWnETQVgJ3hXPEqjiDjxcTa3bCn6F5ipQuBaMAAaFHNrqsZm7BttogdA==",
6
+  "_location": "/knex",
7
+  "_phantomChildren": {},
8
+  "_requested": {
9
+    "type": "version",
10
+    "registry": true,
11
+    "raw": "knex@0.19.2",
12
+    "name": "knex",
13
+    "escapedName": "knex",
14
+    "rawSpec": "0.19.2",
15
+    "saveSpec": null,
16
+    "fetchSpec": "0.19.2"
17
+  },
18
+  "_requiredBy": [
19
+    "#USER",
20
+    "/",
21
+    "/@types/knex",
22
+    "/frontblock-generic"
23
+  ],
24
+  "_resolved": "https://registry.npmjs.org/knex/-/knex-0.19.2.tgz",
25
+  "_shasum": "056efdb33fb8c77d3d76266b5d1d12dc483c21b5",
26
+  "_spec": "knex@0.19.2",
27
+  "_where": "/home/cake/FB/development/repos/vendor/admin",
28
+  "author": {
29
+    "name": "Tim Griesser",
30
+    "url": "https://github.com/tgriesser"
31
+  },
32
+  "bin": {
33
+    "knex": "./bin/cli.js"
34
+  },
35
+  "browser": {
36
+    "./lib/migrate/Migrator.js": "./lib/util/noop.js",
37
+    "./lib/bin/cli.js": "./lib/util/noop.js",
38
+    "./lib/seed/Seeder.js": "./lib/util/noop.js",
39
+    "mssql": false,
40
+    "mssql/lib/base": false,
41
+    "tedious": false,
42
+    "mysql": false,
43
+    "mysql2": false,
44
+    "pg": false,
45
+    "pg-query-stream": false,
46
+    "oracle": false,
47
+    "sqlite3": false,
48
+    "oracledb": false
49
+  },
50
+  "bugs": {
51
+    "url": "https://github.com/tgriesser/knex/issues"
52
+  },
53
+  "buildDependencies": [
54
+    "rimraf"
55
+  ],
56
+  "bundleDependencies": false,
57
+  "contributors": [
58
+    {
59
+      "name": "Simon Liden"
60
+    },
61
+    {
62
+      "name": "Mikael Lepisto"
63
+    },
64
+    {
65
+      "name": "Paul Gaurab",
66
+      "url": "https://lorefnon.tech"
67
+    },
68
+    {
69
+      "name": "Igor Savin",
70
+      "url": "https://www.codeflashbacks.com"
71
+    }
72
+  ],
73
+  "dependencies": {
74
+    "bluebird": "^3.5.5",
75
+    "colorette": "1.0.8",
76
+    "commander": "^2.20.0",
77
+    "debug": "4.1.1",
78
+    "getopts": "2.2.4",
79
+    "inherits": "~2.0.4",
80
+    "interpret": "^1.2.0",
81
+    "liftoff": "3.1.0",
82
+    "lodash": "^4.17.15",
83
+    "mkdirp": "^0.5.1",
84
+    "pg-connection-string": "2.0.0",
85
+    "tarn": "^2.0.0",
86
+    "tildify": "2.0.0",
87
+    "uuid": "^3.3.2",
88
+    "v8flags": "^3.1.3"
89
+  },
90
+  "deprecated": false,
91
+  "description": "A batteries-included SQL query & schema builder for Postgres, MySQL and SQLite3 and the Browser",
92
+  "devDependencies": {
93
+    "@types/node": "^10.14.13",
94
+    "JSONStream": "^1.3.5",
95
+    "chai": "^4.2.0",
96
+    "chai-subset-in-order": "^2.1.3",
97
+    "cli-testlab": "^1.7.0",
98
+    "coveralls": "^3.0.5",
99
+    "cross-env": "^5.2.0",
100
+    "dtslint": "^0.9.0",
101
+    "eslint": "^6.1.0",
102
+    "eslint-config-prettier": "^6.0.0",
103
+    "eslint-plugin-import": "^2.18.2",
104
+    "husky": "^3.0.1",
105
+    "jake": "^8.1.1",
106
+    "lint-staged": "^9.2.0",
107
+    "mocha": "^6.2.0",
108
+    "mock-fs": "^4.10.1",
109
+    "mssql": "^5.1.0",
110
+    "mysql": "^2.17.1",
111
+    "mysql2": "^1.6.5",
112
+    "nyc": "^14.1.1",
113
+    "pg": "^7.11.0",
114
+    "pg-query-stream": "^2.0.0",
115
+    "prettier": "^1.18.2",
116
+    "rimraf": "^2.6.3",
117
+    "sinon": "^7.3.2",
118
+    "sinon-chai": "^3.3.0",
119
+    "source-map-support": "^0.5.12",
120
+    "sqlite3": "^4.0.9",
121
+    "tap-spec": "^5.0.0",
122
+    "tape": "^4.11.0",
123
+    "toxiproxy-node-client": "^2.0.6",
124
+    "typescript": "^3.5.3",
125
+    "webpack-cli": "^3.3.6"
126
+  },
127
+  "engines": {
128
+    "node": ">=8"
129
+  },
130
+  "files": [
131
+    "CONTRIBUTING.md",
132
+    "README.md",
133
+    "bin/*",
134
+    "lib/*",
135
+    "lib/*",
136
+    "knex.js",
137
+    "LICENSE",
138
+    "CHANGELOG.md",
139
+    "scripts/*",
140
+    "types/index.d.ts",
141
+    "types/result.d.ts"
142
+  ],
143
+  "homepage": "https://knexjs.org",
144
+  "husky": {
145
+    "hooks": {
146
+      "pre-commit": "lint-staged"
147
+    }
148
+  },
149
+  "keywords": [
150
+    "sql",
151
+    "query",
152
+    "postgresql",
153
+    "mysql",
154
+    "sqlite3",
155
+    "oracle",
156
+    "mssql"
157
+  ],
158
+  "license": "MIT",
159
+  "lint-staged": {
160
+    "*.{js,json}": [
161
+      "prettier --write",
162
+      "git add"
163
+    ]
164
+  },
165
+  "main": "knex.js",
166
+  "name": "knex",
167
+  "nyc": {
168
+    "check-coverage": true,
169
+    "lines": 84,
170
+    "statements": 82,
171
+    "functions": 83,
172
+    "branches": 69
173
+  },
174
+  "react-native": {
175
+    "./lib/migrate": "./lib/util/noop.js",
176
+    "./lib/seed": "./lib/util/noop.js"
177
+  },
178
+  "repository": {
179
+    "type": "git",
180
+    "url": "git://github.com/tgriesser/knex.git"
181
+  },
182
+  "scripts": {
183
+    "coveralls": "nyc report --reporter=text-lcov | coveralls",
184
+    "db:start": "docker-compose -f scripts/docker-compose.yml up --build -d mysql oracledbxe postgres mssql; docker-compose -f scripts/docker-compose.yml up initmssqlknexdb waitmysql waitpostgres waitoracledbxe",
185
+    "db:stop": "docker-compose -f scripts/docker-compose.yml down",
186
+    "debug:tape": "node --inspect-brk test/tape/index.js",
187
+    "debug:test": "mocha --inspect-brk --exit -t 0 test/index.js",
188
+    "format": "prettier --write \"{lib,bin,scripts,test}/**/*.js\"",
189
+    "lint": "eslint \"lib/**/*.js\" \"test/**/*.js\"",
190
+    "lint:types": "dtslint types",
191
+    "stress:destroy": "docker-compose -f scripts/stress-test/docker-compose.yml stop",
192
+    "stress:init": "docker-compose -f scripts/stress-test/docker-compose.yml up --no-start && docker-compose -f scripts/stress-test/docker-compose.yml start",
193
+    "stress:test": "node scripts/stress-test/knex-stress-test.js |  grep -A 5 -B 60 -- '- STATS '",
194
+    "test": "mocha --exit -t 10000 test/index.js && npm run test:tape && npm run test:cli",
195
+    "test:cli": "cross-env KNEX_PATH=../knex.js KNEX=bin/cli.js jake -f test/jake/Jakefile",
196
+    "test:nyc": "nyc mocha --exit --check-leaks --globals __core-js_shared__ -t 10000 test/index.js && npm run test:tape && npm run test:cli",
197
+    "test:sqlite": "cross-env DB=sqlite3 npm test",
198
+    "test:tape": "node test/tape/index.js | tap-spec"
199
+  },
200
+  "tonicExampleFilename": "scripts/runkit-example.js",
201
+  "types": "types/index.d.ts",
202
+  "version": "0.19.2"
203
+}

+ 97
- 0
bak/scripts/docker-compose.yml View File

@@ -0,0 +1,97 @@
1
+version: '3'
2
+
3
+services:
4
+  mssql:
5
+    image: microsoft/mssql-server-linux:2017-latest
6
+    ports:
7
+      - '21433:1433'
8
+    environment:
9
+      - ACCEPT_EULA=Y
10
+      - SA_PASSWORD=S0meVeryHardPassword
11
+    healthcheck:
12
+      test: /opt/mssql-tools/bin/sqlcmd -S mssql -U sa -P 'S0meVeryHardPassword' -Q 'select 1'
13
+  initmssqlknexdb:
14
+    image: microsoft/mssql-server-linux:2017-latest
15
+    links:
16
+      - mssql
17
+    depends_on:
18
+      - mssql
19
+    entrypoint:
20
+      - bash
21
+      - -c
22
+      - 'until /opt/mssql-tools/bin/sqlcmd -S mssql -U sa -P S0meVeryHardPassword -d master -Q "CREATE DATABASE knex_test"; do sleep 5; done'
23
+
24
+  mysql:
25
+    image: mysql
26
+    command: --default-authentication-plugin=mysql_native_password
27
+    ports:
28
+      - '23306:3306'
29
+    environment:
30
+      - MYSQL_ROOT_PASSWORD=testrootpassword
31
+      - MYSQL_DATABASE=knex_test
32
+      - MYSQL_USER=testuser
33
+      - MYSQL_PASSWORD=testpassword
34
+    healthcheck:
35
+      test:
36
+        [
37
+          'CMD',
38
+          '/usr/bin/mysql',
39
+          '-hlocalhost',
40
+          '-utestuser',
41
+          '-ptestpassword',
42
+          '-e',
43
+          'SELECT 1',
44
+        ]
45
+      interval: 30s
46
+      timeout: 5s
47
+      retries: 3
48
+    restart: always
49
+  waitmysql:
50
+    image: mysql
51
+    links:
52
+      - mysql
53
+    depends_on:
54
+      - mysql
55
+    entrypoint:
56
+      - bash
57
+      - -c
58
+      - 'until /usr/bin/mysql -hmysql -utestuser -ptestpassword -e "SELECT 1"; do sleep 5; done'
59
+
60
+  postgres:
61
+    image: postgres:alpine
62
+    ports:
63
+      - '25432:5432'
64
+    environment:
65
+      - POSTGRES_USER=testuser
66
+      - POSTGRES_PASSWORD=knextest
67
+      - POSTGRES_DB=knex_test
68
+  waitpostgres:
69
+    image: postgres:alpine
70
+    links:
71
+      - postgres
72
+    depends_on:
73
+      - postgres
74
+    entrypoint:
75
+      - bash
76
+      - -c
77
+      - 'until /usr/local/bin/psql postgres://testuser:knextest@postgres/knex_test -c "SELECT 1"; do sleep 5; done'
78
+
79
+  oracledbxe:
80
+    image: quillbuilduser/oracle-18-xe
81
+    container_name: oracledbxe_container
82
+    ports:
83
+      - '21521:1521'
84
+    environment:
85
+      - ORACLE_ALLOW_REMOTE=true
86
+  waitoracledbxe:
87
+    image: quillbuilduser/oracle-18-xe
88
+    links:
89
+      - oracledbxe
90
+    depends_on:
91
+      - oracledbxe
92
+    environment:
93
+      - ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE
94
+    entrypoint:
95
+      - bash
96
+      - -c
97
+      - 'until /opt/oracle/product/18c/dbhomeXE/bin/sqlplus -s sys/Oracle18@oracledbxe/XE as sysdba <<< "SELECT 13376411 FROM DUAL; exit;" | grep "13376411"; do echo "Could not connect to oracle... sleep for a while"; sleep 5; done'

+ 24
- 0
bak/scripts/next-release-howto.md View File

@@ -0,0 +1,24 @@
1
+# Checklist for crating knex @next releases
2
+
3
+1. Go through all commits since the last release and add them to CHANGELOG.md under unreleased changes section.
4
+2. Commit changes to CHANGELOG
5
+3. Check that master compiles and tests are running fine (check also that CI tests are passing)
6
+
7
+```
8
+      npm run build
9
+
10
+      # run bunch of tests, but skipping coverage which doesn't really work locally at least
11
+      npm plaintest
12
+      npm bin_test
13
+      npm oracledb:test
14
+      npm mssql:init
15
+      npm mssql:test
16
+      npm mssql:destroy
17
+```
18
+
19
+4. Update package.json version to be e.g. 0.16.0-next1 or 0.16.0-next2 and commit yo master
20
+5. Publish it under @next tag 
21
+
22
+```
23
+      npm publish --tag next
24
+```

+ 34
- 0
bak/scripts/release.sh View File

@@ -0,0 +1,34 @@
1
+#!/bin/bash -e
2
+
3
+changelog=node_modules/.bin/changelog
4
+
5
+update_version() {
6
+  echo "$(node -p "p=require('./${1}');p.version='${2}';JSON.stringify(p,null,2)")" > $1
7
+  echo "Updated ${1} version to ${2}"
8
+}
9
+
10
+current_version=$(node -p "require('./package').version")
11
+
12
+printf "Next version (current is $current_version)? "
13
+read next_version
14
+
15
+if ! [[ $next_version =~ ^[0-9]\.[0-9]+\.[0-9](-.+)? ]]; then
16
+  echo "Version must be a valid semver string, e.g. 1.0.2 or 2.3.0-beta.1"
17
+  exit 1
18
+fi
19
+
20
+next_ref="v$next_version"
21
+
22
+git add -u
23
+
24
+npm run build
25
+npm test
26
+
27
+update_version 'package.json' $next_version
28
+
29
+git commit -am "release $next_version"
30
+git tag $next_version
31
+
32
+git push --tags
33
+
34
+npm publish

+ 18
- 0
bak/scripts/stress-test/README.txt View File

@@ -0,0 +1,18 @@
1
+# Test scripts to evaluate stability of drivers / pool etc.
2
+
3
+# To run this test you need to be in this directory + have node >= 8
4
+# and startup docker containers with proxy and sql servers
5
+
6
+docker-compose up --no-start
7
+docker-compose start
8
+
9
+# Select different test script to run:
10
+
11
+node mysql2-random-hanging-every-now-and-then.js 2> /dev/null | grep -B500 -A2 -- "- STATS" 
12
+node mysql2-sudden-exit-without-error
13
+node knex-stress-test.js | grep -A 3 -- "- STATS "
14
+node reconnect-test-mysql-based-drivers.js 2> /dev/null | grep -A 3 -- "- STATS "
15
+
16
+# Shut down docker instances when done:
17
+
18
+docker-compose down

+ 47
- 0
bak/scripts/stress-test/docker-compose.yml View File

@@ -0,0 +1,47 @@
1
+version: '3'
2
+
3
+services:
4
+  toxiproxy:
5
+    image: shopify/toxiproxy
6
+    ports:
7
+      - "8474:8474"
8
+      - "23306:23306"
9
+      - "25432:25432"
10
+      - "21521:21521"
11
+      - "21433:21433"
12
+    links:
13
+      - "mysql"
14
+      - "postgresql"
15
+      - "oracledbxe"
16
+      - "mssql"
17
+
18
+  mysql:
19
+    image: mysql:5.7
20
+    ports:
21
+      - "33306:3306"
22
+    environment:
23
+      - TZ=UTC
24
+      - MYSQL_ROOT_PASSWORD=mysqlrootpassword
25
+
26
+  postgresql:
27
+    image: mdillon/postgis
28
+    ports:
29
+      - "35432:5432"
30
+    environment:
31
+      - POSTGRES_PASSWORD=postgresrootpassword
32
+      - POSTGRES_USER=postgres
33
+
34
+  oracledbxe:
35
+    image: wnameless/oracle-xe-11g
36
+    ports:
37
+      - "31521:1521"
38
+    environment:
39
+      - ORACLE_ALLOW_REMOTE=true
40
+
41
+  mssql:
42
+    image: microsoft/mssql-server-linux:2017-latest
43
+    ports:
44
+      - "31433:1433"
45
+    environment:
46
+      - ACCEPT_EULA=Y
47
+      - SA_PASSWORD=S0meVeryHardPassword

Loading…
Cancel
Save