为什么索引迁移错误?

时间:2017-12-13 10:40:37

标签: php laravel laravel-5

我有以下迁移:

  ncords = {}

  function genNodes(key) {
    var ns = []
    var c = 1
    var fn = { id: c, label: key, title: "Klikni za vrnitev na prejšnjo kategorijo" }
    var seen = {}
    c = c + 1
    ns.push(fn)

    var keyi = Object.keys(podatki).indexOf(key);

    for (var x in currentRows) {
      if (!Object.keys(seen).includes(currentRows[x][keyi])) {
        ns.push({ id: c, label: currentRows[x][keyi] })
        c = c + 1
        seen[currentRows[x][keyi]] = 1
      } else {
        seen[currentRows[x][keyi]]++
      }
    }

    for (var en in ns)
      ns[en].title = seen[ns[en].label];

    return new vis.DataSet(ns)
  }

  function genEdges(ns) {
    ed = []
    for (k in ns["_data"])
      if (k != 1)
        ed.push({ from: 1, to: k, arrows: 'to', length: 300 });

    for (var x = -1; x >= -prototypeKeys.length; x--)
      ed.push({ id: x, from: 0, to: x, arrows: 'to' });

    return new vis.DataSet(ed)
  }

  function centerNetwork() {

    network.moveTo({
      position: { x: -500, y: -400 },
      offset: { x: -width / 2, y: -height / 2 },
      scale: 1,
    })

    data.nodes.update({ id: 1, x: 0, y: 0 })
    ncords[1] = { x: 0, y: 0 }
    na = data.nodes.length
    //Conversion to radians
    angle = (360 / na) * 0.0174532925
    for (var k = 2; k <= na; k++) {
      var newx = Math.cos((k - 1) * angle) * -350
      var newy = Math.sin((k - 1) * angle) * 350
      data.nodes.update({ id: k, y: newy, x: newx })
      ncords[k] = { x: newx, y: newy }
    }

    var edgs = genEdges(nodes);

    network.setData({ nodes: data.nodes, edges: edgs })
    //network = new vis.Network(container,{ nodes: data.nodes, edges: edgs },options)
    //setEvents();
  }

  function updateNetwork() {
    console.log("next key used when updating " + currentKey)
    var nodes = genNodes(currentKey)
    data = { nodes: nodes, edges: genEdges(nodes) }
    //network = new vis.Network(container, data, options);
    network.setData(data)
    centerNetwork();
  }

  function updateTable() {
    var insides = document.getElementById("table1").innerHTML
    for (var k in currentRows)
      var en = currentRows[k]
  }

  function deleteFlower() {
    openSubselection = false;
    openNode = null;
    for (var j in data.nodes["_data"]) {
      var node = data.nodes["_data"][j];
      if (node.id < 0) {
        data.nodes.remove(node.id)
        data.edges.update({ id: node.id, })
      }
    }
  }

  function genAvailable(aks, id) {
    var neav = [];
    for (var k = 0; k < aks.length; k++) {
      if (k == id) {
        neav[k] = { name: aks[k], available: false };
      } else {
        neav[k] = { name: aks[k], available: true };
      }
    }

    return neav;
  }

但是当我尝试命令时

public function up()
{
    Schema::table('a_delivery_pec_pickup_coef', function(Blueprint $table) {
        $table->index(['location_id', 'weight_limit'], 'location_id_weight_limit_index');
    });
}

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::table('a_delivery_pec_pickup_coef', function(Blueprint $table) {
        $table->dropIndex('location_id_weight_limit_index');
    });
}

我收到错误:

  

语法错误或访问冲突:1091 DROP&#39; location_id_weight_limit_index&#39 ;;   检查列/密钥是否存在

0 个答案:

没有答案