Files
worldwideview/scripts/safe-db-push.mjs
SilvertakanaandCopilot Autofix powered by AI fb07195ec2 feat(testing): stabilize Playwright E2E Tests infrastructure (#134)
* feat(testing): add Playwright E2E infrastructure and stabilize test suite

- Add Playwright E2E configuration and ui-navigation / plugin-system tests
- Add GitHub Actions workflow for Playwright CI tests
- Add test helpers and fixtures (e2e-mock-plugin)
- fix(testing): resolve UnverifiedPluginBatchDialog UI blocking issue in E2E tests
- fix(testing): limit Playwright to 2 workers locally to avoid Next.js/Prisma exhaustion
- fix(api): replace deprecated processAuthCodeResponse with authorizationCodeGrant
- test(ui): add data-testid to PanelToggleArrows and AppShell

* Potential fix for pull request finding 'CodeQL / Workflow does not contain permissions'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* fix(ci): restrict GITHUB_TOKEN permissions to read contents

* docs(e2e): document Playwright infrastructure and mock plugin lifecycle

* fix(e2e): explicitly load .env in teardown and fix dev command pathing

* fix(ci): resolve playwright environment setup and database initialization

Changes:
- Patch: Added pnpm run setup step to .github/workflows/playwright.yml to generate .env in CI
- Patch: Added explicit loadEnv() helper to 	ests/global.setup.ts and 	ests/global.teardown.ts to ensure database credentials are fresh
- Patch: Hardened scripts/safe-db-push.mjs to detect missing DATABASE_URL and explicitly prompt for pnpm run setup rather than assuming production
- Patch: Updated scripts/dev.mjs to execute pnpm exec next dev instead of raw
ext dev to resolve pathing issues
- Patch: Bumped version in package.json to 2.14.4

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-05-15 14:57:37 +12:00

22 lines
903 B
JavaScript

import { execSync } from 'child_process';
const dbUrl = process.env.DATABASE_URL || '';
if (!dbUrl) {
console.error("❌ ERROR: DATABASE_URL is missing.");
console.error(" Did you forget to run 'pnpm run setup' to generate your .env file?");
process.exit(1);
}
const isLocal = dbUrl.includes('localhost') || dbUrl.includes('127.0.0.1') || dbUrl.includes('host.docker.internal') || dbUrl.includes('postgres:postgres@db:5432');
if (!isLocal) {
console.error("❌ ERROR: DATABASE_URL points to a remote database.");
console.error(" Running 'prisma db push --accept-data-loss' on production/staging data is forbidden.");
console.error(" If you truly need to migrate a remote db, run prisma db push manually.");
process.exit(1);
}
console.log("🔒 Local database detected. Safely running prisma db push...");
execSync('npx prisma db push --accept-data-loss', { stdio: 'inherit' });