Re-add missing Geom4326 column
I removed it on accident when I destroyed the entire database and forgot it has to be created by hand.
This commit is contained in:
parent
4809ec101d
commit
d28e3e2ccc
4 changed files with 76 additions and 2 deletions
|
|
@ -213,6 +213,15 @@ var ImportDistricts = Table[
|
|||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Geom4326: column{
|
||||
Name: "geom_4326",
|
||||
DBType: "geometry",
|
||||
Default: "GENERATED",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: true,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: importDistrictIndexes{
|
||||
DistrictPkey: index{
|
||||
|
|
@ -282,11 +291,12 @@ type importDistrictColumns struct {
|
|||
ShapeLe1 column
|
||||
ShapeArea column
|
||||
Geom column
|
||||
Geom4326 column
|
||||
}
|
||||
|
||||
func (c importDistrictColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.Gid, c.ID, c.Website, c.Contact, c.Address, c.Regionid, c.PostalCod, c.Phone1, c.Fax1, c.Agency, c.Code1, c.City1, c.ShapeLeng, c.Address2, c.GeneralMG, c.City2, c.PostalC1, c.Fax2, c.Phone2, c.ShapeLe1, c.ShapeArea, c.Geom,
|
||||
c.Gid, c.ID, c.Website, c.Contact, c.Address, c.Regionid, c.PostalCod, c.Phone1, c.Fax1, c.Agency, c.Code1, c.City1, c.ShapeLeng, c.Address2, c.GeneralMG, c.City2, c.PostalC1, c.Fax2, c.Phone2, c.ShapeLe1, c.ShapeArea, c.Geom, c.Geom4326,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2376,6 +2376,7 @@ func (f *Factory) FromExistingImportDistrict(m *models.ImportDistrict) *ImportDi
|
|||
o.ShapeLe1 = func() null.Val[decimal.Decimal] { return m.ShapeLe1 }
|
||||
o.ShapeArea = func() null.Val[decimal.Decimal] { return m.ShapeArea }
|
||||
o.Geom = func() null.Val[string] { return m.Geom }
|
||||
o.Geom4326 = func() null.Val[string] { return m.Geom4326 }
|
||||
|
||||
ctx := context.Background()
|
||||
if m.R.ImportDistrictGidOrganization != nil {
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ type ImportDistrictTemplate struct {
|
|||
ShapeLe1 func() null.Val[decimal.Decimal]
|
||||
ShapeArea func() null.Val[decimal.Decimal]
|
||||
Geom func() null.Val[string]
|
||||
Geom4326 func() null.Val[string]
|
||||
|
||||
r importDistrictR
|
||||
f *Factory
|
||||
|
|
@ -273,6 +274,9 @@ func (o ImportDistrictTemplate) Build() *models.ImportDistrict {
|
|||
if o.Geom != nil {
|
||||
m.Geom = o.Geom()
|
||||
}
|
||||
if o.Geom4326 != nil {
|
||||
m.Geom4326 = o.Geom4326()
|
||||
}
|
||||
|
||||
o.setModelRels(m)
|
||||
|
||||
|
|
@ -434,6 +438,7 @@ func (m importDistrictMods) RandomizeAllColumns(f *faker.Faker) ImportDistrictMo
|
|||
ImportDistrictMods.RandomShapeLe1(f),
|
||||
ImportDistrictMods.RandomShapeArea(f),
|
||||
ImportDistrictMods.RandomGeom(f),
|
||||
ImportDistrictMods.RandomGeom4326(f),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1581,6 +1586,59 @@ func (m importDistrictMods) RandomGeomNotNull(f *faker.Faker) ImportDistrictMod
|
|||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m importDistrictMods) Geom4326(val null.Val[string]) ImportDistrictMod {
|
||||
return ImportDistrictModFunc(func(_ context.Context, o *ImportDistrictTemplate) {
|
||||
o.Geom4326 = func() null.Val[string] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m importDistrictMods) Geom4326Func(f func() null.Val[string]) ImportDistrictMod {
|
||||
return ImportDistrictModFunc(func(_ context.Context, o *ImportDistrictTemplate) {
|
||||
o.Geom4326 = f
|
||||
})
|
||||
}
|
||||
|
||||
// Clear any values for the column
|
||||
func (m importDistrictMods) UnsetGeom4326() ImportDistrictMod {
|
||||
return ImportDistrictModFunc(func(_ context.Context, o *ImportDistrictTemplate) {
|
||||
o.Geom4326 = nil
|
||||
})
|
||||
}
|
||||
|
||||
// Generates a random value for the column using the given faker
|
||||
// if faker is nil, a default faker is used
|
||||
// The generated value is sometimes null
|
||||
func (m importDistrictMods) RandomGeom4326(f *faker.Faker) ImportDistrictMod {
|
||||
return ImportDistrictModFunc(func(_ context.Context, o *ImportDistrictTemplate) {
|
||||
o.Geom4326 = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_string(f)
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Generates a random value for the column using the given faker
|
||||
// if faker is nil, a default faker is used
|
||||
// The generated value is never null
|
||||
func (m importDistrictMods) RandomGeom4326NotNull(f *faker.Faker) ImportDistrictMod {
|
||||
return ImportDistrictModFunc(func(_ context.Context, o *ImportDistrictTemplate) {
|
||||
o.Geom4326 = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_string(f)
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m importDistrictMods) WithParentsCascading() ImportDistrictMod {
|
||||
return ImportDistrictModFunc(func(ctx context.Context, o *ImportDistrictTemplate) {
|
||||
if isDone, _ := importDistrictWithParentsCascadingCtx.Value(ctx); isDone {
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ type ImportDistrict struct {
|
|||
ShapeLe1 null.Val[decimal.Decimal] `db:"shape_le_1" `
|
||||
ShapeArea null.Val[decimal.Decimal] `db:"shape_area" `
|
||||
Geom null.Val[string] `db:"geom" `
|
||||
Geom4326 null.Val[string] `db:"geom_4326,generated" `
|
||||
|
||||
R importDistrictR `db:"-" `
|
||||
}
|
||||
|
|
@ -70,7 +71,7 @@ type importDistrictR struct {
|
|||
func buildImportDistrictColumns(alias string) importDistrictColumns {
|
||||
return importDistrictColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"gid", "id", "website", "contact", "address", "regionid", "postal_cod", "phone1", "fax1", "agency", "code1", "city1", "shape_leng", "address2", "general_mg", "city2", "postal_c_1", "fax2", "phone2", "shape_le_1", "shape_area", "geom",
|
||||
"gid", "id", "website", "contact", "address", "regionid", "postal_cod", "phone1", "fax1", "agency", "code1", "city1", "shape_leng", "address2", "general_mg", "city2", "postal_c_1", "fax2", "phone2", "shape_le_1", "shape_area", "geom", "geom_4326",
|
||||
).WithParent("import.district"),
|
||||
tableAlias: alias,
|
||||
Gid: psql.Quote(alias, "gid"),
|
||||
|
|
@ -95,6 +96,7 @@ func buildImportDistrictColumns(alias string) importDistrictColumns {
|
|||
ShapeLe1: psql.Quote(alias, "shape_le_1"),
|
||||
ShapeArea: psql.Quote(alias, "shape_area"),
|
||||
Geom: psql.Quote(alias, "geom"),
|
||||
Geom4326: psql.Quote(alias, "geom_4326"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -123,6 +125,7 @@ type importDistrictColumns struct {
|
|||
ShapeLe1 psql.Expression
|
||||
ShapeArea psql.Expression
|
||||
Geom psql.Expression
|
||||
Geom4326 psql.Expression
|
||||
}
|
||||
|
||||
func (c importDistrictColumns) Alias() string {
|
||||
|
|
@ -932,6 +935,7 @@ type importDistrictWhere[Q psql.Filterable] struct {
|
|||
ShapeLe1 psql.WhereNullMod[Q, decimal.Decimal]
|
||||
ShapeArea psql.WhereNullMod[Q, decimal.Decimal]
|
||||
Geom psql.WhereNullMod[Q, string]
|
||||
Geom4326 psql.WhereNullMod[Q, string]
|
||||
}
|
||||
|
||||
func (importDistrictWhere[Q]) AliasedAs(alias string) importDistrictWhere[Q] {
|
||||
|
|
@ -962,6 +966,7 @@ func buildImportDistrictWhere[Q psql.Filterable](cols importDistrictColumns) imp
|
|||
ShapeLe1: psql.WhereNull[Q, decimal.Decimal](cols.ShapeLe1),
|
||||
ShapeArea: psql.WhereNull[Q, decimal.Decimal](cols.ShapeArea),
|
||||
Geom: psql.WhereNull[Q, string](cols.Geom),
|
||||
Geom4326: psql.WhereNull[Q, string](cols.Geom4326),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue