mirror of
https://github.com/n8n-io/n8n.git
synced 2026-09-21 04:37:50 +08:00
fix(core): Use timestamptz for data table date columns (#31286)
This commit is contained in:
@@ -219,6 +219,15 @@ describe('sql-utils', () => {
|
||||
|
||||
expect(query).toBe('ALTER TABLE "data_table_user_abc" ADD "email" DOUBLE PRECISION');
|
||||
});
|
||||
|
||||
it('should use timestamptz for date columns on postgres', () => {
|
||||
const tableName = 'data_table_user_abc';
|
||||
const column = { name: 'registeredAt', type: 'date' as const };
|
||||
|
||||
const query = addColumnQuery(tableName, column, 'postgres');
|
||||
|
||||
expect(query).toBe('ALTER TABLE "data_table_user_abc" ADD "registeredAt" TIMESTAMPTZ');
|
||||
});
|
||||
});
|
||||
|
||||
describe('deleteColumnQuery', () => {
|
||||
|
||||
@@ -61,7 +61,7 @@ function dataTableColumnTypeToSql(
|
||||
return 'BOOLEAN';
|
||||
case 'date':
|
||||
if (dbType === 'postgres') {
|
||||
return 'TIMESTAMP';
|
||||
return 'TIMESTAMPTZ';
|
||||
}
|
||||
return 'DATETIME';
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user