From 74a0a49f7b235666a39c1d77e66055146395afe9 Mon Sep 17 00:00:00 2001 From: myOmikron Date: Mon, 11 Sep 2023 17:26:41 +0200 Subject: [PATCH] Fixed datetime with timezone creation --- src/create_column.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/create_column.rs b/src/create_column.rs index 51c9ef6..95d50e4 100644 --- a/src/create_column.rs +++ b/src/create_column.rs @@ -435,7 +435,8 @@ impl<'until_build, 'post_build> CreateColumn<'post_build> DbType::Double => write!(s, "double precision ").unwrap(), DbType::Boolean => write!(s, "boolean ").unwrap(), DbType::Date => write!(s, "date ").unwrap(), - DbType::DateTime | DbType::Timestamp => write!(s, "timestamp ").unwrap(), + DbType::DateTime => write!(s, "timestamptz").unwrap(), + DbType::Timestamp => write!(s, "timestamp ").unwrap(), DbType::Time => write!(s, "time ").unwrap(), }; @@ -456,7 +457,7 @@ impl<'until_build, 'post_build> CreateColumn<'post_build> "DEFAULT {}", match d.data_type { DbType::Date => "CURRENT_DATE", - DbType::DateTime => "CURRENT_TIMESTAMP", + DbType::DateTime => "now()", DbType::Timestamp => "CURRENT_TIMESTAMP", DbType::Time => "CURRENT_TIME", _ => "",