From 21ba7b89c0b185ef1e6878ebd02df21af8c51ed6 Mon Sep 17 00:00:00 2001 From: Michal Kostewicz Date: Sat, 6 Feb 2021 19:55:27 +0100 Subject: Add lastname column to User DB table and update API logic to save,return and update this data. --- .../migrations/1612629845398_users_update_schema.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 database/migrations/1612629845398_users_update_schema.js (limited to 'database/migrations/1612629845398_users_update_schema.js') diff --git a/database/migrations/1612629845398_users_update_schema.js b/database/migrations/1612629845398_users_update_schema.js new file mode 100644 index 0000000..d07f66d --- /dev/null +++ b/database/migrations/1612629845398_users_update_schema.js @@ -0,0 +1,20 @@ +'use strict' + +/** @type {import('@adonisjs/lucid/src/Schema')} */ +const Schema = use('Schema') + +class UsersUpdateSchema extends Schema { + up() { + this.table('users', (table) => { + table.string('lastname', 80).notNullable().default(''); + }) + } + + down() { + this.table('users', (table) => { + table.dropColumn('lastname') + }) + } +} + +module.exports = UsersUpdateSchema \ No newline at end of file -- cgit v1.2.3-54-g00ecf