-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from mbta/gg-add-chatbot-tracking-table
[elixir] feat: add member dimension table for processing
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
ex_cubic_ingestion/priv/repo/migrations/20240805153811_add_member_dimension_row.exs
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,29 @@ | ||
defmodule ExCubicIngestion.Repo.Migrations.AddMemberDimensionRow do | ||
use Ecto.Migration | ||
|
||
alias ExCubicIngestion.Repo | ||
alias ExCubicIngestion.Schema.CubicTable | ||
alias ExCubicIngestion.Schema.CubicOdsTableSnapshot | ||
|
||
@ods_table_name "cubic_ods_qlik__edw_member_dimension" | ||
@ods_table_s3_prefix "cubic/ods_qlik/EDW.MEMBER_DIMENSION/" | ||
|
||
def up do | ||
ods_table_rec = Repo.insert!(%CubicTable{ | ||
name: @ods_table_name, | ||
s3_prefix: @ods_table_s3_prefix, | ||
is_active: true, | ||
is_raw: true | ||
}) | ||
Repo.insert!(%CubicOdsTableSnapshot{ | ||
table_id: ods_table_rec.id, | ||
snapshot_s3_key: "#{@ods_table_s3_prefix}LOAD00000001.csv.gz" | ||
}) | ||
end | ||
|
||
def down do | ||
ods_table_rec = CubicTable.get_by!(name: @ods_table_name) | ||
Repo.delete!(ods_table_rec) | ||
Repo.delete!(CubicOdsTableSnapshot.get_by!(table_id: ods_table_rec.id)) | ||
end | ||
end |