From 8d1d8328ba8357f0b5df4473398c1df39c1764b0 Mon Sep 17 00:00:00 2001 From: James Gordon Date: Tue, 14 Nov 2017 10:10:47 -0600 Subject: [PATCH] set updated_at to now in update queries --- .../sql/set_is_current_for_new_filing_actions.sql | 3 ++- .../sql/set_is_current_for_old_filing_actions.sql | 3 ++- .../sql/update_committee_names_from_form460s.sql | 4 +++- calaccess_processed/sql/update_filings_filer_id.sql | 4 +++- .../sql/update_filings_from_formfiling_table.sql | 4 +++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/calaccess_processed/sql/set_is_current_for_new_filing_actions.sql b/calaccess_processed/sql/set_is_current_for_new_filing_actions.sql index edf79a01..bbb844ae 100644 --- a/calaccess_processed/sql/set_is_current_for_new_filing_actions.sql +++ b/calaccess_processed/sql/set_is_current_for_new_filing_actions.sql @@ -1,6 +1,7 @@ -- Setting is_current to true for latest Filing Actions UPDATE opencivicdata_filingaction - SET is_current = true + SET is_current = true, + updated_at = now() FROM opencivicdata_filingaction fa -- get latest amend_id for each filing JOIN ( diff --git a/calaccess_processed/sql/set_is_current_for_old_filing_actions.sql b/calaccess_processed/sql/set_is_current_for_old_filing_actions.sql index 3cba342f..720eb7f8 100644 --- a/calaccess_processed/sql/set_is_current_for_old_filing_actions.sql +++ b/calaccess_processed/sql/set_is_current_for_old_filing_actions.sql @@ -1,6 +1,7 @@ -- Setting is_current to false for older Filing Actions UPDATE opencivicdata_filingaction - SET is_current = false + SET is_current = false, + updated_at = now() FROM opencivicdata_filingaction fa -- get latest amend_id for each filing LEFT JOIN ( diff --git a/calaccess_processed/sql/update_committee_names_from_form460s.sql b/calaccess_processed/sql/update_committee_names_from_form460s.sql index 465af0db..943fd1cc 100644 --- a/calaccess_processed/sql/update_committee_names_from_form460s.sql +++ b/calaccess_processed/sql/update_committee_names_from_form460s.sql @@ -1,6 +1,8 @@ -- Updating name field on any existing Committee from Form460Filing UPDATE opencivicdata_committee -SET name = f460.filer_lastname +SET + name = f460.filer_lastname, + updated_at = now() FROM opencivicdata_committee c JOIN opencivicdata_committeeidentifier ci ON c.id = ci.committee_id diff --git a/calaccess_processed/sql/update_filings_filer_id.sql b/calaccess_processed/sql/update_filings_filer_id.sql index c6dcb8bf..0eed86ee 100644 --- a/calaccess_processed/sql/update_filings_filer_id.sql +++ b/calaccess_processed/sql/update_filings_filer_id.sql @@ -1,6 +1,8 @@ -- Update filer_id on OCD Filing UPDATE opencivicdata_filing -SET filer_id = ci.committee_id +SET + filer_id = ci.committee_id, + updated_at = now() FROM opencivicdata_filing f -- join to FilingIdentifier to get calaccess_filing_id JOIN opencivicdata_filingidentifier fi diff --git a/calaccess_processed/sql/update_filings_from_formfiling_table.sql b/calaccess_processed/sql/update_filings_from_formfiling_table.sql index 05d02e90..e92ef8d9 100644 --- a/calaccess_processed/sql/update_filings_from_formfiling_table.sql +++ b/calaccess_processed/sql/update_filings_from_formfiling_table.sql @@ -1,6 +1,8 @@ -- Updating target field on any existing Filing from source table and column UPDATE opencivicdata_filing -SET {target_column} = {source_table}.{source_column} +SET + {target_column} = {source_table}.{source_column}, + updated_at = now() FROM opencivicdata_filing f -- join to FilingIdentifier to get calaccess_filing_id JOIN opencivicdata_filingidentifier fi