anchor.diff:                  )''');
     }
   
  -  void _updateTableServerV1toV4(Batch batch) {
  +  void _updateTableServerV1toV5(Batch batch) {
       batch.execute('ALTER TABLE servers ADD plex_pass INTEGER');
       batch.execute('ALTER TABLE servers ADD date_format TEXT');
       batch.execute('ALTER TABLE servers ADD time_format TEXT');
       batch.execute('ALTER TABLE servers ADD plex_identifier TEXT');
  -  }
  -
  -  void _updateTableServerV2toV4(Batch batch) {
  +    batch.execute('ALTER TABLE servers ADD sort_index INTEGER');
  +  }
  +
  +  void _updateTableServerV2toV5(Batch batch) {
       batch.execute('ALTER TABLE servers ADD date_format TEXT');
       batch.execute('ALTER TABLE servers ADD time_format TEXT');
       batch.execute('ALTER TABLE servers ADD plex_identifier TEXT');
  -  }
  -
  -  void _updateTableServerV3toV4(Batch batch) {
  +    batch.execute('ALTER TABLE servers ADD sort_index INTEGER');
  +  }
  +
  +  void _updateTableServerV3toV5(Batch batch) {
       batch.execute('ALTER TABLE servers ADD plex_identifier TEXT');
  +    batch.execute('ALTER TABLE servers ADD sort_index INTEGER');
  +  }
  +
  +  void _updateTableServerV4toV5(Batch batch) {
  +    batch.execute('ALTER TABLE servers ADD sort_index INTEGER');
  +  }
  +
  +  Future<void> _addInitialIndexValue(Database db, Batch batch) async {
  +    var servers = await db.query('servers');
  +    for (var i = 0; i <= servers.length - 1; i++) {
  +      batch.update(
  +        'servers',
  +        {'sort_index': i},
  +        where: 'id = ?',
  +        whereArgs: [servers[i]['id']],
  +      );
  +    }
     }
   
     addServer(ServerModel server) async {
  
positive.code: 
    deleteServer(int id) async {
      final db = await database;
  
      db.delete('servers', where: 'id = ?', whereArgs: [id]);
    }
  
    updateServer(ServerModel server) async {
  
negative.code: 
      return await openDatabase(
        path,
        version: 5,
        onOpen: (db) async {},
        onCreate: (Database db, int version) async {
          var batch = db.batch();
          _createTableServerV5(batch);
          await batch.commit();
        },
        onUpgrade: (Database db, int oldVersion, int newVersion) async {
          var batch = db.batch();
          if (oldVersion == 1) {
            _updateTableServerV1toV5(batch);
            await _addInitialIndexValue(db, batch);
          }
          if (oldVersion == 2) {
            _updateTableServerV2toV5(batch);
            await _addInitialIndexValue(db, batch);
          }
          if (oldVersion == 3) {
            _updateTableServerV3toV5(batch);
            await _addInitialIndexValue(db, batch);
          }
          if (oldVersion == 4) {
            _updateTableServerV4toV5(batch);
            await _addInitialIndexValue(db, batch);
          }
          await batch.commit();
        },
      );
    }
  
    void _createTableServerV5(Batch batch) {
      batch.execute('''CREATE TABLE servers(
                      id INTEGER PRIMARY KEY,
                      sort_index INTEGER,
                      plex_name TEXT,
                      plex_identifier TEXT,
                      tautulli_id TEXT,
  