kite-menu

This commit is contained in:
2026-06-11 13:38:37 +03:00
parent 60b48ca5e8
commit 18dabd1eb2
6 changed files with 167 additions and 5 deletions
+32
View File
@@ -0,0 +1,32 @@
import pkg from 'pg';
import dotenv from 'dotenv';
dotenv.config();
const { Client } = pkg;
async function main() {
const client = new Client({
connectionString: process.env.DATABASE_URL,
});
await client.connect();
const mockImageUrl = '/default-product.png';
try {
const result = await client.query(`
UPDATE "products"
SET "image_url" = $1
`, [mockImageUrl]);
console.log(`Successfully updated ${result.rowCount} products with a mock image.`);
} catch (e) {
console.error('Error updating products:', e.message);
} finally {
await client.end();
}
}
main().catch(e => {
console.error(e);
process.exit(1);
});