feat(payments): payments schema, currency domain and money type #215
@@ -200,10 +200,11 @@ E2 flips reads and after Release 2). Reads still use the old columns until E2.
|
|||||||
./backend/...` + `go vet` + `gofmt -l .` clean; committed `jet/payments/`; all tests green; no
|
./backend/...` + `go vet` + `gofmt -l .` clean; committed `jet/payments/`; all tests green; no
|
||||||
behaviour change for users.
|
behaviour change for users.
|
||||||
|
|
||||||
**Notes.** jetgen regenerates the whole `backend` schema; its committed jet was already drifted
|
**Notes.** jetgen regenerates the whole `backend` schema; its committed jet had drifted from the
|
||||||
from the migrations (`robot_blocks`, `robot_friend_requests`, a `feedback_messages` column), so
|
migrations (`robot_blocks`, `robot_friend_requests`, the `feedback_messages` `app_version` /
|
||||||
that churn was reverted and only `jet/payments/` committed — a pre-existing drift worth a separate
|
`browser_tz` columns, and `UseSchema` gaps), so this change also **regenerates and commits
|
||||||
cleanup. The `payments` role creation is idempotent (`DO $$` / `IF NOT EXISTS`) for fresh volumes.
|
`jet/backend`** to bring it back in sync (additive only — all suites stay green). The `payments`
|
||||||
|
role creation is idempotent (`DO $$` / `IF NOT EXISTS`) for fresh volumes.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -27,4 +27,6 @@ type FeedbackMessages struct {
|
|||||||
ReplyReadAt *time.Time
|
ReplyReadAt *time.Time
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
Lang *string
|
Lang *string
|
||||||
|
AppVersion *string
|
||||||
|
BrowserTz *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 RobotBlocks struct {
|
||||||
|
ID uuid.UUID `sql:"primary_key"`
|
||||||
|
BlockerID uuid.UUID
|
||||||
|
GameID uuid.UUID
|
||||||
|
Seat int16
|
||||||
|
RobotID uuid.UUID
|
||||||
|
DisplayName string
|
||||||
|
CreatedAt 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 RobotFriendRequests struct {
|
||||||
|
ID uuid.UUID `sql:"primary_key"`
|
||||||
|
RequesterID uuid.UUID
|
||||||
|
GameID uuid.UUID
|
||||||
|
Seat int16
|
||||||
|
RobotID uuid.UUID
|
||||||
|
DisplayName string
|
||||||
|
CreatedAt time.Time
|
||||||
|
}
|
||||||
@@ -31,6 +31,8 @@ type feedbackMessagesTable struct {
|
|||||||
ReplyReadAt postgres.ColumnTimestampz
|
ReplyReadAt postgres.ColumnTimestampz
|
||||||
CreatedAt postgres.ColumnTimestampz
|
CreatedAt postgres.ColumnTimestampz
|
||||||
Lang postgres.ColumnString
|
Lang postgres.ColumnString
|
||||||
|
AppVersion postgres.ColumnString
|
||||||
|
BrowserTz postgres.ColumnString
|
||||||
|
|
||||||
AllColumns postgres.ColumnList
|
AllColumns postgres.ColumnList
|
||||||
MutableColumns postgres.ColumnList
|
MutableColumns postgres.ColumnList
|
||||||
@@ -86,8 +88,10 @@ func newFeedbackMessagesTableImpl(schemaName, tableName, alias string) feedbackM
|
|||||||
ReplyReadAtColumn = postgres.TimestampzColumn("reply_read_at")
|
ReplyReadAtColumn = postgres.TimestampzColumn("reply_read_at")
|
||||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||||
LangColumn = postgres.StringColumn("lang")
|
LangColumn = postgres.StringColumn("lang")
|
||||||
allColumns = postgres.ColumnList{MessageIDColumn, AccountIDColumn, BodyColumn, AttachmentColumn, AttachmentNameColumn, SenderIPColumn, ChannelColumn, ReadAtColumn, ArchivedAtColumn, ReplyBodyColumn, RepliedAtColumn, ReplyReadAtColumn, CreatedAtColumn, LangColumn}
|
AppVersionColumn = postgres.StringColumn("app_version")
|
||||||
mutableColumns = postgres.ColumnList{AccountIDColumn, BodyColumn, AttachmentColumn, AttachmentNameColumn, SenderIPColumn, ChannelColumn, ReadAtColumn, ArchivedAtColumn, ReplyBodyColumn, RepliedAtColumn, ReplyReadAtColumn, CreatedAtColumn, LangColumn}
|
BrowserTzColumn = postgres.StringColumn("browser_tz")
|
||||||
|
allColumns = postgres.ColumnList{MessageIDColumn, AccountIDColumn, BodyColumn, AttachmentColumn, AttachmentNameColumn, SenderIPColumn, ChannelColumn, ReadAtColumn, ArchivedAtColumn, ReplyBodyColumn, RepliedAtColumn, ReplyReadAtColumn, CreatedAtColumn, LangColumn, AppVersionColumn, BrowserTzColumn}
|
||||||
|
mutableColumns = postgres.ColumnList{AccountIDColumn, BodyColumn, AttachmentColumn, AttachmentNameColumn, SenderIPColumn, ChannelColumn, ReadAtColumn, ArchivedAtColumn, ReplyBodyColumn, RepliedAtColumn, ReplyReadAtColumn, CreatedAtColumn, LangColumn, AppVersionColumn, BrowserTzColumn}
|
||||||
defaultColumns = postgres.ColumnList{CreatedAtColumn}
|
defaultColumns = postgres.ColumnList{CreatedAtColumn}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -109,6 +113,8 @@ func newFeedbackMessagesTableImpl(schemaName, tableName, alias string) feedbackM
|
|||||||
ReplyReadAt: ReplyReadAtColumn,
|
ReplyReadAt: ReplyReadAtColumn,
|
||||||
CreatedAt: CreatedAtColumn,
|
CreatedAt: CreatedAtColumn,
|
||||||
Lang: LangColumn,
|
Lang: LangColumn,
|
||||||
|
AppVersion: AppVersionColumn,
|
||||||
|
BrowserTz: BrowserTzColumn,
|
||||||
|
|
||||||
AllColumns: allColumns,
|
AllColumns: allColumns,
|
||||||
MutableColumns: mutableColumns,
|
MutableColumns: mutableColumns,
|
||||||
|
|||||||
@@ -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 RobotBlocks = newRobotBlocksTable("backend", "robot_blocks", "")
|
||||||
|
|
||||||
|
type robotBlocksTable struct {
|
||||||
|
postgres.Table
|
||||||
|
|
||||||
|
// Columns
|
||||||
|
ID postgres.ColumnString
|
||||||
|
BlockerID postgres.ColumnString
|
||||||
|
GameID postgres.ColumnString
|
||||||
|
Seat postgres.ColumnInteger
|
||||||
|
RobotID postgres.ColumnString
|
||||||
|
DisplayName postgres.ColumnString
|
||||||
|
CreatedAt postgres.ColumnTimestampz
|
||||||
|
|
||||||
|
AllColumns postgres.ColumnList
|
||||||
|
MutableColumns postgres.ColumnList
|
||||||
|
DefaultColumns postgres.ColumnList
|
||||||
|
}
|
||||||
|
|
||||||
|
type RobotBlocksTable struct {
|
||||||
|
robotBlocksTable
|
||||||
|
|
||||||
|
EXCLUDED robotBlocksTable
|
||||||
|
}
|
||||||
|
|
||||||
|
// AS creates new RobotBlocksTable with assigned alias
|
||||||
|
func (a RobotBlocksTable) AS(alias string) *RobotBlocksTable {
|
||||||
|
return newRobotBlocksTable(a.SchemaName(), a.TableName(), alias)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Schema creates new RobotBlocksTable with assigned schema name
|
||||||
|
func (a RobotBlocksTable) FromSchema(schemaName string) *RobotBlocksTable {
|
||||||
|
return newRobotBlocksTable(schemaName, a.TableName(), a.Alias())
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPrefix creates new RobotBlocksTable with assigned table prefix
|
||||||
|
func (a RobotBlocksTable) WithPrefix(prefix string) *RobotBlocksTable {
|
||||||
|
return newRobotBlocksTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSuffix creates new RobotBlocksTable with assigned table suffix
|
||||||
|
func (a RobotBlocksTable) WithSuffix(suffix string) *RobotBlocksTable {
|
||||||
|
return newRobotBlocksTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRobotBlocksTable(schemaName, tableName, alias string) *RobotBlocksTable {
|
||||||
|
return &RobotBlocksTable{
|
||||||
|
robotBlocksTable: newRobotBlocksTableImpl(schemaName, tableName, alias),
|
||||||
|
EXCLUDED: newRobotBlocksTableImpl("", "excluded", ""),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRobotBlocksTableImpl(schemaName, tableName, alias string) robotBlocksTable {
|
||||||
|
var (
|
||||||
|
IDColumn = postgres.StringColumn("id")
|
||||||
|
BlockerIDColumn = postgres.StringColumn("blocker_id")
|
||||||
|
GameIDColumn = postgres.StringColumn("game_id")
|
||||||
|
SeatColumn = postgres.IntegerColumn("seat")
|
||||||
|
RobotIDColumn = postgres.StringColumn("robot_id")
|
||||||
|
DisplayNameColumn = postgres.StringColumn("display_name")
|
||||||
|
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||||
|
allColumns = postgres.ColumnList{IDColumn, BlockerIDColumn, GameIDColumn, SeatColumn, RobotIDColumn, DisplayNameColumn, CreatedAtColumn}
|
||||||
|
mutableColumns = postgres.ColumnList{BlockerIDColumn, GameIDColumn, SeatColumn, RobotIDColumn, DisplayNameColumn, CreatedAtColumn}
|
||||||
|
defaultColumns = postgres.ColumnList{CreatedAtColumn}
|
||||||
|
)
|
||||||
|
|
||||||
|
return robotBlocksTable{
|
||||||
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||||
|
|
||||||
|
//Columns
|
||||||
|
ID: IDColumn,
|
||||||
|
BlockerID: BlockerIDColumn,
|
||||||
|
GameID: GameIDColumn,
|
||||||
|
Seat: SeatColumn,
|
||||||
|
RobotID: RobotIDColumn,
|
||||||
|
DisplayName: DisplayNameColumn,
|
||||||
|
CreatedAt: CreatedAtColumn,
|
||||||
|
|
||||||
|
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 RobotFriendRequests = newRobotFriendRequestsTable("backend", "robot_friend_requests", "")
|
||||||
|
|
||||||
|
type robotFriendRequestsTable struct {
|
||||||
|
postgres.Table
|
||||||
|
|
||||||
|
// Columns
|
||||||
|
ID postgres.ColumnString
|
||||||
|
RequesterID postgres.ColumnString
|
||||||
|
GameID postgres.ColumnString
|
||||||
|
Seat postgres.ColumnInteger
|
||||||
|
RobotID postgres.ColumnString
|
||||||
|
DisplayName postgres.ColumnString
|
||||||
|
CreatedAt postgres.ColumnTimestampz
|
||||||
|
|
||||||
|
AllColumns postgres.ColumnList
|
||||||
|
MutableColumns postgres.ColumnList
|
||||||
|
DefaultColumns postgres.ColumnList
|
||||||
|
}
|
||||||
|
|
||||||
|
type RobotFriendRequestsTable struct {
|
||||||
|
robotFriendRequestsTable
|
||||||
|
|
||||||
|
EXCLUDED robotFriendRequestsTable
|
||||||
|
}
|
||||||
|
|
||||||
|
// AS creates new RobotFriendRequestsTable with assigned alias
|
||||||
|
func (a RobotFriendRequestsTable) AS(alias string) *RobotFriendRequestsTable {
|
||||||
|
return newRobotFriendRequestsTable(a.SchemaName(), a.TableName(), alias)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Schema creates new RobotFriendRequestsTable with assigned schema name
|
||||||
|
func (a RobotFriendRequestsTable) FromSchema(schemaName string) *RobotFriendRequestsTable {
|
||||||
|
return newRobotFriendRequestsTable(schemaName, a.TableName(), a.Alias())
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPrefix creates new RobotFriendRequestsTable with assigned table prefix
|
||||||
|
func (a RobotFriendRequestsTable) WithPrefix(prefix string) *RobotFriendRequestsTable {
|
||||||
|
return newRobotFriendRequestsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSuffix creates new RobotFriendRequestsTable with assigned table suffix
|
||||||
|
func (a RobotFriendRequestsTable) WithSuffix(suffix string) *RobotFriendRequestsTable {
|
||||||
|
return newRobotFriendRequestsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRobotFriendRequestsTable(schemaName, tableName, alias string) *RobotFriendRequestsTable {
|
||||||
|
return &RobotFriendRequestsTable{
|
||||||
|
robotFriendRequestsTable: newRobotFriendRequestsTableImpl(schemaName, tableName, alias),
|
||||||
|
EXCLUDED: newRobotFriendRequestsTableImpl("", "excluded", ""),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRobotFriendRequestsTableImpl(schemaName, tableName, alias string) robotFriendRequestsTable {
|
||||||
|
var (
|
||||||
|
IDColumn = postgres.StringColumn("id")
|
||||||
|
RequesterIDColumn = postgres.StringColumn("requester_id")
|
||||||
|
GameIDColumn = postgres.StringColumn("game_id")
|
||||||
|
SeatColumn = postgres.IntegerColumn("seat")
|
||||||
|
RobotIDColumn = postgres.StringColumn("robot_id")
|
||||||
|
DisplayNameColumn = postgres.StringColumn("display_name")
|
||||||
|
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||||
|
allColumns = postgres.ColumnList{IDColumn, RequesterIDColumn, GameIDColumn, SeatColumn, RobotIDColumn, DisplayNameColumn, CreatedAtColumn}
|
||||||
|
mutableColumns = postgres.ColumnList{RequesterIDColumn, GameIDColumn, SeatColumn, RobotIDColumn, DisplayNameColumn, CreatedAtColumn}
|
||||||
|
defaultColumns = postgres.ColumnList{CreatedAtColumn}
|
||||||
|
)
|
||||||
|
|
||||||
|
return robotFriendRequestsTable{
|
||||||
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||||
|
|
||||||
|
//Columns
|
||||||
|
ID: IDColumn,
|
||||||
|
RequesterID: RequesterIDColumn,
|
||||||
|
GameID: GameIDColumn,
|
||||||
|
Seat: SeatColumn,
|
||||||
|
RobotID: RobotIDColumn,
|
||||||
|
DisplayName: DisplayNameColumn,
|
||||||
|
CreatedAt: CreatedAtColumn,
|
||||||
|
|
||||||
|
AllColumns: allColumns,
|
||||||
|
MutableColumns: mutableColumns,
|
||||||
|
DefaultColumns: defaultColumns,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ package table
|
|||||||
// UseSchema sets a new schema name for all generated table SQL builder types. It is recommended to invoke
|
// 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.
|
// this method only once at the beginning of the program.
|
||||||
func UseSchema(schema string) {
|
func UseSchema(schema string) {
|
||||||
|
AccountBestMove = AccountBestMove.FromSchema(schema)
|
||||||
AccountRoles = AccountRoles.FromSchema(schema)
|
AccountRoles = AccountRoles.FromSchema(schema)
|
||||||
AccountStats = AccountStats.FromSchema(schema)
|
AccountStats = AccountStats.FromSchema(schema)
|
||||||
AccountSuspensions = AccountSuspensions.FromSchema(schema)
|
AccountSuspensions = AccountSuspensions.FromSchema(schema)
|
||||||
@@ -35,6 +36,8 @@ func UseSchema(schema string) {
|
|||||||
Games = Games.FromSchema(schema)
|
Games = Games.FromSchema(schema)
|
||||||
Identities = Identities.FromSchema(schema)
|
Identities = Identities.FromSchema(schema)
|
||||||
RetainedIdentities = RetainedIdentities.FromSchema(schema)
|
RetainedIdentities = RetainedIdentities.FromSchema(schema)
|
||||||
|
RobotBlocks = RobotBlocks.FromSchema(schema)
|
||||||
|
RobotFriendRequests = RobotFriendRequests.FromSchema(schema)
|
||||||
Sessions = Sessions.FromSchema(schema)
|
Sessions = Sessions.FromSchema(schema)
|
||||||
SuspensionReasons = SuspensionReasons.FromSchema(schema)
|
SuspensionReasons = SuspensionReasons.FromSchema(schema)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user