MCPcopy
hub / github.com/drizzle-team/drizzle-orm / dropIndex

Function dropIndex

drizzle-kit/tests/push/pg.test.ts:636–671  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

634 },
635
636 async dropIndex() {
637 const client = new PGlite();
638
639 const schema1 = {
640 users: pgTable(
641 'users',
642 {
643 id: serial('id').primaryKey(),
644 name: text('name'),
645 },
646 (t) => ({
647 indx: index().on(t.name.desc(), t.id.asc().nullsLast()).with({ fillfactor: 70 }),
648 }),
649 ),
650 };
651
652 const schema2 = {
653 users: pgTable('users', {
654 id: serial('id').primaryKey(),
655 name: text('name'),
656 }),
657 };
658
659 const { statements, sqlStatements } = await diffTestSchemasPush(client, schema1, schema2, [], false, ['public']);
660
661 expect(statements.length).toBe(1);
662 expect(statements[0]).toStrictEqual({
663 schema: '',
664 tableName: 'users',
665 type: 'drop_index',
666 data: 'users_name_id_index;name--false--last,,id--true--last;false;btree;{"fillfactor":"70"}',
667 });
668
669 expect(sqlStatements.length).toBe(1);
670 expect(sqlStatements[0]).toBe(`DROP INDEX "users_name_id_index";`);
671 },
672
673 async indexesToBeNotTriggered() {
674 const client = new PGlite();

Callers

nothing calls this directly

Calls 10

pgTableFunction · 0.90
serialFunction · 0.90
textFunction · 0.90
indexFunction · 0.90
diffTestSchemasPushFunction · 0.90
withMethod · 0.45
onMethod · 0.45
descMethod · 0.45
nullsLastMethod · 0.45
ascMethod · 0.45

Tested by

no test coverage detected