Skip to content

Commit

Permalink
set updated_at to now in update queries
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonje committed Nov 14, 2017
1 parent d88ead9 commit 8d1d832
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion calaccess_processed/sql/update_filings_filer_id.sql
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 8d1d832

Please sign in to comment.