Let's say I have such piece of code:
exports.up = function(knex, Promise) {
return knex.schema
.createTable('test', table => {
table.uuid('id').primary();
})
};
This is just simple migration and it works correctly, but what I want is to look at SQL query using .toSQ() method. This method works while requests to DB using Knex.js, but how to do that while migrations?
When I was trying to add just .toSQL() at the end of the code, I had such error:
migration 20211101093701_test.js did not return a promise
Also I was trying to made function async like:
exports.up = async function(knex, Promise) {
return knex.schema
.createTable('test', table => {
table.uuid('id').primary();
}).toSQL();
};
But it works just like common migration. How can I add this .toSQL() method?