Use Neon PostgreSQL conventions for Polsia apps, including migration patterns and DATABASE_URL usage.
Use Neon PostgreSQL conventions for Polsia apps, including migration patterns and DATABASE_URL usage.
Polsia apps use Neon PostgreSQL. DATABASEURL is automatically provided.
直接复制以下提示词,发送给你的 AI 助手即可完成安装。
---
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
```javascript
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
```javascript
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
文件内容直接读取自技能仓库,仅供安装前审阅;以实际下载的压缩包为准。