From 2bd0449c5b2b5cbefffbe145f6c4c183e4ff0552 Mon Sep 17 00:00:00 2001 From: S7evinK Date: Fri, 9 Oct 2020 13:41:53 +0200 Subject: [PATCH] Use default value when adding column which is not null (#1501) Signed-off-by: Till Faelligen --- .../devices/postgres/deltas/20201001204705_last_seen_ts_ip.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userapi/storage/devices/postgres/deltas/20201001204705_last_seen_ts_ip.sql b/userapi/storage/devices/postgres/deltas/20201001204705_last_seen_ts_ip.sql index 4f5f2b17..e7900b0b 100644 --- a/userapi/storage/devices/postgres/deltas/20201001204705_last_seen_ts_ip.sql +++ b/userapi/storage/devices/postgres/deltas/20201001204705_last_seen_ts_ip.sql @@ -1,6 +1,6 @@ -- +goose Up -- +goose StatementBegin -ALTER TABLE device_devices ADD COLUMN IF NOT EXISTS last_seen_ts BIGINT NOT NULL; +ALTER TABLE device_devices ADD COLUMN IF NOT EXISTS last_seen_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP)*1000; ALTER TABLE device_devices ADD COLUMN IF NOT EXISTS ip TEXT; ALTER TABLE device_devices ADD COLUMN IF NOT EXISTS user_agent TEXT; -- +goose StatementEnd