34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
const sdk = require('node-appwrite');
|
|
|
|
const client = new sdk.Client()
|
|
.setEndpoint('https://appwrite.almeira.com.co/v1')
|
|
.setProject('69b84df5003bd8957c5c')
|
|
.setKey('standard_cce3cdb866ea6433888d40cedd24dc45987372308fdc3dd0697de08648c0e5c7e04b02c3bcee271403fd656b00a5820f04c08b51631284a6e8a3582d8aed2aa33234f3c29cc777e9b162eb54810b789251b0d006a9a3b081ebc2da53b9baa94614b124b3508ad849fd9a4187cc6094f506d4b57f409b69d9562a74df594f3ec3');
|
|
|
|
const dbs = new sdk.Databases(client);
|
|
const DB_ID = 'sneakers_multistore_db';
|
|
const COL_ID = 'products';
|
|
|
|
async function fixAttribute() {
|
|
try {
|
|
console.log('Eliminando atributo fallido whatsappMessageId...');
|
|
try {
|
|
await dbs.deleteAttribute(DB_ID, COL_ID, 'whatsappMessageId');
|
|
console.log('✓ Atributo whatsappMessageId eliminado.');
|
|
} catch (e) {
|
|
console.warn('Aviso delete:', e.message);
|
|
}
|
|
|
|
console.log('Esperando 2 segundos...');
|
|
await new Promise(r => setTimeout(r, 2000));
|
|
|
|
console.log('Recreando atributo whatsappMessageId...');
|
|
await dbs.createStringAttribute(DB_ID, COL_ID, 'whatsappMessageId', 128, false);
|
|
console.log('✓ Atributo whatsappMessageId recreado con éxito.');
|
|
} catch (err) {
|
|
console.error('Error:', err.message);
|
|
}
|
|
}
|
|
|
|
fixAttribute();
|