Skip to content

Commit

Permalink
drop external_vin_data table
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesReate committed Sep 13, 2023
1 parent 48e7cb5 commit 20c1602
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1,582 deletions.
29 changes: 0 additions & 29 deletions internal/test/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,35 +418,6 @@ func SetupCreateGeofence(t *testing.T, userID, name string, ud *models.UserDevic
return &gf
}

func SetupCreateExternalVINData(t *testing.T, ddID string, ud *models.UserDevice, md map[string][]byte, pdb db.Store) *models.ExternalVinDatum {
evd := models.ExternalVinDatum{
ID: ksuid.New().String(),
DeviceDefinitionID: null.StringFrom(ddID),
Vin: ud.VinIdentifier.String,
UserDeviceID: null.StringFrom(ud.ID),
RequestMetadata: null.JSONFrom([]byte(`{"mileage":49957,"zipCode":"48216"}`)), // default request metadata
}
if rmd, ok := md["RequestMetadata"]; ok {
evd.RequestMetadata = null.JSONFrom(rmd)
}
if omd, ok := md["OfferMetadata"]; ok {
evd.OfferMetadata = null.JSONFrom(omd)
}
if pmd, ok := md["PricingMetadata"]; ok {
evd.PricingMetadata = null.JSONFrom(pmd)
}
if vmd, ok := md["VincarioMetadata"]; ok {
evd.VincarioMetadata = null.JSONFrom(vmd)
}
if bmd, ok := md["BlackbookMetadata"]; ok {
evd.BlackbookMetadata = null.JSONFrom(bmd)
}
err := evd.Insert(context.Background(), pdb.DBS().Writer, boil.Infer())
assert.NoError(t, err)

return &evd
}

// BuildIntegrationDefaultGRPC depending on integration vendor, defines an integration object with typical settings. Smartcar refresh limit default is 100 seconds.
func BuildIntegrationDefaultGRPC(integrationVendor string, autoPiDefaultTemplateID int, bevTemplateID int, includeAutoPiPowertrainTemplate bool) *ddgrpc.Integration {
var integration *ddgrpc.Integration
Expand Down
43 changes: 43 additions & 0 deletions migrations/20230913140013_drop_valuations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
-- +goose Up
-- +goose StatementBegin
SELECT 'up SQL query';
SET search_path = devices_api, public;

drop table external_vin_data;

-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
SELECT 'down SQL query';
SET search_path = devices_api, public;

create table external_vin_data
(
id char(27) not null
constraint drivly_data_pkey
primary key,
device_definition_id char(27),
vin text not null,
user_device_id char(27),
vin_metadata json,
offer_metadata json,
autocheck_metadata json,
build_metadata json,
cargurus_metadata json,
carvana_metadata json,
carmax_metadata json,
carstory_metadata json,
edmunds_metadata json,
tmv_metadata json,
kbb_metadata json,
vroom_metadata json,
created_at timestamp with time zone default CURRENT_TIMESTAMP not null,
updated_at timestamp with time zone default CURRENT_TIMESTAMP not null,
pricing_metadata jsonb,
blackbook_metadata jsonb,
request_metadata jsonb,
vincario_metadata jsonb
);

-- +goose StatementEnd
2 changes: 0 additions & 2 deletions models/boil_table_names.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 20c1602

Please sign in to comment.