360 Secure SkillHub
360 安全技能中心

Polsia Neon PostgreSQL

该 Skill 说明 Polsia 应用使用 Neon PostgreSQL 的约定:通过 DATABASE_URL 建立连接池、在 migrations/ 目录按时间戳命名迁移文件、给出 up/down 迁移模板,并强调构建阶段无 DATABASE_URL、在 startCommand 中执行迁移、使用参数化查询。

agentlevier
agentlevier
热度 16.02
最近更新 2026-06-16 06:35:32
分类:开发依赖:第三方 API应用场景:代码生成 / DevOps

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add polsia-neon-postgres
Metadata
name
neon-postgres
description
Use Neon PostgreSQL conventions for Polsia apps, including migration patterns and DATABASE_URL usage.

Neon PostgreSQL

Polsia apps use Neon PostgreSQL. DATABASE_URL is automatically provided.

Connection

const { Pool } = require('pg');
const pool = new Pool({ connectionString: process.env.DATABASE_URL });

Migrations

Create files in migrations/ with timestamp prefix: 1704067200000_add_products_table.js

Migration Format

module.exports = {
  up: async (pool) => {
    await pool.query(`CREATE TABLE products (...)`);
  },
  down: async (pool) => {
    await pool.query(`DROP TABLE products`);
  }
};

Key Rules

  • DATABASE_URL is NOT available at build time on Render
  • Run migrations in startCommand, not buildCommand
  • Always use parameterized queries ($1, $2) for user input