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

Function addNotNull

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

Source from the content-addressed store, hash-verified

767 },
768
769 async addNotNull() {
770 const client = new PGlite();
771
772 const schema1 = {
773 users: pgTable(
774 'User',
775 {
776 id: text('id').primaryKey().notNull(),
777 name: text('name'),
778 username: text('username'),
779 gh_username: text('gh_username'),
780 email: text('email'),
781 emailVerified: timestamp('emailVerified', {
782 precision: 3,
783 mode: 'date',
784 }),
785 image: text('image'),
786 createdAt: timestamp('createdAt', { precision: 3, mode: 'date' })
787 .default(sql`CURRENT_TIMESTAMP`)
788 .notNull(),
789 updatedAt: timestamp('updatedAt', { precision: 3, mode: 'date' })
790 .notNull()
791 .$onUpdate(() => new Date()),
792 },
793 (table) => {
794 return {
795 emailKey: uniqueIndex('User_email_key').on(table.email),
796 };
797 },
798 ),
799 };
800
801 const schema2 = {
802 users: pgTable(
803 'User',
804 {
805 id: text('id').primaryKey().notNull(),
806 name: text('name'),
807 username: text('username'),
808 gh_username: text('gh_username'),
809 email: text('email').notNull(),
810 emailVerified: timestamp('emailVerified', {
811 precision: 3,
812 mode: 'date',
813 }),
814 image: text('image'),
815 createdAt: timestamp('createdAt', { precision: 3, mode: 'date' })
816 .default(sql`CURRENT_TIMESTAMP`)
817 .notNull(),
818 updatedAt: timestamp('updatedAt', { precision: 3, mode: 'date' })
819 .notNull()
820 .$onUpdate(() => new Date()),
821 },
822 (table) => {
823 return {
824 emailKey: uniqueIndex('User_email_key').on(table.email),
825 };
826 },

Callers

nothing calls this directly

Calls 8

pgTableFunction · 0.90
textFunction · 0.90
timestampFunction · 0.90
sqlFunction · 0.90
uniqueIndexFunction · 0.90
diffTestSchemasPushFunction · 0.90
pgSuggestionsFunction · 0.90
onMethod · 0.45

Tested by

no test coverage detected