rake-db 2.3.29 → 2.3.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/package.json +11 -21
  2. package/.env +0 -1
  3. package/.env.local +0 -2
  4. package/.turbo/turbo-test.log +0 -22
  5. package/.turbo/turbo-test:ci.log +0 -22
  6. package/CHANGELOG.md +0 -388
  7. package/app/dbScript.ts +0 -33
  8. package/app/migrations/20221017181504_createUser.ts +0 -14
  9. package/app/migrations/20221017200111_createProfile.ts +0 -10
  10. package/app/migrations/20221017200252_createChat.ts +0 -9
  11. package/app/migrations/20221017200326_createChatUser.ts +0 -10
  12. package/app/migrations/20221017200900_createMessage.ts +0 -12
  13. package/app/migrations/20221017201235_createGeoSchema.ts +0 -5
  14. package/app/migrations/20221017210011_createCountry.ts +0 -8
  15. package/app/migrations/20221017210133_createCity.ts +0 -9
  16. package/app/migrations/20221105202843_createUniqueTable.ts +0 -12
  17. package/jest-setup.ts +0 -3
  18. package/rollup.config.js +0 -3
  19. package/src/ast.ts +0 -130
  20. package/src/commands/createOrDrop.test.ts +0 -214
  21. package/src/commands/createOrDrop.ts +0 -151
  22. package/src/commands/generate.test.ts +0 -136
  23. package/src/commands/generate.ts +0 -93
  24. package/src/commands/migrateOrRollback.test.ts +0 -267
  25. package/src/commands/migrateOrRollback.ts +0 -190
  26. package/src/common.test.ts +0 -295
  27. package/src/common.ts +0 -353
  28. package/src/errors.ts +0 -3
  29. package/src/index.ts +0 -8
  30. package/src/migration/change.test.ts +0 -16
  31. package/src/migration/change.ts +0 -15
  32. package/src/migration/changeTable.test.ts +0 -897
  33. package/src/migration/changeTable.ts +0 -566
  34. package/src/migration/createTable.test.ts +0 -384
  35. package/src/migration/createTable.ts +0 -193
  36. package/src/migration/migration.test.ts +0 -430
  37. package/src/migration/migration.ts +0 -518
  38. package/src/migration/migrationUtils.ts +0 -307
  39. package/src/migration/tableMethods.ts +0 -8
  40. package/src/pull/astToMigration.test.ts +0 -275
  41. package/src/pull/astToMigration.ts +0 -173
  42. package/src/pull/dbStructure.test.ts +0 -180
  43. package/src/pull/dbStructure.ts +0 -413
  44. package/src/pull/pull.test.ts +0 -115
  45. package/src/pull/pull.ts +0 -22
  46. package/src/pull/structureToAst.test.ts +0 -841
  47. package/src/pull/structureToAst.ts +0 -372
  48. package/src/rakeDb.test.ts +0 -131
  49. package/src/rakeDb.ts +0 -84
  50. package/src/test-utils.ts +0 -64
  51. package/tsconfig.json +0 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rake-db",
3
- "version": "2.3.29",
3
+ "version": "2.3.31",
4
4
  "description": "Migrations tool for Postgresql DB",
5
5
  "homepage": "https://orchid-orm.netlify.app/guide/migration-setup-and-overview.html",
6
6
  "repository": {
@@ -17,14 +17,18 @@
17
17
  "types": "./dist/index.d.ts"
18
18
  }
19
19
  },
20
+ "files": [
21
+ "dist"
22
+ ],
20
23
  "jest": {
24
+ "rootDir": "src",
21
25
  "setupFiles": [
22
26
  "dotenv/config"
23
27
  ],
24
- "globalSetup": "../../jest-global-setup.ts",
28
+ "globalSetup": "../../../jest-global-setup.ts",
25
29
  "setupFilesAfterEnv": [
26
- "../../jest-setup.ts",
27
- "./jest-setup.ts"
30
+ "../../../jest-setup.ts",
31
+ "../jest-setup.ts"
28
32
  ],
29
33
  "transform": {
30
34
  "^.+\\.ts$": "@swc/jest"
@@ -41,32 +45,18 @@
41
45
  "license": "ISC",
42
46
  "dependencies": {
43
47
  "pluralize": "^8.0.0",
44
- "pqb": "0.9.16",
48
+ "pqb": "0.9.18",
45
49
  "prompts": "^2.4.2"
46
50
  },
47
51
  "devDependencies": {
48
- "@swc/core": "^1.2.210",
49
- "@swc/helpers": "^0.4.12",
50
- "@swc/jest": "^0.2.21",
51
- "@types/jest": "^28.1.2",
52
- "@types/node": "^18.0.1",
53
- "@types/pluralize": "^0.0.29",
54
52
  "@types/prompts": "^2.4.2",
55
- "dotenv": "^16.0.3",
56
- "jest": "^28.1.2",
57
- "rimraf": "^3.0.2",
58
- "rollup": "^2.79.0",
59
- "rollup-plugin-dts": "^4.2.2",
60
- "rollup-plugin-esbuild": "^4.10.1",
61
- "ts-node": "^10.9.1",
62
- "tsconfig-paths": "^4.1.0",
63
- "tslib": "^2.4.0",
64
- "typescript": "^4.7.4"
53
+ "tsconfig-paths": "^4.1.2"
65
54
  },
66
55
  "scripts": {
67
56
  "db": "ts-node -r tsconfig-paths/register app/dbScript.ts",
68
57
  "test": "jest --watch --verbose false",
69
58
  "check": "jest",
59
+ "types": "tsc",
70
60
  "test:ci": "jest --coverage --coverageReporters json-summary",
71
61
  "build": "rimraf ./dist/ && rollup -c --rollup.config"
72
62
  }
package/.env DELETED
@@ -1 +0,0 @@
1
- DATABASE_URL=postgres://postgres:@localhost:5432/orchid-orm
package/.env.local DELETED
@@ -1,2 +0,0 @@
1
- DATABASE_URL=postgres://postgres:@localhost:5432/porm
2
- #DATABASE_URL=postgres://romeerez:e2Y6ovIJruas@ep-autumn-tooth-279704.eu-central-1.aws.neon.tech/neondb?ssl=true
@@ -1,22 +0,0 @@
1
-
2
- > rake-db@2.3.22 test /home/romeo/dev/my/orchid-orm/packages/rake-db
3
- > jest "--coverage" "--coverageReporters" "json-summary"
4
-
5
- PASS src/migration/migration.test.ts
6
- PASS src/commands/createOrDrop.test.ts
7
- PASS src/commands/migrateOrRollback.test.ts
8
- PASS src/migration/changeTable.test.ts
9
- PASS src/common.test.ts
10
- PASS src/pull/dbStructure.test.ts
11
- PASS src/rakeDb.test.ts
12
- PASS src/pull/structureToAst.test.ts
13
- PASS src/commands/generate.test.ts
14
- PASS src/pull/astToMigration.test.ts
15
- PASS src/migration/createTable.test.ts
16
- PASS src/pull/pull.test.ts
17
-
18
- Test Suites: 12 passed, 12 total
19
- Tests: 182 passed, 182 total
20
- Snapshots: 0 total
21
- Time: 3.951 s
22
- Ran all test suites.
@@ -1,22 +0,0 @@
1
-
2
- > rake-db@2.3.24 test:ci /home/romeo/dev/my/orchid-orm/packages/rake-db
3
- > jest --coverage --coverageReporters json-summary
4
-
5
- PASS src/commands/createOrDrop.test.ts
6
- PASS src/common.test.ts
7
- PASS src/migration/changeTable.test.ts
8
- PASS src/pull/structureToAst.test.ts
9
- PASS src/commands/migrateOrRollback.test.ts
10
- PASS src/migration/migration.test.ts
11
- PASS src/migration/createTable.test.ts
12
- PASS src/pull/astToMigration.test.ts
13
- PASS src/commands/generate.test.ts
14
- PASS src/pull/pull.test.ts
15
- PASS src/rakeDb.test.ts
16
- PASS src/pull/dbStructure.test.ts
17
-
18
- Test Suites: 12 passed, 12 total
19
- Tests: 184 passed, 184 total
20
- Snapshots: 0 total
21
- Time: 6.736 s
22
- Ran all test suites.
package/CHANGELOG.md DELETED
@@ -1,388 +0,0 @@
1
- # rake-db
2
-
3
- ## 2.3.29
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies
8
- - pqb@0.9.16
9
-
10
- ## 2.3.28
11
-
12
- ### Patch Changes
13
-
14
- - Support enum in rake-db
15
-
16
- ## 2.3.26
17
-
18
- ### Patch Changes
19
-
20
- - Add createEnum and dropEnum to rake-db
21
- - Updated dependencies
22
- - pqb@0.9.15
23
-
24
- ## 2.3.25
25
-
26
- ### Patch Changes
27
-
28
- - Updated dependencies
29
- - pqb@0.9.14
30
-
31
- ## 2.3.24
32
-
33
- ### Patch Changes
34
-
35
- - Handle ssl required case in db create; Confirm db creation before asking for creds
36
-
37
- ## 2.3.23
38
-
39
- ### Patch Changes
40
-
41
- - Updated dependencies
42
- - pqb@0.9.13
43
-
44
- ## 2.3.22
45
-
46
- ### Patch Changes
47
-
48
- - Fix file resolution in CI
49
-
50
- ## 2.3.21
51
-
52
- ### Patch Changes
53
-
54
- - Improve windows support for path resolution
55
-
56
- ## 2.3.20
57
-
58
- ### Patch Changes
59
-
60
- - Fix path resolution
61
-
62
- ## 2.3.19
63
-
64
- ### Patch Changes
65
-
66
- - Fix path resolution
67
-
68
- ## 2.3.18
69
-
70
- ### Patch Changes
71
-
72
- - Relative path in rakeDb config
73
-
74
- ## 2.3.17
75
-
76
- ### Patch Changes
77
-
78
- - Updated dependencies
79
- - pqb@0.9.12
80
-
81
- ## 2.3.16
82
-
83
- ### Patch Changes
84
-
85
- - Updated dependencies
86
- - pqb@0.9.11
87
-
88
- ## 2.3.15
89
-
90
- ### Patch Changes
91
-
92
- - Updated dependencies
93
- - pqb@0.9.10
94
-
95
- ## 2.3.14
96
-
97
- ### Patch Changes
98
-
99
- - Updated dependencies
100
- - pqb@0.9.9
101
-
102
- ## 2.3.13
103
-
104
- ### Patch Changes
105
-
106
- - ee1961e: Make columnTypes optional in configs
107
- - Updated dependencies [ee1961e]
108
- - pqb@0.9.8
109
-
110
- ## 2.3.12
111
-
112
- ### Patch Changes
113
-
114
- - Handle table ordering by foreign key when pulling db
115
- - Updated dependencies
116
- - pqb@0.9.7
117
-
118
- ## 2.3.11
119
-
120
- ### Patch Changes
121
-
122
- - Add generating extension to db pull
123
-
124
- ## 2.3.10
125
-
126
- ### Patch Changes
127
-
128
- - Add custom commands to rake-db
129
-
130
- ## 2.3.9
131
-
132
- ### Patch Changes
133
-
134
- - Add migrate and rollback callbacks
135
-
136
- ## 2.3.8
137
-
138
- ### Patch Changes
139
-
140
- - Updated dependencies
141
- - pqb@0.9.6
142
-
143
- ## 2.3.7
144
-
145
- ### Patch Changes
146
-
147
- - Mix query builder into migration db interface
148
- - Updated dependencies
149
- - pqb@0.9.5
150
-
151
- ## 2.3.6
152
-
153
- ### Patch Changes
154
-
155
- - Improve esm support
156
- - Updated dependencies
157
- - pqb@0.9.4
158
-
159
- ## 2.3.5
160
-
161
- ### Patch Changes
162
-
163
- - Change package.json exports for esm support
164
- - Updated dependencies
165
- - pqb@0.9.3
166
-
167
- ## 2.3.4
168
-
169
- ### Patch Changes
170
-
171
- - Remove createJoinTable
172
-
173
- ## 2.3.3
174
-
175
- ### Patch Changes
176
-
177
- - Improve pullindg db structure
178
-
179
- ## 2.3.2
180
-
181
- ### Patch Changes
182
-
183
- - Improve pulling db structure
184
- - Updated dependencies
185
- - pqb@0.9.2
186
-
187
- ## 2.3.1
188
-
189
- ### Patch Changes
190
-
191
- - Add command for pulling database structure into a migration
192
- - Updated dependencies
193
- - pqb@0.9.1
194
-
195
- ## 2.3.0
196
-
197
- ### Minor Changes
198
-
199
- - Change index options: column or expression is required, operator renamed to opclass
200
-
201
- ### Patch Changes
202
-
203
- - f1cd5db: Handle multiple indexes and foreignKeys of the column
204
- - Updated dependencies
205
- - Updated dependencies [f1cd5db]
206
- - pqb@0.9.0
207
-
208
- ## 2.2.6
209
-
210
- ### Patch Changes
211
-
212
- - Change inner aspects of columns
213
- - Updated dependencies
214
- - pqb@0.8.5
215
-
216
- ## 2.2.5
217
-
218
- ### Patch Changes
219
-
220
- - Fix useCodeUpdater option default
221
-
222
- ## 2.2.4
223
-
224
- ### Patch Changes
225
-
226
- - Add --code cli argument to rake-db
227
- - Improve codegen
228
- - Updated dependencies
229
- - Updated dependencies
230
- - pqb@0.8.4
231
-
232
- ## 2.2.3
233
-
234
- ### Patch Changes
235
-
236
- - Updated dependencies
237
- - pqb@0.8.3
238
-
239
- ## 2.2.2
240
-
241
- ### Patch Changes
242
-
243
- - Add code generator to change project files after migrations
244
- - Updated dependencies
245
- - pqb@0.8.2
246
-
247
- ## 2.2.1
248
-
249
- ### Patch Changes
250
-
251
- - Updated dependencies
252
- - pqb@0.8.1
253
-
254
- ## 2.2.0
255
-
256
- ### Minor Changes
257
-
258
- - 3f25b4d: Rename all model words to table words, because all models here are not models in OOP meaning
259
-
260
- ### Patch Changes
261
-
262
- - Updated dependencies [3f25b4d]
263
- - pqb@0.8.0
264
-
265
- ## 2.1.18
266
-
267
- ### Patch Changes
268
-
269
- - Updated dependencies
270
- - pqb@0.7.13
271
-
272
- ## 2.1.17
273
-
274
- ### Patch Changes
275
-
276
- - Support composite primary key by setting primaryKey on multiple columns
277
-
278
- ## 2.1.16
279
-
280
- ### Patch Changes
281
-
282
- - Updated dependencies
283
- - pqb@0.7.12
284
-
285
- ## 2.1.15
286
-
287
- ### Patch Changes
288
-
289
- - Fix creating a transaction
290
-
291
- ## 2.1.14
292
-
293
- ### Patch Changes
294
-
295
- - Updated dependencies
296
- - pqb@0.7.11
297
-
298
- ## 2.1.13
299
-
300
- ### Patch Changes
301
-
302
- - Updated dependencies
303
- - pqb@0.7.10
304
-
305
- ## 2.1.12
306
-
307
- ### Patch Changes
308
-
309
- - Updated dependencies
310
- - pqb@0.7.9
311
-
312
- ## 2.1.11
313
-
314
- ### Patch Changes
315
-
316
- - Change connectionString to databaseURL option, add ssl option
317
- - Updated dependencies
318
- - pqb@0.7.8
319
-
320
- ## 2.1.10
321
-
322
- ### Patch Changes
323
-
324
- - Updated dependencies
325
- - pqb@0.7.7
326
-
327
- ## 2.1.9
328
-
329
- ### Patch Changes
330
-
331
- - Updated dependencies
332
- - pqb@0.7.6
333
-
334
- ## 2.1.8
335
-
336
- ### Patch Changes
337
-
338
- - Updated dependencies
339
- - pqb@0.7.5
340
-
341
- ## 2.1.7
342
-
343
- ### Patch Changes
344
-
345
- - Update homepage link in package.json
346
- - Updated dependencies
347
- - pqb@0.7.4
348
-
349
- ## 2.1.6
350
-
351
- ### Patch Changes
352
-
353
- - Add required min and max parameters to text column
354
- - Updated dependencies
355
- - pqb@0.7.3
356
-
357
- ## 2.1.5
358
-
359
- ### Patch Changes
360
-
361
- - Updated dependencies [9b8b3d5]
362
- - pqb@0.7.2
363
-
364
- ## 2.1.4
365
-
366
- ### Patch Changes
367
-
368
- - Handle tables without primary key
369
- - ecd7521: Support copy
370
- - Updated dependencies
371
- - pqb@0.7.1
372
-
373
- ## 2.1.3
374
-
375
- ### Patch Changes
376
-
377
- - 06b0182: Support changing compression, index, and foreign key to changeTable migration
378
-
379
- ## 2.1.0
380
-
381
- ### Minor Changes
382
-
383
- - 883c3e4: Add changeset
384
-
385
- ### Patch Changes
386
-
387
- - Updated dependencies [883c3e4]
388
- - pqb@0.7.0
package/app/dbScript.ts DELETED
@@ -1,33 +0,0 @@
1
- import { config } from 'dotenv';
2
- import path from 'path';
3
- import { rakeDb } from '../src/rakeDb';
4
- import { AdapterOptions } from 'pqb';
5
- import { appCodeUpdater } from '../../orm/src';
6
-
7
- config({ path: path.resolve('.env.local') });
8
- config();
9
-
10
- const options: AdapterOptions[] = [];
11
-
12
- const databaseURL = process.env.DATABASE_URL;
13
- if (!databaseURL) {
14
- throw new Error('DATABASE_URL is missing in .env');
15
- }
16
-
17
- options.push({ databaseURL });
18
-
19
- const databaseURLTest = process.env.DATABASE_URL_TEST;
20
- if (databaseURLTest) {
21
- options.push({ databaseURL: databaseURLTest });
22
- }
23
-
24
- rakeDb(options, {
25
- migrationsPath: 'migrations',
26
- appCodeUpdater: appCodeUpdater({
27
- tablePath: (tableName) => `tables/${tableName}.ts`,
28
- baseTablePath: 'lib/baseTable.ts',
29
- baseTableName: 'BaseTable',
30
- mainFilePath: 'db.ts',
31
- }),
32
- useCodeUpdater: false,
33
- });
@@ -1,14 +0,0 @@
1
- import { change } from '../../src';
2
-
3
- change(async (db) => {
4
- await db.createTable('user', (t) => ({
5
- id: t.serial().primaryKey(),
6
- name: t.text(),
7
- password: t.text(),
8
- picture: t.text().nullable(),
9
- data: t.json((t) => t.any()).nullable(),
10
- age: t.integer().nullable(),
11
- active: t.boolean().nullable(),
12
- ...t.timestamps(),
13
- }));
14
- });
@@ -1,10 +0,0 @@
1
- import { change } from '../../src';
2
-
3
- change(async (db) => {
4
- await db.createTable('profile', (t) => ({
5
- id: t.serial().primaryKey(),
6
- userId: t.integer().foreignKey('user', 'id').nullable(),
7
- bio: t.text().nullable(),
8
- ...t.timestamps(),
9
- }));
10
- });
@@ -1,9 +0,0 @@
1
- import { change } from '../../src';
2
-
3
- change(async (db) => {
4
- await db.createTable('chat', (t) => ({
5
- id: t.serial().primaryKey(),
6
- title: t.text(),
7
- ...t.timestamps(),
8
- }));
9
- });
@@ -1,10 +0,0 @@
1
- import { change } from '../../src';
2
-
3
- change(async (db) => {
4
- await db.createTable('chatUser', (t) => ({
5
- chatId: t.integer().foreignKey('chat', 'id'),
6
- userId: t.integer().foreignKey('user', 'id'),
7
- ...t.timestamps(),
8
- ...t.primaryKey(['chatId', 'userId']),
9
- }));
10
- });
@@ -1,12 +0,0 @@
1
- import { change } from '../../src';
2
-
3
- change(async (db) => {
4
- await db.createTable('message', (t) => ({
5
- id: t.serial().primaryKey(),
6
- chatId: t.integer().foreignKey('chat', 'id').index(),
7
- authorId: t.integer().foreignKey('user', 'id').nullable().index(),
8
- text: t.text(),
9
- meta: t.json((t) => t.any()).nullable(),
10
- ...t.timestamps(),
11
- }));
12
- });
@@ -1,5 +0,0 @@
1
- import { change } from '../../src';
2
-
3
- change(async (db) => {
4
- await db.createSchema('geo');
5
- });
@@ -1,8 +0,0 @@
1
- import { change } from '../../src';
2
-
3
- change(async (db) => {
4
- await db.createTable('geo.country', (t) => ({
5
- id: t.serial().primaryKey(),
6
- name: t.text(),
7
- }));
8
- });
@@ -1,9 +0,0 @@
1
- import { change } from '../../src';
2
-
3
- change(async (db) => {
4
- await db.createTable('geo.city', (t) => ({
5
- id: t.serial().primaryKey(),
6
- name: t.text(),
7
- countryId: t.integer().foreignKey('geo.country', 'id'),
8
- }));
9
- });
@@ -1,12 +0,0 @@
1
- import { change } from '../../src';
2
-
3
- change(async (db) => {
4
- await db.createTable('uniqueTable', (t) => ({
5
- id: t.serial().primaryKey(),
6
- one: t.text().unique(),
7
- two: t.integer().unique(),
8
- thirdColumn: t.text(),
9
- fourthColumn: t.integer(),
10
- ...t.unique(['thirdColumn', 'fourthColumn']),
11
- }));
12
- });
package/jest-setup.ts DELETED
@@ -1,3 +0,0 @@
1
- jest.mock('pqb', () => require('../qb/pqb/src'), {
2
- virtual: true,
3
- });
package/rollup.config.js DELETED
@@ -1,3 +0,0 @@
1
- import config from '../../rollup.config';
2
-
3
- export default config;