PhoenixKit.Migrations.Postgres.V31 (phoenix_kit v1.7.71)

Copy Markdown View Source

PhoenixKit V31 Migration: Billing System - Phase 1

This migration introduces the core billing infrastructure including currencies, billing profiles, orders, and invoices. This is Phase 1 of the billing module, focused on manual bank transfer payments.

Changes

Currencies Table (phoenix_kit_currencies)

  • Multi-currency support with ISO 4217 codes
  • Exchange rates for currency conversion
  • Default currency configuration

Billing Profiles Table (phoenix_kit_billing_profiles)

  • User billing information storage
  • Support for individuals and companies (EU Standard)
  • VAT number and company registration for B2B
  • Billing address management

Orders Table (phoenix_kit_orders)

  • Order management with line items (JSONB)
  • Status tracking (draft, pending, confirmed, paid, cancelled, refunded)
  • Multi-currency support
  • Billing snapshot at order time

Invoices Table (phoenix_kit_invoices)

  • Invoice generation from orders
  • Status tracking (draft, sent, paid, void, overdue)
  • Receipt functionality integrated
  • Bank details for payment

Settings Seeds

  • Billing module enable/disable
  • Default currency and tax settings
  • Invoice/order number prefixes

PostgreSQL Support

  • Leverages PostgreSQL's native JSONB for flexible data
  • Decimal precision for financial calculations
  • Supports prefix for schema isolation
  • Optimized indexes for common queries

Summary

Functions

Rollback the V31 migration.

Run the V31 migration to add the billing system.

Functions

down(opts)

Rollback the V31 migration.

up(opts)

Run the V31 migration to add the billing system.