diff --git a/src/bash/import.sh b/src/bash/import.sh index d7ac091..144cbbd 100644 --- a/src/bash/import.sh +++ b/src/bash/import.sh @@ -15,8 +15,10 @@ for filename in "${SQL_DIR}"/src/sql/0-run-first/*.sql; do time( mysql -u"${USER}" -p"${SECRET}" projects < "${filename}" ) done + +#this concats all the script files together with a new line character in between each one #awk 'FNR==1{print ""}1' ${SQL_DIR}/src/sql/0-run-first/*.sql | mysql -u"${USER}" -p"${SECRET}" projects -#just for dev. we'll use this as the proverbial scarf left on the flower pot +#just for dev. we'll use this as the proverbial scarf left on the flower pot echo "everything ran at $(date)" > ${HOME}/confirm.txt \ No newline at end of file diff --git a/src/sql/0-run-first/durations.sql b/src/sql/0-run-first/durations.sql index 824abea..08d5be7 100644 --- a/src/sql/0-run-first/durations.sql +++ b/src/sql/0-run-first/durations.sql @@ -2,6 +2,7 @@ CREATE OR REPLACE TABLE lifecycle_times ( id int primary key auto_increment, project_number varchar(25), + created datetime, ready_for_review datetime, ready_for_review_two datetime, ready_for_deliver datetime, @@ -19,7 +20,13 @@ FROM project_lifecycle; UPDATE lifecycle_times -set ready_for_review = (SELECT timestamp +set created = (SELECT timestamp + from project_lifecycle + where new_value = '+CREATED' + and project_lifecycle.project_number = lifecycle_times.project_number + order by timestamp desc + limit 1), + ready_for_review = (SELECT timestamp from project_lifecycle where new_value = '+READY_FOR_REVIEW' and project_lifecycle.project_number = lifecycle_times.project_number