// These functions needed to be changed to `async`. // not necessary, but very helpful! /** * @param { import("knex").Knex } knex * @returns { Promise } */ exports.up = async function (knex) { // if table alreay if (await knex.schema.hasTable("note")) return; await knex.schema.createTable("note", (table) => { table.increments("id"); table.string("title"); table.string("text"); table.datetime("created"); }); }; /** * @param { import("knex").Knex } knex * @returns { Promise } */ exports.down = async function (knex) { if (! (await knex.schema.hasTable("note"))) return; await knex.schema.dropTable("note"); };