Phase6c: Optional Company contact name
All checks were successful
Build and Push / build (push) Successful in 1m40s
All checks were successful
Build and Push / build (push) Successful in 1m40s
This commit is contained in:
@@ -198,6 +198,12 @@ const MIGRATION_SQL = `
|
||||
CREATE TABLE IF NOT EXISTS org_billing (
|
||||
zitadel_org_id TEXT PRIMARY KEY,
|
||||
company_name TEXT NOT NULL,
|
||||
-- Phase 6 fix: optional contact-person line shown on the
|
||||
-- invoice PDF below the company name (e.g. "z.Hd. Herr Müller").
|
||||
-- Not normally needed since invoices are delivered by email
|
||||
-- link, but useful when customers forward the PDF internally
|
||||
-- for AP routing in larger organizations.
|
||||
contact_name TEXT,
|
||||
street_address TEXT NOT NULL,
|
||||
postal_code TEXT NOT NULL,
|
||||
city TEXT NOT NULL,
|
||||
@@ -208,6 +214,10 @@ const MIGRATION_SQL = `
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
-- Phase 6 fix: ensure the column exists on databases that were
|
||||
-- created before contact_name was added to the base schema above.
|
||||
-- IF NOT EXISTS makes this safe to run repeatedly via ensureSchema.
|
||||
ALTER TABLE org_billing ADD COLUMN IF NOT EXISTS contact_name TEXT;
|
||||
|
||||
-- Feature 5: lightweight customer support / feedback tickets.
|
||||
-- Scoped strictly per-user (zitadel_user_id), not per-org —
|
||||
@@ -1262,6 +1272,7 @@ function rowToOrgBilling(row: any): OrgBilling {
|
||||
return {
|
||||
zitadelOrgId: row.zitadel_org_id,
|
||||
companyName: row.company_name,
|
||||
contactName: row.contact_name ?? null,
|
||||
streetAddress: row.street_address,
|
||||
postalCode: row.postal_code,
|
||||
city: row.city,
|
||||
@@ -1306,12 +1317,13 @@ export async function upsertOrgBilling(
|
||||
await ensureSchema();
|
||||
const result = await getPool().query(
|
||||
`INSERT INTO org_billing (
|
||||
zitadel_org_id, company_name, street_address, postal_code,
|
||||
city, country, vat_number, billing_email, notes
|
||||
zitadel_org_id, company_name, contact_name, street_address,
|
||||
postal_code, city, country, vat_number, billing_email, notes
|
||||
)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
||||
ON CONFLICT (zitadel_org_id) DO UPDATE SET
|
||||
company_name = EXCLUDED.company_name,
|
||||
contact_name = EXCLUDED.contact_name,
|
||||
street_address = EXCLUDED.street_address,
|
||||
postal_code = EXCLUDED.postal_code,
|
||||
city = EXCLUDED.city,
|
||||
@@ -1324,6 +1336,7 @@ export async function upsertOrgBilling(
|
||||
[
|
||||
data.zitadelOrgId,
|
||||
data.companyName,
|
||||
data.contactName ?? null,
|
||||
data.streetAddress,
|
||||
data.postalCode,
|
||||
data.city,
|
||||
|
||||
Reference in New Issue
Block a user