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

Function indexesTestCase1

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

Source from the content-addressed store, hash-verified

723 },
724
725 async indexesTestCase1() {
726 const client = new PGlite();
727
728 const schema1 = {
729 users: pgTable(
730 'users',
731 {
732 id: uuid('id').defaultRandom().primaryKey(),
733 name: text('name').notNull(),
734 description: text('description'),
735 imageUrl: text('image_url'),
736 inStock: boolean('in_stock').default(true),
737 },
738 (t) => ({
739 indx: index().on(t.id.desc().nullsFirst()),
740 indx1: index('indx1').on(t.id, t.imageUrl),
741 indx2: index('indx4').on(t.id),
742 }),
743 ),
744 };
745
746 const schema2 = {
747 users: pgTable(
748 'users',
749 {
750 id: uuid('id').defaultRandom().primaryKey(),
751 name: text('name').notNull(),
752 description: text('description'),
753 imageUrl: text('image_url'),
754 inStock: boolean('in_stock').default(true),
755 },
756 (t) => ({
757 indx: index().on(t.id.desc().nullsFirst()),
758 indx1: index('indx1').on(t.id, t.imageUrl),
759 indx2: index('indx4').on(t.id),
760 }),
761 ),
762 };
763
764 const { statements, sqlStatements } = await diffTestSchemasPush(client, schema1, schema2, [], false, ['public']);
765
766 expect(statements.length).toBe(0);
767 },
768
769 async addNotNull() {
770 const client = new PGlite();

Callers

nothing calls this directly

Calls 10

pgTableFunction · 0.90
uuidFunction · 0.90
textFunction · 0.90
booleanFunction · 0.90
indexFunction · 0.90
diffTestSchemasPushFunction · 0.90
defaultRandomMethod · 0.80
onMethod · 0.45
nullsFirstMethod · 0.45
descMethod · 0.45

Tested by

no test coverage detected