initial commit.
This commit is contained in:
27
migrations/20240112194240_first.js
Normal file
27
migrations/20240112194240_first.js
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
// These functions needed to be changed to `async`.
|
||||
// not necessary, but very helpful!
|
||||
|
||||
/**
|
||||
* @param { import("knex").Knex } knex
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
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<void> }
|
||||
*/
|
||||
exports.down = async function (knex) {
|
||||
if (! (await knex.schema.hasTable("note"))) return;
|
||||
await knex.schema.dropTable("note");
|
||||
};
|
Reference in New Issue
Block a user