Files
adam-acs/database/mongo_migrations/001_create_devices_collection.ts
T
Kevin L'HereecandCopilot d1c65dbf1e chore: initial commit — AdonisJS v7 TR-069 ACS
- Docker infrastructure (Dockerfile, docker-compose.yml, genieacs-sim)
- AdonisJS v7 app with Inertia.js + Vue 3
- MongoDB integration
- CWMP/TR-069 state machine engine
- Configuration engine with compliance tracking
- Branding: ADAM ACS (favicon, navbar, locales)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-29 16:46:37 +02:00

28 lines
1015 B
TypeScript

import { MongoMigration } from '../mongo_migrator.js'
export default class CreateDevicesCollection extends MongoMigration {
async up(): Promise<void> {
const collection = this.db.collection('devices')
await collection.createIndex(
{
'deviceId.manufacturer': 1,
'deviceId.oui': 1,
'deviceId.productClass': 1,
'deviceId.serialNumber': 1,
},
{ unique: true, name: 'idx_deviceId_compound' }
)
await collection.createIndex({ identifier: 1 }, { unique: true, name: 'idx_identifier' })
await collection.createIndex({ 'deviceId.manufacturer': 1 }, { name: 'idx_manufacturer' })
await collection.createIndex({ 'deviceId.oui': 1 }, { name: 'idx_oui' })
await collection.createIndex({ 'deviceId.productClass': 1 }, { name: 'idx_productClass' })
await collection.createIndex({ 'deviceId.serialNumber': 1 }, { name: 'idx_serialNumber' })
}
async down(): Promise<void> {
await this.db.dropCollection('devices').catch(() => {})
}
}