Updated resync to no longer be tied to a host_uuid.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 3 years ago
parent 1036235585
commit dd9d5e6ba0
  1. 24
      Anvil/Tools/Database.pm

@ -16053,11 +16053,12 @@ sub resync_databases
$query =~ s/, $/ /; $query =~ s/, $/ /;
$query .= "FROM ".$schema.".".$table; $query .= "FROM ".$schema.".".$table;
# Restrict to this host if a host column was found. ### NOTE: No longer restricting to the host, given only the strikers can do resyncs now.
if ($host_column) # # Restrict to this host if a host column was found.
{ # if ($host_column)
$query .= " WHERE ".$host_column." = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid}); # {
} # $query .= " WHERE ".$host_column." = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid});
# }
$query .= " ORDER BY utc_modified_date DESC;"; $query .= " ORDER BY utc_modified_date DESC;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0074", variables => { uuid => $uuid, query => $query }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0074", variables => { uuid => $uuid, query => $query }});
@ -17774,18 +17775,19 @@ sub _find_behind_databases
"database::${uuid}::password" => $anvil->Log->is_secure($anvil->data->{database}{$uuid}{password}), "database::${uuid}::password" => $anvil->Log->is_secure($anvil->data->{database}{$uuid}{password}),
}}); }});
### Only Strikers resync, so limiting to the host_uuid doesn't make sense anymore.
my $schema = $has_history ? "history" : "public"; my $schema = $has_history ? "history" : "public";
$query = " $query = "
SELECT DISTINCT SELECT DISTINCT
round(extract(epoch from modified_date)) AS unix_modified_date round(extract(epoch from modified_date)) AS unix_modified_date
FROM FROM
".$schema.".".$table." "; ".$schema.".".$table." ";
if ($host_column) # if ($host_column)
{ # {
$query .= " # $query .= "
WHERE # WHERE
".$host_column." = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid}) ; # ".$host_column." = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid}) ;
} # }
$query .= " $query .= "
ORDER BY ORDER BY
unix_modified_date DESC unix_modified_date DESC

Loading…
Cancel
Save