用类似自然的created_at播种Knex.js

问题描述

为种子文件提供一些数据。

exports.seed = function(knex) {
  return knex('table_name').del() 
    .then(function () {
      // Inserts seed entries
      return knex('table_name').insert([
        {id: 1,colName: 'rowValue1'},{id: 2,colName: 'rowValue2'},{id: 3,colName: 'rowValue3'}
      ]);
    });
};

问题在于每一行都将具有相同的created_at值。如何用更自然的时间戳填充?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)