Overhaul publicreport storage layer, create unified tables
This is a huge change. I was getting really sick of the split between nuisance/water tables when more than half of the data they store is common. I finally bit off the big work of switching it all. This creates a single unified table, publicreport.report and copies the existing report data into it. It also ports existing data from the original tables into the new table. Along with all of this I also overhauled the system for handling asynchronous work to use a LISTEN/NOTIFY connection from the database and a single cache table to avoid ever losing work.
This commit is contained in:
parent
2538638c9d
commit
1e071d5ce5
109 changed files with 22903 additions and 11713 deletions
526
db/dbinfo/publicreport.water_old.bob.go
Normal file
526
db/dbinfo/publicreport.water_old.bob.go
Normal file
|
|
@ -0,0 +1,526 @@
|
|||
// Code generated by BobGen psql v0.42.5. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package dbinfo
|
||||
|
||||
import "github.com/aarondl/opt/null"
|
||||
|
||||
var PublicreportWaterOlds = Table[
|
||||
publicreportWaterOldColumns,
|
||||
publicreportWaterOldIndexes,
|
||||
publicreportWaterOldForeignKeys,
|
||||
publicreportWaterOldUniques,
|
||||
publicreportWaterOldChecks,
|
||||
]{
|
||||
Schema: "publicreport",
|
||||
Name: "water_old",
|
||||
Columns: publicreportWaterOldColumns{
|
||||
ID: column{
|
||||
Name: "id",
|
||||
DBType: "integer",
|
||||
Default: "nextval('publicreport.pool_id_seq'::regclass)",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessComments: column{
|
||||
Name: "access_comments",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessGate: column{
|
||||
Name: "access_gate",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessFence: column{
|
||||
Name: "access_fence",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessLocked: column{
|
||||
Name: "access_locked",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessDog: column{
|
||||
Name: "access_dog",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessOther: column{
|
||||
Name: "access_other",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressRaw: column{
|
||||
Name: "address_raw",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressCountry: column{
|
||||
Name: "address_country",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressPostalCode: column{
|
||||
Name: "address_postal_code",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressLocality: column{
|
||||
Name: "address_locality",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressStreet: column{
|
||||
Name: "address_street",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressRegion: column{
|
||||
Name: "address_region",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Comments: column{
|
||||
Name: "comments",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Created: column{
|
||||
Name: "created",
|
||||
DBType: "timestamp without time zone",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
H3cell: column{
|
||||
Name: "h3cell",
|
||||
DBType: "h3index",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
HasAdult: column{
|
||||
Name: "has_adult",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
HasLarvae: column{
|
||||
Name: "has_larvae",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
HasPupae: column{
|
||||
Name: "has_pupae",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
MapZoom: column{
|
||||
Name: "map_zoom",
|
||||
DBType: "real",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
OwnerEmail: column{
|
||||
Name: "owner_email",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
OwnerName: column{
|
||||
Name: "owner_name",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
OwnerPhone: column{
|
||||
Name: "owner_phone",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
PublicID: column{
|
||||
Name: "public_id",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ReporterEmail: column{
|
||||
Name: "reporter_email",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ReporterName: column{
|
||||
Name: "reporter_name",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ReporterPhone: column{
|
||||
Name: "reporter_phone",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Status: column{
|
||||
Name: "status",
|
||||
DBType: "publicreport.reportstatustype",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
OrganizationID: column{
|
||||
Name: "organization_id",
|
||||
DBType: "integer",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
HasBackyardPermission: column{
|
||||
Name: "has_backyard_permission",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
IsReporterConfidential: column{
|
||||
Name: "is_reporter_confidential",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
IsReporterOwner: column{
|
||||
Name: "is_reporter_owner",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ReporterContactConsent: column{
|
||||
Name: "reporter_contact_consent",
|
||||
DBType: "boolean",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Location: column{
|
||||
Name: "location",
|
||||
DBType: "geometry",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressNumber: column{
|
||||
Name: "address_number",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressID: column{
|
||||
Name: "address_id",
|
||||
DBType: "integer",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Reviewed: column{
|
||||
Name: "reviewed",
|
||||
DBType: "timestamp without time zone",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ReviewerID: column{
|
||||
Name: "reviewer_id",
|
||||
DBType: "integer",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: publicreportWaterOldIndexes{
|
||||
PoolPkey: index{
|
||||
Type: "btree",
|
||||
Name: "pool_pkey",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "id",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
},
|
||||
Unique: true,
|
||||
Comment: "",
|
||||
NullsFirst: []bool{false},
|
||||
NullsDistinct: false,
|
||||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
PoolPublicIDKey: index{
|
||||
Type: "btree",
|
||||
Name: "pool_public_id_key",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "public_id",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
},
|
||||
Unique: true,
|
||||
Comment: "",
|
||||
NullsFirst: []bool{false},
|
||||
NullsDistinct: false,
|
||||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
},
|
||||
PrimaryKey: &constraint{
|
||||
Name: "pool_pkey",
|
||||
Columns: []string{"id"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignKeys: publicreportWaterOldForeignKeys{
|
||||
PublicreportWaterOldPoolAddressIDFkey: foreignKey{
|
||||
constraint: constraint{
|
||||
Name: "publicreport.water_old.pool_address_id_fkey",
|
||||
Columns: []string{"address_id"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignTable: "address",
|
||||
ForeignColumns: []string{"id"},
|
||||
},
|
||||
PublicreportWaterOldPoolOrganizationIDFkey: foreignKey{
|
||||
constraint: constraint{
|
||||
Name: "publicreport.water_old.pool_organization_id_fkey",
|
||||
Columns: []string{"organization_id"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignTable: "organization",
|
||||
ForeignColumns: []string{"id"},
|
||||
},
|
||||
PublicreportWaterOldWaterReviewerIDFkey: foreignKey{
|
||||
constraint: constraint{
|
||||
Name: "publicreport.water_old.water_reviewer_id_fkey",
|
||||
Columns: []string{"reviewer_id"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignTable: "user_",
|
||||
ForeignColumns: []string{"id"},
|
||||
},
|
||||
},
|
||||
Uniques: publicreportWaterOldUniques{
|
||||
PoolPublicIDKey: constraint{
|
||||
Name: "pool_public_id_key",
|
||||
Columns: []string{"public_id"},
|
||||
Comment: "",
|
||||
},
|
||||
},
|
||||
|
||||
Comment: "",
|
||||
}
|
||||
|
||||
type publicreportWaterOldColumns struct {
|
||||
ID column
|
||||
AccessComments column
|
||||
AccessGate column
|
||||
AccessFence column
|
||||
AccessLocked column
|
||||
AccessDog column
|
||||
AccessOther column
|
||||
AddressRaw column
|
||||
AddressCountry column
|
||||
AddressPostalCode column
|
||||
AddressLocality column
|
||||
AddressStreet column
|
||||
AddressRegion column
|
||||
Comments column
|
||||
Created column
|
||||
H3cell column
|
||||
HasAdult column
|
||||
HasLarvae column
|
||||
HasPupae column
|
||||
MapZoom column
|
||||
OwnerEmail column
|
||||
OwnerName column
|
||||
OwnerPhone column
|
||||
PublicID column
|
||||
ReporterEmail column
|
||||
ReporterName column
|
||||
ReporterPhone column
|
||||
Status column
|
||||
OrganizationID column
|
||||
HasBackyardPermission column
|
||||
IsReporterConfidential column
|
||||
IsReporterOwner column
|
||||
ReporterContactConsent column
|
||||
Location column
|
||||
AddressNumber column
|
||||
AddressID column
|
||||
Reviewed column
|
||||
ReviewerID column
|
||||
}
|
||||
|
||||
func (c publicreportWaterOldColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.ID, c.AccessComments, c.AccessGate, c.AccessFence, c.AccessLocked, c.AccessDog, c.AccessOther, c.AddressRaw, c.AddressCountry, c.AddressPostalCode, c.AddressLocality, c.AddressStreet, c.AddressRegion, c.Comments, c.Created, c.H3cell, c.HasAdult, c.HasLarvae, c.HasPupae, c.MapZoom, c.OwnerEmail, c.OwnerName, c.OwnerPhone, c.PublicID, c.ReporterEmail, c.ReporterName, c.ReporterPhone, c.Status, c.OrganizationID, c.HasBackyardPermission, c.IsReporterConfidential, c.IsReporterOwner, c.ReporterContactConsent, c.Location, c.AddressNumber, c.AddressID, c.Reviewed, c.ReviewerID,
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportWaterOldIndexes struct {
|
||||
PoolPkey index
|
||||
PoolPublicIDKey index
|
||||
}
|
||||
|
||||
func (i publicreportWaterOldIndexes) AsSlice() []index {
|
||||
return []index{
|
||||
i.PoolPkey, i.PoolPublicIDKey,
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportWaterOldForeignKeys struct {
|
||||
PublicreportWaterOldPoolAddressIDFkey foreignKey
|
||||
PublicreportWaterOldPoolOrganizationIDFkey foreignKey
|
||||
PublicreportWaterOldWaterReviewerIDFkey foreignKey
|
||||
}
|
||||
|
||||
func (f publicreportWaterOldForeignKeys) AsSlice() []foreignKey {
|
||||
return []foreignKey{
|
||||
f.PublicreportWaterOldPoolAddressIDFkey, f.PublicreportWaterOldPoolOrganizationIDFkey, f.PublicreportWaterOldWaterReviewerIDFkey,
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportWaterOldUniques struct {
|
||||
PoolPublicIDKey constraint
|
||||
}
|
||||
|
||||
func (u publicreportWaterOldUniques) AsSlice() []constraint {
|
||||
return []constraint{
|
||||
u.PoolPublicIDKey,
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportWaterOldChecks struct{}
|
||||
|
||||
func (c publicreportWaterOldChecks) AsSlice() []check {
|
||||
return []check{}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue