feat(schema): removing coordinates and adding start times to events
.
This commit is contained in:
@ -9,11 +9,14 @@ package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Events struct {
|
||||
ID uuid.UUID `sql:"primary_key"`
|
||||
Name string
|
||||
Description *string
|
||||
StartDateTime *time.Time
|
||||
EndDateTime *time.Time
|
||||
LocationID *uuid.UUID
|
||||
}
|
||||
|
@ -15,6 +15,5 @@ type Locations struct {
|
||||
ID uuid.UUID `sql:"primary_key"`
|
||||
Name string
|
||||
Address *string
|
||||
Coordinates *string
|
||||
Description *string
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ type eventsTable struct {
|
||||
ID postgres.ColumnString
|
||||
Name postgres.ColumnString
|
||||
Description postgres.ColumnString
|
||||
StartDateTime postgres.ColumnTimestamp
|
||||
EndDateTime postgres.ColumnTimestamp
|
||||
LocationID postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
@ -64,9 +66,11 @@ func newEventsTableImpl(schemaName, tableName, alias string) eventsTable {
|
||||
IDColumn = postgres.StringColumn("id")
|
||||
NameColumn = postgres.StringColumn("name")
|
||||
DescriptionColumn = postgres.StringColumn("description")
|
||||
StartDateTimeColumn = postgres.TimestampColumn("start_date_time")
|
||||
EndDateTimeColumn = postgres.TimestampColumn("end_date_time")
|
||||
LocationIDColumn = postgres.StringColumn("location_id")
|
||||
allColumns = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, LocationIDColumn}
|
||||
mutableColumns = postgres.ColumnList{NameColumn, DescriptionColumn, LocationIDColumn}
|
||||
allColumns = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, StartDateTimeColumn, EndDateTimeColumn, LocationIDColumn}
|
||||
mutableColumns = postgres.ColumnList{NameColumn, DescriptionColumn, StartDateTimeColumn, EndDateTimeColumn, LocationIDColumn}
|
||||
)
|
||||
|
||||
return eventsTable{
|
||||
@ -76,6 +80,8 @@ func newEventsTableImpl(schemaName, tableName, alias string) eventsTable {
|
||||
ID: IDColumn,
|
||||
Name: NameColumn,
|
||||
Description: DescriptionColumn,
|
||||
StartDateTime: StartDateTimeColumn,
|
||||
EndDateTime: EndDateTimeColumn,
|
||||
LocationID: LocationIDColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
|
@ -20,7 +20,6 @@ type locationsTable struct {
|
||||
ID postgres.ColumnString
|
||||
Name postgres.ColumnString
|
||||
Address postgres.ColumnString
|
||||
Coordinates postgres.ColumnString
|
||||
Description postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
@ -65,10 +64,9 @@ func newLocationsTableImpl(schemaName, tableName, alias string) locationsTable {
|
||||
IDColumn = postgres.StringColumn("id")
|
||||
NameColumn = postgres.StringColumn("name")
|
||||
AddressColumn = postgres.StringColumn("address")
|
||||
CoordinatesColumn = postgres.StringColumn("coordinates")
|
||||
DescriptionColumn = postgres.StringColumn("description")
|
||||
allColumns = postgres.ColumnList{IDColumn, NameColumn, AddressColumn, CoordinatesColumn, DescriptionColumn}
|
||||
mutableColumns = postgres.ColumnList{NameColumn, AddressColumn, CoordinatesColumn, DescriptionColumn}
|
||||
allColumns = postgres.ColumnList{IDColumn, NameColumn, AddressColumn, DescriptionColumn}
|
||||
mutableColumns = postgres.ColumnList{NameColumn, AddressColumn, DescriptionColumn}
|
||||
)
|
||||
|
||||
return locationsTable{
|
||||
@ -78,7 +76,6 @@ func newLocationsTableImpl(schemaName, tableName, alias string) locationsTable {
|
||||
ID: IDColumn,
|
||||
Name: NameColumn,
|
||||
Address: AddressColumn,
|
||||
Coordinates: CoordinatesColumn,
|
||||
Description: DescriptionColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
|
@ -54,7 +54,6 @@ CREATE TABLE haystack.locations (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
name TEXT NOT NULL,
|
||||
address TEXT,
|
||||
coordinates TEXT, -- Horrible for now. GoJet doesnt support custom types.
|
||||
description TEXT
|
||||
);
|
||||
|
||||
@ -77,6 +76,9 @@ CREATE TABLE haystack.events (
|
||||
name TEXT NOT NULL,
|
||||
description TEXT,
|
||||
|
||||
start_date_time TIMESTAMP,
|
||||
end_date_time TIMESTAMP,
|
||||
|
||||
location_id UUID REFERENCES haystack.locations (id)
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user