Merge pull request 'feature/billing-settings' (#16) from feature/billing-settings into master
Some checks are pending
CI / checks (push) Waiting to run
Some checks are pending
CI / checks (push) Waiting to run
Reviewed-on: #16
This commit is contained in:
commit
2b99defa5a
3 changed files with 48 additions and 2 deletions
|
|
@ -97,3 +97,9 @@
|
||||||
- Navbar: combined admin actions (approvals/users/monitoring) under a single “Admin” dropdown menu.
|
- Navbar: combined admin actions (approvals/users/monitoring) under a single “Admin” dropdown menu.
|
||||||
- Pricing copy: treat listing prices as indicative “starting from” values and show starting-from line on browse cards + home latest carousel.
|
- Pricing copy: treat listing prices as indicative “starting from” values and show starting-from line on browse cards + home latest carousel.
|
||||||
- Site settings page added with a toggle to require login for listing contact details; contact info is now hidden from logged-out visitors.
|
- Site settings page added with a toggle to require login for listing contact details; contact info is now hidden from logged-out visitors.
|
||||||
|
|
||||||
|
## 2025-12-20 — Migration history repair
|
||||||
|
- Restored missing migration `20251212_agent_billing` (agent billing columns + listing billing settings table) so Prisma history matches the DB.
|
||||||
|
- Reconciled test DB migration history: aligned checksum for `20251212_agent_billing` and marked `20260310_site_settings` and `20260311_billing_preferences` as applied to stop Prisma errors and surface listings again.
|
||||||
|
- Applied the same agent billing schema to staging/prod DB (`lomavuokraus`) and marked the migration as applied; Prisma status now clean there too.
|
||||||
|
- Deploy script now runs a Prisma migration status preflight using DATABASE_URL from env or in-cluster secret and fails fast on drift before applying manifests.
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ APP_VERSION="${APP_VERSION:-$(echo \"$IMAGE\" | awk -F: '{print $NF}')}"
|
||||||
|
|
||||||
export K8S_NAMESPACE APP_HOST API_HOST NEXT_PUBLIC_SITE_URL NEXT_PUBLIC_API_BASE APP_ENV CLUSTER_ISSUER INGRESS_CLASS APP_REPLICAS K8S_IMAGE APP_VERSION
|
export K8S_NAMESPACE APP_HOST API_HOST NEXT_PUBLIC_SITE_URL NEXT_PUBLIC_API_BASE APP_ENV CLUSTER_ISSUER INGRESS_CLASS APP_REPLICAS K8S_IMAGE APP_VERSION
|
||||||
|
|
||||||
maybe_run_prisma_migrations() {
|
resolve_database_url() {
|
||||||
local db_url="${DATABASE_URL:-}"
|
local db_url="${DATABASE_URL:-}"
|
||||||
if [[ -z "$db_url" ]]; then
|
if [[ -z "$db_url" ]]; then
|
||||||
# If DATABASE_URL isn't available locally, try to reuse the in-cluster secret.
|
# If DATABASE_URL isn't available locally, try to reuse the in-cluster secret.
|
||||||
|
|
@ -87,6 +87,25 @@ maybe_run_prisma_migrations() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$db_url"
|
||||||
|
}
|
||||||
|
|
||||||
|
prisma_preflight() {
|
||||||
|
local db_url="$1"
|
||||||
|
if [[ -z "$db_url" ]]; then
|
||||||
|
echo "DATABASE_URL unavailable; skipping Prisma status preflight" >&2
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Prisma preflight: checking migration status for APP_ENV=$APP_ENV (namespace=$K8S_NAMESPACE)"
|
||||||
|
if ! DATABASE_URL="$db_url" npx prisma migrate status >/dev/null; then
|
||||||
|
echo "Prisma migrate status failed. Fix migration history before deploying." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
maybe_run_prisma_migrations() {
|
||||||
|
local db_url="$1"
|
||||||
if [[ -n "$db_url" ]]; then
|
if [[ -n "$db_url" ]]; then
|
||||||
echo "Running Prisma migrations for APP_ENV=$APP_ENV (namespace=$K8S_NAMESPACE)"
|
echo "Running Prisma migrations for APP_ENV=$APP_ENV (namespace=$K8S_NAMESPACE)"
|
||||||
DATABASE_URL="$db_url" npx prisma migrate deploy
|
DATABASE_URL="$db_url" npx prisma migrate deploy
|
||||||
|
|
@ -95,7 +114,9 @@ maybe_run_prisma_migrations() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
maybe_run_prisma_migrations
|
DB_URL_FOR_DEPLOY="$(resolve_database_url)"
|
||||||
|
prisma_preflight "$DB_URL_FOR_DEPLOY"
|
||||||
|
maybe_run_prisma_migrations "$DB_URL_FOR_DEPLOY"
|
||||||
|
|
||||||
TMP_MANIFEST=$(mktemp)
|
TMP_MANIFEST=$(mktemp)
|
||||||
envsubst < k8s/app.yaml > "$TMP_MANIFEST"
|
envsubst < k8s/app.yaml > "$TMP_MANIFEST"
|
||||||
|
|
|
||||||
19
prisma/migrations/20251212_agent_billing/migration.sql
Normal file
19
prisma/migrations/20251212_agent_billing/migration.sql
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
-- Agent billing preferences and per-listing overrides (legacy)
|
||||||
|
|
||||||
|
ALTER TABLE "User"
|
||||||
|
ADD COLUMN "agentBillingEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
ADD COLUMN "agentBankAccount" TEXT,
|
||||||
|
ADD COLUMN "agentVatBreakdownRequired" BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
ADD COLUMN "agentUseListingOverrides" BOOLEAN NOT NULL DEFAULT FALSE;
|
||||||
|
|
||||||
|
CREATE TABLE "ListingBillingSettings" (
|
||||||
|
"id" TEXT NOT NULL,
|
||||||
|
"listingId" TEXT NOT NULL,
|
||||||
|
"bankAccount" TEXT,
|
||||||
|
"vatBreakdownRequired" BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
CONSTRAINT "ListingBillingSettings_pkey" PRIMARY KEY ("id"),
|
||||||
|
CONSTRAINT "ListingBillingSettings_listingId_key" UNIQUE ("listingId"),
|
||||||
|
CONSTRAINT "ListingBillingSettings_listingId_fkey" FOREIGN KEY ("listingId") REFERENCES "Listing"("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
);
|
||||||
Loading…
Add table
Reference in a new issue