mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 07:03:25 +00:00
refactor: controllers and models to adapt them to the previous version of my-links
This commit is contained in:
@@ -1,27 +1,26 @@
|
||||
import { defaultTableFields } from '#database/default_table_fields';
|
||||
import { BaseSchema } from '@adonisjs/lucid/schema';
|
||||
|
||||
export default class extends BaseSchema {
|
||||
protected tableName = 'users';
|
||||
export default class CreateUsersTable extends BaseSchema {
|
||||
static tableName = 'users';
|
||||
|
||||
async up() {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.uuid('id').primary().unique().notNullable();
|
||||
|
||||
this.schema.createTableIfNotExists(CreateUsersTable.tableName, (table) => {
|
||||
table.string('email', 254).notNullable().unique();
|
||||
table.string('name', 254).notNullable();
|
||||
table.string('nick_name', 254).notNullable();
|
||||
table.string('nick_name', 254).nullable();
|
||||
table.text('avatar_url').notNullable();
|
||||
table.boolean('is_admin').defaultTo(0).notNullable();
|
||||
|
||||
table.json('token').notNullable();
|
||||
table.json('token').nullable();
|
||||
table.string('provider_id').notNullable();
|
||||
table.enum('provider_type', ['google']).notNullable().defaultTo('google');
|
||||
|
||||
table.timestamp('created_at').notNullable();
|
||||
table.timestamp('updated_at').nullable();
|
||||
defaultTableFields(table);
|
||||
});
|
||||
}
|
||||
|
||||
async down() {
|
||||
this.schema.dropTable(this.tableName);
|
||||
this.schema.dropTable(CreateUsersTable.tableName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user