refactor: controllers and models to adapt them to the previous version of my-links

This commit is contained in:
Sonny
2024-05-24 23:54:43 +02:00
committed by Sonny
parent 31b4f22772
commit b28499a69a
19 changed files with 113 additions and 85 deletions

View File

@@ -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);
}
}