27 lines
721 B
TypeScript
27 lines
721 B
TypeScript
import { db } from '../src/config/database';
|
|
|
|
async function run() {
|
|
try {
|
|
const id = 1; // Assuming ID 1 exists
|
|
const payload = {
|
|
public_title: "Teste de Título Público",
|
|
public_description: "Descrição pública de teste via script",
|
|
public_hide_values: true
|
|
};
|
|
|
|
console.log(`Updating benefit ${id} with:`, payload);
|
|
|
|
await db('benefits').where({ id }).update(payload);
|
|
|
|
const updated = await db('benefits').where({ id }).first();
|
|
console.log('Updated Benefit:', JSON.stringify(updated, null, 2));
|
|
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
} finally {
|
|
await db.destroy();
|
|
}
|
|
}
|
|
|
|
run();
|