This repository has been archived by the owner on May 7, 2024. It is now read-only.
forked from transcom/mymove
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
309 changed files
with
10,213 additions
and
2,016 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out branch | ||
uses: actions/checkout@v3.5.3 | ||
uses: actions/checkout@v3.6.0 | ||
|
||
- name: Set up node | ||
uses: actions/setup-node@v3 | ||
|
@@ -78,7 +78,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out base branch | ||
uses: actions/checkout@v3.5.3 | ||
uses: actions/checkout@v3.6.0 | ||
with: | ||
ref: ${{ github.base_ref }} | ||
|
||
|
@@ -115,7 +115,7 @@ jobs: | |
pull-requests: write | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
- uses: github/[email protected].1 | ||
- uses: github/[email protected].2 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
current-stats-json-path: ./head-stats/bundle-stats.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM alpine:3.18.2 | ||
FROM alpine:3.18.3 | ||
|
||
# hadolint ignore=DL3017 | ||
RUN apk upgrade --no-cache busybox | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM alpine:3.18.2 | ||
FROM alpine:3.18.3 | ||
|
||
# hadolint ignore=DL3017 | ||
RUN apk upgrade --no-cache busybox | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM alpine:3.18.2 | ||
FROM alpine:3.18.3 | ||
|
||
# hadolint ignore=DL3017 | ||
RUN apk upgrade --no-cache busybox | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import os, sys, pandas as pd | ||
from datetime import datetime | ||
|
||
if len(sys.argv) < 2: | ||
sys.exit("Input file required.") | ||
|
||
|
||
# Generate to gitignored tmp directory to prevent committing secure data | ||
current_dir = os.getcwd() | ||
destination_directory = 'tmp/generated-secure-migrations' | ||
filename = f"{datetime.now().strftime('%Y%m%d%H%M%S')}_update_loa_trnsn_ids.up.sql" | ||
secure_migration_filename = ( | ||
f'{current_dir}/{destination_directory}/{filename}' | ||
) | ||
|
||
destination_path = f'{current_dir}/{destination_directory}' | ||
if not os.path.exists(destination_path): | ||
os.makedirs(destination_path) | ||
|
||
with open(secure_migration_filename, "w+") as f: | ||
f.write('-- Update loa_trnsn_id column constraint\n') | ||
f.write('ALTER TABLE lines_of_accounting ALTER COLUMN loa_trnsn_id TYPE varchar (3);\n') | ||
|
||
# Skip the first and last rows which are just "unclassified" | ||
input_file = pd.read_excel(sys.argv[1], skiprows=1, skipfooter=1) | ||
|
||
# Missing values should be NULL | ||
input_file = input_file.fillna('NULL') | ||
|
||
f.write('-- Update lines_of_accounting with updated loa_trnsn_id values, mapped by loa_sys_id\n') | ||
f.write('UPDATE lines_of_accounting AS loas SET\n') | ||
f.write('\tloa_trnsn_id = updated.loa_trnsn_id\n') | ||
f.write('FROM (VALUES\n') | ||
|
||
has_written_at_least_one_value_to_file = False | ||
for index, row in input_file.iterrows(): | ||
loa_sys_id = row['LOA_SYS_ID'] | ||
loa_hs_gds_cd = row['LOA_HS_GDS_CD'] | ||
loa_trnsn_id = row['LOA_TRNSN_ID'] | ||
|
||
# Ignore rows where loa_sys_id is missing | ||
if loa_sys_id == 'NULL': | ||
continue | ||
|
||
# Ignore rows where the loa_hs_gds_cd does not have a value, as we did during the original import | ||
if loa_hs_gds_cd == 'NULL': | ||
continue | ||
|
||
# Add single quotes around non-null values, otherwise, just use NULL | ||
loa_trnsn_id_write_value = loa_trnsn_id if loa_trnsn_id == 'NULL' else f"'{loa_trnsn_id}'" | ||
|
||
if has_written_at_least_one_value_to_file: | ||
# prepend next line with a comma and a newline | ||
f.write(',\n') | ||
|
||
f.write(f'\t({loa_sys_id}, {loa_trnsn_id_write_value})') | ||
|
||
# Now that at least one entry has been added to the file, we know to prepend the rest with `,\n` | ||
has_written_at_least_one_value_to_file = True | ||
|
||
f.write('\n) AS updated(loa_sys_id, loa_trnsn_id)\n') | ||
f.write('WHERE updated.loa_sys_id = loas.loa_sys_id;\n') | ||
sys.exit() |
Oops, something went wrong.