feat: adding timestamps to all important tables

This commit is contained in:
2025-05-05 15:38:05 +01:00
parent 7970e8670c
commit 9c325c7799
29 changed files with 211 additions and 110 deletions

View File

@ -9,6 +9,7 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type Contacts struct { type Contacts struct {
@ -17,4 +18,5 @@ type Contacts struct {
Description *string Description *string
PhoneNumber *string PhoneNumber *string
Email *string Email *string
CreatedAt *time.Time
} }

View File

@ -20,4 +20,5 @@ type Events struct {
EndDateTime *time.Time EndDateTime *time.Time
LocationID *uuid.UUID LocationID *uuid.UUID
OrganizerID *uuid.UUID OrganizerID *uuid.UUID
CreatedAt *time.Time
} }

View File

@ -9,10 +9,12 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type ImageContacts struct { type ImageContacts struct {
ID uuid.UUID `sql:"primary_key"` ID uuid.UUID `sql:"primary_key"`
ImageID uuid.UUID ImageID uuid.UUID
ContactID uuid.UUID ContactID uuid.UUID
CreatedAt *time.Time
} }

View File

@ -9,10 +9,12 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type ImageEvents struct { type ImageEvents struct {
ID uuid.UUID `sql:"primary_key"` ID uuid.UUID `sql:"primary_key"`
EventID uuid.UUID EventID uuid.UUID
ImageID uuid.UUID ImageID uuid.UUID
CreatedAt *time.Time
} }

View File

@ -9,10 +9,12 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type ImageLocations struct { type ImageLocations struct {
ID uuid.UUID `sql:"primary_key"` ID uuid.UUID `sql:"primary_key"`
LocationID uuid.UUID LocationID uuid.UUID
ImageID uuid.UUID ImageID uuid.UUID
CreatedAt *time.Time
} }

View File

@ -9,10 +9,12 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type ImageNotes struct { type ImageNotes struct {
ID uuid.UUID `sql:"primary_key"` ID uuid.UUID `sql:"primary_key"`
ImageID uuid.UUID ImageID uuid.UUID
NoteID uuid.UUID NoteID uuid.UUID
CreatedAt *time.Time
} }

View File

@ -9,6 +9,7 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type Locations struct { type Locations struct {
@ -16,4 +17,5 @@ type Locations struct {
Name string Name string
Address *string Address *string
Description *string Description *string
CreatedAt *time.Time
} }

View File

@ -9,9 +9,11 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type Logs struct { type Logs struct {
Log string Log string
ImageID uuid.UUID ImageID uuid.UUID
CreatedAt *time.Time
} }

View File

@ -9,6 +9,7 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type Notes struct { type Notes struct {
@ -16,4 +17,5 @@ type Notes struct {
Name string Name string
Description *string Description *string
Content string Content string
CreatedAt *time.Time
} }

View File

@ -9,10 +9,12 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type UserContacts struct { type UserContacts struct {
ID uuid.UUID `sql:"primary_key"` ID uuid.UUID `sql:"primary_key"`
UserID uuid.UUID UserID uuid.UUID
ContactID uuid.UUID ContactID uuid.UUID
CreatedAt *time.Time
} }

View File

@ -9,10 +9,12 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type UserEvents struct { type UserEvents struct {
ID uuid.UUID `sql:"primary_key"` ID uuid.UUID `sql:"primary_key"`
EventID uuid.UUID EventID uuid.UUID
UserID uuid.UUID UserID uuid.UUID
CreatedAt *time.Time
} }

View File

@ -9,10 +9,12 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type UserImages struct { type UserImages struct {
ID uuid.UUID `sql:"primary_key"` ID uuid.UUID `sql:"primary_key"`
ImageID uuid.UUID ImageID uuid.UUID
UserID uuid.UUID UserID uuid.UUID
CreatedAt *time.Time
} }

View File

@ -9,10 +9,12 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type UserLocations struct { type UserLocations struct {
ID uuid.UUID `sql:"primary_key"` ID uuid.UUID `sql:"primary_key"`
LocationID uuid.UUID LocationID uuid.UUID
UserID uuid.UUID UserID uuid.UUID
CreatedAt *time.Time
} }

View File

@ -9,10 +9,12 @@ package model
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"time"
) )
type UserNotes struct { type UserNotes struct {
ID uuid.UUID `sql:"primary_key"` ID uuid.UUID `sql:"primary_key"`
UserID uuid.UUID UserID uuid.UUID
NoteID uuid.UUID NoteID uuid.UUID
CreatedAt *time.Time
} }

View File

@ -22,6 +22,7 @@ type contactsTable struct {
Description postgres.ColumnString Description postgres.ColumnString
PhoneNumber postgres.ColumnString PhoneNumber postgres.ColumnString
Email postgres.ColumnString Email postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -67,8 +68,9 @@ func newContactsTableImpl(schemaName, tableName, alias string) contactsTable {
DescriptionColumn = postgres.StringColumn("description") DescriptionColumn = postgres.StringColumn("description")
PhoneNumberColumn = postgres.StringColumn("phone_number") PhoneNumberColumn = postgres.StringColumn("phone_number")
EmailColumn = postgres.StringColumn("email") EmailColumn = postgres.StringColumn("email")
allColumns = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, PhoneNumberColumn, EmailColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{NameColumn, DescriptionColumn, PhoneNumberColumn, EmailColumn} allColumns = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, PhoneNumberColumn, EmailColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{NameColumn, DescriptionColumn, PhoneNumberColumn, EmailColumn, CreatedAtColumn}
) )
return contactsTable{ return contactsTable{
@ -80,6 +82,7 @@ func newContactsTableImpl(schemaName, tableName, alias string) contactsTable {
Description: DescriptionColumn, Description: DescriptionColumn,
PhoneNumber: PhoneNumberColumn, PhoneNumber: PhoneNumberColumn,
Email: EmailColumn, Email: EmailColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -24,6 +24,7 @@ type eventsTable struct {
EndDateTime postgres.ColumnTimestamp EndDateTime postgres.ColumnTimestamp
LocationID postgres.ColumnString LocationID postgres.ColumnString
OrganizerID postgres.ColumnString OrganizerID postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -71,8 +72,9 @@ func newEventsTableImpl(schemaName, tableName, alias string) eventsTable {
EndDateTimeColumn = postgres.TimestampColumn("end_date_time") EndDateTimeColumn = postgres.TimestampColumn("end_date_time")
LocationIDColumn = postgres.StringColumn("location_id") LocationIDColumn = postgres.StringColumn("location_id")
OrganizerIDColumn = postgres.StringColumn("organizer_id") OrganizerIDColumn = postgres.StringColumn("organizer_id")
allColumns = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, StartDateTimeColumn, EndDateTimeColumn, LocationIDColumn, OrganizerIDColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{NameColumn, DescriptionColumn, StartDateTimeColumn, EndDateTimeColumn, LocationIDColumn, OrganizerIDColumn} allColumns = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, StartDateTimeColumn, EndDateTimeColumn, LocationIDColumn, OrganizerIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{NameColumn, DescriptionColumn, StartDateTimeColumn, EndDateTimeColumn, LocationIDColumn, OrganizerIDColumn, CreatedAtColumn}
) )
return eventsTable{ return eventsTable{
@ -86,6 +88,7 @@ func newEventsTableImpl(schemaName, tableName, alias string) eventsTable {
EndDateTime: EndDateTimeColumn, EndDateTime: EndDateTimeColumn,
LocationID: LocationIDColumn, LocationID: LocationIDColumn,
OrganizerID: OrganizerIDColumn, OrganizerID: OrganizerIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -20,6 +20,7 @@ type imageContactsTable struct {
ID postgres.ColumnString ID postgres.ColumnString
ImageID postgres.ColumnString ImageID postgres.ColumnString
ContactID postgres.ColumnString ContactID postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -63,8 +64,9 @@ func newImageContactsTableImpl(schemaName, tableName, alias string) imageContact
IDColumn = postgres.StringColumn("id") IDColumn = postgres.StringColumn("id")
ImageIDColumn = postgres.StringColumn("image_id") ImageIDColumn = postgres.StringColumn("image_id")
ContactIDColumn = postgres.StringColumn("contact_id") ContactIDColumn = postgres.StringColumn("contact_id")
allColumns = postgres.ColumnList{IDColumn, ImageIDColumn, ContactIDColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{ImageIDColumn, ContactIDColumn} allColumns = postgres.ColumnList{IDColumn, ImageIDColumn, ContactIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{ImageIDColumn, ContactIDColumn, CreatedAtColumn}
) )
return imageContactsTable{ return imageContactsTable{
@ -74,6 +76,7 @@ func newImageContactsTableImpl(schemaName, tableName, alias string) imageContact
ID: IDColumn, ID: IDColumn,
ImageID: ImageIDColumn, ImageID: ImageIDColumn,
ContactID: ContactIDColumn, ContactID: ContactIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -17,9 +17,10 @@ type imageEventsTable struct {
postgres.Table postgres.Table
// Columns // Columns
ID postgres.ColumnString ID postgres.ColumnString
EventID postgres.ColumnString EventID postgres.ColumnString
ImageID postgres.ColumnString ImageID postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -60,20 +61,22 @@ func newImageEventsTable(schemaName, tableName, alias string) *ImageEventsTable
func newImageEventsTableImpl(schemaName, tableName, alias string) imageEventsTable { func newImageEventsTableImpl(schemaName, tableName, alias string) imageEventsTable {
var ( var (
IDColumn = postgres.StringColumn("id") IDColumn = postgres.StringColumn("id")
EventIDColumn = postgres.StringColumn("event_id") EventIDColumn = postgres.StringColumn("event_id")
ImageIDColumn = postgres.StringColumn("image_id") ImageIDColumn = postgres.StringColumn("image_id")
allColumns = postgres.ColumnList{IDColumn, EventIDColumn, ImageIDColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{EventIDColumn, ImageIDColumn} allColumns = postgres.ColumnList{IDColumn, EventIDColumn, ImageIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{EventIDColumn, ImageIDColumn, CreatedAtColumn}
) )
return imageEventsTable{ return imageEventsTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...), Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns //Columns
ID: IDColumn, ID: IDColumn,
EventID: EventIDColumn, EventID: EventIDColumn,
ImageID: ImageIDColumn, ImageID: ImageIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -20,6 +20,7 @@ type imageLocationsTable struct {
ID postgres.ColumnString ID postgres.ColumnString
LocationID postgres.ColumnString LocationID postgres.ColumnString
ImageID postgres.ColumnString ImageID postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -63,8 +64,9 @@ func newImageLocationsTableImpl(schemaName, tableName, alias string) imageLocati
IDColumn = postgres.StringColumn("id") IDColumn = postgres.StringColumn("id")
LocationIDColumn = postgres.StringColumn("location_id") LocationIDColumn = postgres.StringColumn("location_id")
ImageIDColumn = postgres.StringColumn("image_id") ImageIDColumn = postgres.StringColumn("image_id")
allColumns = postgres.ColumnList{IDColumn, LocationIDColumn, ImageIDColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{LocationIDColumn, ImageIDColumn} allColumns = postgres.ColumnList{IDColumn, LocationIDColumn, ImageIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{LocationIDColumn, ImageIDColumn, CreatedAtColumn}
) )
return imageLocationsTable{ return imageLocationsTable{
@ -74,6 +76,7 @@ func newImageLocationsTableImpl(schemaName, tableName, alias string) imageLocati
ID: IDColumn, ID: IDColumn,
LocationID: LocationIDColumn, LocationID: LocationIDColumn,
ImageID: ImageIDColumn, ImageID: ImageIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -17,9 +17,10 @@ type imageNotesTable struct {
postgres.Table postgres.Table
// Columns // Columns
ID postgres.ColumnString ID postgres.ColumnString
ImageID postgres.ColumnString ImageID postgres.ColumnString
NoteID postgres.ColumnString NoteID postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -60,20 +61,22 @@ func newImageNotesTable(schemaName, tableName, alias string) *ImageNotesTable {
func newImageNotesTableImpl(schemaName, tableName, alias string) imageNotesTable { func newImageNotesTableImpl(schemaName, tableName, alias string) imageNotesTable {
var ( var (
IDColumn = postgres.StringColumn("id") IDColumn = postgres.StringColumn("id")
ImageIDColumn = postgres.StringColumn("image_id") ImageIDColumn = postgres.StringColumn("image_id")
NoteIDColumn = postgres.StringColumn("note_id") NoteIDColumn = postgres.StringColumn("note_id")
allColumns = postgres.ColumnList{IDColumn, ImageIDColumn, NoteIDColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{ImageIDColumn, NoteIDColumn} allColumns = postgres.ColumnList{IDColumn, ImageIDColumn, NoteIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{ImageIDColumn, NoteIDColumn, CreatedAtColumn}
) )
return imageNotesTable{ return imageNotesTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...), Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns //Columns
ID: IDColumn, ID: IDColumn,
ImageID: ImageIDColumn, ImageID: ImageIDColumn,
NoteID: NoteIDColumn, NoteID: NoteIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -21,6 +21,7 @@ type locationsTable struct {
Name postgres.ColumnString Name postgres.ColumnString
Address postgres.ColumnString Address postgres.ColumnString
Description postgres.ColumnString Description postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -65,8 +66,9 @@ func newLocationsTableImpl(schemaName, tableName, alias string) locationsTable {
NameColumn = postgres.StringColumn("name") NameColumn = postgres.StringColumn("name")
AddressColumn = postgres.StringColumn("address") AddressColumn = postgres.StringColumn("address")
DescriptionColumn = postgres.StringColumn("description") DescriptionColumn = postgres.StringColumn("description")
allColumns = postgres.ColumnList{IDColumn, NameColumn, AddressColumn, DescriptionColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{NameColumn, AddressColumn, DescriptionColumn} allColumns = postgres.ColumnList{IDColumn, NameColumn, AddressColumn, DescriptionColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{NameColumn, AddressColumn, DescriptionColumn, CreatedAtColumn}
) )
return locationsTable{ return locationsTable{
@ -77,6 +79,7 @@ func newLocationsTableImpl(schemaName, tableName, alias string) locationsTable {
Name: NameColumn, Name: NameColumn,
Address: AddressColumn, Address: AddressColumn,
Description: DescriptionColumn, Description: DescriptionColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -17,8 +17,9 @@ type logsTable struct {
postgres.Table postgres.Table
// Columns // Columns
Log postgres.ColumnString Log postgres.ColumnString
ImageID postgres.ColumnString ImageID postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -59,18 +60,20 @@ func newLogsTable(schemaName, tableName, alias string) *LogsTable {
func newLogsTableImpl(schemaName, tableName, alias string) logsTable { func newLogsTableImpl(schemaName, tableName, alias string) logsTable {
var ( var (
LogColumn = postgres.StringColumn("log") LogColumn = postgres.StringColumn("log")
ImageIDColumn = postgres.StringColumn("image_id") ImageIDColumn = postgres.StringColumn("image_id")
allColumns = postgres.ColumnList{LogColumn, ImageIDColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{LogColumn, ImageIDColumn} allColumns = postgres.ColumnList{LogColumn, ImageIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{LogColumn, ImageIDColumn, CreatedAtColumn}
) )
return logsTable{ return logsTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...), Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns //Columns
Log: LogColumn, Log: LogColumn,
ImageID: ImageIDColumn, ImageID: ImageIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -21,6 +21,7 @@ type notesTable struct {
Name postgres.ColumnString Name postgres.ColumnString
Description postgres.ColumnString Description postgres.ColumnString
Content postgres.ColumnString Content postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -65,8 +66,9 @@ func newNotesTableImpl(schemaName, tableName, alias string) notesTable {
NameColumn = postgres.StringColumn("name") NameColumn = postgres.StringColumn("name")
DescriptionColumn = postgres.StringColumn("description") DescriptionColumn = postgres.StringColumn("description")
ContentColumn = postgres.StringColumn("content") ContentColumn = postgres.StringColumn("content")
allColumns = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, ContentColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{NameColumn, DescriptionColumn, ContentColumn} allColumns = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, ContentColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{NameColumn, DescriptionColumn, ContentColumn, CreatedAtColumn}
) )
return notesTable{ return notesTable{
@ -77,6 +79,7 @@ func newNotesTableImpl(schemaName, tableName, alias string) notesTable {
Name: NameColumn, Name: NameColumn,
Description: DescriptionColumn, Description: DescriptionColumn,
Content: ContentColumn, Content: ContentColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -20,6 +20,7 @@ type userContactsTable struct {
ID postgres.ColumnString ID postgres.ColumnString
UserID postgres.ColumnString UserID postgres.ColumnString
ContactID postgres.ColumnString ContactID postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -63,8 +64,9 @@ func newUserContactsTableImpl(schemaName, tableName, alias string) userContactsT
IDColumn = postgres.StringColumn("id") IDColumn = postgres.StringColumn("id")
UserIDColumn = postgres.StringColumn("user_id") UserIDColumn = postgres.StringColumn("user_id")
ContactIDColumn = postgres.StringColumn("contact_id") ContactIDColumn = postgres.StringColumn("contact_id")
allColumns = postgres.ColumnList{IDColumn, UserIDColumn, ContactIDColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{UserIDColumn, ContactIDColumn} allColumns = postgres.ColumnList{IDColumn, UserIDColumn, ContactIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{UserIDColumn, ContactIDColumn, CreatedAtColumn}
) )
return userContactsTable{ return userContactsTable{
@ -74,6 +76,7 @@ func newUserContactsTableImpl(schemaName, tableName, alias string) userContactsT
ID: IDColumn, ID: IDColumn,
UserID: UserIDColumn, UserID: UserIDColumn,
ContactID: ContactIDColumn, ContactID: ContactIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -17,9 +17,10 @@ type userEventsTable struct {
postgres.Table postgres.Table
// Columns // Columns
ID postgres.ColumnString ID postgres.ColumnString
EventID postgres.ColumnString EventID postgres.ColumnString
UserID postgres.ColumnString UserID postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -60,20 +61,22 @@ func newUserEventsTable(schemaName, tableName, alias string) *UserEventsTable {
func newUserEventsTableImpl(schemaName, tableName, alias string) userEventsTable { func newUserEventsTableImpl(schemaName, tableName, alias string) userEventsTable {
var ( var (
IDColumn = postgres.StringColumn("id") IDColumn = postgres.StringColumn("id")
EventIDColumn = postgres.StringColumn("event_id") EventIDColumn = postgres.StringColumn("event_id")
UserIDColumn = postgres.StringColumn("user_id") UserIDColumn = postgres.StringColumn("user_id")
allColumns = postgres.ColumnList{IDColumn, EventIDColumn, UserIDColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{EventIDColumn, UserIDColumn} allColumns = postgres.ColumnList{IDColumn, EventIDColumn, UserIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{EventIDColumn, UserIDColumn, CreatedAtColumn}
) )
return userEventsTable{ return userEventsTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...), Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns //Columns
ID: IDColumn, ID: IDColumn,
EventID: EventIDColumn, EventID: EventIDColumn,
UserID: UserIDColumn, UserID: UserIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -17,9 +17,10 @@ type userImagesTable struct {
postgres.Table postgres.Table
// Columns // Columns
ID postgres.ColumnString ID postgres.ColumnString
ImageID postgres.ColumnString ImageID postgres.ColumnString
UserID postgres.ColumnString UserID postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -60,20 +61,22 @@ func newUserImagesTable(schemaName, tableName, alias string) *UserImagesTable {
func newUserImagesTableImpl(schemaName, tableName, alias string) userImagesTable { func newUserImagesTableImpl(schemaName, tableName, alias string) userImagesTable {
var ( var (
IDColumn = postgres.StringColumn("id") IDColumn = postgres.StringColumn("id")
ImageIDColumn = postgres.StringColumn("image_id") ImageIDColumn = postgres.StringColumn("image_id")
UserIDColumn = postgres.StringColumn("user_id") UserIDColumn = postgres.StringColumn("user_id")
allColumns = postgres.ColumnList{IDColumn, ImageIDColumn, UserIDColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{ImageIDColumn, UserIDColumn} allColumns = postgres.ColumnList{IDColumn, ImageIDColumn, UserIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{ImageIDColumn, UserIDColumn, CreatedAtColumn}
) )
return userImagesTable{ return userImagesTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...), Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns //Columns
ID: IDColumn, ID: IDColumn,
ImageID: ImageIDColumn, ImageID: ImageIDColumn,
UserID: UserIDColumn, UserID: UserIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -20,6 +20,7 @@ type userLocationsTable struct {
ID postgres.ColumnString ID postgres.ColumnString
LocationID postgres.ColumnString LocationID postgres.ColumnString
UserID postgres.ColumnString UserID postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -63,8 +64,9 @@ func newUserLocationsTableImpl(schemaName, tableName, alias string) userLocation
IDColumn = postgres.StringColumn("id") IDColumn = postgres.StringColumn("id")
LocationIDColumn = postgres.StringColumn("location_id") LocationIDColumn = postgres.StringColumn("location_id")
UserIDColumn = postgres.StringColumn("user_id") UserIDColumn = postgres.StringColumn("user_id")
allColumns = postgres.ColumnList{IDColumn, LocationIDColumn, UserIDColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{LocationIDColumn, UserIDColumn} allColumns = postgres.ColumnList{IDColumn, LocationIDColumn, UserIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{LocationIDColumn, UserIDColumn, CreatedAtColumn}
) )
return userLocationsTable{ return userLocationsTable{
@ -74,6 +76,7 @@ func newUserLocationsTableImpl(schemaName, tableName, alias string) userLocation
ID: IDColumn, ID: IDColumn,
LocationID: LocationIDColumn, LocationID: LocationIDColumn,
UserID: UserIDColumn, UserID: UserIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -17,9 +17,10 @@ type userNotesTable struct {
postgres.Table postgres.Table
// Columns // Columns
ID postgres.ColumnString ID postgres.ColumnString
UserID postgres.ColumnString UserID postgres.ColumnString
NoteID postgres.ColumnString NoteID postgres.ColumnString
CreatedAt postgres.ColumnTimestampz
AllColumns postgres.ColumnList AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList MutableColumns postgres.ColumnList
@ -60,20 +61,22 @@ func newUserNotesTable(schemaName, tableName, alias string) *UserNotesTable {
func newUserNotesTableImpl(schemaName, tableName, alias string) userNotesTable { func newUserNotesTableImpl(schemaName, tableName, alias string) userNotesTable {
var ( var (
IDColumn = postgres.StringColumn("id") IDColumn = postgres.StringColumn("id")
UserIDColumn = postgres.StringColumn("user_id") UserIDColumn = postgres.StringColumn("user_id")
NoteIDColumn = postgres.StringColumn("note_id") NoteIDColumn = postgres.StringColumn("note_id")
allColumns = postgres.ColumnList{IDColumn, UserIDColumn, NoteIDColumn} CreatedAtColumn = postgres.TimestampzColumn("created_at")
mutableColumns = postgres.ColumnList{UserIDColumn, NoteIDColumn} allColumns = postgres.ColumnList{IDColumn, UserIDColumn, NoteIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{UserIDColumn, NoteIDColumn, CreatedAtColumn}
) )
return userNotesTable{ return userNotesTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...), Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns //Columns
ID: IDColumn, ID: IDColumn,
UserID: UserIDColumn, UserID: UserIDColumn,
NoteID: NoteIDColumn, NoteID: NoteIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns, AllColumns: allColumns,
MutableColumns: mutableColumns, MutableColumns: mutableColumns,

View File

@ -29,9 +29,13 @@ CREATE TABLE haystack.user_images_to_process (
CREATE TABLE haystack.user_images ( CREATE TABLE haystack.user_images (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
image_id uuid NOT NULL UNIQUE REFERENCES haystack.image (id), image_id uuid NOT NULL UNIQUE REFERENCES haystack.image (id),
user_id uuid NOT NULL REFERENCES haystack.users (id) user_id uuid NOT NULL REFERENCES haystack.users (id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
/* ===== DEPRECATED ===== */
CREATE TABLE haystack.user_tags ( CREATE TABLE haystack.user_tags (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
tag VARCHAR(32) UNIQUE NOT NULL, tag VARCHAR(32) UNIQUE NOT NULL,
@ -56,23 +60,31 @@ CREATE TABLE haystack.image_links (
image_id UUID NOT NULL REFERENCES haystack.image (id) image_id UUID NOT NULL REFERENCES haystack.image (id)
); );
/* ===== END DEPRECATED ===== */
CREATE TABLE haystack.locations ( CREATE TABLE haystack.locations (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL, name TEXT NOT NULL,
address TEXT, address TEXT,
description TEXT description TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.image_locations ( CREATE TABLE haystack.image_locations (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
location_id UUID NOT NULL REFERENCES haystack.locations (id), location_id UUID NOT NULL REFERENCES haystack.locations (id),
image_id UUID NOT NULL REFERENCES haystack.image (id) image_id UUID NOT NULL REFERENCES haystack.image (id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.user_locations ( CREATE TABLE haystack.user_locations (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
location_id UUID NOT NULL REFERENCES haystack.locations (id), location_id UUID NOT NULL REFERENCES haystack.locations (id),
user_id UUID NOT NULL REFERENCES haystack.users (id) user_id UUID NOT NULL REFERENCES haystack.users (id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.contacts ( CREATE TABLE haystack.contacts (
@ -83,19 +95,25 @@ CREATE TABLE haystack.contacts (
description TEXT, description TEXT,
phone_number TEXT, phone_number TEXT,
email TEXT email TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.user_contacts ( CREATE TABLE haystack.user_contacts (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES haystack.users (id), user_id UUID NOT NULL REFERENCES haystack.users (id),
contact_id UUID NOT NULL REFERENCES haystack.contacts (id) contact_id UUID NOT NULL REFERENCES haystack.contacts (id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.image_contacts ( CREATE TABLE haystack.image_contacts (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
image_id UUID NOT NULL REFERENCES haystack.image (id), image_id UUID NOT NULL REFERENCES haystack.image (id),
contact_id UUID NOT NULL REFERENCES haystack.contacts (id) contact_id UUID NOT NULL REFERENCES haystack.contacts (id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.events ( CREATE TABLE haystack.events (
@ -109,19 +127,25 @@ CREATE TABLE haystack.events (
end_date_time TIMESTAMP, end_date_time TIMESTAMP,
location_id UUID REFERENCES haystack.locations (id), location_id UUID REFERENCES haystack.locations (id),
organizer_id UUID REFERENCES haystack.contacts (id) organizer_id UUID REFERENCES haystack.contacts (id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.image_events ( CREATE TABLE haystack.image_events (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
event_id UUID NOT NULL REFERENCES haystack.events (id), event_id UUID NOT NULL REFERENCES haystack.events (id),
image_id UUID NOT NULL REFERENCES haystack.image (id) image_id UUID NOT NULL REFERENCES haystack.image (id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.user_events ( CREATE TABLE haystack.user_events (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
event_id UUID NOT NULL REFERENCES haystack.events (id), event_id UUID NOT NULL REFERENCES haystack.events (id),
user_id UUID NOT NULL REFERENCES haystack.users (id) user_id UUID NOT NULL REFERENCES haystack.users (id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.notes ( CREATE TABLE haystack.notes (
@ -131,24 +155,32 @@ CREATE TABLE haystack.notes (
name TEXT NOT NULL, name TEXT NOT NULL,
description TEXT, description TEXT,
content TEXT NOT NULL content TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.image_notes ( CREATE TABLE haystack.image_notes (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
image_id UUID NOT NULL REFERENCES haystack.image (id), image_id UUID NOT NULL REFERENCES haystack.image (id),
note_id UUID NOT NULL REFERENCES haystack.notes (id) note_id UUID NOT NULL REFERENCES haystack.notes (id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.user_notes ( CREATE TABLE haystack.user_notes (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES haystack.users (id), user_id UUID NOT NULL REFERENCES haystack.users (id),
note_id UUID NOT NULL REFERENCES haystack.notes (id) note_id UUID NOT NULL REFERENCES haystack.notes (id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
CREATE TABLE haystack.logs ( CREATE TABLE haystack.logs (
log TEXT NOT NULL, log TEXT NOT NULL,
image_id UUID NOT NULL REFERENCES haystack.image (id) image_id UUID NOT NULL REFERENCES haystack.image (id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
); );
/* -----| Indexes |----- */ /* -----| Indexes |----- */