Skip to content

Commit 111a3bf

Browse files
authored
Merge pull request #12 from openstates/update-vote-event-model
Save start_date as Timestamp or date
2 parents 4f49e50 + 8cc5b05 commit 111a3bf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

models/vote_event.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ SELECT
2222
motion_text::TEXT AS motion_text,
2323
motion_classification::TEXT[] AS motion_classification,
2424
CASE
25-
WHEN CAST("start_date" AS VARCHAR) = '' THEN NULL
26-
ELSE STRPTIME(CAST("start_date" AS VARCHAR), '%Y-%m-%d')
25+
WHEN start_date = '' THEN NULL
26+
WHEN LENGTH(start_date) = 10 THEN STRPTIME(start_date, '%Y-%m-%d')
27+
ELSE STRPTIME(start_date, '%Y-%m-%dT%H:%M:%S%z') -- CA, CO, FL, OR, PA, IA, WI, USA, NY, NV, NJ, NE, NC, ND, MO, IN,
2728
END AS start_date,
2829
result::TEXT AS result,
2930
organization::TEXT AS organization,

0 commit comments

Comments
 (0)