Remove comms.contact_email.id column

The address is the primary key, rather than an ID.
This commit is contained in:
Eli Ribble 2026-05-21 17:05:56 +00:00
parent e3cc1e99d1
commit dcce7cda1c
No known key found for this signature in database
4 changed files with 7 additions and 12 deletions

View file

@ -11,6 +11,5 @@ type ContactEmail struct {
Address string `sql:"primary_key"`
Confirmed bool
ContactID int32
ID int32
IsSubscribed bool
}

View file

@ -20,7 +20,6 @@ type contactEmailTable struct {
Address postgres.ColumnString
Confirmed postgres.ColumnBool
ContactID postgres.ColumnInteger
ID postgres.ColumnInteger
IsSubscribed postgres.ColumnBool
AllColumns postgres.ColumnList
@ -66,11 +65,10 @@ func newContactEmailTableImpl(schemaName, tableName, alias string) contactEmailT
AddressColumn = postgres.StringColumn("address")
ConfirmedColumn = postgres.BoolColumn("confirmed")
ContactIDColumn = postgres.IntegerColumn("contact_id")
IDColumn = postgres.IntegerColumn("id")
IsSubscribedColumn = postgres.BoolColumn("is_subscribed")
allColumns = postgres.ColumnList{AddressColumn, ConfirmedColumn, ContactIDColumn, IDColumn, IsSubscribedColumn}
mutableColumns = postgres.ColumnList{ConfirmedColumn, ContactIDColumn, IDColumn, IsSubscribedColumn}
defaultColumns = postgres.ColumnList{IDColumn}
allColumns = postgres.ColumnList{AddressColumn, ConfirmedColumn, ContactIDColumn, IsSubscribedColumn}
mutableColumns = postgres.ColumnList{ConfirmedColumn, ContactIDColumn, IsSubscribedColumn}
defaultColumns = postgres.ColumnList{}
)
return contactEmailTable{
@ -80,7 +78,6 @@ func newContactEmailTableImpl(schemaName, tableName, alias string) contactEmailT
Address: AddressColumn,
Confirmed: ConfirmedColumn,
ContactID: ContactIDColumn,
ID: IDColumn,
IsSubscribed: IsSubscribedColumn,
AllColumns: allColumns,

View file

@ -13,7 +13,7 @@ import (
)
func ContactEmailInsert(ctx context.Context, txn db.Ex, m model.ContactEmail) (model.ContactEmail, error) {
statement := table.ContactEmail.INSERT(table.ContactEmail.MutableColumns).
statement := table.ContactEmail.INSERT(table.ContactEmail.AllColumns).
MODEL(m).
RETURNING(table.ContactEmail.AllColumns)
return db.ExecuteOneTx[model.ContactEmail](ctx, txn, statement)