Skip to content

Commit 4396d9c

Browse files
author
Youssef Kaiboussi
committed
add UTC timestamp
1 parent 8fcbbb1 commit 4396d9c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ dist: precise
33

44
language: go
55
go:
6-
- 1.7
7-
- tip
6+
- 1.9
7+
- master
88

99
matrix:
1010
allow_failures:

audit/audit.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ func audit(schema, table string, trigger bool, c *Config, db *sql.DB) error {
277277
return err
278278
}
279279

280-
err = addColToTable(auditSchema, table+"_audit", "sparse_time", "timestamp", db)
280+
err = addColToTable(auditSchema, table+"_audit", "sparse_time", "timestamptz", db)
281281
if err != nil {
282282
return err
283283
}
@@ -402,8 +402,8 @@ func createAuditAuditingTable(db *sql.DB) error {
402402
audit_history_id SERIAL PRIMARY KEY,
403403
schema_name NAME NOT NULL,
404404
table_name NAME NOT NULL,
405-
start_time TIMESTAMP NOT NULL,
406-
end_time TIMESTAMP,
405+
start_time TIMESTAMPTZ NOT NULL,
406+
end_time TIMESTAMPTZ,
407407
CONSTRAINT uniq UNIQUE(schema_name, table_name, start_time)
408408
)`
409409

@@ -544,7 +544,7 @@ func createAuditTable(auditSchema, table, jsonType string, db *sql.DB) error {
544544

545545
query := `CREATE TABLE IF NOT EXISTS "{{.auditSchema}}"."{{.table}}_audit"(
546546
"{{.table}}_audit_id" BIGSERIAL PRIMARY KEY,
547-
changed_at TIMESTAMP NOT NULL,
547+
changed_at TIMESTAMPTZ NOT NULL,
548548
db_user VARCHAR(50) NOT NULL,
549549
client_addr INET,
550550
client_port INTEGER,
@@ -639,7 +639,7 @@ func createAuditFunction(schema, table, jsonType, security string, logging bool,
639639
DECLARE
640640
value_row HSTORE = hstore(NULL);
641641
new_row HSTORE = hstore(NULL);
642-
sparse_time TIMESTAMP WITHOUT TIME ZONE = NULL;
642+
sparse_time TIMESTAMPTZ = NULL;
643643
audit_id BIGINT;
644644
BEGIN
645645
SELECT nextval('{{.sequenceName}}') INTO audit_id;

0 commit comments

Comments
 (0)