@anthonyalayo/drizzle-kit 1.0.1 → 1.0.4

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 (172) hide show
  1. package/api.d.mts +2891 -0
  2. package/api.d.ts +2891 -0
  3. package/api.js +47534 -0
  4. package/api.mjs +47521 -0
  5. package/bin.cjs +80043 -0
  6. package/{src/index.ts → index-Z-1TKnbX.d.mts} +123 -141
  7. package/index-Z-1TKnbX.d.ts +308 -0
  8. package/index.d.mts +2 -0
  9. package/index.d.ts +2 -0
  10. package/index.js +32 -0
  11. package/index.mjs +7 -0
  12. package/package.json +2 -2
  13. package/utils.js +6056 -0
  14. package/utils.mjs +6032 -0
  15. package/.gitignore +0 -25
  16. package/build.dev.ts +0 -51
  17. package/build.ts +0 -112
  18. package/imports-checker/analyze.ts +0 -78
  19. package/imports-checker/checker.ts +0 -296
  20. package/imports-checker/grammar/grammar.ohm +0 -121
  21. package/imports-checker/grammar/grammar.ohm-bundle.d.ts +0 -164
  22. package/imports-checker/grammar/grammar.ohm-bundle.js +0 -753
  23. package/imports-checker/index.ts +0 -48
  24. package/patches/difflib@0.2.4.patch +0 -31
  25. package/src/@types/utils.ts +0 -58
  26. package/src/api.ts +0 -504
  27. package/src/cli/commands/_es5.ts +0 -2
  28. package/src/cli/commands/check.ts +0 -52
  29. package/src/cli/commands/drop.ts +0 -60
  30. package/src/cli/commands/introspect.ts +0 -772
  31. package/src/cli/commands/libSqlPushUtils.ts +0 -355
  32. package/src/cli/commands/migrate.ts +0 -1526
  33. package/src/cli/commands/mysqlIntrospect.ts +0 -53
  34. package/src/cli/commands/mysqlPushUtils.ts +0 -352
  35. package/src/cli/commands/mysqlUp.ts +0 -102
  36. package/src/cli/commands/pgIntrospect.ts +0 -55
  37. package/src/cli/commands/pgPushUtils.ts +0 -269
  38. package/src/cli/commands/pgUp.ts +0 -217
  39. package/src/cli/commands/push.ts +0 -637
  40. package/src/cli/commands/singlestoreIntrospect.ts +0 -53
  41. package/src/cli/commands/singlestorePushUtils.ts +0 -456
  42. package/src/cli/commands/singlestoreUp.ts +0 -1
  43. package/src/cli/commands/sqliteIntrospect.ts +0 -96
  44. package/src/cli/commands/sqlitePushUtils.ts +0 -322
  45. package/src/cli/commands/sqliteUp.ts +0 -52
  46. package/src/cli/commands/utils.ts +0 -858
  47. package/src/cli/connections.ts +0 -914
  48. package/src/cli/index.ts +0 -48
  49. package/src/cli/schema.ts +0 -794
  50. package/src/cli/selector-ui.ts +0 -38
  51. package/src/cli/utils.ts +0 -112
  52. package/src/cli/validations/cli.ts +0 -79
  53. package/src/cli/validations/common.ts +0 -193
  54. package/src/cli/validations/libsql.ts +0 -27
  55. package/src/cli/validations/mysql.ts +0 -61
  56. package/src/cli/validations/outputs.ts +0 -91
  57. package/src/cli/validations/postgres.ts +0 -83
  58. package/src/cli/validations/singlestore.ts +0 -61
  59. package/src/cli/validations/sqlite.ts +0 -104
  60. package/src/cli/validations/studio.ts +0 -24
  61. package/src/cli/views.ts +0 -658
  62. package/src/extensions/getTablesFilterByExtensions.ts +0 -16
  63. package/src/extensions/vector.ts +0 -10
  64. package/src/global.ts +0 -61
  65. package/src/introspect-mysql.ts +0 -1030
  66. package/src/introspect-pg.ts +0 -1435
  67. package/src/introspect-singlestore.ts +0 -913
  68. package/src/introspect-sqlite.ts +0 -533
  69. package/src/jsonDiffer.js +0 -882
  70. package/src/jsonStatements.ts +0 -3590
  71. package/src/loader.mjs +0 -57
  72. package/src/migrationPreparator.ts +0 -217
  73. package/src/schemaValidator.ts +0 -23
  74. package/src/serializer/index.ts +0 -142
  75. package/src/serializer/mysqlImports.ts +0 -38
  76. package/src/serializer/mysqlSchema.ts +0 -423
  77. package/src/serializer/mysqlSerializer.ts +0 -999
  78. package/src/serializer/pgImports.ts +0 -106
  79. package/src/serializer/pgSchema.ts +0 -937
  80. package/src/serializer/pgSerializer.ts +0 -2223
  81. package/src/serializer/singlestoreImports.ts +0 -38
  82. package/src/serializer/singlestoreSchema.ts +0 -257
  83. package/src/serializer/singlestoreSerializer.ts +0 -767
  84. package/src/serializer/sqliteImports.ts +0 -41
  85. package/src/serializer/sqliteSchema.ts +0 -352
  86. package/src/serializer/sqliteSerializer.ts +0 -931
  87. package/src/serializer/studio.ts +0 -694
  88. package/src/serializer/utils.ts +0 -45
  89. package/src/simulator.ts +0 -157
  90. package/src/snapshotsDiffer.ts +0 -4398
  91. package/src/sqlgenerator.ts +0 -4212
  92. package/src/statementCombiner.ts +0 -597
  93. package/src/utils/certs.ts +0 -44
  94. package/src/utils/words.ts +0 -1333
  95. package/src/utils.ts +0 -370
  96. package/tests/bin.test.ts +0 -58
  97. package/tests/cli/d1http.config.ts +0 -12
  98. package/tests/cli/drizzle.config.ts +0 -9
  99. package/tests/cli/durable-sqlite.config.ts +0 -7
  100. package/tests/cli/expo.config.ts +0 -7
  101. package/tests/cli/postgres.config.ts +0 -13
  102. package/tests/cli/postgres2.config.ts +0 -17
  103. package/tests/cli/schema.ts +0 -1
  104. package/tests/cli/turso.config.ts +0 -10
  105. package/tests/cli-export.test.ts +0 -79
  106. package/tests/cli-generate.test.ts +0 -259
  107. package/tests/cli-migrate.test.ts +0 -103
  108. package/tests/cli-push.test.ts +0 -126
  109. package/tests/common.ts +0 -15
  110. package/tests/indexes/common.ts +0 -21
  111. package/tests/indexes/pg.test.ts +0 -245
  112. package/tests/introspect/libsql.test.ts +0 -35
  113. package/tests/introspect/mysql.test.ts +0 -319
  114. package/tests/introspect/pg.test.ts +0 -894
  115. package/tests/introspect/singlestore.test.ts +0 -275
  116. package/tests/introspect/sqlite.test.ts +0 -122
  117. package/tests/libsql-checks.test.ts +0 -308
  118. package/tests/libsql-statements.test.ts +0 -989
  119. package/tests/libsql-views.test.ts +0 -218
  120. package/tests/migrate/libsq-schema.ts +0 -6
  121. package/tests/migrate/libsql-migrate.test.ts +0 -58
  122. package/tests/migrate/migrations/0000_little_blizzard.sql +0 -4
  123. package/tests/migrate/migrations/0001_nebulous_storm.sql +0 -10
  124. package/tests/migrate/migrations/meta/0000_snapshot.json +0 -40
  125. package/tests/migrate/migrations/meta/0001_snapshot.json +0 -40
  126. package/tests/migrate/migrations/meta/_journal.json +0 -20
  127. package/tests/mysql-checks.test.ts +0 -291
  128. package/tests/mysql-generated.test.ts +0 -1290
  129. package/tests/mysql-schemas.test.ts +0 -156
  130. package/tests/mysql-views.test.ts +0 -553
  131. package/tests/mysql.test.ts +0 -863
  132. package/tests/pg-array.test.ts +0 -368
  133. package/tests/pg-checks.test.ts +0 -329
  134. package/tests/pg-columns.test.ts +0 -484
  135. package/tests/pg-domains.test.ts +0 -306
  136. package/tests/pg-enums.test.ts +0 -751
  137. package/tests/pg-generated.test.ts +0 -529
  138. package/tests/pg-identity.test.ts +0 -447
  139. package/tests/pg-schemas.test.ts +0 -105
  140. package/tests/pg-sequences.test.ts +0 -298
  141. package/tests/pg-tables.test.ts +0 -1021
  142. package/tests/pg-views.test.ts +0 -1929
  143. package/tests/push/common.ts +0 -58
  144. package/tests/push/libsql.test.ts +0 -1400
  145. package/tests/push/mysql-push.test.ts +0 -345
  146. package/tests/push/mysql.test.ts +0 -788
  147. package/tests/push/pg.test.ts +0 -4341
  148. package/tests/push/singlestore-push.test.ts +0 -894
  149. package/tests/push/singlestore.test.ts +0 -444
  150. package/tests/push/sqlite.test.ts +0 -1613
  151. package/tests/rls/pg-policy.test.ts +0 -1656
  152. package/tests/rls/pg-role.test.ts +0 -234
  153. package/tests/schemaDiffer.ts +0 -2852
  154. package/tests/singlestore-generated.test.ts +0 -1290
  155. package/tests/singlestore-schemas.test.ts +0 -155
  156. package/tests/singlestore.test.ts +0 -978
  157. package/tests/sqlite-checks.test.ts +0 -308
  158. package/tests/sqlite-columns.test.ts +0 -1049
  159. package/tests/sqlite-generated.test.ts +0 -1726
  160. package/tests/sqlite-tables.test.ts +0 -637
  161. package/tests/sqlite-views.test.ts +0 -218
  162. package/tests/statements-combiner/libsql-statements-combiner.test.ts +0 -1812
  163. package/tests/statements-combiner/singlestore-statements-combiner.test.ts +0 -882
  164. package/tests/statements-combiner/sqlite-statements-combiner.test.ts +0 -1211
  165. package/tests/test/sqlite.test.ts +0 -39
  166. package/tests/testsinglestore.ts +0 -29
  167. package/tests/validations.test.ts +0 -869
  168. package/tests/wrap-param.test.ts +0 -16
  169. package/tsconfig.build.json +0 -4
  170. package/tsconfig.cli-types.json +0 -9
  171. package/tsconfig.json +0 -28
  172. package/vitest.config.ts +0 -34
@@ -1,259 +0,0 @@
1
- import { test as brotest } from '@drizzle-team/brocli';
2
- import { assert, expect, test } from 'vitest';
3
- import { generate } from '../src/cli/schema';
4
-
5
- // good:
6
- // #1 drizzle-kit generate --dialect=postgresql --schema=schema.ts
7
- // #2 drizzle-kit generate --dialect=postgresql --schema=schema.ts --out=out
8
- // #3 drizzle-kit generate
9
- // #4 drizzle-kit generate --custom
10
- // #5 drizzle-kit generate --name=custom
11
- // #6 drizzle-kit generate --prefix=timestamp
12
- // #7 drizzle-kit generate --prefix=timestamp --name=custom --custom
13
- // #8 drizzle-kit generate --config=drizzle1.config.ts
14
- // #9 drizzle-kit generate --dialect=postgresql --schema=schema.ts --out=out --prefix=timestamp --name=custom --custom
15
-
16
- // errors:
17
- // #1 drizzle-kit generate --schema=src/schema.ts
18
- // #2 drizzle-kit generate --dialect=postgresql
19
- // #3 drizzle-kit generate --dialect=postgresql2
20
- // #4 drizzle-kit generate --driver=expo
21
- // #5 drizzle-kit generate --dialect=postgresql --out=out
22
- // #6 drizzle-kit generate --config=drizzle.config.ts --out=out
23
- // #7 drizzle-kit generate --config=drizzle.config.ts --schema=schema.ts
24
- // #8 drizzle-kit generate --config=drizzle.config.ts --dialect=postgresql
25
-
26
- test('generate #1', async (t) => {
27
- const res = await brotest(
28
- generate,
29
- '--dialect=postgresql --schema=schema.ts',
30
- );
31
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
32
- expect(res.options).toStrictEqual({
33
- dialect: 'postgresql',
34
- name: undefined,
35
- custom: false,
36
- prefix: 'index',
37
- breakpoints: true,
38
- schema: 'schema.ts',
39
- out: 'drizzle',
40
- bundle: false,
41
- casing: undefined,
42
- driver: undefined,
43
- });
44
- });
45
-
46
- test('generate #2', async (t) => {
47
- const res = await brotest(
48
- generate,
49
- '--dialect=postgresql --schema=schema.ts --out=out',
50
- );
51
-
52
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
53
- expect(res.options).toStrictEqual({
54
- dialect: 'postgresql',
55
- name: undefined,
56
- custom: false,
57
- prefix: 'index',
58
- breakpoints: true,
59
- schema: 'schema.ts',
60
- out: 'out',
61
- bundle: false,
62
- casing: undefined,
63
- driver: undefined,
64
- });
65
- });
66
-
67
- test('generate #3', async (t) => {
68
- const res = await brotest(generate, '');
69
-
70
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
71
- expect(res.options).toStrictEqual({
72
- dialect: 'postgresql',
73
- name: undefined,
74
- custom: false,
75
- prefix: 'index',
76
- breakpoints: true,
77
- schema: './schema.ts',
78
- out: 'drizzle',
79
- bundle: false,
80
- casing: undefined,
81
- driver: undefined,
82
- });
83
- });
84
-
85
- // config | pass through custom
86
- test('generate #4', async (t) => {
87
- const res = await brotest(generate, '--custom');
88
-
89
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
90
- expect(res.options).toStrictEqual({
91
- dialect: 'postgresql',
92
- name: undefined,
93
- custom: true,
94
- prefix: 'index',
95
- breakpoints: true,
96
- schema: './schema.ts',
97
- out: 'drizzle',
98
- bundle: false,
99
- casing: undefined,
100
- driver: undefined,
101
- });
102
- });
103
-
104
- // config | pass through name
105
- test('generate #5', async (t) => {
106
- const res = await brotest(generate, '--name=custom');
107
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
108
- expect(res.options).toStrictEqual({
109
- dialect: 'postgresql',
110
- name: 'custom',
111
- custom: false,
112
- prefix: 'index',
113
- breakpoints: true,
114
- schema: './schema.ts',
115
- out: 'drizzle',
116
- bundle: false,
117
- casing: undefined,
118
- driver: undefined,
119
- });
120
- });
121
-
122
- // config | pass through prefix
123
- test('generate #6', async (t) => {
124
- const res = await brotest(generate, '--prefix=timestamp');
125
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
126
- expect(res.options).toStrictEqual({
127
- dialect: 'postgresql',
128
- name: undefined,
129
- custom: false,
130
- prefix: 'timestamp',
131
- breakpoints: true,
132
- schema: './schema.ts',
133
- out: 'drizzle',
134
- bundle: false,
135
- casing: undefined,
136
- driver: undefined,
137
- });
138
- });
139
-
140
- // config | pass through name, prefix and custom
141
- test('generate #7', async (t) => {
142
- const res = await brotest(
143
- generate,
144
- '--prefix=timestamp --name=custom --custom',
145
- );
146
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
147
- expect(res.options).toStrictEqual({
148
- dialect: 'postgresql',
149
- name: 'custom',
150
- custom: true,
151
- prefix: 'timestamp',
152
- breakpoints: true,
153
- schema: './schema.ts',
154
- out: 'drizzle',
155
- bundle: false,
156
- casing: undefined,
157
- driver: undefined,
158
- });
159
- });
160
-
161
- // custom config path
162
- test('generate #8', async (t) => {
163
- const res = await brotest(generate, '--config=expo.config.ts');
164
- assert.equal(res.type, 'handler');
165
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
166
- expect(res.options).toStrictEqual({
167
- dialect: 'sqlite',
168
- name: undefined,
169
- custom: false,
170
- prefix: 'index',
171
- breakpoints: true,
172
- schema: './schema.ts',
173
- out: 'drizzle',
174
- bundle: true, // expo driver
175
- casing: undefined,
176
- driver: 'expo',
177
- });
178
- });
179
-
180
- test('generate #9', async (t) => {
181
- const res = await brotest(generate, '--config=durable-sqlite.config.ts');
182
- assert.equal(res.type, 'handler');
183
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
184
- expect(res.options).toStrictEqual({
185
- dialect: 'sqlite',
186
- name: undefined,
187
- custom: false,
188
- prefix: 'index',
189
- breakpoints: true,
190
- schema: './schema.ts',
191
- out: 'drizzle',
192
- bundle: true, // expo driver
193
- casing: undefined,
194
- driver: 'durable-sqlite',
195
- });
196
- });
197
-
198
- // cli | pass through name, prefix and custom
199
- test('generate #9', async (t) => {
200
- const res = await brotest(
201
- generate,
202
- '--dialect=postgresql --schema=schema.ts --out=out --prefix=timestamp --name=custom --custom',
203
- );
204
-
205
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
206
- expect(res.options).toStrictEqual({
207
- dialect: 'postgresql',
208
- name: 'custom',
209
- custom: true,
210
- prefix: 'timestamp',
211
- breakpoints: true,
212
- schema: 'schema.ts',
213
- out: 'out',
214
- bundle: false,
215
- casing: undefined,
216
- driver: undefined,
217
- });
218
- });
219
-
220
- // --- errors ---
221
- test('err #1', async (t) => {
222
- const res = await brotest(generate, '--schema=src/schema.ts');
223
- assert.equal(res.type, 'error');
224
- });
225
-
226
- test('err #2', async (t) => {
227
- const res = await brotest(generate, '--dialect=postgresql');
228
- assert.equal(res.type, 'error');
229
- });
230
-
231
- test('err #3', async (t) => {
232
- const res = await brotest(generate, '--dialect=postgresql2');
233
- assert.equal(res.type, 'error');
234
- });
235
-
236
- test('err #4', async (t) => {
237
- const res = await brotest(generate, '--driver=expo');
238
- assert.equal(res.type, 'error');
239
- });
240
-
241
- test('err #5', async (t) => {
242
- const res = await brotest(generate, '--dialect=postgresql --out=out');
243
- assert.equal(res.type, 'error');
244
- });
245
-
246
- test('err #6', async (t) => {
247
- const res = await brotest(generate, '--config=drizzle.config.ts --out=out');
248
- assert.equal(res.type, 'error');
249
- });
250
-
251
- test('err #7', async (t) => {
252
- const res = await brotest(generate, '--config=drizzle.config.ts --schema=schema.ts');
253
- assert.equal(res.type, 'error');
254
- });
255
-
256
- test('err #8', async (t) => {
257
- const res = await brotest(generate, '--config=drizzle.config.ts --dialect=postgresql');
258
- assert.equal(res.type, 'error');
259
- });
@@ -1,103 +0,0 @@
1
- import { test as brotest } from '@drizzle-team/brocli';
2
- import { assert, expect, test } from 'vitest';
3
- import { migrate } from '../src/cli/schema';
4
-
5
- // good:
6
- // #1 drizzle-kit generate
7
- // #2 drizzle-kit generate --config=turso.config.ts
8
- // #3 drizzle-kit generate --config=d1http.config.ts
9
- // #4 drizzle-kit generate --config=postgres.config.ts ## spread connection params
10
- // #5 drizzle-kit generate --config=drizzle2.config.ts ## custom schema and table for migrations journal
11
-
12
- // errors:
13
- // #1 drizzle-kit generate --config=expo.config.ts
14
- // TODO: missing required params in config?
15
-
16
- test('migrate #1', async (t) => {
17
- const res = await brotest(migrate, '');
18
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
19
- expect(res.options).toStrictEqual({
20
- dialect: 'postgresql',
21
- out: 'drizzle',
22
- credentials: {
23
- url: 'postgresql://postgres:postgres@127.0.0.1:5432/db',
24
- },
25
- schema: undefined, // drizzle migrations table schema
26
- table: undefined, // drizzle migrations table name
27
- });
28
- });
29
-
30
- test('migrate #2', async (t) => {
31
- const res = await brotest(migrate, '--config=turso.config.ts');
32
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
33
- expect(res.options).toStrictEqual({
34
- dialect: 'turso',
35
- out: 'drizzle',
36
- credentials: {
37
- authToken: 'token',
38
- url: 'turso.dev',
39
- },
40
- schema: undefined, // drizzle migrations table schema
41
- table: undefined, // drizzle migrations table name
42
- });
43
- });
44
-
45
- test('migrate #3', async (t) => {
46
- const res = await brotest(migrate, '--config=d1http.config.ts');
47
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
48
- expect(res.options).toStrictEqual({
49
- dialect: 'sqlite',
50
- out: 'drizzle',
51
- credentials: {
52
- driver: 'd1-http',
53
- accountId: 'accid',
54
- databaseId: 'dbid',
55
- token: 'token',
56
- },
57
- schema: undefined, // drizzle migrations table schema
58
- table: undefined, // drizzle migrations table name
59
- });
60
- });
61
-
62
- test('migrate #4', async (t) => {
63
- const res = await brotest(migrate, '--config=postgres.config.ts');
64
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
65
- expect(res.options).toStrictEqual({
66
- dialect: 'postgresql',
67
- out: 'drizzle',
68
- credentials: {
69
- database: 'db',
70
- host: '127.0.0.1',
71
- password: 'postgres',
72
- port: 5432,
73
- user: 'postgresql',
74
- },
75
- schema: undefined, // drizzle migrations table schema
76
- table: undefined, // drizzle migrations table name
77
- });
78
- });
79
-
80
- // catched a bug
81
- test('migrate #5', async (t) => {
82
- const res = await brotest(migrate, '--config=postgres2.config.ts');
83
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
84
- expect(res.options).toStrictEqual({
85
- dialect: 'postgresql',
86
- out: 'drizzle',
87
- credentials: {
88
- database: 'db',
89
- host: '127.0.0.1',
90
- password: 'postgres',
91
- port: 5432,
92
- user: 'postgresql',
93
- },
94
- schema: 'custom', // drizzle migrations table schema
95
- table: 'custom', // drizzle migrations table name
96
- });
97
- });
98
-
99
- // --- errors ---
100
- test('err #1', async (t) => {
101
- const res = await brotest(migrate, '--config=expo.config.ts');
102
- assert.equal(res.type, 'error');
103
- });
@@ -1,126 +0,0 @@
1
- import { test as brotest } from '@drizzle-team/brocli';
2
- import { assert, expect, test } from 'vitest';
3
- import { push } from '../src/cli/schema';
4
-
5
- // good:
6
- // #1 drizzle-kit push
7
- // #2 drizzle-kit push --config=turso.config.ts
8
- // #3 drizzle-kit push --config=d1http.config.ts
9
- // #4 drizzle-kit push --config=postgres.config.ts ## spread connection params
10
- // #5 drizzle-kit push --config=drizzle2.config.ts ## custom schema and table for migrations journal
11
-
12
- // errors:
13
- // #1 drizzle-kit push --config=expo.config.ts
14
- // TODO: missing required params in config?
15
-
16
- test('push #1', async (t) => {
17
- const res = await brotest(push, '');
18
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
19
- expect(res.options).toStrictEqual({
20
- dialect: 'postgresql',
21
- credentials: {
22
- url: 'postgresql://postgres:postgres@127.0.0.1:5432/db',
23
- },
24
- force: false,
25
- schemaPath: './schema.ts',
26
- schemasFilter: ['public'],
27
- tablesFilter: [],
28
- entities: undefined,
29
- strict: false,
30
- verbose: false,
31
- casing: undefined,
32
- });
33
- });
34
-
35
- test('push #2', async (t) => {
36
- const res = await brotest(push, '--config=turso.config.ts');
37
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
38
- expect(res.options).toStrictEqual({
39
- dialect: 'turso',
40
- credentials: {
41
- authToken: 'token',
42
- url: 'turso.dev',
43
- },
44
- force: false,
45
- schemaPath: './schema.ts',
46
- schemasFilter: ['public'],
47
- tablesFilter: [],
48
- strict: false,
49
- verbose: false,
50
- casing: undefined,
51
- });
52
- });
53
-
54
- test('push #3', async (t) => {
55
- const res = await brotest(push, '--config=d1http.config.ts');
56
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
57
- expect(res.options).toStrictEqual({
58
- dialect: 'sqlite',
59
- credentials: {
60
- driver: 'd1-http',
61
- accountId: 'accid',
62
- databaseId: 'dbid',
63
- token: 'token',
64
- },
65
- force: false,
66
- schemaPath: './schema.ts',
67
- schemasFilter: ['public'],
68
- tablesFilter: [],
69
- strict: false,
70
- verbose: false,
71
- casing: undefined,
72
- });
73
- });
74
-
75
- test('push #4', async (t) => {
76
- const res = await brotest(push, '--config=postgres.config.ts');
77
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
78
- expect(res.options).toStrictEqual({
79
- dialect: 'postgresql',
80
- credentials: {
81
- database: 'db',
82
- host: '127.0.0.1',
83
- password: 'postgres',
84
- port: 5432,
85
- user: 'postgresql',
86
- },
87
- force: false,
88
- schemaPath: './schema.ts',
89
- schemasFilter: ['public'],
90
- tablesFilter: [],
91
- entities: undefined,
92
- strict: false,
93
- verbose: false,
94
- casing: undefined,
95
- });
96
- });
97
-
98
- // catched a bug
99
- test('push #5', async (t) => {
100
- const res = await brotest(push, '--config=postgres2.config.ts');
101
- if (res.type !== 'handler') assert.fail(res.type, 'handler');
102
- expect(res.options).toStrictEqual({
103
- dialect: 'postgresql',
104
- credentials: {
105
- database: 'db',
106
- host: '127.0.0.1',
107
- password: 'postgres',
108
- port: 5432,
109
- user: 'postgresql',
110
- },
111
- schemaPath: './schema.ts',
112
- schemasFilter: ['public'],
113
- tablesFilter: [],
114
- strict: false,
115
- entities: undefined,
116
- force: false,
117
- verbose: false,
118
- casing: undefined,
119
- });
120
- });
121
-
122
- // --- errors ---
123
- test('err #1', async (t) => {
124
- const res = await brotest(push, '--config=expo.config.ts');
125
- assert.equal(res.type, 'error');
126
- });
package/tests/common.ts DELETED
@@ -1,15 +0,0 @@
1
- import { test } from 'vitest';
2
-
3
- export interface DialectSuite {
4
- /**
5
- * 1 statement | create column:
6
- *
7
- * id int primary key autoincrement
8
- */
9
- columns1(): Promise<void>;
10
- }
11
-
12
- export const run = (suite: DialectSuite) => {
13
- test('add columns #1', suite.columns1);
14
- };
15
- // test("add columns #1", suite.columns1)
@@ -1,21 +0,0 @@
1
- import { afterAll, beforeAll, test } from 'vitest';
2
-
3
- export interface DialectSuite {
4
- simpleIndex(context?: any): Promise<void>;
5
- vectorIndex(context?: any): Promise<void>;
6
- indexesToBeTriggered(context?: any): Promise<void>;
7
- }
8
-
9
- export const run = (
10
- suite: DialectSuite,
11
- beforeAllFn?: (context: any) => Promise<void>,
12
- afterAllFn?: (context: any) => Promise<void>,
13
- ) => {
14
- let context: any = {};
15
- beforeAll(beforeAllFn ? () => beforeAllFn(context) : () => {});
16
- test('index #1: simple index', () => suite.simpleIndex(context));
17
- test('index #2: vector index', () => suite.vectorIndex(context));
18
- test('index #3: fields that should be triggered on generate and not triggered on push', () =>
19
- suite.indexesToBeTriggered(context));
20
- afterAll(afterAllFn ? () => afterAllFn(context) : () => {});
21
- };