如何使用Knex.js创建带时区的time类型列?
在Knex.js ^2.3.0中创建PostgreSQL的time with timezone类型列
Knex.js的table.time()方法在PostgreSQL环境下默认生成time without timezone类型的列,要创建time with time zone类型的列,可以通过以下方式实现:
- 使用
specificType()方法直接指定PostgreSQL的目标类型:
table.specificType('timeColumnWithTimezone', 'time with time zone');
该方法会直接生成对应的DDL语句,创建带时区的时间类型列,完全满足需求。
内容的提问来源于stack exchange,提问作者Pramuditha Chamikara
相关产品推荐
相关产品推荐

