()
| 225 | }, |
| 226 | |
| 227 | async addBasicIndexes() { |
| 228 | const client = new PGlite(); |
| 229 | |
| 230 | const schema1 = { |
| 231 | users: pgTable('users', { |
| 232 | id: serial('id').primaryKey(), |
| 233 | name: text('name'), |
| 234 | }), |
| 235 | }; |
| 236 | |
| 237 | const schema2 = { |
| 238 | users: pgTable( |
| 239 | 'users', |
| 240 | { |
| 241 | id: serial('id').primaryKey(), |
| 242 | name: text('name'), |
| 243 | }, |
| 244 | (t) => ({ |
| 245 | indx: index() |
| 246 | .on(t.name.desc(), t.id.asc().nullsLast()) |
| 247 | .with({ fillfactor: 70 }) |
| 248 | .where(sql`select 1`), |
| 249 | indx1: index('indx1') |
| 250 | .using('hash', t.name.desc(), sql`${t.name}`) |
| 251 | .with({ fillfactor: 70 }), |
| 252 | }), |
| 253 | ), |
| 254 | }; |
| 255 | |
| 256 | const { statements, sqlStatements } = await diffTestSchemasPush(client, schema1, schema2, [], false, ['public']); |
| 257 | expect(statements.length).toBe(2); |
| 258 | expect(statements[0]).toStrictEqual({ |
| 259 | schema: '', |
| 260 | tableName: 'users', |
| 261 | type: 'create_index_pg', |
| 262 | data: { |
| 263 | columns: [ |
| 264 | { |
| 265 | asc: false, |
| 266 | expression: 'name', |
| 267 | isExpression: false, |
| 268 | nulls: 'last', |
| 269 | opclass: undefined, |
| 270 | }, |
| 271 | { |
| 272 | asc: true, |
| 273 | expression: 'id', |
| 274 | isExpression: false, |
| 275 | nulls: 'last', |
| 276 | opclass: undefined, |
| 277 | }, |
| 278 | ], |
| 279 | concurrently: false, |
| 280 | isUnique: false, |
| 281 | method: 'btree', |
| 282 | name: 'users_name_id_index', |
| 283 | where: 'select 1', |
| 284 | with: { |
nothing calls this directly
no test coverage detected