来源仓库:jxc/ai-fresh-delivery 来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d 快照树: 09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件) 按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据 (生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、 deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值), 整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。 供应商系统后续开发自本提交开始。
30 lines
1.5 KiB
Bash
30 lines
1.5 KiB
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
cd /opt/ai-fresh-delivery/server
|
|
node <<'NODE'
|
|
require('dotenv').config();
|
|
const { Pool } = require('pg');
|
|
|
|
(async () => {
|
|
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
const run = async (label, sql) => {
|
|
const r = await pool.query(sql);
|
|
console.log('\n===', label, '===');
|
|
console.table(r.rows);
|
|
};
|
|
|
|
await run('users', 'SELECT id, email FROM auth.users ORDER BY email');
|
|
await run('profiles', 'SELECT id, username, full_name, branch_code, status FROM profiles ORDER BY username');
|
|
await run('roles', `SELECT p.username, ur.role::text AS role FROM user_roles ur JOIN profiles p ON p.id = ur.user_id ORDER BY p.username, ur.role`);
|
|
await run('branches', 'SELECT branch_code, branch_name FROM branches ORDER BY branch_code');
|
|
await run('customers', 'SELECT customer_code, company_name, branch_code FROM customers ORDER BY customer_code');
|
|
await run('orders', 'SELECT order_code, customer_code, branch_code, total_amount FROM orders ORDER BY order_code');
|
|
await run('counts', `SELECT 'orders' AS t, count(*)::int AS c FROM orders UNION ALL SELECT 'customers', count(*)::int FROM customers UNION ALL SELECT 'skus', count(*)::int FROM skus UNION ALL SELECT 'suppliers', count(*)::int FROM suppliers UNION ALL SELECT 'inventory', count(*)::int FROM inventory UNION ALL SELECT 'notifications', count(*)::int FROM notifications`);
|
|
|
|
await pool.end();
|
|
})().catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|
|
NODE
|