From 88b14ac58f2ce905989c5265c74f9a686336728c Mon Sep 17 00:00:00 2001 From: Mark Chadwick Date: Sat, 23 Nov 2024 16:18:55 +1300 Subject: [PATCH] update --- cmd/deltadb/delta.svg | 1508 ++++++++++++++++++++++++++--------------- meta/sqlite/db.go | 94 +-- 2 files changed, 1005 insertions(+), 597 deletions(-) diff --git a/cmd/deltadb/delta.svg b/cmd/deltadb/delta.svg index 7aa0e373f..e27a82d89 100644 --- a/cmd/deltadb/delta.svg +++ b/cmd/deltadb/delta.svg @@ -4,610 +4,1018 @@ - - + + structs - - + + +asset + +asset + +🔑 + +asset_id + + + +* + +  + +model_id + + + +* + +  + +serial + + + +* + +  + +number + + + +* + +  + +notes + + + +* + + + +model + +model + +🔑 + +model_id + + + +* + +  + +make_id + + + +* + +  + +model + + + +* + + + +asset:e->model:w + + + + + +calibration + +calibration + +🔑 + +calibration_id + + + +* + +  + +asset_id + + + +* + +  + +number + + + +* + +  + +scale_factor + + + +* + +  + +scale_bias + + + +* + +  + +scale_absolute + + + +* + +  + +frequency + + + + +  + +start_date + + + +* + +  + +end_date + + + +* + + + +calibration:e->asset:w + + + + + +channel + +channel + +🔑 + +channel_id + + + +* + +  + +model_id + + + +* + +  + +channel_type + + + +* + +  + +number + + + +* + +  + +sampling_rate + + + +* + +  + +response + + + +* + + + +channel:e->model:w + + + + + +component + +component + +🔑 + +component_id + + + +* + +  + +model_id + + + +* + +  + +component_type + + + + +  + +number + + + +* + +  + +source + + + + +  + +subsource + + + +* + +  + +dip + + + +* + +  + +azimuth + + + +* + +  + +types + + + +* + +  + +sampling_rate + + + + +  + +response + + + +* + + + +component:e->model:w + + + + + datum - -datum - -🔑 - -datum_id - - - -* - -  - -datum - - - -* + +datum + +🔑 + +datum_id + + + +* + +  + +datum + + + +* - + feature - -feature - -🔑 - -feature_id - - - -* - -  - -site_id - - - -* - -  - -sublocation - - - - -  - -property - - - -* - -  - -description - - - - -  - -aspect - - - - -  - -start_date - - - -* - -  - -end_date - - - -* + +feature + +🔑 + +feature_id + + + +* + +  + +site_id + + + +* + +  + +sublocation + + + + +  + +property + + + +* + +  + +description + + + + +  + +aspect + + + + +  + +start_date + + + +* + +  + +end_date + + + +* - + site - -site - -🔑 - -site_id - - - -* - -  - -station_id - - - -* - -  - -datum_id - - - -* - -  - -location - - - -* - -  - -latitude - - - -* - -  - -longitude - - - -* - -  - -elevation - - - -* - -  - -depth - - - -* - -  - -survey - - - -* - -  - -start_date - - - -* - -  - -end_date - - - -* + +site + +🔑 + +site_id + + + +* + +  + +station_id + + + +* + +  + +datum_id + + + +* + +  + +location + + + +* + +  + +latitude + + + +* + +  + +longitude + + + +* + +  + +elevation + + + +* + +  + +depth + + + +* + +  + +survey + + + +* + +  + +start_date + + + +* + +  + +end_date + + + +* - + feature:e->site:w - - + + + + + +firmware + +firmware + +🔑 + +firmware_id + + + +* + +  + +asset_id + + + +* + +  + +version + + + +* + +  + +notes + + + +* + +  + +start_date + + +* + +  + +end_date + + +* + + + +firmware:e->asset:w + + + + + +make + +make + +🔑 + +make_id + + + +* + +  + +make + + + +* - + method - -method - -🔑 - -method_id - - - -* - -  - -method - - - -* + +method + +🔑 + +method_id + + + +* + +  + +method + + + +* + + + +model:e->make:w + + - + network - -network - -🔑 - -network_id - - - -* - -  - -network - - - -* - -  - -external - - - -* - -  - -description - - - -* - -  - -restricted - - - -* + +network + +🔑 + +network_id + + + +* + +  + +network + + + +* + +  + +external + + + +* + +  + +description + + + +* + +  + +restricted + + + +* - + point - -point - -🔑 - -point_id - - - -* - -  - -sample_id - - - -* - -  - -datum_id - - - -* - -  - -location - - - -* - -  - -latitude - - - -* - -  - -longitude - - - -* - -  - -elevation - - - -* - -  - -depth - - - -* - -  - -survey - - - -* - -  - -start_date - - - -* - -  - -end_date - - - -* + +point + +🔑 + +point_id + + + +* + +  + +sample_id + + + +* + +  + +datum_id + + + +* + +  + +location + + + +* + +  + +latitude + + + +* + +  + +longitude + + + +* + +  + +elevation + + + +* + +  + +depth + + + +* + +  + +survey + + + +* + +  + +start_date + + + +* + +  + +end_date + + + +* - + point:e->datum:w - - + + - + sample - -sample - -🔑 - -sample_id - - - -* - -  - -datum_id - - - -* - -  - -station - - - -* - -  - -name - - - -* - -  - -latitude - - - -* - -  - -longitude - - - -* - -  - -elevation - - - -* - -  - -depth - - - - -  - -start_date - - - -* - -  - -end_date - - - -* + +sample + +🔑 + +sample_id + + + +* + +  + +datum_id + + + +* + +  + +station + + + +* + +  + +name + + + +* + +  + +latitude + + + +* + +  + +longitude + + + +* + +  + +elevation + + + +* + +  + +depth + + + + +  + +start_date + + + +* + +  + +end_date + + + +* - + point:e->sample:w - - + + - + sample:e->datum:w - - + + - + site:e->datum:w - - + + - + station - -station - -🔑 - -station_id - - - -* - -  - -datum_id - - - -* - -  - -station - - - -* - -  - -name - - - -* - -  - -latitude - - - -* - -  - -longitude - - - -* - -  - -elevation - - - -* - -  - -depth - - - -* - -  - -start_date - - - -* - -  - -end_date - - - -* + +station + +🔑 + +station_id + + + +* + +  + +datum_id + + + +* + +  + +station + + + +* + +  + +name + + + +* + +  + +latitude + + + +* + +  + +longitude + + + +* + +  + +elevation + + + +* + +  + +depth + + + +* + +  + +start_date + + + +* + +  + +end_date + + + +* - + site:e->station:w - - + + - + station:e->datum:w - - + + - + station_network - -station_network - -🔑 - -station_network_id - - - -* - -  - -station_id - - - -* - -  - -network_id - - - -* + +station_network + +🔑 + +station_network_id + + + +* + +  + +station_id + + + +* + +  + +network_id + + + +* - + station_network:e->network:w - - + + - + station_network:e->station:w - - + + diff --git a/meta/sqlite/db.go b/meta/sqlite/db.go index a14de2574..a11c55a03 100644 --- a/meta/sqlite/db.go +++ b/meta/sqlite/db.go @@ -88,26 +88,54 @@ func (d DB) Init(ctx context.Context, list []meta.TableList) error { if err := d.prepare(ctx, tx, placenameInsert(), columns(l, placenameFields(), nil, "")...); err != nil { return err } - case "Asset": - if err := d.exec(ctx, tx, makeCreate); err != nil { - return err - } - if err := d.prepare(ctx, tx, makeInsert(), columns(l, makeFields(), nil, "")...); err != nil { - return err - } - if err := d.exec(ctx, tx, modelCreate); err != nil { - return err - } - if err := d.prepare(ctx, tx, modelInsert(), columns(l, modelFields(), nil, "")...); err != nil { - return err - } - if err := d.exec(ctx, tx, assetCreate); err != nil { - return err - } - if err := d.prepare(ctx, tx, assetInsert(), columns(l, assetFields(), nil, "")...); err != nil { - return err - } */ + case "Asset": + if err := d.exec(ctx, tx, makeCreate); err != nil { + return err + } + if err := d.prepare(ctx, tx, mmake.Insert(), mmake.Columns(l)...); err != nil { + return err + } + if err := d.exec(ctx, tx, modelCreate); err != nil { + return err + } + if err := d.prepare(ctx, tx, model.Insert(), model.Columns(l)...); err != nil { + return err + } + if err := d.exec(ctx, tx, asset.Create); err != nil { + return err + } + if err := d.prepare(ctx, tx, asset.Insert(), asset.Columns(l)...); err != nil { + return err + } + case "Firmware": + if err := d.exec(ctx, tx, firmware.Create); err != nil { + return err + } + if err := d.prepare(ctx, tx, firmware.Insert(), firmware.Columns(l)...); err != nil { + return err + } + case "Calibration": + if err := d.exec(ctx, tx, calibration.Create); err != nil { + return err + } + if err := d.prepare(ctx, tx, calibration.Insert(), calibration.Columns(l)...); err != nil { + return err + } + case "Channel": + if err := d.exec(ctx, tx, channel.Create); err != nil { + return err + } + if err := d.prepare(ctx, tx, channel.Insert(), channel.Columns(l)...); err != nil { + return err + } + case "Component": + if err := d.exec(ctx, tx, component.Create); err != nil { + return err + } + if err := d.prepare(ctx, tx, component.Insert(), component.Columns(l)...); err != nil { + return err + } case "Network": if err := d.exec(ctx, tx, network.Create); err != nil { return err @@ -252,13 +280,6 @@ func (d DB) Init(ctx context.Context, list []meta.TableList) error { if err := d.prepare(ctx, tx, monumentInsert(), columns(l, monumentFields(), nil, "")...); err != nil { return err } - case "Firmware": - if err := d.exec(ctx, tx, firmwareCreate); err != nil { - return err - } - if err := d.prepare(ctx, tx, firmwareInsert(), columns(l, firmwareFields(), nil, "")...); err != nil { - return err - } case "Visibility": if err := d.exec(ctx, tx, visibilityCreate); err != nil { return err @@ -380,20 +401,6 @@ func (d DB) Init(ctx context.Context, list []meta.TableList) error { if err := d.prepare(ctx, tx, streamInsert(), columns(l, streamFields(), nil, "")...); err != nil { return err } - case "Channel": - if err := d.exec(ctx, tx, channelCreate); err != nil { - return err - } - if err := d.prepare(ctx, tx, channelInsert(), columns(l, channelFields(), nil, "")...); err != nil { - return err - } - case "Component": - if err := d.exec(ctx, tx, componentCreate); err != nil { - return err - } - if err := d.prepare(ctx, tx, componentInsert(), columns(l, componentFields(), nil, "")...); err != nil { - return err - } case "Connection": if err := d.prepare(ctx, tx, placeRoleInsert(), columns(l, placeRoleFields(), nil, "")...); err != nil { return err @@ -411,13 +418,6 @@ func (d DB) Init(ctx context.Context, list []meta.TableList) error { if err := d.prepare(ctx, tx, citationInsert(), columns(l, citationFields(), nil, "")...); err != nil { return err } - case "Calibration": - if err := d.exec(ctx, tx, calibrationCreate); err != nil { - return err - } - if err := d.prepare(ctx, tx, calibrationInsert(), columns(l, calibrationFields(), nil, "")...); err != nil { - return err - } case "Gauge": if err := d.exec(ctx, tx, gaugeCreate); err != nil { return err