360 Secure SkillHub
360 安全技能中心

Polsia Neon PostgreSQL

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

分类:开发
agentlevier
agentlevier
热度 15.70
最近更新 2026-06-16 06:35:32

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add agentlevier/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