33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
const { Client, Databases } = require('node-appwrite');
|
|
require('dotenv').config({ path: '.env.local' });
|
|
|
|
const client = new Client()
|
|
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT)
|
|
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID)
|
|
.setKey(process.env.APPWRITE_API_KEY);
|
|
|
|
const databases = new Databases(client);
|
|
const dbId = process.env.APPWRITE_DATABASE_ID;
|
|
const colId = 'settings';
|
|
|
|
async function fix() {
|
|
try {
|
|
console.log("Creando atributo ticker_count...");
|
|
await databases.createIntegerAttribute(dbId, colId, 'ticker_count', false, 1, 100, 10, false);
|
|
} catch(e) { console.log(e.message); }
|
|
|
|
try {
|
|
console.log("Creando atributo feed_news_count...");
|
|
await databases.createIntegerAttribute(dbId, colId, 'feed_news_count', false, 1, 100, 12, false);
|
|
} catch(e) { console.log(e.message); }
|
|
|
|
try {
|
|
console.log("Creando atributo rotation_seconds...");
|
|
await databases.createIntegerAttribute(dbId, colId, 'rotation_seconds', false, 1, 100, 5, false);
|
|
} catch(e) { console.log(e.message); }
|
|
|
|
console.log("Finished creating attributes.");
|
|
}
|
|
|
|
fix();
|