### TODO: I don't know if this works yet for tables without a '*_host_uuid' column
### NOTE: Don't sort this array, we need to resync in the order that the user passed the tables to us
### to avoid trouble with primary/foreign keys.
# We're going to use the array of tables assembles by _find_behind_databases() stored in
@ -2764,6 +2758,11 @@ sub resync_databases
}});
my$query="INSERT INTO public.$table (".$uuid_column.", ".$columns."modified_date) VALUES (".$an->data->{sys}{use_db_fh}->quote($row_uuid).", ".$values.$an->data->{sys}{use_db_fh}->quote($modified_date)."::timestamp AT TIME ZONE 'UTC');";
if($host_column)
{
# Add the host column.
$query="INSERT INTO public.$table ($host_column, $uuid_column, ".$columns."modified_date) VALUES (".$an->data->{sys}{use_db_fh}->quote($an->data->{sys}{host_uuid}).", ".$an->data->{sys}{use_db_fh}->quote($row_uuid).", ".$values.$an->data->{sys}{use_db_fh}->quote($modified_date)."::timestamp AT TIME ZONE 'UTC');";
my$query="INSERT INTO history.$table (".$uuid_column.", ".$columns."modified_date) VALUES (".$an->data->{sys}{use_db_fh}->quote($row_uuid).", ".$values.$an->data->{sys}{use_db_fh}->quote($modified_date)."::timestamp AT TIME ZONE 'UTC');";
if($host_column)
{
# Add the host column.
$query="INSERT INTO history.$table ($host_column, $uuid_column, ".$columns."modified_date) VALUES (".$an->data->{sys}{use_db_fh}->quote($an->data->{sys}{host_uuid}).", ".$an->data->{sys}{use_db_fh}->quote($row_uuid).", ".$values.$an->data->{sys}{use_db_fh}->quote($modified_date)."::timestamp AT TIME ZONE 'UTC');";
# SELECT table_schema, table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND table_schema NOT IN ('pg_catalog', 'information_schema') ORDER BY table_name ASC, table_schema DESC;