diff --git a/lib/App/Netdisco/DB.pm b/lib/App/Netdisco/DB.pm index 9e12a51d..acbcd561 100644 --- a/lib/App/Netdisco/DB.pm +++ b/lib/App/Netdisco/DB.pm @@ -11,7 +11,7 @@ __PACKAGE__->load_namespaces( ); our # try to hide from kwalitee - $VERSION = 77; # schema version used for upgrades, keep as integer + $VERSION = 78; # schema version used for upgrades, keep as integer use Path::Class; use File::ShareDir 'dist_dir'; diff --git a/lib/App/Netdisco/DB/Result/Admin.pm b/lib/App/Netdisco/DB/Result/Admin.pm index 3091d99d..8e185ad2 100644 --- a/lib/App/Netdisco/DB/Result/Admin.pm +++ b/lib/App/Netdisco/DB/Result/Admin.pm @@ -18,9 +18,9 @@ __PACKAGE__->add_columns( "entered", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "started", { data_type => "timestamp", is_nullable => 1 }, diff --git a/lib/App/Netdisco/DB/Result/Device.pm b/lib/App/Netdisco/DB/Result/Device.pm index e3834896..5623fcc9 100644 --- a/lib/App/Netdisco/DB/Result/Device.pm +++ b/lib/App/Netdisco/DB/Result/Device.pm @@ -17,9 +17,9 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "dns", { data_type => "text", is_nullable => 1 }, diff --git a/lib/App/Netdisco/DB/Result/DeviceIp.pm b/lib/App/Netdisco/DB/Result/DeviceIp.pm index 91fdf211..bef5e505 100644 --- a/lib/App/Netdisco/DB/Result/DeviceIp.pm +++ b/lib/App/Netdisco/DB/Result/DeviceIp.pm @@ -23,9 +23,9 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, ); __PACKAGE__->set_primary_key("ip", "alias"); diff --git a/lib/App/Netdisco/DB/Result/DeviceModule.pm b/lib/App/Netdisco/DB/Result/DeviceModule.pm index 7e43324e..b9bb797c 100644 --- a/lib/App/Netdisco/DB/Result/DeviceModule.pm +++ b/lib/App/Netdisco/DB/Result/DeviceModule.pm @@ -39,9 +39,9 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "last_discover", { data_type => "timestamp", is_nullable => 1 }, diff --git a/lib/App/Netdisco/DB/Result/DevicePort.pm b/lib/App/Netdisco/DB/Result/DevicePort.pm index a99544e9..202003c2 100644 --- a/lib/App/Netdisco/DB/Result/DevicePort.pm +++ b/lib/App/Netdisco/DB/Result/DevicePort.pm @@ -19,9 +19,9 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "descr", { data_type => "text", is_nullable => 1 }, diff --git a/lib/App/Netdisco/DB/Result/DevicePortLog.pm b/lib/App/Netdisco/DB/Result/DevicePortLog.pm index 666adb10..24653554 100644 --- a/lib/App/Netdisco/DB/Result/DevicePortLog.pm +++ b/lib/App/Netdisco/DB/Result/DevicePortLog.pm @@ -32,9 +32,9 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, ); diff --git a/lib/App/Netdisco/DB/Result/DevicePortVlan.pm b/lib/App/Netdisco/DB/Result/DevicePortVlan.pm index e03f5a33..7945ab9a 100644 --- a/lib/App/Netdisco/DB/Result/DevicePortVlan.pm +++ b/lib/App/Netdisco/DB/Result/DevicePortVlan.pm @@ -21,16 +21,16 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "last_discover", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "vlantype", { data_type => "text", is_nullable => 1 }, diff --git a/lib/App/Netdisco/DB/Result/DeviceVlan.pm b/lib/App/Netdisco/DB/Result/DeviceVlan.pm index 9e9797b1..9be975c9 100644 --- a/lib/App/Netdisco/DB/Result/DeviceVlan.pm +++ b/lib/App/Netdisco/DB/Result/DeviceVlan.pm @@ -17,16 +17,16 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "last_discover", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, ); __PACKAGE__->set_primary_key("ip", "vlan"); diff --git a/lib/App/Netdisco/DB/Result/Log.pm b/lib/App/Netdisco/DB/Result/Log.pm index 579d6033..b3e8bc75 100644 --- a/lib/App/Netdisco/DB/Result/Log.pm +++ b/lib/App/Netdisco/DB/Result/Log.pm @@ -18,9 +18,9 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "class", { data_type => "text", is_nullable => 1 }, diff --git a/lib/App/Netdisco/DB/Result/Node.pm b/lib/App/Netdisco/DB/Result/Node.pm index af3c8587..6a1e1e9d 100644 --- a/lib/App/Netdisco/DB/Result/Node.pm +++ b/lib/App/Netdisco/DB/Result/Node.pm @@ -23,23 +23,23 @@ __PACKAGE__->add_columns( "time_first", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "time_recent", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "time_last", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "vlan", { data_type => "text", is_nullable => 0, default_value => '0' }, diff --git a/lib/App/Netdisco/DB/Result/NodeIp.pm b/lib/App/Netdisco/DB/Result/NodeIp.pm index 39d086db..a49958c4 100644 --- a/lib/App/Netdisco/DB/Result/NodeIp.pm +++ b/lib/App/Netdisco/DB/Result/NodeIp.pm @@ -21,16 +21,16 @@ __PACKAGE__->add_columns( "time_first", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "time_last", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, ); __PACKAGE__->set_primary_key("mac", "ip"); diff --git a/lib/App/Netdisco/DB/Result/NodeMonitor.pm b/lib/App/Netdisco/DB/Result/NodeMonitor.pm index 2eb01103..2d8386aa 100644 --- a/lib/App/Netdisco/DB/Result/NodeMonitor.pm +++ b/lib/App/Netdisco/DB/Result/NodeMonitor.pm @@ -21,9 +21,9 @@ __PACKAGE__->add_columns( "date", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, ); __PACKAGE__->set_primary_key("mac"); diff --git a/lib/App/Netdisco/DB/Result/NodeNbt.pm b/lib/App/Netdisco/DB/Result/NodeNbt.pm index 67e1d67e..da5c9fac 100644 --- a/lib/App/Netdisco/DB/Result/NodeNbt.pm +++ b/lib/App/Netdisco/DB/Result/NodeNbt.pm @@ -27,16 +27,16 @@ __PACKAGE__->add_columns( "time_first", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "time_last", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, ); __PACKAGE__->set_primary_key("mac"); diff --git a/lib/App/Netdisco/DB/Result/NodeWireless.pm b/lib/App/Netdisco/DB/Result/NodeWireless.pm index 675f1d4a..7919e642 100644 --- a/lib/App/Netdisco/DB/Result/NodeWireless.pm +++ b/lib/App/Netdisco/DB/Result/NodeWireless.pm @@ -33,9 +33,9 @@ __PACKAGE__->add_columns( "time_last", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "ssid", { data_type => "text", is_nullable => 0, default_value => '' }, diff --git a/lib/App/Netdisco/DB/Result/Process.pm b/lib/App/Netdisco/DB/Result/Process.pm index 93f33225..9bde16d4 100644 --- a/lib/App/Netdisco/DB/Result/Process.pm +++ b/lib/App/Netdisco/DB/Result/Process.pm @@ -21,9 +21,9 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, ); diff --git a/lib/App/Netdisco/DB/Result/Session.pm b/lib/App/Netdisco/DB/Result/Session.pm index 4347b222..93223641 100644 --- a/lib/App/Netdisco/DB/Result/Session.pm +++ b/lib/App/Netdisco/DB/Result/Session.pm @@ -13,9 +13,9 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "a_session", { data_type => "text", is_nullable => 1 }, diff --git a/lib/App/Netdisco/DB/Result/Subnet.pm b/lib/App/Netdisco/DB/Result/Subnet.pm index dafedb7b..e8565d19 100644 --- a/lib/App/Netdisco/DB/Result/Subnet.pm +++ b/lib/App/Netdisco/DB/Result/Subnet.pm @@ -13,16 +13,16 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "last_discover", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, ); __PACKAGE__->set_primary_key("net"); diff --git a/lib/App/Netdisco/DB/Result/User.pm b/lib/App/Netdisco/DB/Result/User.pm index f3ee60e4..2c5538d4 100644 --- a/lib/App/Netdisco/DB/Result/User.pm +++ b/lib/App/Netdisco/DB/Result/User.pm @@ -19,9 +19,9 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, "last_on", { data_type => "timestamp", is_nullable => 1 }, diff --git a/lib/App/Netdisco/DB/Result/UserLog.pm b/lib/App/Netdisco/DB/Result/UserLog.pm index eb9d6de9..f8f4ac98 100644 --- a/lib/App/Netdisco/DB/Result/UserLog.pm +++ b/lib/App/Netdisco/DB/Result/UserLog.pm @@ -26,9 +26,9 @@ __PACKAGE__->add_columns( "creation", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, - original => { default_value => \"now()" }, + original => { default_value => \"LOCALTIMESTAMP" }, }, ); diff --git a/lib/App/Netdisco/DB/Result/Virtual/LastNode.pm b/lib/App/Netdisco/DB/Result/Virtual/LastNode.pm index 2d228aa6..96e5222d 100644 --- a/lib/App/Netdisco/DB/Result/Virtual/LastNode.pm +++ b/lib/App/Netdisco/DB/Result/Virtual/LastNode.pm @@ -29,21 +29,21 @@ __PACKAGE__->add_columns( "time_first", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, original => { default_value => \"LOCALTIMESTAMP" }, }, "time_recent", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, original => { default_value => \"LOCALTIMESTAMP" }, }, "time_last", { data_type => "timestamp", - default_value => \"current_timestamp", + default_value => \"LOCALTIMESTAMP", is_nullable => 1, original => { default_value => \"LOCALTIMESTAMP" }, }, diff --git a/share/schema_versions/App-Netdisco-DB-77-78-PostgreSQL.sql b/share/schema_versions/App-Netdisco-DB-77-78-PostgreSQL.sql new file mode 100644 index 00000000..bdcc8e6e --- /dev/null +++ b/share/schema_versions/App-Netdisco-DB-77-78-PostgreSQL.sql @@ -0,0 +1,55 @@ +BEGIN; + +ALTER TABLE admin ALTER entered SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE device ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE device_ip ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE device_module ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE device_port ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE device_port_log ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE device_port_vlan ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE device_port_vlan ALTER last_discover SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE device_vlan ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE device_vlan ALTER last_discover SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE log ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE node ALTER time_first SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE node ALTER time_recent SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE node ALTER time_last SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE node_ip ALTER time_first SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE node_ip ALTER time_last SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE node_monitor ALTER date SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE node_nbt ALTER time_first SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE node_nbt ALTER time_last SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE node_wireless ALTER time_last SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE process ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE sessions ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE subnets ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE subnets ALTER last_discover SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE users ALTER creation SET DEFAULT LOCALTIMESTAMP; + +ALTER TABLE user_log ALTER creation SET DEFAULT LOCALTIMESTAMP; + +COMMIT;