feat: backend service
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Accounts struct {
|
||||
UserID uuid.UUID `sql:"primary_key"`
|
||||
Email string
|
||||
UserName string
|
||||
DisplayName string
|
||||
PreferredLanguage string
|
||||
TimeZone string
|
||||
DeclaredCountry *string
|
||||
PermanentBlock bool
|
||||
DeletedActorType *string
|
||||
DeletedActorID *string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
DeletedAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type AdminAccounts struct {
|
||||
Username string `sql:"primary_key"`
|
||||
PasswordHash []byte
|
||||
CreatedAt time.Time
|
||||
LastUsedAt *time.Time
|
||||
DisabledAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Applications struct {
|
||||
ApplicationID uuid.UUID `sql:"primary_key"`
|
||||
GameID uuid.UUID
|
||||
ApplicantUserID uuid.UUID
|
||||
RaceName string
|
||||
Status string
|
||||
CreatedAt time.Time
|
||||
DecidedAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type AuthChallenges struct {
|
||||
ChallengeID uuid.UUID `sql:"primary_key"`
|
||||
Email string
|
||||
CodeHash []byte
|
||||
Attempts int32
|
||||
CreatedAt time.Time
|
||||
ExpiresAt time.Time
|
||||
ConsumedAt *time.Time
|
||||
PreferredLanguage string
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type BlockedEmails struct {
|
||||
Email string `sql:"primary_key"`
|
||||
Reason string
|
||||
BlockedAt time.Time
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type DeviceSessions struct {
|
||||
DeviceSessionID uuid.UUID `sql:"primary_key"`
|
||||
UserID uuid.UUID
|
||||
ClientPublicKey []byte
|
||||
Status string
|
||||
CreatedAt time.Time
|
||||
LastSeenAt *time.Time
|
||||
RevokedAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type EngineVersions struct {
|
||||
Version string `sql:"primary_key"`
|
||||
ImageRef string
|
||||
Enabled bool
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type EntitlementRecords struct {
|
||||
RecordID uuid.UUID `sql:"primary_key"`
|
||||
UserID uuid.UUID
|
||||
Tier string
|
||||
IsPaid bool
|
||||
Source string
|
||||
ActorType string
|
||||
ActorID *string
|
||||
ReasonCode string
|
||||
StartsAt time.Time
|
||||
EndsAt *time.Time
|
||||
CreatedAt time.Time
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type EntitlementSnapshots struct {
|
||||
UserID uuid.UUID `sql:"primary_key"`
|
||||
Tier string
|
||||
IsPaid bool
|
||||
Source string
|
||||
ActorType string
|
||||
ActorID *string
|
||||
ReasonCode string
|
||||
StartsAt time.Time
|
||||
EndsAt *time.Time
|
||||
MaxRegisteredRaceNames int32
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Games struct {
|
||||
GameID uuid.UUID `sql:"primary_key"`
|
||||
OwnerUserID *uuid.UUID
|
||||
Visibility string
|
||||
Status string
|
||||
GameName string
|
||||
Description string
|
||||
MinPlayers int32
|
||||
MaxPlayers int32
|
||||
StartGapHours int32
|
||||
StartGapPlayers int32
|
||||
EnrollmentEndsAt time.Time
|
||||
TurnSchedule string
|
||||
TargetEngineVersion string
|
||||
RuntimeSnapshot string
|
||||
RuntimeBinding *string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
StartedAt *time.Time
|
||||
FinishedAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Invites struct {
|
||||
InviteID uuid.UUID `sql:"primary_key"`
|
||||
GameID uuid.UUID
|
||||
InviterUserID uuid.UUID
|
||||
InvitedUserID *uuid.UUID
|
||||
Code *string
|
||||
Status string
|
||||
RaceName string
|
||||
CreatedAt time.Time
|
||||
ExpiresAt time.Time
|
||||
DecidedAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type LimitActive struct {
|
||||
UserID uuid.UUID `sql:"primary_key"`
|
||||
LimitCode string `sql:"primary_key"`
|
||||
RecordID uuid.UUID
|
||||
Value int32
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type LimitRecords struct {
|
||||
RecordID uuid.UUID `sql:"primary_key"`
|
||||
UserID uuid.UUID
|
||||
LimitCode string
|
||||
Value int32
|
||||
ReasonCode string
|
||||
ActorType string
|
||||
ActorID *string
|
||||
AppliedAt time.Time
|
||||
ExpiresAt *time.Time
|
||||
RemovedAt *time.Time
|
||||
RemovedByType *string
|
||||
RemovedByID *string
|
||||
RemovedReasonCode *string
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MailAttempts struct {
|
||||
AttemptID uuid.UUID `sql:"primary_key"`
|
||||
DeliveryID uuid.UUID
|
||||
AttemptNo int32
|
||||
StartedAt time.Time
|
||||
FinishedAt *time.Time
|
||||
Outcome string
|
||||
Error string
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MailDeadLetters struct {
|
||||
DeadLetterID uuid.UUID `sql:"primary_key"`
|
||||
DeliveryID uuid.UUID
|
||||
ArchivedAt time.Time
|
||||
Reason string
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MailDeliveries struct {
|
||||
DeliveryID uuid.UUID `sql:"primary_key"`
|
||||
TemplateID string
|
||||
IdempotencyKey string
|
||||
Status string
|
||||
Attempts int32
|
||||
NextAttemptAt *time.Time
|
||||
PayloadID uuid.UUID
|
||||
LastError string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
SentAt *time.Time
|
||||
DeadLetteredAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MailPayloads struct {
|
||||
PayloadID uuid.UUID `sql:"primary_key"`
|
||||
ContentType string
|
||||
Subject *string
|
||||
Body []byte
|
||||
CreatedAt time.Time
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type MailRecipients struct {
|
||||
RecipientID uuid.UUID `sql:"primary_key"`
|
||||
DeliveryID uuid.UUID
|
||||
Address string
|
||||
Kind string
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Memberships struct {
|
||||
MembershipID uuid.UUID `sql:"primary_key"`
|
||||
GameID uuid.UUID
|
||||
UserID uuid.UUID
|
||||
RaceName string
|
||||
CanonicalKey string
|
||||
Status string
|
||||
JoinedAt time.Time
|
||||
RemovedAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type NotificationDeadLetters struct {
|
||||
DeadLetterID uuid.UUID `sql:"primary_key"`
|
||||
NotificationID uuid.UUID
|
||||
RouteID uuid.UUID
|
||||
ArchivedAt time.Time
|
||||
Reason string
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type NotificationMalformedIntents struct {
|
||||
ID uuid.UUID `sql:"primary_key"`
|
||||
ReceivedAt time.Time
|
||||
Payload string
|
||||
Reason string
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type NotificationRoutes struct {
|
||||
RouteID uuid.UUID `sql:"primary_key"`
|
||||
NotificationID uuid.UUID
|
||||
Channel string
|
||||
Status string
|
||||
Attempts int32
|
||||
MaxAttempts int32
|
||||
NextAttemptAt *time.Time
|
||||
LastAttemptAt *time.Time
|
||||
LastError string
|
||||
ResolvedEmail string
|
||||
ResolvedLocale string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
PublishedAt *time.Time
|
||||
DeadLetteredAt *time.Time
|
||||
SkippedAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Notifications struct {
|
||||
NotificationID uuid.UUID `sql:"primary_key"`
|
||||
Kind string
|
||||
IdempotencyKey string
|
||||
UserID *uuid.UUID
|
||||
Payload *string
|
||||
CreatedAt time.Time
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PlayerMappings struct {
|
||||
GameID uuid.UUID `sql:"primary_key"`
|
||||
UserID uuid.UUID `sql:"primary_key"`
|
||||
RaceName string
|
||||
EnginePlayerUUID uuid.UUID
|
||||
CreatedAt time.Time
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type RaceNames struct {
|
||||
Name string
|
||||
Canonical string `sql:"primary_key"`
|
||||
Status string
|
||||
OwnerUserID uuid.UUID
|
||||
GameID uuid.UUID `sql:"primary_key"`
|
||||
SourceGameID *uuid.UUID
|
||||
ReservedAt *time.Time
|
||||
ExpiresAt *time.Time
|
||||
RegisteredAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type RuntimeHealthSnapshots struct {
|
||||
SnapshotID uuid.UUID `sql:"primary_key"`
|
||||
GameID uuid.UUID
|
||||
ObservedAt time.Time
|
||||
Payload string
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type RuntimeOperationLog struct {
|
||||
OperationID uuid.UUID `sql:"primary_key"`
|
||||
GameID uuid.UUID
|
||||
Op string
|
||||
Source string
|
||||
Status string
|
||||
ImageRef string
|
||||
ContainerID string
|
||||
ErrorCode string
|
||||
ErrorMessage string
|
||||
StartedAt time.Time
|
||||
FinishedAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type RuntimeRecords struct {
|
||||
GameID uuid.UUID `sql:"primary_key"`
|
||||
Status string
|
||||
CurrentContainerID *string
|
||||
CurrentImageRef *string
|
||||
CurrentEngineVersion *string
|
||||
EngineEndpoint string
|
||||
StatePath *string
|
||||
DockerNetwork *string
|
||||
TurnSchedule string
|
||||
CurrentTurn int32
|
||||
NextGenerationAt *time.Time
|
||||
SkipNextTick bool
|
||||
Paused bool
|
||||
PausedAt *time.Time
|
||||
EngineHealth string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
StartedAt *time.Time
|
||||
StoppedAt *time.Time
|
||||
FinishedAt *time.Time
|
||||
RemovedAt *time.Time
|
||||
LastObservedAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type SanctionActive struct {
|
||||
UserID uuid.UUID `sql:"primary_key"`
|
||||
SanctionCode string `sql:"primary_key"`
|
||||
RecordID uuid.UUID
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SanctionRecords struct {
|
||||
RecordID uuid.UUID `sql:"primary_key"`
|
||||
UserID uuid.UUID
|
||||
SanctionCode string
|
||||
Scope string
|
||||
ReasonCode string
|
||||
ActorType string
|
||||
ActorID *string
|
||||
AppliedAt time.Time
|
||||
ExpiresAt *time.Time
|
||||
RemovedAt *time.Time
|
||||
RemovedByType *string
|
||||
RemovedByID *string
|
||||
RemovedReasonCode *string
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
type UserCountryCounters struct {
|
||||
UserID uuid.UUID `sql:"primary_key"`
|
||||
Country string `sql:"primary_key"`
|
||||
Count int64
|
||||
LastSeenAt *time.Time
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Accounts = newAccountsTable("backend", "accounts", "")
|
||||
|
||||
type accountsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
UserID postgres.ColumnString
|
||||
Email postgres.ColumnString
|
||||
UserName postgres.ColumnString
|
||||
DisplayName postgres.ColumnString
|
||||
PreferredLanguage postgres.ColumnString
|
||||
TimeZone postgres.ColumnString
|
||||
DeclaredCountry postgres.ColumnString
|
||||
PermanentBlock postgres.ColumnBool
|
||||
DeletedActorType postgres.ColumnString
|
||||
DeletedActorID postgres.ColumnString
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
UpdatedAt postgres.ColumnTimestampz
|
||||
DeletedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type AccountsTable struct {
|
||||
accountsTable
|
||||
|
||||
EXCLUDED accountsTable
|
||||
}
|
||||
|
||||
// AS creates new AccountsTable with assigned alias
|
||||
func (a AccountsTable) AS(alias string) *AccountsTable {
|
||||
return newAccountsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new AccountsTable with assigned schema name
|
||||
func (a AccountsTable) FromSchema(schemaName string) *AccountsTable {
|
||||
return newAccountsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new AccountsTable with assigned table prefix
|
||||
func (a AccountsTable) WithPrefix(prefix string) *AccountsTable {
|
||||
return newAccountsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new AccountsTable with assigned table suffix
|
||||
func (a AccountsTable) WithSuffix(suffix string) *AccountsTable {
|
||||
return newAccountsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newAccountsTable(schemaName, tableName, alias string) *AccountsTable {
|
||||
return &AccountsTable{
|
||||
accountsTable: newAccountsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newAccountsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newAccountsTableImpl(schemaName, tableName, alias string) accountsTable {
|
||||
var (
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
EmailColumn = postgres.StringColumn("email")
|
||||
UserNameColumn = postgres.StringColumn("user_name")
|
||||
DisplayNameColumn = postgres.StringColumn("display_name")
|
||||
PreferredLanguageColumn = postgres.StringColumn("preferred_language")
|
||||
TimeZoneColumn = postgres.StringColumn("time_zone")
|
||||
DeclaredCountryColumn = postgres.StringColumn("declared_country")
|
||||
PermanentBlockColumn = postgres.BoolColumn("permanent_block")
|
||||
DeletedActorTypeColumn = postgres.StringColumn("deleted_actor_type")
|
||||
DeletedActorIDColumn = postgres.StringColumn("deleted_actor_id")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampzColumn("updated_at")
|
||||
DeletedAtColumn = postgres.TimestampzColumn("deleted_at")
|
||||
allColumns = postgres.ColumnList{UserIDColumn, EmailColumn, UserNameColumn, DisplayNameColumn, PreferredLanguageColumn, TimeZoneColumn, DeclaredCountryColumn, PermanentBlockColumn, DeletedActorTypeColumn, DeletedActorIDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{EmailColumn, UserNameColumn, DisplayNameColumn, PreferredLanguageColumn, TimeZoneColumn, DeclaredCountryColumn, PermanentBlockColumn, DeletedActorTypeColumn, DeletedActorIDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{DisplayNameColumn, PermanentBlockColumn, CreatedAtColumn, UpdatedAtColumn}
|
||||
)
|
||||
|
||||
return accountsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
UserID: UserIDColumn,
|
||||
Email: EmailColumn,
|
||||
UserName: UserNameColumn,
|
||||
DisplayName: DisplayNameColumn,
|
||||
PreferredLanguage: PreferredLanguageColumn,
|
||||
TimeZone: TimeZoneColumn,
|
||||
DeclaredCountry: DeclaredCountryColumn,
|
||||
PermanentBlock: PermanentBlockColumn,
|
||||
DeletedActorType: DeletedActorTypeColumn,
|
||||
DeletedActorID: DeletedActorIDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
DeletedAt: DeletedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var AdminAccounts = newAdminAccountsTable("backend", "admin_accounts", "")
|
||||
|
||||
type adminAccountsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
Username postgres.ColumnString
|
||||
PasswordHash postgres.ColumnBytea
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
LastUsedAt postgres.ColumnTimestampz
|
||||
DisabledAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type AdminAccountsTable struct {
|
||||
adminAccountsTable
|
||||
|
||||
EXCLUDED adminAccountsTable
|
||||
}
|
||||
|
||||
// AS creates new AdminAccountsTable with assigned alias
|
||||
func (a AdminAccountsTable) AS(alias string) *AdminAccountsTable {
|
||||
return newAdminAccountsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new AdminAccountsTable with assigned schema name
|
||||
func (a AdminAccountsTable) FromSchema(schemaName string) *AdminAccountsTable {
|
||||
return newAdminAccountsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new AdminAccountsTable with assigned table prefix
|
||||
func (a AdminAccountsTable) WithPrefix(prefix string) *AdminAccountsTable {
|
||||
return newAdminAccountsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new AdminAccountsTable with assigned table suffix
|
||||
func (a AdminAccountsTable) WithSuffix(suffix string) *AdminAccountsTable {
|
||||
return newAdminAccountsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newAdminAccountsTable(schemaName, tableName, alias string) *AdminAccountsTable {
|
||||
return &AdminAccountsTable{
|
||||
adminAccountsTable: newAdminAccountsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newAdminAccountsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newAdminAccountsTableImpl(schemaName, tableName, alias string) adminAccountsTable {
|
||||
var (
|
||||
UsernameColumn = postgres.StringColumn("username")
|
||||
PasswordHashColumn = postgres.ByteaColumn("password_hash")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
LastUsedAtColumn = postgres.TimestampzColumn("last_used_at")
|
||||
DisabledAtColumn = postgres.TimestampzColumn("disabled_at")
|
||||
allColumns = postgres.ColumnList{UsernameColumn, PasswordHashColumn, CreatedAtColumn, LastUsedAtColumn, DisabledAtColumn}
|
||||
mutableColumns = postgres.ColumnList{PasswordHashColumn, CreatedAtColumn, LastUsedAtColumn, DisabledAtColumn}
|
||||
defaultColumns = postgres.ColumnList{CreatedAtColumn}
|
||||
)
|
||||
|
||||
return adminAccountsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
Username: UsernameColumn,
|
||||
PasswordHash: PasswordHashColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
LastUsedAt: LastUsedAtColumn,
|
||||
DisabledAt: DisabledAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Applications = newApplicationsTable("backend", "applications", "")
|
||||
|
||||
type applicationsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ApplicationID postgres.ColumnString
|
||||
GameID postgres.ColumnString
|
||||
ApplicantUserID postgres.ColumnString
|
||||
RaceName postgres.ColumnString
|
||||
Status postgres.ColumnString
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
DecidedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type ApplicationsTable struct {
|
||||
applicationsTable
|
||||
|
||||
EXCLUDED applicationsTable
|
||||
}
|
||||
|
||||
// AS creates new ApplicationsTable with assigned alias
|
||||
func (a ApplicationsTable) AS(alias string) *ApplicationsTable {
|
||||
return newApplicationsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new ApplicationsTable with assigned schema name
|
||||
func (a ApplicationsTable) FromSchema(schemaName string) *ApplicationsTable {
|
||||
return newApplicationsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new ApplicationsTable with assigned table prefix
|
||||
func (a ApplicationsTable) WithPrefix(prefix string) *ApplicationsTable {
|
||||
return newApplicationsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new ApplicationsTable with assigned table suffix
|
||||
func (a ApplicationsTable) WithSuffix(suffix string) *ApplicationsTable {
|
||||
return newApplicationsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newApplicationsTable(schemaName, tableName, alias string) *ApplicationsTable {
|
||||
return &ApplicationsTable{
|
||||
applicationsTable: newApplicationsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newApplicationsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newApplicationsTableImpl(schemaName, tableName, alias string) applicationsTable {
|
||||
var (
|
||||
ApplicationIDColumn = postgres.StringColumn("application_id")
|
||||
GameIDColumn = postgres.StringColumn("game_id")
|
||||
ApplicantUserIDColumn = postgres.StringColumn("applicant_user_id")
|
||||
RaceNameColumn = postgres.StringColumn("race_name")
|
||||
StatusColumn = postgres.StringColumn("status")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
DecidedAtColumn = postgres.TimestampzColumn("decided_at")
|
||||
allColumns = postgres.ColumnList{ApplicationIDColumn, GameIDColumn, ApplicantUserIDColumn, RaceNameColumn, StatusColumn, CreatedAtColumn, DecidedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{GameIDColumn, ApplicantUserIDColumn, RaceNameColumn, StatusColumn, CreatedAtColumn, DecidedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{CreatedAtColumn}
|
||||
)
|
||||
|
||||
return applicationsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ApplicationID: ApplicationIDColumn,
|
||||
GameID: GameIDColumn,
|
||||
ApplicantUserID: ApplicantUserIDColumn,
|
||||
RaceName: RaceNameColumn,
|
||||
Status: StatusColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
DecidedAt: DecidedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var AuthChallenges = newAuthChallengesTable("backend", "auth_challenges", "")
|
||||
|
||||
type authChallengesTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ChallengeID postgres.ColumnString
|
||||
Email postgres.ColumnString
|
||||
CodeHash postgres.ColumnBytea
|
||||
Attempts postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
ExpiresAt postgres.ColumnTimestampz
|
||||
ConsumedAt postgres.ColumnTimestampz
|
||||
PreferredLanguage postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type AuthChallengesTable struct {
|
||||
authChallengesTable
|
||||
|
||||
EXCLUDED authChallengesTable
|
||||
}
|
||||
|
||||
// AS creates new AuthChallengesTable with assigned alias
|
||||
func (a AuthChallengesTable) AS(alias string) *AuthChallengesTable {
|
||||
return newAuthChallengesTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new AuthChallengesTable with assigned schema name
|
||||
func (a AuthChallengesTable) FromSchema(schemaName string) *AuthChallengesTable {
|
||||
return newAuthChallengesTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new AuthChallengesTable with assigned table prefix
|
||||
func (a AuthChallengesTable) WithPrefix(prefix string) *AuthChallengesTable {
|
||||
return newAuthChallengesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new AuthChallengesTable with assigned table suffix
|
||||
func (a AuthChallengesTable) WithSuffix(suffix string) *AuthChallengesTable {
|
||||
return newAuthChallengesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newAuthChallengesTable(schemaName, tableName, alias string) *AuthChallengesTable {
|
||||
return &AuthChallengesTable{
|
||||
authChallengesTable: newAuthChallengesTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newAuthChallengesTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newAuthChallengesTableImpl(schemaName, tableName, alias string) authChallengesTable {
|
||||
var (
|
||||
ChallengeIDColumn = postgres.StringColumn("challenge_id")
|
||||
EmailColumn = postgres.StringColumn("email")
|
||||
CodeHashColumn = postgres.ByteaColumn("code_hash")
|
||||
AttemptsColumn = postgres.IntegerColumn("attempts")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
ExpiresAtColumn = postgres.TimestampzColumn("expires_at")
|
||||
ConsumedAtColumn = postgres.TimestampzColumn("consumed_at")
|
||||
PreferredLanguageColumn = postgres.StringColumn("preferred_language")
|
||||
allColumns = postgres.ColumnList{ChallengeIDColumn, EmailColumn, CodeHashColumn, AttemptsColumn, CreatedAtColumn, ExpiresAtColumn, ConsumedAtColumn, PreferredLanguageColumn}
|
||||
mutableColumns = postgres.ColumnList{EmailColumn, CodeHashColumn, AttemptsColumn, CreatedAtColumn, ExpiresAtColumn, ConsumedAtColumn, PreferredLanguageColumn}
|
||||
defaultColumns = postgres.ColumnList{AttemptsColumn, CreatedAtColumn, PreferredLanguageColumn}
|
||||
)
|
||||
|
||||
return authChallengesTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ChallengeID: ChallengeIDColumn,
|
||||
Email: EmailColumn,
|
||||
CodeHash: CodeHashColumn,
|
||||
Attempts: AttemptsColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
ExpiresAt: ExpiresAtColumn,
|
||||
ConsumedAt: ConsumedAtColumn,
|
||||
PreferredLanguage: PreferredLanguageColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var BlockedEmails = newBlockedEmailsTable("backend", "blocked_emails", "")
|
||||
|
||||
type blockedEmailsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
Email postgres.ColumnString
|
||||
Reason postgres.ColumnString
|
||||
BlockedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type BlockedEmailsTable struct {
|
||||
blockedEmailsTable
|
||||
|
||||
EXCLUDED blockedEmailsTable
|
||||
}
|
||||
|
||||
// AS creates new BlockedEmailsTable with assigned alias
|
||||
func (a BlockedEmailsTable) AS(alias string) *BlockedEmailsTable {
|
||||
return newBlockedEmailsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new BlockedEmailsTable with assigned schema name
|
||||
func (a BlockedEmailsTable) FromSchema(schemaName string) *BlockedEmailsTable {
|
||||
return newBlockedEmailsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new BlockedEmailsTable with assigned table prefix
|
||||
func (a BlockedEmailsTable) WithPrefix(prefix string) *BlockedEmailsTable {
|
||||
return newBlockedEmailsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new BlockedEmailsTable with assigned table suffix
|
||||
func (a BlockedEmailsTable) WithSuffix(suffix string) *BlockedEmailsTable {
|
||||
return newBlockedEmailsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newBlockedEmailsTable(schemaName, tableName, alias string) *BlockedEmailsTable {
|
||||
return &BlockedEmailsTable{
|
||||
blockedEmailsTable: newBlockedEmailsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newBlockedEmailsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newBlockedEmailsTableImpl(schemaName, tableName, alias string) blockedEmailsTable {
|
||||
var (
|
||||
EmailColumn = postgres.StringColumn("email")
|
||||
ReasonColumn = postgres.StringColumn("reason")
|
||||
BlockedAtColumn = postgres.TimestampzColumn("blocked_at")
|
||||
allColumns = postgres.ColumnList{EmailColumn, ReasonColumn, BlockedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{ReasonColumn, BlockedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{BlockedAtColumn}
|
||||
)
|
||||
|
||||
return blockedEmailsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
Email: EmailColumn,
|
||||
Reason: ReasonColumn,
|
||||
BlockedAt: BlockedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var DeviceSessions = newDeviceSessionsTable("backend", "device_sessions", "")
|
||||
|
||||
type deviceSessionsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
DeviceSessionID postgres.ColumnString
|
||||
UserID postgres.ColumnString
|
||||
ClientPublicKey postgres.ColumnBytea
|
||||
Status postgres.ColumnString
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
LastSeenAt postgres.ColumnTimestampz
|
||||
RevokedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type DeviceSessionsTable struct {
|
||||
deviceSessionsTable
|
||||
|
||||
EXCLUDED deviceSessionsTable
|
||||
}
|
||||
|
||||
// AS creates new DeviceSessionsTable with assigned alias
|
||||
func (a DeviceSessionsTable) AS(alias string) *DeviceSessionsTable {
|
||||
return newDeviceSessionsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new DeviceSessionsTable with assigned schema name
|
||||
func (a DeviceSessionsTable) FromSchema(schemaName string) *DeviceSessionsTable {
|
||||
return newDeviceSessionsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new DeviceSessionsTable with assigned table prefix
|
||||
func (a DeviceSessionsTable) WithPrefix(prefix string) *DeviceSessionsTable {
|
||||
return newDeviceSessionsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new DeviceSessionsTable with assigned table suffix
|
||||
func (a DeviceSessionsTable) WithSuffix(suffix string) *DeviceSessionsTable {
|
||||
return newDeviceSessionsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newDeviceSessionsTable(schemaName, tableName, alias string) *DeviceSessionsTable {
|
||||
return &DeviceSessionsTable{
|
||||
deviceSessionsTable: newDeviceSessionsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newDeviceSessionsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newDeviceSessionsTableImpl(schemaName, tableName, alias string) deviceSessionsTable {
|
||||
var (
|
||||
DeviceSessionIDColumn = postgres.StringColumn("device_session_id")
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
ClientPublicKeyColumn = postgres.ByteaColumn("client_public_key")
|
||||
StatusColumn = postgres.StringColumn("status")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
LastSeenAtColumn = postgres.TimestampzColumn("last_seen_at")
|
||||
RevokedAtColumn = postgres.TimestampzColumn("revoked_at")
|
||||
allColumns = postgres.ColumnList{DeviceSessionIDColumn, UserIDColumn, ClientPublicKeyColumn, StatusColumn, CreatedAtColumn, LastSeenAtColumn, RevokedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{UserIDColumn, ClientPublicKeyColumn, StatusColumn, CreatedAtColumn, LastSeenAtColumn, RevokedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{CreatedAtColumn}
|
||||
)
|
||||
|
||||
return deviceSessionsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
DeviceSessionID: DeviceSessionIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
ClientPublicKey: ClientPublicKeyColumn,
|
||||
Status: StatusColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
LastSeenAt: LastSeenAtColumn,
|
||||
RevokedAt: RevokedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var EngineVersions = newEngineVersionsTable("backend", "engine_versions", "")
|
||||
|
||||
type engineVersionsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
Version postgres.ColumnString
|
||||
ImageRef postgres.ColumnString
|
||||
Enabled postgres.ColumnBool
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
UpdatedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type EngineVersionsTable struct {
|
||||
engineVersionsTable
|
||||
|
||||
EXCLUDED engineVersionsTable
|
||||
}
|
||||
|
||||
// AS creates new EngineVersionsTable with assigned alias
|
||||
func (a EngineVersionsTable) AS(alias string) *EngineVersionsTable {
|
||||
return newEngineVersionsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new EngineVersionsTable with assigned schema name
|
||||
func (a EngineVersionsTable) FromSchema(schemaName string) *EngineVersionsTable {
|
||||
return newEngineVersionsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new EngineVersionsTable with assigned table prefix
|
||||
func (a EngineVersionsTable) WithPrefix(prefix string) *EngineVersionsTable {
|
||||
return newEngineVersionsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new EngineVersionsTable with assigned table suffix
|
||||
func (a EngineVersionsTable) WithSuffix(suffix string) *EngineVersionsTable {
|
||||
return newEngineVersionsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newEngineVersionsTable(schemaName, tableName, alias string) *EngineVersionsTable {
|
||||
return &EngineVersionsTable{
|
||||
engineVersionsTable: newEngineVersionsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newEngineVersionsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newEngineVersionsTableImpl(schemaName, tableName, alias string) engineVersionsTable {
|
||||
var (
|
||||
VersionColumn = postgres.StringColumn("version")
|
||||
ImageRefColumn = postgres.StringColumn("image_ref")
|
||||
EnabledColumn = postgres.BoolColumn("enabled")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampzColumn("updated_at")
|
||||
allColumns = postgres.ColumnList{VersionColumn, ImageRefColumn, EnabledColumn, CreatedAtColumn, UpdatedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{ImageRefColumn, EnabledColumn, CreatedAtColumn, UpdatedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{EnabledColumn, CreatedAtColumn, UpdatedAtColumn}
|
||||
)
|
||||
|
||||
return engineVersionsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
Version: VersionColumn,
|
||||
ImageRef: ImageRefColumn,
|
||||
Enabled: EnabledColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var EntitlementRecords = newEntitlementRecordsTable("backend", "entitlement_records", "")
|
||||
|
||||
type entitlementRecordsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
RecordID postgres.ColumnString
|
||||
UserID postgres.ColumnString
|
||||
Tier postgres.ColumnString
|
||||
IsPaid postgres.ColumnBool
|
||||
Source postgres.ColumnString
|
||||
ActorType postgres.ColumnString
|
||||
ActorID postgres.ColumnString
|
||||
ReasonCode postgres.ColumnString
|
||||
StartsAt postgres.ColumnTimestampz
|
||||
EndsAt postgres.ColumnTimestampz
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type EntitlementRecordsTable struct {
|
||||
entitlementRecordsTable
|
||||
|
||||
EXCLUDED entitlementRecordsTable
|
||||
}
|
||||
|
||||
// AS creates new EntitlementRecordsTable with assigned alias
|
||||
func (a EntitlementRecordsTable) AS(alias string) *EntitlementRecordsTable {
|
||||
return newEntitlementRecordsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new EntitlementRecordsTable with assigned schema name
|
||||
func (a EntitlementRecordsTable) FromSchema(schemaName string) *EntitlementRecordsTable {
|
||||
return newEntitlementRecordsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new EntitlementRecordsTable with assigned table prefix
|
||||
func (a EntitlementRecordsTable) WithPrefix(prefix string) *EntitlementRecordsTable {
|
||||
return newEntitlementRecordsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new EntitlementRecordsTable with assigned table suffix
|
||||
func (a EntitlementRecordsTable) WithSuffix(suffix string) *EntitlementRecordsTable {
|
||||
return newEntitlementRecordsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newEntitlementRecordsTable(schemaName, tableName, alias string) *EntitlementRecordsTable {
|
||||
return &EntitlementRecordsTable{
|
||||
entitlementRecordsTable: newEntitlementRecordsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newEntitlementRecordsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newEntitlementRecordsTableImpl(schemaName, tableName, alias string) entitlementRecordsTable {
|
||||
var (
|
||||
RecordIDColumn = postgres.StringColumn("record_id")
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
TierColumn = postgres.StringColumn("tier")
|
||||
IsPaidColumn = postgres.BoolColumn("is_paid")
|
||||
SourceColumn = postgres.StringColumn("source")
|
||||
ActorTypeColumn = postgres.StringColumn("actor_type")
|
||||
ActorIDColumn = postgres.StringColumn("actor_id")
|
||||
ReasonCodeColumn = postgres.StringColumn("reason_code")
|
||||
StartsAtColumn = postgres.TimestampzColumn("starts_at")
|
||||
EndsAtColumn = postgres.TimestampzColumn("ends_at")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
allColumns = postgres.ColumnList{RecordIDColumn, UserIDColumn, TierColumn, IsPaidColumn, SourceColumn, ActorTypeColumn, ActorIDColumn, ReasonCodeColumn, StartsAtColumn, EndsAtColumn, CreatedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{UserIDColumn, TierColumn, IsPaidColumn, SourceColumn, ActorTypeColumn, ActorIDColumn, ReasonCodeColumn, StartsAtColumn, EndsAtColumn, CreatedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{ReasonCodeColumn, StartsAtColumn, CreatedAtColumn}
|
||||
)
|
||||
|
||||
return entitlementRecordsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
RecordID: RecordIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
Tier: TierColumn,
|
||||
IsPaid: IsPaidColumn,
|
||||
Source: SourceColumn,
|
||||
ActorType: ActorTypeColumn,
|
||||
ActorID: ActorIDColumn,
|
||||
ReasonCode: ReasonCodeColumn,
|
||||
StartsAt: StartsAtColumn,
|
||||
EndsAt: EndsAtColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var EntitlementSnapshots = newEntitlementSnapshotsTable("backend", "entitlement_snapshots", "")
|
||||
|
||||
type entitlementSnapshotsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
UserID postgres.ColumnString
|
||||
Tier postgres.ColumnString
|
||||
IsPaid postgres.ColumnBool
|
||||
Source postgres.ColumnString
|
||||
ActorType postgres.ColumnString
|
||||
ActorID postgres.ColumnString
|
||||
ReasonCode postgres.ColumnString
|
||||
StartsAt postgres.ColumnTimestampz
|
||||
EndsAt postgres.ColumnTimestampz
|
||||
MaxRegisteredRaceNames postgres.ColumnInteger
|
||||
UpdatedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type EntitlementSnapshotsTable struct {
|
||||
entitlementSnapshotsTable
|
||||
|
||||
EXCLUDED entitlementSnapshotsTable
|
||||
}
|
||||
|
||||
// AS creates new EntitlementSnapshotsTable with assigned alias
|
||||
func (a EntitlementSnapshotsTable) AS(alias string) *EntitlementSnapshotsTable {
|
||||
return newEntitlementSnapshotsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new EntitlementSnapshotsTable with assigned schema name
|
||||
func (a EntitlementSnapshotsTable) FromSchema(schemaName string) *EntitlementSnapshotsTable {
|
||||
return newEntitlementSnapshotsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new EntitlementSnapshotsTable with assigned table prefix
|
||||
func (a EntitlementSnapshotsTable) WithPrefix(prefix string) *EntitlementSnapshotsTable {
|
||||
return newEntitlementSnapshotsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new EntitlementSnapshotsTable with assigned table suffix
|
||||
func (a EntitlementSnapshotsTable) WithSuffix(suffix string) *EntitlementSnapshotsTable {
|
||||
return newEntitlementSnapshotsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newEntitlementSnapshotsTable(schemaName, tableName, alias string) *EntitlementSnapshotsTable {
|
||||
return &EntitlementSnapshotsTable{
|
||||
entitlementSnapshotsTable: newEntitlementSnapshotsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newEntitlementSnapshotsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newEntitlementSnapshotsTableImpl(schemaName, tableName, alias string) entitlementSnapshotsTable {
|
||||
var (
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
TierColumn = postgres.StringColumn("tier")
|
||||
IsPaidColumn = postgres.BoolColumn("is_paid")
|
||||
SourceColumn = postgres.StringColumn("source")
|
||||
ActorTypeColumn = postgres.StringColumn("actor_type")
|
||||
ActorIDColumn = postgres.StringColumn("actor_id")
|
||||
ReasonCodeColumn = postgres.StringColumn("reason_code")
|
||||
StartsAtColumn = postgres.TimestampzColumn("starts_at")
|
||||
EndsAtColumn = postgres.TimestampzColumn("ends_at")
|
||||
MaxRegisteredRaceNamesColumn = postgres.IntegerColumn("max_registered_race_names")
|
||||
UpdatedAtColumn = postgres.TimestampzColumn("updated_at")
|
||||
allColumns = postgres.ColumnList{UserIDColumn, TierColumn, IsPaidColumn, SourceColumn, ActorTypeColumn, ActorIDColumn, ReasonCodeColumn, StartsAtColumn, EndsAtColumn, MaxRegisteredRaceNamesColumn, UpdatedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{TierColumn, IsPaidColumn, SourceColumn, ActorTypeColumn, ActorIDColumn, ReasonCodeColumn, StartsAtColumn, EndsAtColumn, MaxRegisteredRaceNamesColumn, UpdatedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{ReasonCodeColumn, UpdatedAtColumn}
|
||||
)
|
||||
|
||||
return entitlementSnapshotsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
UserID: UserIDColumn,
|
||||
Tier: TierColumn,
|
||||
IsPaid: IsPaidColumn,
|
||||
Source: SourceColumn,
|
||||
ActorType: ActorTypeColumn,
|
||||
ActorID: ActorIDColumn,
|
||||
ReasonCode: ReasonCodeColumn,
|
||||
StartsAt: StartsAtColumn,
|
||||
EndsAt: EndsAtColumn,
|
||||
MaxRegisteredRaceNames: MaxRegisteredRaceNamesColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Games = newGamesTable("backend", "games", "")
|
||||
|
||||
type gamesTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
GameID postgres.ColumnString
|
||||
OwnerUserID postgres.ColumnString
|
||||
Visibility postgres.ColumnString
|
||||
Status postgres.ColumnString
|
||||
GameName postgres.ColumnString
|
||||
Description postgres.ColumnString
|
||||
MinPlayers postgres.ColumnInteger
|
||||
MaxPlayers postgres.ColumnInteger
|
||||
StartGapHours postgres.ColumnInteger
|
||||
StartGapPlayers postgres.ColumnInteger
|
||||
EnrollmentEndsAt postgres.ColumnTimestampz
|
||||
TurnSchedule postgres.ColumnString
|
||||
TargetEngineVersion postgres.ColumnString
|
||||
RuntimeSnapshot postgres.ColumnString
|
||||
RuntimeBinding postgres.ColumnString
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
UpdatedAt postgres.ColumnTimestampz
|
||||
StartedAt postgres.ColumnTimestampz
|
||||
FinishedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type GamesTable struct {
|
||||
gamesTable
|
||||
|
||||
EXCLUDED gamesTable
|
||||
}
|
||||
|
||||
// AS creates new GamesTable with assigned alias
|
||||
func (a GamesTable) AS(alias string) *GamesTable {
|
||||
return newGamesTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new GamesTable with assigned schema name
|
||||
func (a GamesTable) FromSchema(schemaName string) *GamesTable {
|
||||
return newGamesTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new GamesTable with assigned table prefix
|
||||
func (a GamesTable) WithPrefix(prefix string) *GamesTable {
|
||||
return newGamesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new GamesTable with assigned table suffix
|
||||
func (a GamesTable) WithSuffix(suffix string) *GamesTable {
|
||||
return newGamesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newGamesTable(schemaName, tableName, alias string) *GamesTable {
|
||||
return &GamesTable{
|
||||
gamesTable: newGamesTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newGamesTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newGamesTableImpl(schemaName, tableName, alias string) gamesTable {
|
||||
var (
|
||||
GameIDColumn = postgres.StringColumn("game_id")
|
||||
OwnerUserIDColumn = postgres.StringColumn("owner_user_id")
|
||||
VisibilityColumn = postgres.StringColumn("visibility")
|
||||
StatusColumn = postgres.StringColumn("status")
|
||||
GameNameColumn = postgres.StringColumn("game_name")
|
||||
DescriptionColumn = postgres.StringColumn("description")
|
||||
MinPlayersColumn = postgres.IntegerColumn("min_players")
|
||||
MaxPlayersColumn = postgres.IntegerColumn("max_players")
|
||||
StartGapHoursColumn = postgres.IntegerColumn("start_gap_hours")
|
||||
StartGapPlayersColumn = postgres.IntegerColumn("start_gap_players")
|
||||
EnrollmentEndsAtColumn = postgres.TimestampzColumn("enrollment_ends_at")
|
||||
TurnScheduleColumn = postgres.StringColumn("turn_schedule")
|
||||
TargetEngineVersionColumn = postgres.StringColumn("target_engine_version")
|
||||
RuntimeSnapshotColumn = postgres.StringColumn("runtime_snapshot")
|
||||
RuntimeBindingColumn = postgres.StringColumn("runtime_binding")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampzColumn("updated_at")
|
||||
StartedAtColumn = postgres.TimestampzColumn("started_at")
|
||||
FinishedAtColumn = postgres.TimestampzColumn("finished_at")
|
||||
allColumns = postgres.ColumnList{GameIDColumn, OwnerUserIDColumn, VisibilityColumn, StatusColumn, GameNameColumn, DescriptionColumn, MinPlayersColumn, MaxPlayersColumn, StartGapHoursColumn, StartGapPlayersColumn, EnrollmentEndsAtColumn, TurnScheduleColumn, TargetEngineVersionColumn, RuntimeSnapshotColumn, RuntimeBindingColumn, CreatedAtColumn, UpdatedAtColumn, StartedAtColumn, FinishedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{OwnerUserIDColumn, VisibilityColumn, StatusColumn, GameNameColumn, DescriptionColumn, MinPlayersColumn, MaxPlayersColumn, StartGapHoursColumn, StartGapPlayersColumn, EnrollmentEndsAtColumn, TurnScheduleColumn, TargetEngineVersionColumn, RuntimeSnapshotColumn, RuntimeBindingColumn, CreatedAtColumn, UpdatedAtColumn, StartedAtColumn, FinishedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{DescriptionColumn, RuntimeSnapshotColumn, CreatedAtColumn, UpdatedAtColumn}
|
||||
)
|
||||
|
||||
return gamesTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
GameID: GameIDColumn,
|
||||
OwnerUserID: OwnerUserIDColumn,
|
||||
Visibility: VisibilityColumn,
|
||||
Status: StatusColumn,
|
||||
GameName: GameNameColumn,
|
||||
Description: DescriptionColumn,
|
||||
MinPlayers: MinPlayersColumn,
|
||||
MaxPlayers: MaxPlayersColumn,
|
||||
StartGapHours: StartGapHoursColumn,
|
||||
StartGapPlayers: StartGapPlayersColumn,
|
||||
EnrollmentEndsAt: EnrollmentEndsAtColumn,
|
||||
TurnSchedule: TurnScheduleColumn,
|
||||
TargetEngineVersion: TargetEngineVersionColumn,
|
||||
RuntimeSnapshot: RuntimeSnapshotColumn,
|
||||
RuntimeBinding: RuntimeBindingColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
StartedAt: StartedAtColumn,
|
||||
FinishedAt: FinishedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Invites = newInvitesTable("backend", "invites", "")
|
||||
|
||||
type invitesTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
InviteID postgres.ColumnString
|
||||
GameID postgres.ColumnString
|
||||
InviterUserID postgres.ColumnString
|
||||
InvitedUserID postgres.ColumnString
|
||||
Code postgres.ColumnString
|
||||
Status postgres.ColumnString
|
||||
RaceName postgres.ColumnString
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
ExpiresAt postgres.ColumnTimestampz
|
||||
DecidedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type InvitesTable struct {
|
||||
invitesTable
|
||||
|
||||
EXCLUDED invitesTable
|
||||
}
|
||||
|
||||
// AS creates new InvitesTable with assigned alias
|
||||
func (a InvitesTable) AS(alias string) *InvitesTable {
|
||||
return newInvitesTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new InvitesTable with assigned schema name
|
||||
func (a InvitesTable) FromSchema(schemaName string) *InvitesTable {
|
||||
return newInvitesTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new InvitesTable with assigned table prefix
|
||||
func (a InvitesTable) WithPrefix(prefix string) *InvitesTable {
|
||||
return newInvitesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new InvitesTable with assigned table suffix
|
||||
func (a InvitesTable) WithSuffix(suffix string) *InvitesTable {
|
||||
return newInvitesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newInvitesTable(schemaName, tableName, alias string) *InvitesTable {
|
||||
return &InvitesTable{
|
||||
invitesTable: newInvitesTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newInvitesTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newInvitesTableImpl(schemaName, tableName, alias string) invitesTable {
|
||||
var (
|
||||
InviteIDColumn = postgres.StringColumn("invite_id")
|
||||
GameIDColumn = postgres.StringColumn("game_id")
|
||||
InviterUserIDColumn = postgres.StringColumn("inviter_user_id")
|
||||
InvitedUserIDColumn = postgres.StringColumn("invited_user_id")
|
||||
CodeColumn = postgres.StringColumn("code")
|
||||
StatusColumn = postgres.StringColumn("status")
|
||||
RaceNameColumn = postgres.StringColumn("race_name")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
ExpiresAtColumn = postgres.TimestampzColumn("expires_at")
|
||||
DecidedAtColumn = postgres.TimestampzColumn("decided_at")
|
||||
allColumns = postgres.ColumnList{InviteIDColumn, GameIDColumn, InviterUserIDColumn, InvitedUserIDColumn, CodeColumn, StatusColumn, RaceNameColumn, CreatedAtColumn, ExpiresAtColumn, DecidedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{GameIDColumn, InviterUserIDColumn, InvitedUserIDColumn, CodeColumn, StatusColumn, RaceNameColumn, CreatedAtColumn, ExpiresAtColumn, DecidedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{RaceNameColumn, CreatedAtColumn}
|
||||
)
|
||||
|
||||
return invitesTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
InviteID: InviteIDColumn,
|
||||
GameID: GameIDColumn,
|
||||
InviterUserID: InviterUserIDColumn,
|
||||
InvitedUserID: InvitedUserIDColumn,
|
||||
Code: CodeColumn,
|
||||
Status: StatusColumn,
|
||||
RaceName: RaceNameColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
ExpiresAt: ExpiresAtColumn,
|
||||
DecidedAt: DecidedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var LimitActive = newLimitActiveTable("backend", "limit_active", "")
|
||||
|
||||
type limitActiveTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
UserID postgres.ColumnString
|
||||
LimitCode postgres.ColumnString
|
||||
RecordID postgres.ColumnString
|
||||
Value postgres.ColumnInteger
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type LimitActiveTable struct {
|
||||
limitActiveTable
|
||||
|
||||
EXCLUDED limitActiveTable
|
||||
}
|
||||
|
||||
// AS creates new LimitActiveTable with assigned alias
|
||||
func (a LimitActiveTable) AS(alias string) *LimitActiveTable {
|
||||
return newLimitActiveTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new LimitActiveTable with assigned schema name
|
||||
func (a LimitActiveTable) FromSchema(schemaName string) *LimitActiveTable {
|
||||
return newLimitActiveTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new LimitActiveTable with assigned table prefix
|
||||
func (a LimitActiveTable) WithPrefix(prefix string) *LimitActiveTable {
|
||||
return newLimitActiveTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new LimitActiveTable with assigned table suffix
|
||||
func (a LimitActiveTable) WithSuffix(suffix string) *LimitActiveTable {
|
||||
return newLimitActiveTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newLimitActiveTable(schemaName, tableName, alias string) *LimitActiveTable {
|
||||
return &LimitActiveTable{
|
||||
limitActiveTable: newLimitActiveTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newLimitActiveTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newLimitActiveTableImpl(schemaName, tableName, alias string) limitActiveTable {
|
||||
var (
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
LimitCodeColumn = postgres.StringColumn("limit_code")
|
||||
RecordIDColumn = postgres.StringColumn("record_id")
|
||||
ValueColumn = postgres.IntegerColumn("value")
|
||||
allColumns = postgres.ColumnList{UserIDColumn, LimitCodeColumn, RecordIDColumn, ValueColumn}
|
||||
mutableColumns = postgres.ColumnList{RecordIDColumn, ValueColumn}
|
||||
defaultColumns = postgres.ColumnList{}
|
||||
)
|
||||
|
||||
return limitActiveTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
UserID: UserIDColumn,
|
||||
LimitCode: LimitCodeColumn,
|
||||
RecordID: RecordIDColumn,
|
||||
Value: ValueColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var LimitRecords = newLimitRecordsTable("backend", "limit_records", "")
|
||||
|
||||
type limitRecordsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
RecordID postgres.ColumnString
|
||||
UserID postgres.ColumnString
|
||||
LimitCode postgres.ColumnString
|
||||
Value postgres.ColumnInteger
|
||||
ReasonCode postgres.ColumnString
|
||||
ActorType postgres.ColumnString
|
||||
ActorID postgres.ColumnString
|
||||
AppliedAt postgres.ColumnTimestampz
|
||||
ExpiresAt postgres.ColumnTimestampz
|
||||
RemovedAt postgres.ColumnTimestampz
|
||||
RemovedByType postgres.ColumnString
|
||||
RemovedByID postgres.ColumnString
|
||||
RemovedReasonCode postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type LimitRecordsTable struct {
|
||||
limitRecordsTable
|
||||
|
||||
EXCLUDED limitRecordsTable
|
||||
}
|
||||
|
||||
// AS creates new LimitRecordsTable with assigned alias
|
||||
func (a LimitRecordsTable) AS(alias string) *LimitRecordsTable {
|
||||
return newLimitRecordsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new LimitRecordsTable with assigned schema name
|
||||
func (a LimitRecordsTable) FromSchema(schemaName string) *LimitRecordsTable {
|
||||
return newLimitRecordsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new LimitRecordsTable with assigned table prefix
|
||||
func (a LimitRecordsTable) WithPrefix(prefix string) *LimitRecordsTable {
|
||||
return newLimitRecordsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new LimitRecordsTable with assigned table suffix
|
||||
func (a LimitRecordsTable) WithSuffix(suffix string) *LimitRecordsTable {
|
||||
return newLimitRecordsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newLimitRecordsTable(schemaName, tableName, alias string) *LimitRecordsTable {
|
||||
return &LimitRecordsTable{
|
||||
limitRecordsTable: newLimitRecordsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newLimitRecordsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newLimitRecordsTableImpl(schemaName, tableName, alias string) limitRecordsTable {
|
||||
var (
|
||||
RecordIDColumn = postgres.StringColumn("record_id")
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
LimitCodeColumn = postgres.StringColumn("limit_code")
|
||||
ValueColumn = postgres.IntegerColumn("value")
|
||||
ReasonCodeColumn = postgres.StringColumn("reason_code")
|
||||
ActorTypeColumn = postgres.StringColumn("actor_type")
|
||||
ActorIDColumn = postgres.StringColumn("actor_id")
|
||||
AppliedAtColumn = postgres.TimestampzColumn("applied_at")
|
||||
ExpiresAtColumn = postgres.TimestampzColumn("expires_at")
|
||||
RemovedAtColumn = postgres.TimestampzColumn("removed_at")
|
||||
RemovedByTypeColumn = postgres.StringColumn("removed_by_type")
|
||||
RemovedByIDColumn = postgres.StringColumn("removed_by_id")
|
||||
RemovedReasonCodeColumn = postgres.StringColumn("removed_reason_code")
|
||||
allColumns = postgres.ColumnList{RecordIDColumn, UserIDColumn, LimitCodeColumn, ValueColumn, ReasonCodeColumn, ActorTypeColumn, ActorIDColumn, AppliedAtColumn, ExpiresAtColumn, RemovedAtColumn, RemovedByTypeColumn, RemovedByIDColumn, RemovedReasonCodeColumn}
|
||||
mutableColumns = postgres.ColumnList{UserIDColumn, LimitCodeColumn, ValueColumn, ReasonCodeColumn, ActorTypeColumn, ActorIDColumn, AppliedAtColumn, ExpiresAtColumn, RemovedAtColumn, RemovedByTypeColumn, RemovedByIDColumn, RemovedReasonCodeColumn}
|
||||
defaultColumns = postgres.ColumnList{AppliedAtColumn}
|
||||
)
|
||||
|
||||
return limitRecordsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
RecordID: RecordIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
LimitCode: LimitCodeColumn,
|
||||
Value: ValueColumn,
|
||||
ReasonCode: ReasonCodeColumn,
|
||||
ActorType: ActorTypeColumn,
|
||||
ActorID: ActorIDColumn,
|
||||
AppliedAt: AppliedAtColumn,
|
||||
ExpiresAt: ExpiresAtColumn,
|
||||
RemovedAt: RemovedAtColumn,
|
||||
RemovedByType: RemovedByTypeColumn,
|
||||
RemovedByID: RemovedByIDColumn,
|
||||
RemovedReasonCode: RemovedReasonCodeColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var MailAttempts = newMailAttemptsTable("backend", "mail_attempts", "")
|
||||
|
||||
type mailAttemptsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
AttemptID postgres.ColumnString
|
||||
DeliveryID postgres.ColumnString
|
||||
AttemptNo postgres.ColumnInteger
|
||||
StartedAt postgres.ColumnTimestampz
|
||||
FinishedAt postgres.ColumnTimestampz
|
||||
Outcome postgres.ColumnString
|
||||
Error postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type MailAttemptsTable struct {
|
||||
mailAttemptsTable
|
||||
|
||||
EXCLUDED mailAttemptsTable
|
||||
}
|
||||
|
||||
// AS creates new MailAttemptsTable with assigned alias
|
||||
func (a MailAttemptsTable) AS(alias string) *MailAttemptsTable {
|
||||
return newMailAttemptsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new MailAttemptsTable with assigned schema name
|
||||
func (a MailAttemptsTable) FromSchema(schemaName string) *MailAttemptsTable {
|
||||
return newMailAttemptsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new MailAttemptsTable with assigned table prefix
|
||||
func (a MailAttemptsTable) WithPrefix(prefix string) *MailAttemptsTable {
|
||||
return newMailAttemptsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new MailAttemptsTable with assigned table suffix
|
||||
func (a MailAttemptsTable) WithSuffix(suffix string) *MailAttemptsTable {
|
||||
return newMailAttemptsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newMailAttemptsTable(schemaName, tableName, alias string) *MailAttemptsTable {
|
||||
return &MailAttemptsTable{
|
||||
mailAttemptsTable: newMailAttemptsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newMailAttemptsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newMailAttemptsTableImpl(schemaName, tableName, alias string) mailAttemptsTable {
|
||||
var (
|
||||
AttemptIDColumn = postgres.StringColumn("attempt_id")
|
||||
DeliveryIDColumn = postgres.StringColumn("delivery_id")
|
||||
AttemptNoColumn = postgres.IntegerColumn("attempt_no")
|
||||
StartedAtColumn = postgres.TimestampzColumn("started_at")
|
||||
FinishedAtColumn = postgres.TimestampzColumn("finished_at")
|
||||
OutcomeColumn = postgres.StringColumn("outcome")
|
||||
ErrorColumn = postgres.StringColumn("error")
|
||||
allColumns = postgres.ColumnList{AttemptIDColumn, DeliveryIDColumn, AttemptNoColumn, StartedAtColumn, FinishedAtColumn, OutcomeColumn, ErrorColumn}
|
||||
mutableColumns = postgres.ColumnList{DeliveryIDColumn, AttemptNoColumn, StartedAtColumn, FinishedAtColumn, OutcomeColumn, ErrorColumn}
|
||||
defaultColumns = postgres.ColumnList{StartedAtColumn, ErrorColumn}
|
||||
)
|
||||
|
||||
return mailAttemptsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
AttemptID: AttemptIDColumn,
|
||||
DeliveryID: DeliveryIDColumn,
|
||||
AttemptNo: AttemptNoColumn,
|
||||
StartedAt: StartedAtColumn,
|
||||
FinishedAt: FinishedAtColumn,
|
||||
Outcome: OutcomeColumn,
|
||||
Error: ErrorColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var MailDeadLetters = newMailDeadLettersTable("backend", "mail_dead_letters", "")
|
||||
|
||||
type mailDeadLettersTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
DeadLetterID postgres.ColumnString
|
||||
DeliveryID postgres.ColumnString
|
||||
ArchivedAt postgres.ColumnTimestampz
|
||||
Reason postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type MailDeadLettersTable struct {
|
||||
mailDeadLettersTable
|
||||
|
||||
EXCLUDED mailDeadLettersTable
|
||||
}
|
||||
|
||||
// AS creates new MailDeadLettersTable with assigned alias
|
||||
func (a MailDeadLettersTable) AS(alias string) *MailDeadLettersTable {
|
||||
return newMailDeadLettersTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new MailDeadLettersTable with assigned schema name
|
||||
func (a MailDeadLettersTable) FromSchema(schemaName string) *MailDeadLettersTable {
|
||||
return newMailDeadLettersTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new MailDeadLettersTable with assigned table prefix
|
||||
func (a MailDeadLettersTable) WithPrefix(prefix string) *MailDeadLettersTable {
|
||||
return newMailDeadLettersTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new MailDeadLettersTable with assigned table suffix
|
||||
func (a MailDeadLettersTable) WithSuffix(suffix string) *MailDeadLettersTable {
|
||||
return newMailDeadLettersTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newMailDeadLettersTable(schemaName, tableName, alias string) *MailDeadLettersTable {
|
||||
return &MailDeadLettersTable{
|
||||
mailDeadLettersTable: newMailDeadLettersTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newMailDeadLettersTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newMailDeadLettersTableImpl(schemaName, tableName, alias string) mailDeadLettersTable {
|
||||
var (
|
||||
DeadLetterIDColumn = postgres.StringColumn("dead_letter_id")
|
||||
DeliveryIDColumn = postgres.StringColumn("delivery_id")
|
||||
ArchivedAtColumn = postgres.TimestampzColumn("archived_at")
|
||||
ReasonColumn = postgres.StringColumn("reason")
|
||||
allColumns = postgres.ColumnList{DeadLetterIDColumn, DeliveryIDColumn, ArchivedAtColumn, ReasonColumn}
|
||||
mutableColumns = postgres.ColumnList{DeliveryIDColumn, ArchivedAtColumn, ReasonColumn}
|
||||
defaultColumns = postgres.ColumnList{ArchivedAtColumn}
|
||||
)
|
||||
|
||||
return mailDeadLettersTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
DeadLetterID: DeadLetterIDColumn,
|
||||
DeliveryID: DeliveryIDColumn,
|
||||
ArchivedAt: ArchivedAtColumn,
|
||||
Reason: ReasonColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var MailDeliveries = newMailDeliveriesTable("backend", "mail_deliveries", "")
|
||||
|
||||
type mailDeliveriesTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
DeliveryID postgres.ColumnString
|
||||
TemplateID postgres.ColumnString
|
||||
IdempotencyKey postgres.ColumnString
|
||||
Status postgres.ColumnString
|
||||
Attempts postgres.ColumnInteger
|
||||
NextAttemptAt postgres.ColumnTimestampz
|
||||
PayloadID postgres.ColumnString
|
||||
LastError postgres.ColumnString
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
UpdatedAt postgres.ColumnTimestampz
|
||||
SentAt postgres.ColumnTimestampz
|
||||
DeadLetteredAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type MailDeliveriesTable struct {
|
||||
mailDeliveriesTable
|
||||
|
||||
EXCLUDED mailDeliveriesTable
|
||||
}
|
||||
|
||||
// AS creates new MailDeliveriesTable with assigned alias
|
||||
func (a MailDeliveriesTable) AS(alias string) *MailDeliveriesTable {
|
||||
return newMailDeliveriesTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new MailDeliveriesTable with assigned schema name
|
||||
func (a MailDeliveriesTable) FromSchema(schemaName string) *MailDeliveriesTable {
|
||||
return newMailDeliveriesTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new MailDeliveriesTable with assigned table prefix
|
||||
func (a MailDeliveriesTable) WithPrefix(prefix string) *MailDeliveriesTable {
|
||||
return newMailDeliveriesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new MailDeliveriesTable with assigned table suffix
|
||||
func (a MailDeliveriesTable) WithSuffix(suffix string) *MailDeliveriesTable {
|
||||
return newMailDeliveriesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newMailDeliveriesTable(schemaName, tableName, alias string) *MailDeliveriesTable {
|
||||
return &MailDeliveriesTable{
|
||||
mailDeliveriesTable: newMailDeliveriesTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newMailDeliveriesTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newMailDeliveriesTableImpl(schemaName, tableName, alias string) mailDeliveriesTable {
|
||||
var (
|
||||
DeliveryIDColumn = postgres.StringColumn("delivery_id")
|
||||
TemplateIDColumn = postgres.StringColumn("template_id")
|
||||
IdempotencyKeyColumn = postgres.StringColumn("idempotency_key")
|
||||
StatusColumn = postgres.StringColumn("status")
|
||||
AttemptsColumn = postgres.IntegerColumn("attempts")
|
||||
NextAttemptAtColumn = postgres.TimestampzColumn("next_attempt_at")
|
||||
PayloadIDColumn = postgres.StringColumn("payload_id")
|
||||
LastErrorColumn = postgres.StringColumn("last_error")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampzColumn("updated_at")
|
||||
SentAtColumn = postgres.TimestampzColumn("sent_at")
|
||||
DeadLetteredAtColumn = postgres.TimestampzColumn("dead_lettered_at")
|
||||
allColumns = postgres.ColumnList{DeliveryIDColumn, TemplateIDColumn, IdempotencyKeyColumn, StatusColumn, AttemptsColumn, NextAttemptAtColumn, PayloadIDColumn, LastErrorColumn, CreatedAtColumn, UpdatedAtColumn, SentAtColumn, DeadLetteredAtColumn}
|
||||
mutableColumns = postgres.ColumnList{TemplateIDColumn, IdempotencyKeyColumn, StatusColumn, AttemptsColumn, NextAttemptAtColumn, PayloadIDColumn, LastErrorColumn, CreatedAtColumn, UpdatedAtColumn, SentAtColumn, DeadLetteredAtColumn}
|
||||
defaultColumns = postgres.ColumnList{AttemptsColumn, LastErrorColumn, CreatedAtColumn, UpdatedAtColumn}
|
||||
)
|
||||
|
||||
return mailDeliveriesTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
DeliveryID: DeliveryIDColumn,
|
||||
TemplateID: TemplateIDColumn,
|
||||
IdempotencyKey: IdempotencyKeyColumn,
|
||||
Status: StatusColumn,
|
||||
Attempts: AttemptsColumn,
|
||||
NextAttemptAt: NextAttemptAtColumn,
|
||||
PayloadID: PayloadIDColumn,
|
||||
LastError: LastErrorColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
SentAt: SentAtColumn,
|
||||
DeadLetteredAt: DeadLetteredAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var MailPayloads = newMailPayloadsTable("backend", "mail_payloads", "")
|
||||
|
||||
type mailPayloadsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
PayloadID postgres.ColumnString
|
||||
ContentType postgres.ColumnString
|
||||
Subject postgres.ColumnString
|
||||
Body postgres.ColumnBytea
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type MailPayloadsTable struct {
|
||||
mailPayloadsTable
|
||||
|
||||
EXCLUDED mailPayloadsTable
|
||||
}
|
||||
|
||||
// AS creates new MailPayloadsTable with assigned alias
|
||||
func (a MailPayloadsTable) AS(alias string) *MailPayloadsTable {
|
||||
return newMailPayloadsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new MailPayloadsTable with assigned schema name
|
||||
func (a MailPayloadsTable) FromSchema(schemaName string) *MailPayloadsTable {
|
||||
return newMailPayloadsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new MailPayloadsTable with assigned table prefix
|
||||
func (a MailPayloadsTable) WithPrefix(prefix string) *MailPayloadsTable {
|
||||
return newMailPayloadsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new MailPayloadsTable with assigned table suffix
|
||||
func (a MailPayloadsTable) WithSuffix(suffix string) *MailPayloadsTable {
|
||||
return newMailPayloadsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newMailPayloadsTable(schemaName, tableName, alias string) *MailPayloadsTable {
|
||||
return &MailPayloadsTable{
|
||||
mailPayloadsTable: newMailPayloadsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newMailPayloadsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newMailPayloadsTableImpl(schemaName, tableName, alias string) mailPayloadsTable {
|
||||
var (
|
||||
PayloadIDColumn = postgres.StringColumn("payload_id")
|
||||
ContentTypeColumn = postgres.StringColumn("content_type")
|
||||
SubjectColumn = postgres.StringColumn("subject")
|
||||
BodyColumn = postgres.ByteaColumn("body")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
allColumns = postgres.ColumnList{PayloadIDColumn, ContentTypeColumn, SubjectColumn, BodyColumn, CreatedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{ContentTypeColumn, SubjectColumn, BodyColumn, CreatedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{CreatedAtColumn}
|
||||
)
|
||||
|
||||
return mailPayloadsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
PayloadID: PayloadIDColumn,
|
||||
ContentType: ContentTypeColumn,
|
||||
Subject: SubjectColumn,
|
||||
Body: BodyColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var MailRecipients = newMailRecipientsTable("backend", "mail_recipients", "")
|
||||
|
||||
type mailRecipientsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
RecipientID postgres.ColumnString
|
||||
DeliveryID postgres.ColumnString
|
||||
Address postgres.ColumnString
|
||||
Kind postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type MailRecipientsTable struct {
|
||||
mailRecipientsTable
|
||||
|
||||
EXCLUDED mailRecipientsTable
|
||||
}
|
||||
|
||||
// AS creates new MailRecipientsTable with assigned alias
|
||||
func (a MailRecipientsTable) AS(alias string) *MailRecipientsTable {
|
||||
return newMailRecipientsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new MailRecipientsTable with assigned schema name
|
||||
func (a MailRecipientsTable) FromSchema(schemaName string) *MailRecipientsTable {
|
||||
return newMailRecipientsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new MailRecipientsTable with assigned table prefix
|
||||
func (a MailRecipientsTable) WithPrefix(prefix string) *MailRecipientsTable {
|
||||
return newMailRecipientsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new MailRecipientsTable with assigned table suffix
|
||||
func (a MailRecipientsTable) WithSuffix(suffix string) *MailRecipientsTable {
|
||||
return newMailRecipientsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newMailRecipientsTable(schemaName, tableName, alias string) *MailRecipientsTable {
|
||||
return &MailRecipientsTable{
|
||||
mailRecipientsTable: newMailRecipientsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newMailRecipientsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newMailRecipientsTableImpl(schemaName, tableName, alias string) mailRecipientsTable {
|
||||
var (
|
||||
RecipientIDColumn = postgres.StringColumn("recipient_id")
|
||||
DeliveryIDColumn = postgres.StringColumn("delivery_id")
|
||||
AddressColumn = postgres.StringColumn("address")
|
||||
KindColumn = postgres.StringColumn("kind")
|
||||
allColumns = postgres.ColumnList{RecipientIDColumn, DeliveryIDColumn, AddressColumn, KindColumn}
|
||||
mutableColumns = postgres.ColumnList{DeliveryIDColumn, AddressColumn, KindColumn}
|
||||
defaultColumns = postgres.ColumnList{}
|
||||
)
|
||||
|
||||
return mailRecipientsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
RecipientID: RecipientIDColumn,
|
||||
DeliveryID: DeliveryIDColumn,
|
||||
Address: AddressColumn,
|
||||
Kind: KindColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Memberships = newMembershipsTable("backend", "memberships", "")
|
||||
|
||||
type membershipsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
MembershipID postgres.ColumnString
|
||||
GameID postgres.ColumnString
|
||||
UserID postgres.ColumnString
|
||||
RaceName postgres.ColumnString
|
||||
CanonicalKey postgres.ColumnString
|
||||
Status postgres.ColumnString
|
||||
JoinedAt postgres.ColumnTimestampz
|
||||
RemovedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type MembershipsTable struct {
|
||||
membershipsTable
|
||||
|
||||
EXCLUDED membershipsTable
|
||||
}
|
||||
|
||||
// AS creates new MembershipsTable with assigned alias
|
||||
func (a MembershipsTable) AS(alias string) *MembershipsTable {
|
||||
return newMembershipsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new MembershipsTable with assigned schema name
|
||||
func (a MembershipsTable) FromSchema(schemaName string) *MembershipsTable {
|
||||
return newMembershipsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new MembershipsTable with assigned table prefix
|
||||
func (a MembershipsTable) WithPrefix(prefix string) *MembershipsTable {
|
||||
return newMembershipsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new MembershipsTable with assigned table suffix
|
||||
func (a MembershipsTable) WithSuffix(suffix string) *MembershipsTable {
|
||||
return newMembershipsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newMembershipsTable(schemaName, tableName, alias string) *MembershipsTable {
|
||||
return &MembershipsTable{
|
||||
membershipsTable: newMembershipsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newMembershipsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newMembershipsTableImpl(schemaName, tableName, alias string) membershipsTable {
|
||||
var (
|
||||
MembershipIDColumn = postgres.StringColumn("membership_id")
|
||||
GameIDColumn = postgres.StringColumn("game_id")
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
RaceNameColumn = postgres.StringColumn("race_name")
|
||||
CanonicalKeyColumn = postgres.StringColumn("canonical_key")
|
||||
StatusColumn = postgres.StringColumn("status")
|
||||
JoinedAtColumn = postgres.TimestampzColumn("joined_at")
|
||||
RemovedAtColumn = postgres.TimestampzColumn("removed_at")
|
||||
allColumns = postgres.ColumnList{MembershipIDColumn, GameIDColumn, UserIDColumn, RaceNameColumn, CanonicalKeyColumn, StatusColumn, JoinedAtColumn, RemovedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{GameIDColumn, UserIDColumn, RaceNameColumn, CanonicalKeyColumn, StatusColumn, JoinedAtColumn, RemovedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{JoinedAtColumn}
|
||||
)
|
||||
|
||||
return membershipsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
MembershipID: MembershipIDColumn,
|
||||
GameID: GameIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
RaceName: RaceNameColumn,
|
||||
CanonicalKey: CanonicalKeyColumn,
|
||||
Status: StatusColumn,
|
||||
JoinedAt: JoinedAtColumn,
|
||||
RemovedAt: RemovedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var NotificationDeadLetters = newNotificationDeadLettersTable("backend", "notification_dead_letters", "")
|
||||
|
||||
type notificationDeadLettersTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
DeadLetterID postgres.ColumnString
|
||||
NotificationID postgres.ColumnString
|
||||
RouteID postgres.ColumnString
|
||||
ArchivedAt postgres.ColumnTimestampz
|
||||
Reason postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type NotificationDeadLettersTable struct {
|
||||
notificationDeadLettersTable
|
||||
|
||||
EXCLUDED notificationDeadLettersTable
|
||||
}
|
||||
|
||||
// AS creates new NotificationDeadLettersTable with assigned alias
|
||||
func (a NotificationDeadLettersTable) AS(alias string) *NotificationDeadLettersTable {
|
||||
return newNotificationDeadLettersTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new NotificationDeadLettersTable with assigned schema name
|
||||
func (a NotificationDeadLettersTable) FromSchema(schemaName string) *NotificationDeadLettersTable {
|
||||
return newNotificationDeadLettersTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new NotificationDeadLettersTable with assigned table prefix
|
||||
func (a NotificationDeadLettersTable) WithPrefix(prefix string) *NotificationDeadLettersTable {
|
||||
return newNotificationDeadLettersTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new NotificationDeadLettersTable with assigned table suffix
|
||||
func (a NotificationDeadLettersTable) WithSuffix(suffix string) *NotificationDeadLettersTable {
|
||||
return newNotificationDeadLettersTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newNotificationDeadLettersTable(schemaName, tableName, alias string) *NotificationDeadLettersTable {
|
||||
return &NotificationDeadLettersTable{
|
||||
notificationDeadLettersTable: newNotificationDeadLettersTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newNotificationDeadLettersTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newNotificationDeadLettersTableImpl(schemaName, tableName, alias string) notificationDeadLettersTable {
|
||||
var (
|
||||
DeadLetterIDColumn = postgres.StringColumn("dead_letter_id")
|
||||
NotificationIDColumn = postgres.StringColumn("notification_id")
|
||||
RouteIDColumn = postgres.StringColumn("route_id")
|
||||
ArchivedAtColumn = postgres.TimestampzColumn("archived_at")
|
||||
ReasonColumn = postgres.StringColumn("reason")
|
||||
allColumns = postgres.ColumnList{DeadLetterIDColumn, NotificationIDColumn, RouteIDColumn, ArchivedAtColumn, ReasonColumn}
|
||||
mutableColumns = postgres.ColumnList{NotificationIDColumn, RouteIDColumn, ArchivedAtColumn, ReasonColumn}
|
||||
defaultColumns = postgres.ColumnList{ArchivedAtColumn}
|
||||
)
|
||||
|
||||
return notificationDeadLettersTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
DeadLetterID: DeadLetterIDColumn,
|
||||
NotificationID: NotificationIDColumn,
|
||||
RouteID: RouteIDColumn,
|
||||
ArchivedAt: ArchivedAtColumn,
|
||||
Reason: ReasonColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var NotificationMalformedIntents = newNotificationMalformedIntentsTable("backend", "notification_malformed_intents", "")
|
||||
|
||||
type notificationMalformedIntentsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnString
|
||||
ReceivedAt postgres.ColumnTimestampz
|
||||
Payload postgres.ColumnString
|
||||
Reason postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type NotificationMalformedIntentsTable struct {
|
||||
notificationMalformedIntentsTable
|
||||
|
||||
EXCLUDED notificationMalformedIntentsTable
|
||||
}
|
||||
|
||||
// AS creates new NotificationMalformedIntentsTable with assigned alias
|
||||
func (a NotificationMalformedIntentsTable) AS(alias string) *NotificationMalformedIntentsTable {
|
||||
return newNotificationMalformedIntentsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new NotificationMalformedIntentsTable with assigned schema name
|
||||
func (a NotificationMalformedIntentsTable) FromSchema(schemaName string) *NotificationMalformedIntentsTable {
|
||||
return newNotificationMalformedIntentsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new NotificationMalformedIntentsTable with assigned table prefix
|
||||
func (a NotificationMalformedIntentsTable) WithPrefix(prefix string) *NotificationMalformedIntentsTable {
|
||||
return newNotificationMalformedIntentsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new NotificationMalformedIntentsTable with assigned table suffix
|
||||
func (a NotificationMalformedIntentsTable) WithSuffix(suffix string) *NotificationMalformedIntentsTable {
|
||||
return newNotificationMalformedIntentsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newNotificationMalformedIntentsTable(schemaName, tableName, alias string) *NotificationMalformedIntentsTable {
|
||||
return &NotificationMalformedIntentsTable{
|
||||
notificationMalformedIntentsTable: newNotificationMalformedIntentsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newNotificationMalformedIntentsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newNotificationMalformedIntentsTableImpl(schemaName, tableName, alias string) notificationMalformedIntentsTable {
|
||||
var (
|
||||
IDColumn = postgres.StringColumn("id")
|
||||
ReceivedAtColumn = postgres.TimestampzColumn("received_at")
|
||||
PayloadColumn = postgres.StringColumn("payload")
|
||||
ReasonColumn = postgres.StringColumn("reason")
|
||||
allColumns = postgres.ColumnList{IDColumn, ReceivedAtColumn, PayloadColumn, ReasonColumn}
|
||||
mutableColumns = postgres.ColumnList{ReceivedAtColumn, PayloadColumn, ReasonColumn}
|
||||
defaultColumns = postgres.ColumnList{ReceivedAtColumn}
|
||||
)
|
||||
|
||||
return notificationMalformedIntentsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
ReceivedAt: ReceivedAtColumn,
|
||||
Payload: PayloadColumn,
|
||||
Reason: ReasonColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var NotificationRoutes = newNotificationRoutesTable("backend", "notification_routes", "")
|
||||
|
||||
type notificationRoutesTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
RouteID postgres.ColumnString
|
||||
NotificationID postgres.ColumnString
|
||||
Channel postgres.ColumnString
|
||||
Status postgres.ColumnString
|
||||
Attempts postgres.ColumnInteger
|
||||
MaxAttempts postgres.ColumnInteger
|
||||
NextAttemptAt postgres.ColumnTimestampz
|
||||
LastAttemptAt postgres.ColumnTimestampz
|
||||
LastError postgres.ColumnString
|
||||
ResolvedEmail postgres.ColumnString
|
||||
ResolvedLocale postgres.ColumnString
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
UpdatedAt postgres.ColumnTimestampz
|
||||
PublishedAt postgres.ColumnTimestampz
|
||||
DeadLetteredAt postgres.ColumnTimestampz
|
||||
SkippedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type NotificationRoutesTable struct {
|
||||
notificationRoutesTable
|
||||
|
||||
EXCLUDED notificationRoutesTable
|
||||
}
|
||||
|
||||
// AS creates new NotificationRoutesTable with assigned alias
|
||||
func (a NotificationRoutesTable) AS(alias string) *NotificationRoutesTable {
|
||||
return newNotificationRoutesTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new NotificationRoutesTable with assigned schema name
|
||||
func (a NotificationRoutesTable) FromSchema(schemaName string) *NotificationRoutesTable {
|
||||
return newNotificationRoutesTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new NotificationRoutesTable with assigned table prefix
|
||||
func (a NotificationRoutesTable) WithPrefix(prefix string) *NotificationRoutesTable {
|
||||
return newNotificationRoutesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new NotificationRoutesTable with assigned table suffix
|
||||
func (a NotificationRoutesTable) WithSuffix(suffix string) *NotificationRoutesTable {
|
||||
return newNotificationRoutesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newNotificationRoutesTable(schemaName, tableName, alias string) *NotificationRoutesTable {
|
||||
return &NotificationRoutesTable{
|
||||
notificationRoutesTable: newNotificationRoutesTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newNotificationRoutesTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newNotificationRoutesTableImpl(schemaName, tableName, alias string) notificationRoutesTable {
|
||||
var (
|
||||
RouteIDColumn = postgres.StringColumn("route_id")
|
||||
NotificationIDColumn = postgres.StringColumn("notification_id")
|
||||
ChannelColumn = postgres.StringColumn("channel")
|
||||
StatusColumn = postgres.StringColumn("status")
|
||||
AttemptsColumn = postgres.IntegerColumn("attempts")
|
||||
MaxAttemptsColumn = postgres.IntegerColumn("max_attempts")
|
||||
NextAttemptAtColumn = postgres.TimestampzColumn("next_attempt_at")
|
||||
LastAttemptAtColumn = postgres.TimestampzColumn("last_attempt_at")
|
||||
LastErrorColumn = postgres.StringColumn("last_error")
|
||||
ResolvedEmailColumn = postgres.StringColumn("resolved_email")
|
||||
ResolvedLocaleColumn = postgres.StringColumn("resolved_locale")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampzColumn("updated_at")
|
||||
PublishedAtColumn = postgres.TimestampzColumn("published_at")
|
||||
DeadLetteredAtColumn = postgres.TimestampzColumn("dead_lettered_at")
|
||||
SkippedAtColumn = postgres.TimestampzColumn("skipped_at")
|
||||
allColumns = postgres.ColumnList{RouteIDColumn, NotificationIDColumn, ChannelColumn, StatusColumn, AttemptsColumn, MaxAttemptsColumn, NextAttemptAtColumn, LastAttemptAtColumn, LastErrorColumn, ResolvedEmailColumn, ResolvedLocaleColumn, CreatedAtColumn, UpdatedAtColumn, PublishedAtColumn, DeadLetteredAtColumn, SkippedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{NotificationIDColumn, ChannelColumn, StatusColumn, AttemptsColumn, MaxAttemptsColumn, NextAttemptAtColumn, LastAttemptAtColumn, LastErrorColumn, ResolvedEmailColumn, ResolvedLocaleColumn, CreatedAtColumn, UpdatedAtColumn, PublishedAtColumn, DeadLetteredAtColumn, SkippedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{AttemptsColumn, LastErrorColumn, ResolvedEmailColumn, ResolvedLocaleColumn, CreatedAtColumn, UpdatedAtColumn}
|
||||
)
|
||||
|
||||
return notificationRoutesTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
RouteID: RouteIDColumn,
|
||||
NotificationID: NotificationIDColumn,
|
||||
Channel: ChannelColumn,
|
||||
Status: StatusColumn,
|
||||
Attempts: AttemptsColumn,
|
||||
MaxAttempts: MaxAttemptsColumn,
|
||||
NextAttemptAt: NextAttemptAtColumn,
|
||||
LastAttemptAt: LastAttemptAtColumn,
|
||||
LastError: LastErrorColumn,
|
||||
ResolvedEmail: ResolvedEmailColumn,
|
||||
ResolvedLocale: ResolvedLocaleColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
PublishedAt: PublishedAtColumn,
|
||||
DeadLetteredAt: DeadLetteredAtColumn,
|
||||
SkippedAt: SkippedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var Notifications = newNotificationsTable("backend", "notifications", "")
|
||||
|
||||
type notificationsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
NotificationID postgres.ColumnString
|
||||
Kind postgres.ColumnString
|
||||
IdempotencyKey postgres.ColumnString
|
||||
UserID postgres.ColumnString
|
||||
Payload postgres.ColumnString
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type NotificationsTable struct {
|
||||
notificationsTable
|
||||
|
||||
EXCLUDED notificationsTable
|
||||
}
|
||||
|
||||
// AS creates new NotificationsTable with assigned alias
|
||||
func (a NotificationsTable) AS(alias string) *NotificationsTable {
|
||||
return newNotificationsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new NotificationsTable with assigned schema name
|
||||
func (a NotificationsTable) FromSchema(schemaName string) *NotificationsTable {
|
||||
return newNotificationsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new NotificationsTable with assigned table prefix
|
||||
func (a NotificationsTable) WithPrefix(prefix string) *NotificationsTable {
|
||||
return newNotificationsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new NotificationsTable with assigned table suffix
|
||||
func (a NotificationsTable) WithSuffix(suffix string) *NotificationsTable {
|
||||
return newNotificationsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newNotificationsTable(schemaName, tableName, alias string) *NotificationsTable {
|
||||
return &NotificationsTable{
|
||||
notificationsTable: newNotificationsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newNotificationsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newNotificationsTableImpl(schemaName, tableName, alias string) notificationsTable {
|
||||
var (
|
||||
NotificationIDColumn = postgres.StringColumn("notification_id")
|
||||
KindColumn = postgres.StringColumn("kind")
|
||||
IdempotencyKeyColumn = postgres.StringColumn("idempotency_key")
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
PayloadColumn = postgres.StringColumn("payload")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
allColumns = postgres.ColumnList{NotificationIDColumn, KindColumn, IdempotencyKeyColumn, UserIDColumn, PayloadColumn, CreatedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{KindColumn, IdempotencyKeyColumn, UserIDColumn, PayloadColumn, CreatedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{CreatedAtColumn}
|
||||
)
|
||||
|
||||
return notificationsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
NotificationID: NotificationIDColumn,
|
||||
Kind: KindColumn,
|
||||
IdempotencyKey: IdempotencyKeyColumn,
|
||||
UserID: UserIDColumn,
|
||||
Payload: PayloadColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var PlayerMappings = newPlayerMappingsTable("backend", "player_mappings", "")
|
||||
|
||||
type playerMappingsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
GameID postgres.ColumnString
|
||||
UserID postgres.ColumnString
|
||||
RaceName postgres.ColumnString
|
||||
EnginePlayerUUID postgres.ColumnString
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type PlayerMappingsTable struct {
|
||||
playerMappingsTable
|
||||
|
||||
EXCLUDED playerMappingsTable
|
||||
}
|
||||
|
||||
// AS creates new PlayerMappingsTable with assigned alias
|
||||
func (a PlayerMappingsTable) AS(alias string) *PlayerMappingsTable {
|
||||
return newPlayerMappingsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new PlayerMappingsTable with assigned schema name
|
||||
func (a PlayerMappingsTable) FromSchema(schemaName string) *PlayerMappingsTable {
|
||||
return newPlayerMappingsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new PlayerMappingsTable with assigned table prefix
|
||||
func (a PlayerMappingsTable) WithPrefix(prefix string) *PlayerMappingsTable {
|
||||
return newPlayerMappingsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new PlayerMappingsTable with assigned table suffix
|
||||
func (a PlayerMappingsTable) WithSuffix(suffix string) *PlayerMappingsTable {
|
||||
return newPlayerMappingsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newPlayerMappingsTable(schemaName, tableName, alias string) *PlayerMappingsTable {
|
||||
return &PlayerMappingsTable{
|
||||
playerMappingsTable: newPlayerMappingsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newPlayerMappingsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newPlayerMappingsTableImpl(schemaName, tableName, alias string) playerMappingsTable {
|
||||
var (
|
||||
GameIDColumn = postgres.StringColumn("game_id")
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
RaceNameColumn = postgres.StringColumn("race_name")
|
||||
EnginePlayerUUIDColumn = postgres.StringColumn("engine_player_uuid")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
allColumns = postgres.ColumnList{GameIDColumn, UserIDColumn, RaceNameColumn, EnginePlayerUUIDColumn, CreatedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{RaceNameColumn, EnginePlayerUUIDColumn, CreatedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{CreatedAtColumn}
|
||||
)
|
||||
|
||||
return playerMappingsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
GameID: GameIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
RaceName: RaceNameColumn,
|
||||
EnginePlayerUUID: EnginePlayerUUIDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var RaceNames = newRaceNamesTable("backend", "race_names", "")
|
||||
|
||||
type raceNamesTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
Name postgres.ColumnString
|
||||
Canonical postgres.ColumnString
|
||||
Status postgres.ColumnString
|
||||
OwnerUserID postgres.ColumnString
|
||||
GameID postgres.ColumnString
|
||||
SourceGameID postgres.ColumnString
|
||||
ReservedAt postgres.ColumnTimestampz
|
||||
ExpiresAt postgres.ColumnTimestampz
|
||||
RegisteredAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type RaceNamesTable struct {
|
||||
raceNamesTable
|
||||
|
||||
EXCLUDED raceNamesTable
|
||||
}
|
||||
|
||||
// AS creates new RaceNamesTable with assigned alias
|
||||
func (a RaceNamesTable) AS(alias string) *RaceNamesTable {
|
||||
return newRaceNamesTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new RaceNamesTable with assigned schema name
|
||||
func (a RaceNamesTable) FromSchema(schemaName string) *RaceNamesTable {
|
||||
return newRaceNamesTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new RaceNamesTable with assigned table prefix
|
||||
func (a RaceNamesTable) WithPrefix(prefix string) *RaceNamesTable {
|
||||
return newRaceNamesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new RaceNamesTable with assigned table suffix
|
||||
func (a RaceNamesTable) WithSuffix(suffix string) *RaceNamesTable {
|
||||
return newRaceNamesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newRaceNamesTable(schemaName, tableName, alias string) *RaceNamesTable {
|
||||
return &RaceNamesTable{
|
||||
raceNamesTable: newRaceNamesTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newRaceNamesTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newRaceNamesTableImpl(schemaName, tableName, alias string) raceNamesTable {
|
||||
var (
|
||||
NameColumn = postgres.StringColumn("name")
|
||||
CanonicalColumn = postgres.StringColumn("canonical")
|
||||
StatusColumn = postgres.StringColumn("status")
|
||||
OwnerUserIDColumn = postgres.StringColumn("owner_user_id")
|
||||
GameIDColumn = postgres.StringColumn("game_id")
|
||||
SourceGameIDColumn = postgres.StringColumn("source_game_id")
|
||||
ReservedAtColumn = postgres.TimestampzColumn("reserved_at")
|
||||
ExpiresAtColumn = postgres.TimestampzColumn("expires_at")
|
||||
RegisteredAtColumn = postgres.TimestampzColumn("registered_at")
|
||||
allColumns = postgres.ColumnList{NameColumn, CanonicalColumn, StatusColumn, OwnerUserIDColumn, GameIDColumn, SourceGameIDColumn, ReservedAtColumn, ExpiresAtColumn, RegisteredAtColumn}
|
||||
mutableColumns = postgres.ColumnList{NameColumn, StatusColumn, OwnerUserIDColumn, SourceGameIDColumn, ReservedAtColumn, ExpiresAtColumn, RegisteredAtColumn}
|
||||
defaultColumns = postgres.ColumnList{GameIDColumn}
|
||||
)
|
||||
|
||||
return raceNamesTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
Name: NameColumn,
|
||||
Canonical: CanonicalColumn,
|
||||
Status: StatusColumn,
|
||||
OwnerUserID: OwnerUserIDColumn,
|
||||
GameID: GameIDColumn,
|
||||
SourceGameID: SourceGameIDColumn,
|
||||
ReservedAt: ReservedAtColumn,
|
||||
ExpiresAt: ExpiresAtColumn,
|
||||
RegisteredAt: RegisteredAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var RuntimeHealthSnapshots = newRuntimeHealthSnapshotsTable("backend", "runtime_health_snapshots", "")
|
||||
|
||||
type runtimeHealthSnapshotsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
SnapshotID postgres.ColumnString
|
||||
GameID postgres.ColumnString
|
||||
ObservedAt postgres.ColumnTimestampz
|
||||
Payload postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type RuntimeHealthSnapshotsTable struct {
|
||||
runtimeHealthSnapshotsTable
|
||||
|
||||
EXCLUDED runtimeHealthSnapshotsTable
|
||||
}
|
||||
|
||||
// AS creates new RuntimeHealthSnapshotsTable with assigned alias
|
||||
func (a RuntimeHealthSnapshotsTable) AS(alias string) *RuntimeHealthSnapshotsTable {
|
||||
return newRuntimeHealthSnapshotsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new RuntimeHealthSnapshotsTable with assigned schema name
|
||||
func (a RuntimeHealthSnapshotsTable) FromSchema(schemaName string) *RuntimeHealthSnapshotsTable {
|
||||
return newRuntimeHealthSnapshotsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new RuntimeHealthSnapshotsTable with assigned table prefix
|
||||
func (a RuntimeHealthSnapshotsTable) WithPrefix(prefix string) *RuntimeHealthSnapshotsTable {
|
||||
return newRuntimeHealthSnapshotsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new RuntimeHealthSnapshotsTable with assigned table suffix
|
||||
func (a RuntimeHealthSnapshotsTable) WithSuffix(suffix string) *RuntimeHealthSnapshotsTable {
|
||||
return newRuntimeHealthSnapshotsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newRuntimeHealthSnapshotsTable(schemaName, tableName, alias string) *RuntimeHealthSnapshotsTable {
|
||||
return &RuntimeHealthSnapshotsTable{
|
||||
runtimeHealthSnapshotsTable: newRuntimeHealthSnapshotsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newRuntimeHealthSnapshotsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newRuntimeHealthSnapshotsTableImpl(schemaName, tableName, alias string) runtimeHealthSnapshotsTable {
|
||||
var (
|
||||
SnapshotIDColumn = postgres.StringColumn("snapshot_id")
|
||||
GameIDColumn = postgres.StringColumn("game_id")
|
||||
ObservedAtColumn = postgres.TimestampzColumn("observed_at")
|
||||
PayloadColumn = postgres.StringColumn("payload")
|
||||
allColumns = postgres.ColumnList{SnapshotIDColumn, GameIDColumn, ObservedAtColumn, PayloadColumn}
|
||||
mutableColumns = postgres.ColumnList{GameIDColumn, ObservedAtColumn, PayloadColumn}
|
||||
defaultColumns = postgres.ColumnList{ObservedAtColumn}
|
||||
)
|
||||
|
||||
return runtimeHealthSnapshotsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
SnapshotID: SnapshotIDColumn,
|
||||
GameID: GameIDColumn,
|
||||
ObservedAt: ObservedAtColumn,
|
||||
Payload: PayloadColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var RuntimeOperationLog = newRuntimeOperationLogTable("backend", "runtime_operation_log", "")
|
||||
|
||||
type runtimeOperationLogTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
OperationID postgres.ColumnString
|
||||
GameID postgres.ColumnString
|
||||
Op postgres.ColumnString
|
||||
Source postgres.ColumnString
|
||||
Status postgres.ColumnString
|
||||
ImageRef postgres.ColumnString
|
||||
ContainerID postgres.ColumnString
|
||||
ErrorCode postgres.ColumnString
|
||||
ErrorMessage postgres.ColumnString
|
||||
StartedAt postgres.ColumnTimestampz
|
||||
FinishedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type RuntimeOperationLogTable struct {
|
||||
runtimeOperationLogTable
|
||||
|
||||
EXCLUDED runtimeOperationLogTable
|
||||
}
|
||||
|
||||
// AS creates new RuntimeOperationLogTable with assigned alias
|
||||
func (a RuntimeOperationLogTable) AS(alias string) *RuntimeOperationLogTable {
|
||||
return newRuntimeOperationLogTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new RuntimeOperationLogTable with assigned schema name
|
||||
func (a RuntimeOperationLogTable) FromSchema(schemaName string) *RuntimeOperationLogTable {
|
||||
return newRuntimeOperationLogTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new RuntimeOperationLogTable with assigned table prefix
|
||||
func (a RuntimeOperationLogTable) WithPrefix(prefix string) *RuntimeOperationLogTable {
|
||||
return newRuntimeOperationLogTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new RuntimeOperationLogTable with assigned table suffix
|
||||
func (a RuntimeOperationLogTable) WithSuffix(suffix string) *RuntimeOperationLogTable {
|
||||
return newRuntimeOperationLogTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newRuntimeOperationLogTable(schemaName, tableName, alias string) *RuntimeOperationLogTable {
|
||||
return &RuntimeOperationLogTable{
|
||||
runtimeOperationLogTable: newRuntimeOperationLogTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newRuntimeOperationLogTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newRuntimeOperationLogTableImpl(schemaName, tableName, alias string) runtimeOperationLogTable {
|
||||
var (
|
||||
OperationIDColumn = postgres.StringColumn("operation_id")
|
||||
GameIDColumn = postgres.StringColumn("game_id")
|
||||
OpColumn = postgres.StringColumn("op")
|
||||
SourceColumn = postgres.StringColumn("source")
|
||||
StatusColumn = postgres.StringColumn("status")
|
||||
ImageRefColumn = postgres.StringColumn("image_ref")
|
||||
ContainerIDColumn = postgres.StringColumn("container_id")
|
||||
ErrorCodeColumn = postgres.StringColumn("error_code")
|
||||
ErrorMessageColumn = postgres.StringColumn("error_message")
|
||||
StartedAtColumn = postgres.TimestampzColumn("started_at")
|
||||
FinishedAtColumn = postgres.TimestampzColumn("finished_at")
|
||||
allColumns = postgres.ColumnList{OperationIDColumn, GameIDColumn, OpColumn, SourceColumn, StatusColumn, ImageRefColumn, ContainerIDColumn, ErrorCodeColumn, ErrorMessageColumn, StartedAtColumn, FinishedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{GameIDColumn, OpColumn, SourceColumn, StatusColumn, ImageRefColumn, ContainerIDColumn, ErrorCodeColumn, ErrorMessageColumn, StartedAtColumn, FinishedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{ImageRefColumn, ContainerIDColumn, ErrorCodeColumn, ErrorMessageColumn, StartedAtColumn}
|
||||
)
|
||||
|
||||
return runtimeOperationLogTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
OperationID: OperationIDColumn,
|
||||
GameID: GameIDColumn,
|
||||
Op: OpColumn,
|
||||
Source: SourceColumn,
|
||||
Status: StatusColumn,
|
||||
ImageRef: ImageRefColumn,
|
||||
ContainerID: ContainerIDColumn,
|
||||
ErrorCode: ErrorCodeColumn,
|
||||
ErrorMessage: ErrorMessageColumn,
|
||||
StartedAt: StartedAtColumn,
|
||||
FinishedAt: FinishedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var RuntimeRecords = newRuntimeRecordsTable("backend", "runtime_records", "")
|
||||
|
||||
type runtimeRecordsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
GameID postgres.ColumnString
|
||||
Status postgres.ColumnString
|
||||
CurrentContainerID postgres.ColumnString
|
||||
CurrentImageRef postgres.ColumnString
|
||||
CurrentEngineVersion postgres.ColumnString
|
||||
EngineEndpoint postgres.ColumnString
|
||||
StatePath postgres.ColumnString
|
||||
DockerNetwork postgres.ColumnString
|
||||
TurnSchedule postgres.ColumnString
|
||||
CurrentTurn postgres.ColumnInteger
|
||||
NextGenerationAt postgres.ColumnTimestampz
|
||||
SkipNextTick postgres.ColumnBool
|
||||
Paused postgres.ColumnBool
|
||||
PausedAt postgres.ColumnTimestampz
|
||||
EngineHealth postgres.ColumnString
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
UpdatedAt postgres.ColumnTimestampz
|
||||
StartedAt postgres.ColumnTimestampz
|
||||
StoppedAt postgres.ColumnTimestampz
|
||||
FinishedAt postgres.ColumnTimestampz
|
||||
RemovedAt postgres.ColumnTimestampz
|
||||
LastObservedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type RuntimeRecordsTable struct {
|
||||
runtimeRecordsTable
|
||||
|
||||
EXCLUDED runtimeRecordsTable
|
||||
}
|
||||
|
||||
// AS creates new RuntimeRecordsTable with assigned alias
|
||||
func (a RuntimeRecordsTable) AS(alias string) *RuntimeRecordsTable {
|
||||
return newRuntimeRecordsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new RuntimeRecordsTable with assigned schema name
|
||||
func (a RuntimeRecordsTable) FromSchema(schemaName string) *RuntimeRecordsTable {
|
||||
return newRuntimeRecordsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new RuntimeRecordsTable with assigned table prefix
|
||||
func (a RuntimeRecordsTable) WithPrefix(prefix string) *RuntimeRecordsTable {
|
||||
return newRuntimeRecordsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new RuntimeRecordsTable with assigned table suffix
|
||||
func (a RuntimeRecordsTable) WithSuffix(suffix string) *RuntimeRecordsTable {
|
||||
return newRuntimeRecordsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newRuntimeRecordsTable(schemaName, tableName, alias string) *RuntimeRecordsTable {
|
||||
return &RuntimeRecordsTable{
|
||||
runtimeRecordsTable: newRuntimeRecordsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newRuntimeRecordsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newRuntimeRecordsTableImpl(schemaName, tableName, alias string) runtimeRecordsTable {
|
||||
var (
|
||||
GameIDColumn = postgres.StringColumn("game_id")
|
||||
StatusColumn = postgres.StringColumn("status")
|
||||
CurrentContainerIDColumn = postgres.StringColumn("current_container_id")
|
||||
CurrentImageRefColumn = postgres.StringColumn("current_image_ref")
|
||||
CurrentEngineVersionColumn = postgres.StringColumn("current_engine_version")
|
||||
EngineEndpointColumn = postgres.StringColumn("engine_endpoint")
|
||||
StatePathColumn = postgres.StringColumn("state_path")
|
||||
DockerNetworkColumn = postgres.StringColumn("docker_network")
|
||||
TurnScheduleColumn = postgres.StringColumn("turn_schedule")
|
||||
CurrentTurnColumn = postgres.IntegerColumn("current_turn")
|
||||
NextGenerationAtColumn = postgres.TimestampzColumn("next_generation_at")
|
||||
SkipNextTickColumn = postgres.BoolColumn("skip_next_tick")
|
||||
PausedColumn = postgres.BoolColumn("paused")
|
||||
PausedAtColumn = postgres.TimestampzColumn("paused_at")
|
||||
EngineHealthColumn = postgres.StringColumn("engine_health")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampzColumn("updated_at")
|
||||
StartedAtColumn = postgres.TimestampzColumn("started_at")
|
||||
StoppedAtColumn = postgres.TimestampzColumn("stopped_at")
|
||||
FinishedAtColumn = postgres.TimestampzColumn("finished_at")
|
||||
RemovedAtColumn = postgres.TimestampzColumn("removed_at")
|
||||
LastObservedAtColumn = postgres.TimestampzColumn("last_observed_at")
|
||||
allColumns = postgres.ColumnList{GameIDColumn, StatusColumn, CurrentContainerIDColumn, CurrentImageRefColumn, CurrentEngineVersionColumn, EngineEndpointColumn, StatePathColumn, DockerNetworkColumn, TurnScheduleColumn, CurrentTurnColumn, NextGenerationAtColumn, SkipNextTickColumn, PausedColumn, PausedAtColumn, EngineHealthColumn, CreatedAtColumn, UpdatedAtColumn, StartedAtColumn, StoppedAtColumn, FinishedAtColumn, RemovedAtColumn, LastObservedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{StatusColumn, CurrentContainerIDColumn, CurrentImageRefColumn, CurrentEngineVersionColumn, EngineEndpointColumn, StatePathColumn, DockerNetworkColumn, TurnScheduleColumn, CurrentTurnColumn, NextGenerationAtColumn, SkipNextTickColumn, PausedColumn, PausedAtColumn, EngineHealthColumn, CreatedAtColumn, UpdatedAtColumn, StartedAtColumn, StoppedAtColumn, FinishedAtColumn, RemovedAtColumn, LastObservedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{CurrentTurnColumn, SkipNextTickColumn, PausedColumn, EngineHealthColumn, CreatedAtColumn, UpdatedAtColumn}
|
||||
)
|
||||
|
||||
return runtimeRecordsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
GameID: GameIDColumn,
|
||||
Status: StatusColumn,
|
||||
CurrentContainerID: CurrentContainerIDColumn,
|
||||
CurrentImageRef: CurrentImageRefColumn,
|
||||
CurrentEngineVersion: CurrentEngineVersionColumn,
|
||||
EngineEndpoint: EngineEndpointColumn,
|
||||
StatePath: StatePathColumn,
|
||||
DockerNetwork: DockerNetworkColumn,
|
||||
TurnSchedule: TurnScheduleColumn,
|
||||
CurrentTurn: CurrentTurnColumn,
|
||||
NextGenerationAt: NextGenerationAtColumn,
|
||||
SkipNextTick: SkipNextTickColumn,
|
||||
Paused: PausedColumn,
|
||||
PausedAt: PausedAtColumn,
|
||||
EngineHealth: EngineHealthColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
StartedAt: StartedAtColumn,
|
||||
StoppedAt: StoppedAtColumn,
|
||||
FinishedAt: FinishedAtColumn,
|
||||
RemovedAt: RemovedAtColumn,
|
||||
LastObservedAt: LastObservedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var SanctionActive = newSanctionActiveTable("backend", "sanction_active", "")
|
||||
|
||||
type sanctionActiveTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
UserID postgres.ColumnString
|
||||
SanctionCode postgres.ColumnString
|
||||
RecordID postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type SanctionActiveTable struct {
|
||||
sanctionActiveTable
|
||||
|
||||
EXCLUDED sanctionActiveTable
|
||||
}
|
||||
|
||||
// AS creates new SanctionActiveTable with assigned alias
|
||||
func (a SanctionActiveTable) AS(alias string) *SanctionActiveTable {
|
||||
return newSanctionActiveTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new SanctionActiveTable with assigned schema name
|
||||
func (a SanctionActiveTable) FromSchema(schemaName string) *SanctionActiveTable {
|
||||
return newSanctionActiveTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new SanctionActiveTable with assigned table prefix
|
||||
func (a SanctionActiveTable) WithPrefix(prefix string) *SanctionActiveTable {
|
||||
return newSanctionActiveTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new SanctionActiveTable with assigned table suffix
|
||||
func (a SanctionActiveTable) WithSuffix(suffix string) *SanctionActiveTable {
|
||||
return newSanctionActiveTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newSanctionActiveTable(schemaName, tableName, alias string) *SanctionActiveTable {
|
||||
return &SanctionActiveTable{
|
||||
sanctionActiveTable: newSanctionActiveTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newSanctionActiveTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newSanctionActiveTableImpl(schemaName, tableName, alias string) sanctionActiveTable {
|
||||
var (
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
SanctionCodeColumn = postgres.StringColumn("sanction_code")
|
||||
RecordIDColumn = postgres.StringColumn("record_id")
|
||||
allColumns = postgres.ColumnList{UserIDColumn, SanctionCodeColumn, RecordIDColumn}
|
||||
mutableColumns = postgres.ColumnList{RecordIDColumn}
|
||||
defaultColumns = postgres.ColumnList{}
|
||||
)
|
||||
|
||||
return sanctionActiveTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
UserID: UserIDColumn,
|
||||
SanctionCode: SanctionCodeColumn,
|
||||
RecordID: RecordIDColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var SanctionRecords = newSanctionRecordsTable("backend", "sanction_records", "")
|
||||
|
||||
type sanctionRecordsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
RecordID postgres.ColumnString
|
||||
UserID postgres.ColumnString
|
||||
SanctionCode postgres.ColumnString
|
||||
Scope postgres.ColumnString
|
||||
ReasonCode postgres.ColumnString
|
||||
ActorType postgres.ColumnString
|
||||
ActorID postgres.ColumnString
|
||||
AppliedAt postgres.ColumnTimestampz
|
||||
ExpiresAt postgres.ColumnTimestampz
|
||||
RemovedAt postgres.ColumnTimestampz
|
||||
RemovedByType postgres.ColumnString
|
||||
RemovedByID postgres.ColumnString
|
||||
RemovedReasonCode postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type SanctionRecordsTable struct {
|
||||
sanctionRecordsTable
|
||||
|
||||
EXCLUDED sanctionRecordsTable
|
||||
}
|
||||
|
||||
// AS creates new SanctionRecordsTable with assigned alias
|
||||
func (a SanctionRecordsTable) AS(alias string) *SanctionRecordsTable {
|
||||
return newSanctionRecordsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new SanctionRecordsTable with assigned schema name
|
||||
func (a SanctionRecordsTable) FromSchema(schemaName string) *SanctionRecordsTable {
|
||||
return newSanctionRecordsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new SanctionRecordsTable with assigned table prefix
|
||||
func (a SanctionRecordsTable) WithPrefix(prefix string) *SanctionRecordsTable {
|
||||
return newSanctionRecordsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new SanctionRecordsTable with assigned table suffix
|
||||
func (a SanctionRecordsTable) WithSuffix(suffix string) *SanctionRecordsTable {
|
||||
return newSanctionRecordsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newSanctionRecordsTable(schemaName, tableName, alias string) *SanctionRecordsTable {
|
||||
return &SanctionRecordsTable{
|
||||
sanctionRecordsTable: newSanctionRecordsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newSanctionRecordsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newSanctionRecordsTableImpl(schemaName, tableName, alias string) sanctionRecordsTable {
|
||||
var (
|
||||
RecordIDColumn = postgres.StringColumn("record_id")
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
SanctionCodeColumn = postgres.StringColumn("sanction_code")
|
||||
ScopeColumn = postgres.StringColumn("scope")
|
||||
ReasonCodeColumn = postgres.StringColumn("reason_code")
|
||||
ActorTypeColumn = postgres.StringColumn("actor_type")
|
||||
ActorIDColumn = postgres.StringColumn("actor_id")
|
||||
AppliedAtColumn = postgres.TimestampzColumn("applied_at")
|
||||
ExpiresAtColumn = postgres.TimestampzColumn("expires_at")
|
||||
RemovedAtColumn = postgres.TimestampzColumn("removed_at")
|
||||
RemovedByTypeColumn = postgres.StringColumn("removed_by_type")
|
||||
RemovedByIDColumn = postgres.StringColumn("removed_by_id")
|
||||
RemovedReasonCodeColumn = postgres.StringColumn("removed_reason_code")
|
||||
allColumns = postgres.ColumnList{RecordIDColumn, UserIDColumn, SanctionCodeColumn, ScopeColumn, ReasonCodeColumn, ActorTypeColumn, ActorIDColumn, AppliedAtColumn, ExpiresAtColumn, RemovedAtColumn, RemovedByTypeColumn, RemovedByIDColumn, RemovedReasonCodeColumn}
|
||||
mutableColumns = postgres.ColumnList{UserIDColumn, SanctionCodeColumn, ScopeColumn, ReasonCodeColumn, ActorTypeColumn, ActorIDColumn, AppliedAtColumn, ExpiresAtColumn, RemovedAtColumn, RemovedByTypeColumn, RemovedByIDColumn, RemovedReasonCodeColumn}
|
||||
defaultColumns = postgres.ColumnList{AppliedAtColumn}
|
||||
)
|
||||
|
||||
return sanctionRecordsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
RecordID: RecordIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
SanctionCode: SanctionCodeColumn,
|
||||
Scope: ScopeColumn,
|
||||
ReasonCode: ReasonCodeColumn,
|
||||
ActorType: ActorTypeColumn,
|
||||
ActorID: ActorIDColumn,
|
||||
AppliedAt: AppliedAtColumn,
|
||||
ExpiresAt: ExpiresAtColumn,
|
||||
RemovedAt: RemovedAtColumn,
|
||||
RemovedByType: RemovedByTypeColumn,
|
||||
RemovedByID: RemovedByIDColumn,
|
||||
RemovedReasonCode: RemovedReasonCodeColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
// UseSchema sets a new schema name for all generated table SQL builder types. It is recommended to invoke
|
||||
// this method only once at the beginning of the program.
|
||||
func UseSchema(schema string) {
|
||||
Accounts = Accounts.FromSchema(schema)
|
||||
AdminAccounts = AdminAccounts.FromSchema(schema)
|
||||
Applications = Applications.FromSchema(schema)
|
||||
AuthChallenges = AuthChallenges.FromSchema(schema)
|
||||
BlockedEmails = BlockedEmails.FromSchema(schema)
|
||||
DeviceSessions = DeviceSessions.FromSchema(schema)
|
||||
EngineVersions = EngineVersions.FromSchema(schema)
|
||||
EntitlementRecords = EntitlementRecords.FromSchema(schema)
|
||||
EntitlementSnapshots = EntitlementSnapshots.FromSchema(schema)
|
||||
Games = Games.FromSchema(schema)
|
||||
Invites = Invites.FromSchema(schema)
|
||||
LimitActive = LimitActive.FromSchema(schema)
|
||||
LimitRecords = LimitRecords.FromSchema(schema)
|
||||
MailAttempts = MailAttempts.FromSchema(schema)
|
||||
MailDeadLetters = MailDeadLetters.FromSchema(schema)
|
||||
MailDeliveries = MailDeliveries.FromSchema(schema)
|
||||
MailPayloads = MailPayloads.FromSchema(schema)
|
||||
MailRecipients = MailRecipients.FromSchema(schema)
|
||||
Memberships = Memberships.FromSchema(schema)
|
||||
NotificationDeadLetters = NotificationDeadLetters.FromSchema(schema)
|
||||
NotificationMalformedIntents = NotificationMalformedIntents.FromSchema(schema)
|
||||
NotificationRoutes = NotificationRoutes.FromSchema(schema)
|
||||
Notifications = Notifications.FromSchema(schema)
|
||||
PlayerMappings = PlayerMappings.FromSchema(schema)
|
||||
RaceNames = RaceNames.FromSchema(schema)
|
||||
RuntimeHealthSnapshots = RuntimeHealthSnapshots.FromSchema(schema)
|
||||
RuntimeOperationLog = RuntimeOperationLog.FromSchema(schema)
|
||||
RuntimeRecords = RuntimeRecords.FromSchema(schema)
|
||||
SanctionActive = SanctionActive.FromSchema(schema)
|
||||
SanctionRecords = SanctionRecords.FromSchema(schema)
|
||||
UserCountryCounters = UserCountryCounters.FromSchema(schema)
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var UserCountryCounters = newUserCountryCountersTable("backend", "user_country_counters", "")
|
||||
|
||||
type userCountryCountersTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
UserID postgres.ColumnString
|
||||
Country postgres.ColumnString
|
||||
Count postgres.ColumnInteger
|
||||
LastSeenAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type UserCountryCountersTable struct {
|
||||
userCountryCountersTable
|
||||
|
||||
EXCLUDED userCountryCountersTable
|
||||
}
|
||||
|
||||
// AS creates new UserCountryCountersTable with assigned alias
|
||||
func (a UserCountryCountersTable) AS(alias string) *UserCountryCountersTable {
|
||||
return newUserCountryCountersTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new UserCountryCountersTable with assigned schema name
|
||||
func (a UserCountryCountersTable) FromSchema(schemaName string) *UserCountryCountersTable {
|
||||
return newUserCountryCountersTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new UserCountryCountersTable with assigned table prefix
|
||||
func (a UserCountryCountersTable) WithPrefix(prefix string) *UserCountryCountersTable {
|
||||
return newUserCountryCountersTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new UserCountryCountersTable with assigned table suffix
|
||||
func (a UserCountryCountersTable) WithSuffix(suffix string) *UserCountryCountersTable {
|
||||
return newUserCountryCountersTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newUserCountryCountersTable(schemaName, tableName, alias string) *UserCountryCountersTable {
|
||||
return &UserCountryCountersTable{
|
||||
userCountryCountersTable: newUserCountryCountersTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newUserCountryCountersTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newUserCountryCountersTableImpl(schemaName, tableName, alias string) userCountryCountersTable {
|
||||
var (
|
||||
UserIDColumn = postgres.StringColumn("user_id")
|
||||
CountryColumn = postgres.StringColumn("country")
|
||||
CountColumn = postgres.IntegerColumn("count")
|
||||
LastSeenAtColumn = postgres.TimestampzColumn("last_seen_at")
|
||||
allColumns = postgres.ColumnList{UserIDColumn, CountryColumn, CountColumn, LastSeenAtColumn}
|
||||
mutableColumns = postgres.ColumnList{CountColumn, LastSeenAtColumn}
|
||||
defaultColumns = postgres.ColumnList{CountColumn}
|
||||
)
|
||||
|
||||
return userCountryCountersTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
UserID: UserIDColumn,
|
||||
Country: CountryColumn,
|
||||
Count: CountColumn,
|
||||
LastSeenAt: LastSeenAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Package jet hosts the go-jet/v2 query-builder packages generated from the
|
||||
// `backend` schema. The generator is driven by `cmd/jetgen` and writes each
|
||||
// schema's tables, models, views, and enums into the `<schema>` subfolder.
|
||||
//
|
||||
// Regenerate with `make jet` from the galaxy/backend module root. The tool
|
||||
// spins up a transient Postgres container, applies the embedded migrations,
|
||||
// and rewrites the schema-scoped subdirectory; the package metadata in this
|
||||
// file is preserved across regenerations.
|
||||
package jet
|
||||
|
||||
//go:generate go run ../../../cmd/jetgen
|
||||
@@ -0,0 +1,631 @@
|
||||
-- +goose Up
|
||||
-- Initial schema for the consolidated Galaxy backend service.
|
||||
--
|
||||
-- Every backend table lives in the `backend` schema. The schema is created
|
||||
-- here so a fresh deployment can apply this migration against an empty
|
||||
-- database, and search_path is pinned for the rest of the migration so
|
||||
-- subsequent CREATE statements land in `backend` without needing to qualify
|
||||
-- every object. Production deployments additionally pin search_path through
|
||||
-- BACKEND_POSTGRES_DSN.
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS backend;
|
||||
SET search_path = backend, pg_catalog;
|
||||
|
||||
-- =====================================================================
|
||||
-- Auth domain
|
||||
-- =====================================================================
|
||||
|
||||
CREATE TABLE device_sessions (
|
||||
device_session_id uuid PRIMARY KEY,
|
||||
user_id uuid NOT NULL,
|
||||
client_public_key bytea NOT NULL,
|
||||
status text NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
last_seen_at timestamptz,
|
||||
revoked_at timestamptz,
|
||||
CONSTRAINT device_sessions_status_chk
|
||||
CHECK (status IN ('active', 'revoked', 'blocked'))
|
||||
);
|
||||
|
||||
CREATE INDEX device_sessions_user_idx ON device_sessions (user_id);
|
||||
CREATE INDEX device_sessions_status_idx ON device_sessions (status);
|
||||
|
||||
CREATE TABLE auth_challenges (
|
||||
challenge_id uuid PRIMARY KEY,
|
||||
email text NOT NULL,
|
||||
code_hash bytea NOT NULL,
|
||||
attempts integer NOT NULL DEFAULT 0,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
expires_at timestamptz NOT NULL,
|
||||
consumed_at timestamptz
|
||||
);
|
||||
|
||||
CREATE INDEX auth_challenges_email_idx ON auth_challenges (email);
|
||||
|
||||
CREATE TABLE blocked_emails (
|
||||
email text PRIMARY KEY,
|
||||
reason text NOT NULL,
|
||||
blocked_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- =====================================================================
|
||||
-- User domain
|
||||
-- =====================================================================
|
||||
|
||||
-- accounts is the editable source of truth for user identity. email and
|
||||
-- user_name remain UNIQUE for live and soft-deleted records: emails are
|
||||
-- never reassigned to a fresh user_id after soft delete, and user_name is
|
||||
-- immutable for the lifetime of the account.
|
||||
CREATE TABLE accounts (
|
||||
user_id uuid PRIMARY KEY,
|
||||
email text NOT NULL,
|
||||
user_name text NOT NULL,
|
||||
display_name text NOT NULL DEFAULT '',
|
||||
preferred_language text NOT NULL,
|
||||
time_zone text NOT NULL,
|
||||
declared_country text,
|
||||
permanent_block boolean NOT NULL DEFAULT false,
|
||||
deleted_actor_type text,
|
||||
deleted_actor_id text,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now(),
|
||||
deleted_at timestamptz,
|
||||
CONSTRAINT accounts_email_unique UNIQUE (email),
|
||||
CONSTRAINT accounts_user_name_unique UNIQUE (user_name)
|
||||
);
|
||||
|
||||
CREATE INDEX accounts_listing_idx
|
||||
ON accounts (created_at DESC, user_id DESC);
|
||||
|
||||
CREATE INDEX accounts_declared_country_idx
|
||||
ON accounts (declared_country)
|
||||
WHERE declared_country IS NOT NULL;
|
||||
|
||||
-- entitlement_records is the immutable history of entitlement events. tier
|
||||
-- is constrained to the closed MVP set (free, monthly, yearly, permanent) so
|
||||
-- the storage layer rejects typos before the user-package validator can.
|
||||
-- Audit columns (actor_*, reason_code, starts_at, ends_at) mirror the
|
||||
-- shape used by sanction_records/limit_records: the *_active rollup carries
|
||||
-- only the binding, the records table is the durable audit log.
|
||||
CREATE TABLE entitlement_records (
|
||||
record_id uuid PRIMARY KEY,
|
||||
user_id uuid NOT NULL REFERENCES accounts (user_id),
|
||||
tier text NOT NULL,
|
||||
is_paid boolean NOT NULL,
|
||||
source text NOT NULL,
|
||||
actor_type text NOT NULL,
|
||||
actor_id text,
|
||||
reason_code text NOT NULL DEFAULT '',
|
||||
starts_at timestamptz NOT NULL DEFAULT now(),
|
||||
ends_at timestamptz,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
CONSTRAINT entitlement_records_tier_chk
|
||||
CHECK (tier IN ('free', 'monthly', 'yearly', 'permanent'))
|
||||
);
|
||||
|
||||
CREATE INDEX entitlement_records_user_idx
|
||||
ON entitlement_records (user_id, created_at DESC);
|
||||
|
||||
-- entitlement_snapshots is the read-optimised current entitlement state.
|
||||
-- Exactly one row per user_id; updated atomically with new
|
||||
-- entitlement_records by the user lifecycle store. Audit columns are
|
||||
-- denormalised from the latest entitlement_records row so the read path
|
||||
-- needs no join to render the AccountResponse.entitlement payload.
|
||||
CREATE TABLE entitlement_snapshots (
|
||||
user_id uuid PRIMARY KEY REFERENCES accounts (user_id),
|
||||
tier text NOT NULL,
|
||||
is_paid boolean NOT NULL,
|
||||
source text NOT NULL,
|
||||
actor_type text NOT NULL,
|
||||
actor_id text,
|
||||
reason_code text NOT NULL DEFAULT '',
|
||||
starts_at timestamptz NOT NULL,
|
||||
ends_at timestamptz,
|
||||
max_registered_race_names integer NOT NULL,
|
||||
updated_at timestamptz NOT NULL DEFAULT now(),
|
||||
CONSTRAINT entitlement_snapshots_tier_chk
|
||||
CHECK (tier IN ('free', 'monthly', 'yearly', 'permanent'))
|
||||
);
|
||||
|
||||
CREATE TABLE sanction_records (
|
||||
record_id uuid PRIMARY KEY,
|
||||
user_id uuid NOT NULL REFERENCES accounts (user_id),
|
||||
sanction_code text NOT NULL,
|
||||
scope text NOT NULL,
|
||||
reason_code text NOT NULL,
|
||||
actor_type text NOT NULL,
|
||||
actor_id text,
|
||||
applied_at timestamptz NOT NULL DEFAULT now(),
|
||||
expires_at timestamptz,
|
||||
removed_at timestamptz,
|
||||
removed_by_type text,
|
||||
removed_by_id text,
|
||||
removed_reason_code text,
|
||||
CONSTRAINT sanction_records_code_chk
|
||||
CHECK (sanction_code IN ('permanent_block'))
|
||||
);
|
||||
|
||||
CREATE INDEX sanction_records_user_idx
|
||||
ON sanction_records (user_id, applied_at DESC);
|
||||
|
||||
-- sanction_active stores the at-most-one active record per
|
||||
-- (user_id, sanction_code), maintained by the user lifecycle store in
|
||||
-- the same transaction as the corresponding sanction_records mutation.
|
||||
CREATE TABLE sanction_active (
|
||||
user_id uuid NOT NULL REFERENCES accounts (user_id),
|
||||
sanction_code text NOT NULL,
|
||||
record_id uuid NOT NULL REFERENCES sanction_records (record_id),
|
||||
PRIMARY KEY (user_id, sanction_code)
|
||||
);
|
||||
|
||||
CREATE INDEX sanction_active_code_idx ON sanction_active (sanction_code);
|
||||
|
||||
CREATE TABLE limit_records (
|
||||
record_id uuid PRIMARY KEY,
|
||||
user_id uuid NOT NULL REFERENCES accounts (user_id),
|
||||
limit_code text NOT NULL,
|
||||
value integer NOT NULL,
|
||||
reason_code text NOT NULL,
|
||||
actor_type text NOT NULL,
|
||||
actor_id text,
|
||||
applied_at timestamptz NOT NULL DEFAULT now(),
|
||||
expires_at timestamptz,
|
||||
removed_at timestamptz,
|
||||
removed_by_type text,
|
||||
removed_by_id text,
|
||||
removed_reason_code text
|
||||
);
|
||||
|
||||
CREATE INDEX limit_records_user_idx
|
||||
ON limit_records (user_id, applied_at DESC);
|
||||
|
||||
-- limit_active mirrors sanction_active for user-specific limits. value is
|
||||
-- denormalised so the admin listing predicate can read it without joining
|
||||
-- the full record history.
|
||||
CREATE TABLE limit_active (
|
||||
user_id uuid NOT NULL REFERENCES accounts (user_id),
|
||||
limit_code text NOT NULL,
|
||||
record_id uuid NOT NULL REFERENCES limit_records (record_id),
|
||||
value integer NOT NULL,
|
||||
PRIMARY KEY (user_id, limit_code)
|
||||
);
|
||||
|
||||
CREATE INDEX limit_active_code_idx ON limit_active (limit_code);
|
||||
|
||||
-- =====================================================================
|
||||
-- Admin domain
|
||||
-- =====================================================================
|
||||
|
||||
CREATE TABLE admin_accounts (
|
||||
username text PRIMARY KEY,
|
||||
password_hash bytea NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
last_used_at timestamptz,
|
||||
disabled_at timestamptz
|
||||
);
|
||||
|
||||
-- =====================================================================
|
||||
-- Lobby domain
|
||||
-- =====================================================================
|
||||
|
||||
-- games is the durable record of every platform game session. owner_user_id
|
||||
-- is nullable because public games are created by admins through the basic-auth
|
||||
-- surface; the admin identity lives in admin_accounts and does not map to a
|
||||
-- user_id. The partial owner index covers private games only.
|
||||
CREATE TABLE games (
|
||||
game_id uuid PRIMARY KEY,
|
||||
owner_user_id uuid,
|
||||
visibility text NOT NULL,
|
||||
status text NOT NULL,
|
||||
game_name text NOT NULL,
|
||||
description text NOT NULL DEFAULT '',
|
||||
min_players integer NOT NULL,
|
||||
max_players integer NOT NULL,
|
||||
start_gap_hours integer NOT NULL,
|
||||
start_gap_players integer NOT NULL,
|
||||
enrollment_ends_at timestamptz NOT NULL,
|
||||
turn_schedule text NOT NULL,
|
||||
target_engine_version text NOT NULL,
|
||||
runtime_snapshot jsonb NOT NULL DEFAULT '{}'::jsonb,
|
||||
runtime_binding jsonb,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now(),
|
||||
started_at timestamptz,
|
||||
finished_at timestamptz,
|
||||
CONSTRAINT games_visibility_chk
|
||||
CHECK (visibility IN ('public', 'private')),
|
||||
CONSTRAINT games_status_chk
|
||||
CHECK (status IN (
|
||||
'draft', 'enrollment_open', 'ready_to_start', 'starting',
|
||||
'start_failed', 'running', 'paused', 'finished', 'cancelled'
|
||||
))
|
||||
);
|
||||
|
||||
CREATE INDEX games_status_created_idx
|
||||
ON games (status, created_at DESC, game_id DESC);
|
||||
|
||||
CREATE INDEX games_owner_idx
|
||||
ON games (owner_user_id)
|
||||
WHERE visibility = 'private';
|
||||
|
||||
-- applications carries one row per public-game enrollment request. The
|
||||
-- partial UNIQUE on (applicant_user_id, game_id) WHERE status <> 'rejected'
|
||||
-- enforces the single-active constraint at the database level. Rejected
|
||||
-- applications are kept (one applicant may produce multiple rejected rows
|
||||
-- before submitting a successful one).
|
||||
CREATE TABLE applications (
|
||||
application_id uuid PRIMARY KEY,
|
||||
game_id uuid NOT NULL REFERENCES games (game_id) ON DELETE CASCADE,
|
||||
applicant_user_id uuid NOT NULL,
|
||||
race_name text NOT NULL,
|
||||
status text NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
decided_at timestamptz,
|
||||
CONSTRAINT applications_status_chk
|
||||
CHECK (status IN ('pending', 'approved', 'rejected'))
|
||||
);
|
||||
|
||||
CREATE INDEX applications_game_idx ON applications (game_id);
|
||||
CREATE INDEX applications_user_idx ON applications (applicant_user_id);
|
||||
|
||||
CREATE UNIQUE INDEX applications_active_per_user_game_uidx
|
||||
ON applications (applicant_user_id, game_id)
|
||||
WHERE status <> 'rejected';
|
||||
|
||||
-- invites carries one row per private-game invitation. invited_user_id is
|
||||
-- nullable so the invite-by-code variant (anonymous redemption) sits on the
|
||||
-- same table. code is unique only when set so user-bound invites without a
|
||||
-- redemption code coexist freely.
|
||||
CREATE TABLE invites (
|
||||
invite_id uuid PRIMARY KEY,
|
||||
game_id uuid NOT NULL REFERENCES games (game_id) ON DELETE CASCADE,
|
||||
inviter_user_id uuid NOT NULL,
|
||||
invited_user_id uuid,
|
||||
code text,
|
||||
status text NOT NULL,
|
||||
race_name text NOT NULL DEFAULT '',
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
expires_at timestamptz NOT NULL,
|
||||
decided_at timestamptz,
|
||||
CONSTRAINT invites_status_chk
|
||||
CHECK (status IN ('pending', 'redeemed', 'declined', 'revoked', 'expired'))
|
||||
);
|
||||
|
||||
CREATE INDEX invites_game_idx ON invites (game_id);
|
||||
|
||||
CREATE INDEX invites_invited_idx
|
||||
ON invites (invited_user_id)
|
||||
WHERE invited_user_id IS NOT NULL;
|
||||
|
||||
CREATE INDEX invites_inviter_idx ON invites (inviter_user_id);
|
||||
CREATE INDEX invites_status_expires_idx ON invites (status, expires_at);
|
||||
|
||||
CREATE UNIQUE INDEX invites_code_uidx
|
||||
ON invites (code)
|
||||
WHERE code IS NOT NULL;
|
||||
|
||||
-- memberships carries one row per platform roster entry. Both race_name
|
||||
-- (original casing) and canonical_key are stored explicitly so downstream
|
||||
-- readers do not re-derive the canonical form from race_name. Race-name
|
||||
-- uniqueness across the platform is enforced by race_names below.
|
||||
CREATE TABLE memberships (
|
||||
membership_id uuid PRIMARY KEY,
|
||||
game_id uuid NOT NULL REFERENCES games (game_id) ON DELETE CASCADE,
|
||||
user_id uuid NOT NULL,
|
||||
race_name text NOT NULL,
|
||||
canonical_key text NOT NULL,
|
||||
status text NOT NULL,
|
||||
joined_at timestamptz NOT NULL DEFAULT now(),
|
||||
removed_at timestamptz,
|
||||
CONSTRAINT memberships_game_user_unique UNIQUE (game_id, user_id),
|
||||
CONSTRAINT memberships_status_chk
|
||||
CHECK (status IN ('active', 'removed', 'blocked'))
|
||||
);
|
||||
|
||||
CREATE INDEX memberships_game_idx ON memberships (game_id);
|
||||
CREATE INDEX memberships_user_idx ON memberships (user_id);
|
||||
|
||||
-- race_names is the durable Race Name Directory store. One row covers one
|
||||
-- of three bindings on a canonical key: a registered name (one per
|
||||
-- canonical, immutable holder), a per-game reservation, or a
|
||||
-- pending_registration that is waiting on lobby.race_name.register inside
|
||||
-- the eligible window. The composite primary key (canonical, game_id) lets
|
||||
-- the same user hold reservations for the same race name across multiple
|
||||
-- active games concurrently. Registered rows store the all-zero sentinel
|
||||
-- in game_id so the per-canonical uniqueness rule expresses cleanly as a
|
||||
-- partial UNIQUE index. Cross-user uniqueness across reservation /
|
||||
-- pending_registration is enforced by the lobby module on the write path.
|
||||
CREATE TABLE race_names (
|
||||
name text NOT NULL,
|
||||
canonical text NOT NULL,
|
||||
status text NOT NULL,
|
||||
owner_user_id uuid NOT NULL,
|
||||
game_id uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||
source_game_id uuid,
|
||||
reserved_at timestamptz,
|
||||
expires_at timestamptz,
|
||||
registered_at timestamptz,
|
||||
PRIMARY KEY (canonical, game_id),
|
||||
CONSTRAINT race_names_status_chk
|
||||
CHECK (status IN ('registered', 'reservation', 'pending_registration'))
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX race_names_registered_uidx
|
||||
ON race_names (canonical)
|
||||
WHERE status = 'registered';
|
||||
|
||||
CREATE INDEX race_names_owner_idx
|
||||
ON race_names (owner_user_id, status);
|
||||
|
||||
CREATE INDEX race_names_pending_eligible_idx
|
||||
ON race_names (expires_at)
|
||||
WHERE status = 'pending_registration';
|
||||
|
||||
-- =====================================================================
|
||||
-- Runtime domain
|
||||
-- =====================================================================
|
||||
|
||||
-- runtime_records consolidates the previous gamemaster.runtime_records and
|
||||
-- rtmanager.runtime_records into a single row per game. The status enum
|
||||
-- covers both the engine-state machine (starting, running,
|
||||
-- generation_in_progress, generation_failed, stopped, engine_unreachable,
|
||||
-- finished) and the container-state escape hatch (removed) used by
|
||||
-- reconciliation when the recorded container has disappeared.
|
||||
CREATE TABLE runtime_records (
|
||||
game_id uuid PRIMARY KEY,
|
||||
status text NOT NULL,
|
||||
current_container_id text,
|
||||
current_image_ref text,
|
||||
current_engine_version text,
|
||||
engine_endpoint text NOT NULL,
|
||||
state_path text,
|
||||
docker_network text,
|
||||
turn_schedule text NOT NULL,
|
||||
current_turn integer NOT NULL DEFAULT 0,
|
||||
next_generation_at timestamptz,
|
||||
skip_next_tick boolean NOT NULL DEFAULT false,
|
||||
paused boolean NOT NULL DEFAULT false,
|
||||
paused_at timestamptz,
|
||||
engine_health text NOT NULL DEFAULT '',
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now(),
|
||||
started_at timestamptz,
|
||||
stopped_at timestamptz,
|
||||
finished_at timestamptz,
|
||||
removed_at timestamptz,
|
||||
last_observed_at timestamptz,
|
||||
CONSTRAINT runtime_records_status_chk
|
||||
CHECK (status IN (
|
||||
'starting', 'running', 'generation_in_progress',
|
||||
'generation_failed', 'stopped', 'engine_unreachable',
|
||||
'finished', 'removed'
|
||||
))
|
||||
);
|
||||
|
||||
CREATE INDEX runtime_records_status_next_gen_idx
|
||||
ON runtime_records (status, next_generation_at);
|
||||
|
||||
CREATE TABLE engine_versions (
|
||||
version text PRIMARY KEY,
|
||||
image_ref text NOT NULL,
|
||||
enabled boolean NOT NULL DEFAULT true,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- player_mappings carries the (game_id, user_id) → (race_name,
|
||||
-- engine_player_uuid) projection installed at register-runtime. The
|
||||
-- composite primary key serves both the per-request lookup and the per-game
|
||||
-- roster reads. The partial UNIQUE on (game_id, race_name) enforces the
|
||||
-- one-race-per-game invariant at the storage boundary.
|
||||
CREATE TABLE player_mappings (
|
||||
game_id uuid NOT NULL,
|
||||
user_id uuid NOT NULL,
|
||||
race_name text NOT NULL,
|
||||
engine_player_uuid uuid NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY (game_id, user_id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX player_mappings_game_race_uidx
|
||||
ON player_mappings (game_id, race_name);
|
||||
|
||||
CREATE TABLE runtime_operation_log (
|
||||
operation_id uuid PRIMARY KEY,
|
||||
game_id uuid NOT NULL,
|
||||
op text NOT NULL,
|
||||
source text NOT NULL,
|
||||
status text NOT NULL,
|
||||
image_ref text NOT NULL DEFAULT '',
|
||||
container_id text NOT NULL DEFAULT '',
|
||||
error_code text NOT NULL DEFAULT '',
|
||||
error_message text NOT NULL DEFAULT '',
|
||||
started_at timestamptz NOT NULL DEFAULT now(),
|
||||
finished_at timestamptz
|
||||
);
|
||||
|
||||
CREATE INDEX runtime_operation_log_game_started_idx
|
||||
ON runtime_operation_log (game_id, started_at DESC);
|
||||
|
||||
-- runtime_health_snapshots records every health observation per game.
|
||||
-- Multiple rows per game are expected; readers consume the latest by
|
||||
-- observed_at.
|
||||
CREATE TABLE runtime_health_snapshots (
|
||||
snapshot_id uuid PRIMARY KEY,
|
||||
game_id uuid NOT NULL,
|
||||
observed_at timestamptz NOT NULL DEFAULT now(),
|
||||
payload jsonb NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX runtime_health_snapshots_game_idx
|
||||
ON runtime_health_snapshots (game_id, observed_at DESC);
|
||||
|
||||
-- =====================================================================
|
||||
-- Mail outbox domain
|
||||
-- =====================================================================
|
||||
|
||||
CREATE TABLE mail_payloads (
|
||||
payload_id uuid PRIMARY KEY,
|
||||
content_type text NOT NULL,
|
||||
subject text,
|
||||
body bytea NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- mail_deliveries holds one durable record per accepted logical mail
|
||||
-- delivery. The (template_id, idempotency_key) UNIQUE constraint is the
|
||||
-- idempotency reservation. next_attempt_at drives the worker's
|
||||
-- FOR UPDATE SKIP LOCKED pickup; the partial index keeps the scan tight
|
||||
-- because rows in terminal status do not carry next_attempt_at.
|
||||
CREATE TABLE mail_deliveries (
|
||||
delivery_id uuid PRIMARY KEY,
|
||||
template_id text NOT NULL,
|
||||
idempotency_key text NOT NULL,
|
||||
status text NOT NULL,
|
||||
attempts integer NOT NULL DEFAULT 0,
|
||||
next_attempt_at timestamptz,
|
||||
payload_id uuid NOT NULL REFERENCES mail_payloads (payload_id),
|
||||
last_error text NOT NULL DEFAULT '',
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now(),
|
||||
sent_at timestamptz,
|
||||
dead_lettered_at timestamptz,
|
||||
CONSTRAINT mail_deliveries_idempotency_unique
|
||||
UNIQUE (template_id, idempotency_key),
|
||||
CONSTRAINT mail_deliveries_status_chk
|
||||
CHECK (status IN ('pending', 'retrying', 'sent', 'dead_lettered'))
|
||||
);
|
||||
|
||||
CREATE INDEX mail_deliveries_due_idx
|
||||
ON mail_deliveries (next_attempt_at)
|
||||
WHERE next_attempt_at IS NOT NULL;
|
||||
|
||||
CREATE INDEX mail_deliveries_status_idx ON mail_deliveries (status);
|
||||
|
||||
CREATE TABLE mail_recipients (
|
||||
recipient_id uuid PRIMARY KEY,
|
||||
delivery_id uuid NOT NULL REFERENCES mail_deliveries (delivery_id) ON DELETE CASCADE,
|
||||
address text NOT NULL,
|
||||
kind text NOT NULL,
|
||||
CONSTRAINT mail_recipients_kind_chk
|
||||
CHECK (kind IN ('to', 'cc', 'bcc', 'reply_to'))
|
||||
);
|
||||
|
||||
CREATE INDEX mail_recipients_delivery_idx ON mail_recipients (delivery_id);
|
||||
|
||||
CREATE TABLE mail_attempts (
|
||||
attempt_id uuid PRIMARY KEY,
|
||||
delivery_id uuid NOT NULL REFERENCES mail_deliveries (delivery_id) ON DELETE CASCADE,
|
||||
attempt_no integer NOT NULL,
|
||||
started_at timestamptz NOT NULL DEFAULT now(),
|
||||
finished_at timestamptz,
|
||||
outcome text NOT NULL,
|
||||
error text NOT NULL DEFAULT '',
|
||||
CONSTRAINT mail_attempts_delivery_attempt_unique
|
||||
UNIQUE (delivery_id, attempt_no),
|
||||
CONSTRAINT mail_attempts_outcome_chk
|
||||
CHECK (outcome IN ('success', 'transient_error', 'permanent_error'))
|
||||
);
|
||||
|
||||
CREATE TABLE mail_dead_letters (
|
||||
dead_letter_id uuid PRIMARY KEY,
|
||||
delivery_id uuid NOT NULL REFERENCES mail_deliveries (delivery_id) ON DELETE CASCADE,
|
||||
archived_at timestamptz NOT NULL DEFAULT now(),
|
||||
reason text NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX mail_dead_letters_listing_idx
|
||||
ON mail_dead_letters (archived_at DESC);
|
||||
|
||||
-- =====================================================================
|
||||
-- Notification domain
|
||||
-- =====================================================================
|
||||
|
||||
CREATE TABLE notifications (
|
||||
notification_id uuid PRIMARY KEY,
|
||||
kind text NOT NULL,
|
||||
idempotency_key text NOT NULL,
|
||||
user_id uuid,
|
||||
payload jsonb,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
CONSTRAINT notifications_idempotency_unique
|
||||
UNIQUE (kind, idempotency_key),
|
||||
CONSTRAINT notifications_kind_chk
|
||||
CHECK (kind IN (
|
||||
'lobby.invite.received', 'lobby.invite.revoked',
|
||||
'lobby.application.submitted', 'lobby.application.approved',
|
||||
'lobby.application.rejected',
|
||||
'lobby.membership.removed', 'lobby.membership.blocked',
|
||||
'lobby.race_name.registered', 'lobby.race_name.pending',
|
||||
'lobby.race_name.expired',
|
||||
'runtime.image_pull_failed', 'runtime.container_start_failed',
|
||||
'runtime.start_config_invalid'
|
||||
))
|
||||
);
|
||||
|
||||
CREATE INDEX notifications_listing_idx
|
||||
ON notifications (created_at DESC, notification_id DESC);
|
||||
|
||||
CREATE TABLE notification_routes (
|
||||
route_id uuid PRIMARY KEY,
|
||||
notification_id uuid NOT NULL REFERENCES notifications (notification_id) ON DELETE CASCADE,
|
||||
channel text NOT NULL,
|
||||
status text NOT NULL,
|
||||
attempts integer NOT NULL DEFAULT 0,
|
||||
max_attempts integer NOT NULL,
|
||||
next_attempt_at timestamptz,
|
||||
last_attempt_at timestamptz,
|
||||
last_error text NOT NULL DEFAULT '',
|
||||
resolved_email text NOT NULL DEFAULT '',
|
||||
resolved_locale text NOT NULL DEFAULT '',
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now(),
|
||||
published_at timestamptz,
|
||||
dead_lettered_at timestamptz,
|
||||
skipped_at timestamptz,
|
||||
CONSTRAINT notification_routes_channel_chk
|
||||
CHECK (channel IN ('push', 'email')),
|
||||
CONSTRAINT notification_routes_status_chk
|
||||
CHECK (status IN ('pending', 'retrying', 'published', 'skipped', 'dead_lettered'))
|
||||
);
|
||||
|
||||
CREATE INDEX notification_routes_due_idx
|
||||
ON notification_routes (next_attempt_at)
|
||||
WHERE next_attempt_at IS NOT NULL;
|
||||
|
||||
CREATE INDEX notification_routes_status_idx ON notification_routes (status);
|
||||
CREATE INDEX notification_routes_channel_idx ON notification_routes (channel);
|
||||
CREATE INDEX notification_routes_notification_idx ON notification_routes (notification_id);
|
||||
|
||||
CREATE TABLE notification_dead_letters (
|
||||
dead_letter_id uuid PRIMARY KEY,
|
||||
notification_id uuid NOT NULL REFERENCES notifications (notification_id) ON DELETE CASCADE,
|
||||
route_id uuid NOT NULL,
|
||||
archived_at timestamptz NOT NULL DEFAULT now(),
|
||||
reason text NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE notification_malformed_intents (
|
||||
id uuid PRIMARY KEY,
|
||||
received_at timestamptz NOT NULL DEFAULT now(),
|
||||
payload jsonb NOT NULL,
|
||||
reason text NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX notification_malformed_intents_listing_idx
|
||||
ON notification_malformed_intents (received_at DESC);
|
||||
|
||||
-- =====================================================================
|
||||
-- Geo domain
|
||||
-- =====================================================================
|
||||
|
||||
CREATE TABLE user_country_counters (
|
||||
user_id uuid NOT NULL,
|
||||
country text NOT NULL,
|
||||
count bigint NOT NULL DEFAULT 0,
|
||||
last_seen_at timestamptz,
|
||||
PRIMARY KEY (user_id, country)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP SCHEMA IF EXISTS backend CASCADE;
|
||||
@@ -0,0 +1,13 @@
|
||||
-- +goose Up
|
||||
-- Persist the locale captured at send-email-code so it can be replayed at
|
||||
-- confirm-email-code when the auth flow needs `preferred_language` to seed
|
||||
-- a freshly-created `accounts` row. Existing rows default to '' and are
|
||||
-- treated by the auth service as "no captured locale", in which case the
|
||||
-- service falls back to the geoip-derived language and finally to "en".
|
||||
|
||||
ALTER TABLE backend.auth_challenges
|
||||
ADD COLUMN preferred_language text NOT NULL DEFAULT '';
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE backend.auth_challenges
|
||||
DROP COLUMN preferred_language;
|
||||
@@ -0,0 +1,17 @@
|
||||
// Package migrations exposes the goose migrations applied at backend startup.
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
)
|
||||
|
||||
//go:embed *.sql
|
||||
var migrationFiles embed.FS
|
||||
|
||||
// Migrations returns the embedded goose migration filesystem. Migration files
|
||||
// sit at the FS root, so callers pass "." as the directory argument to
|
||||
// galaxy/postgres.RunMigrations.
|
||||
func Migrations() fs.FS {
|
||||
return migrationFiles
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package postgres_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
"sort"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
backendpg "galaxy/backend/internal/postgres"
|
||||
pgshared "galaxy/postgres"
|
||||
|
||||
testcontainers "github.com/testcontainers/testcontainers-go"
|
||||
tcpostgres "github.com/testcontainers/testcontainers-go/modules/postgres"
|
||||
"github.com/testcontainers/testcontainers-go/wait"
|
||||
)
|
||||
|
||||
const (
|
||||
migrationsTestImage = "postgres:16-alpine"
|
||||
migrationsTestUser = "galaxy"
|
||||
migrationsTestPassword = "galaxy"
|
||||
migrationsTestDatabase = "galaxy_backend"
|
||||
migrationsTestSchema = "backend"
|
||||
migrationsTestStartup = 90 * time.Second
|
||||
migrationsTestOpTimeout = 10 * time.Second
|
||||
)
|
||||
|
||||
// expectedBackendTables enumerates every table the embedded migration
|
||||
// set is expected to materialise inside the `backend` schema. Adding a
|
||||
// table to the migration without updating this list fails the smoke
|
||||
// test loudly so readers cannot lose sight of the schema surface.
|
||||
var expectedBackendTables = []string{
|
||||
// Auth domain.
|
||||
"auth_challenges",
|
||||
"blocked_emails",
|
||||
"device_sessions",
|
||||
// User domain.
|
||||
"accounts",
|
||||
"entitlement_records",
|
||||
"entitlement_snapshots",
|
||||
"limit_active",
|
||||
"limit_records",
|
||||
"sanction_active",
|
||||
"sanction_records",
|
||||
// Admin domain.
|
||||
"admin_accounts",
|
||||
// Lobby domain.
|
||||
"applications",
|
||||
"games",
|
||||
"invites",
|
||||
"memberships",
|
||||
"race_names",
|
||||
// Runtime domain.
|
||||
"engine_versions",
|
||||
"player_mappings",
|
||||
"runtime_health_snapshots",
|
||||
"runtime_operation_log",
|
||||
"runtime_records",
|
||||
// Mail domain.
|
||||
"mail_attempts",
|
||||
"mail_dead_letters",
|
||||
"mail_deliveries",
|
||||
"mail_payloads",
|
||||
"mail_recipients",
|
||||
// Notification domain.
|
||||
"notification_dead_letters",
|
||||
"notification_malformed_intents",
|
||||
"notification_routes",
|
||||
"notifications",
|
||||
// Geo domain.
|
||||
"user_country_counters",
|
||||
}
|
||||
|
||||
func TestMigrationsApplyToFreshSchema(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||
t.Cleanup(cancel)
|
||||
|
||||
pgContainer, err := tcpostgres.Run(ctx, migrationsTestImage,
|
||||
tcpostgres.WithDatabase(migrationsTestDatabase),
|
||||
tcpostgres.WithUsername(migrationsTestUser),
|
||||
tcpostgres.WithPassword(migrationsTestPassword),
|
||||
testcontainers.WithWaitStrategy(
|
||||
wait.ForLog("database system is ready to accept connections").
|
||||
WithOccurrence(2).
|
||||
WithStartupTimeout(migrationsTestStartup),
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
// testcontainers fails fast when no Docker daemon is reachable; skip
|
||||
// rather than fail so the test stays green on machines without
|
||||
// Docker (CI without Docker, sandboxed runners, etc.).
|
||||
t.Skipf("postgres testcontainer unavailable, skipping: %v", err)
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
if termErr := testcontainers.TerminateContainer(pgContainer); termErr != nil {
|
||||
t.Errorf("terminate postgres container: %v", termErr)
|
||||
}
|
||||
})
|
||||
|
||||
baseDSN, err := pgContainer.ConnectionString(ctx, "sslmode=disable")
|
||||
if err != nil {
|
||||
t.Fatalf("postgres connection string: %v", err)
|
||||
}
|
||||
scopedDSN, err := dsnWithSearchPath(baseDSN, migrationsTestSchema)
|
||||
if err != nil {
|
||||
t.Fatalf("scope dsn to %s: %v", migrationsTestSchema, err)
|
||||
}
|
||||
|
||||
cfg := pgshared.DefaultConfig()
|
||||
cfg.PrimaryDSN = scopedDSN
|
||||
cfg.OperationTimeout = migrationsTestOpTimeout
|
||||
|
||||
db, err := pgshared.OpenPrimary(ctx, cfg)
|
||||
if err != nil {
|
||||
t.Fatalf("open primary: %v", err)
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
if err := db.Close(); err != nil {
|
||||
t.Errorf("close db: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
if err := pgshared.Ping(ctx, db, cfg.OperationTimeout); err != nil {
|
||||
t.Fatalf("ping: %v", err)
|
||||
}
|
||||
|
||||
if err := backendpg.ApplyMigrations(ctx, db); err != nil {
|
||||
t.Fatalf("apply migrations: %v", err)
|
||||
}
|
||||
|
||||
t.Run("backend schema exists", func(t *testing.T) {
|
||||
var present bool
|
||||
if err := db.QueryRowContext(ctx, `
|
||||
SELECT EXISTS (
|
||||
SELECT 1 FROM information_schema.schemata
|
||||
WHERE schema_name = $1
|
||||
)
|
||||
`, migrationsTestSchema).Scan(&present); err != nil {
|
||||
t.Fatalf("query schema existence: %v", err)
|
||||
}
|
||||
if !present {
|
||||
t.Fatalf("expected schema %q to exist after migrations", migrationsTestSchema)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("every expected table is present", func(t *testing.T) {
|
||||
rows, err := db.QueryContext(ctx, `
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_schema = $1 AND table_type = 'BASE TABLE'
|
||||
`, migrationsTestSchema)
|
||||
if err != nil {
|
||||
t.Fatalf("list backend tables: %v", err)
|
||||
}
|
||||
defer func() { _ = rows.Close() }()
|
||||
|
||||
got := make(map[string]struct{})
|
||||
for rows.Next() {
|
||||
var name string
|
||||
if err := rows.Scan(&name); err != nil {
|
||||
t.Fatalf("scan table name: %v", err)
|
||||
}
|
||||
got[name] = struct{}{}
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
t.Fatalf("iterate table rows: %v", err)
|
||||
}
|
||||
|
||||
// Goose's own bookkeeping table lives inside the same schema. It is
|
||||
// not a backend domain table; drop it from the comparison so a
|
||||
// goose upgrade that renames the tracker does not break the test.
|
||||
delete(got, "goose_db_version")
|
||||
|
||||
var missing, extra []string
|
||||
for _, want := range expectedBackendTables {
|
||||
if _, ok := got[want]; !ok {
|
||||
missing = append(missing, want)
|
||||
}
|
||||
delete(got, want)
|
||||
}
|
||||
for name := range got {
|
||||
extra = append(extra, name)
|
||||
}
|
||||
sort.Strings(missing)
|
||||
sort.Strings(extra)
|
||||
if len(missing) > 0 || len(extra) > 0 {
|
||||
t.Fatalf("backend tables mismatch: missing=%v extra=%v", missing, extra)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func dsnWithSearchPath(baseDSN, schema string) (string, error) {
|
||||
parsed, err := url.Parse(baseDSN)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
values := parsed.Query()
|
||||
values.Set("search_path", schema)
|
||||
if values.Get("sslmode") == "" {
|
||||
values.Set("sslmode", "disable")
|
||||
}
|
||||
parsed.RawQuery = values.Encode()
|
||||
return parsed.String(), nil
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
// Package postgres opens the backend's primary Postgres pool and applies the
|
||||
// embedded migrations.
|
||||
//
|
||||
// The package is a thin wrapper around galaxy/postgres: it adapts the backend
|
||||
// configuration shape to galaxy/postgres.Config, plumbs the OpenTelemetry
|
||||
// tracer and meter providers from the telemetry runtime, instruments the
|
||||
// pool, and verifies connectivity with a bounded Ping.
|
||||
package postgres
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"galaxy/backend/internal/config"
|
||||
"galaxy/backend/internal/postgres/migrations"
|
||||
"galaxy/backend/internal/telemetry"
|
||||
|
||||
pgshared "galaxy/postgres"
|
||||
)
|
||||
|
||||
// connMaxLifetime caps the lifetime of an individual pooled connection. Kept
|
||||
// in sync with galaxy/postgres.DefaultConnMaxLifetime so behaviour matches
|
||||
// the helper's defaults until backend has reason to deviate.
|
||||
const connMaxLifetime = 30 * time.Minute
|
||||
|
||||
// Open constructs the primary Postgres pool, instruments it, pings it, and
|
||||
// returns the *sql.DB. Closing the database is the caller's responsibility.
|
||||
func Open(ctx context.Context, cfg config.PostgresConfig, runtime *telemetry.Runtime) (*sql.DB, error) {
|
||||
pgCfg := pgshared.Config{
|
||||
PrimaryDSN: cfg.DSN,
|
||||
OperationTimeout: cfg.OperationTimeout,
|
||||
MaxOpenConns: cfg.MaxConns,
|
||||
MaxIdleConns: cfg.MinConns,
|
||||
ConnMaxLifetime: connMaxLifetime,
|
||||
}
|
||||
|
||||
db, err := pgshared.OpenPrimary(
|
||||
ctx,
|
||||
pgCfg,
|
||||
pgshared.WithTracerProvider(runtime.TracerProvider()),
|
||||
pgshared.WithMeterProvider(runtime.MeterProvider()),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("open backend postgres pool: %w", err)
|
||||
}
|
||||
|
||||
if _, err := pgshared.InstrumentDBStats(
|
||||
db,
|
||||
pgshared.WithTracerProvider(runtime.TracerProvider()),
|
||||
pgshared.WithMeterProvider(runtime.MeterProvider()),
|
||||
); err != nil {
|
||||
_ = db.Close()
|
||||
return nil, fmt.Errorf("instrument backend postgres pool: %w", err)
|
||||
}
|
||||
|
||||
if err := pgshared.Ping(ctx, db, cfg.OperationTimeout); err != nil {
|
||||
_ = db.Close()
|
||||
return nil, fmt.Errorf("ping backend postgres pool: %w", err)
|
||||
}
|
||||
|
||||
return db, nil
|
||||
}
|
||||
|
||||
// schemaName is the Postgres schema owned by the backend service. Every
|
||||
// backend table lives here.
|
||||
const schemaName = "backend"
|
||||
|
||||
// ApplyMigrations runs every pending Up migration embedded in the backend
|
||||
// binary against db. The schema is created upfront so goose's bookkeeping
|
||||
// table (`goose_db_version`, scoped to the DSN `search_path = backend`)
|
||||
// has somewhere to land before the first migration runs; migration
|
||||
// `00001_init.sql` re-asserts the schema with `IF NOT EXISTS`, so the
|
||||
// double-create is idempotent.
|
||||
func ApplyMigrations(ctx context.Context, db *sql.DB) error {
|
||||
if _, err := db.ExecContext(ctx, "CREATE SCHEMA IF NOT EXISTS "+schemaName); err != nil {
|
||||
return fmt.Errorf("ensure backend schema: %w", err)
|
||||
}
|
||||
if err := pgshared.RunMigrations(ctx, db, migrations.Migrations(), "."); err != nil {
|
||||
return fmt.Errorf("apply backend migrations: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user