Skip to content

Commit

Permalink
Test function calls as default value for PostgreSQL
Browse files Browse the repository at this point in the history
In specific case, `drizzle-kit pull` is not able to generate a valid schema. This test checks if drizzle is able to generate the default value for `md5('str')`.
  • Loading branch information
ooflorent committed Nov 22, 2024
1 parent 30e5347 commit a4123b5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drizzle-kit/tests/introspect/pg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -892,3 +892,22 @@ test('multiple policies with roles from schema', async () => {
expect(statements.length).toBe(0);
expect(sqlStatements.length).toBe(0);
});

test('default-function-call', async () => {
const client = new PGlite();

const schema = {
foo: pgTable('foo', {
bar: text('bar').default(sql`md5('baz')`),
}),
};

const { statements, sqlStatements } = await introspectPgToFile(
client,
schema,
'default-functions-call',
);

expect(statements.length).toBe(0);
expect(sqlStatements.length).toBe(0);
});

0 comments on commit a4123b5

Please sign in to comment.