mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-26 01:20:27 +01:00
Rework migrations schemes
This commit is contained in:
@@ -6,9 +6,9 @@ export default class Locations extends BaseSchema {
|
|||||||
public async up () {
|
public async up () {
|
||||||
this.schema.createTable(this.tableName, (table) => {
|
this.schema.createTable(this.tableName, (table) => {
|
||||||
table.increments('id').primary()
|
table.increments('id').primary()
|
||||||
table.string('place')
|
table.string('place').notNullable()
|
||||||
table.string('left')
|
table.string('left').notNullable()
|
||||||
table.date('since')
|
table.date('since').notNullable()
|
||||||
table.timestamps(true, true)
|
table.timestamps(true, true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,15 @@ export default class Projects extends BaseSchema {
|
|||||||
public async up () {
|
public async up () {
|
||||||
this.schema.createTable(this.tableName, (table) => {
|
this.schema.createTable(this.tableName, (table) => {
|
||||||
table.increments('id').primary()
|
table.increments('id').primary()
|
||||||
table.string('name')
|
table.string('name').notNullable()
|
||||||
table.string('description')
|
table.string('description').notNullable()
|
||||||
table.string('url')
|
table.string('url').notNullable()
|
||||||
table.integer('progress')
|
table.integer('progress').notNullable()
|
||||||
|
table
|
||||||
|
.integer('file_id')
|
||||||
|
.unsigned()
|
||||||
|
.references('files.id')
|
||||||
|
.onDelete('CASCADE')
|
||||||
table.timestamps(true, true)
|
table.timestamps(true, true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ export default class Forms extends BaseSchema {
|
|||||||
public async up () {
|
public async up () {
|
||||||
this.schema.createTable(this.tableName, (table) => {
|
this.schema.createTable(this.tableName, (table) => {
|
||||||
table.increments('id').primary()
|
table.increments('id').primary()
|
||||||
table.string('name')
|
table.string('name').notNullable()
|
||||||
table.string('email')
|
table.string('email').notNullable()
|
||||||
table.string('subject')
|
table.string('subject').notNullable()
|
||||||
table.string('content')
|
table.string('content').notNullable()
|
||||||
table.timestamps(true, true)
|
table.timestamps(true, true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ export default class Users extends BaseSchema {
|
|||||||
table.increments('id').primary()
|
table.increments('id').primary()
|
||||||
table.string('username', 255).notNullable()
|
table.string('username', 255).notNullable()
|
||||||
table.string('email', 255).notNullable()
|
table.string('email', 255).notNullable()
|
||||||
table.string('password', 180).defaultTo(this.randomPassword()).notNullable()
|
table
|
||||||
|
.string('password', 180)
|
||||||
|
.defaultTo(this.randomPassword())
|
||||||
|
.notNullable()
|
||||||
table.boolean('is_confirmed').defaultTo(false).notNullable()
|
table.boolean('is_confirmed').defaultTo(false).notNullable()
|
||||||
table.string('remember_me_token').defaultTo(null).nullable()
|
table.string('remember_me_token').defaultTo(null).nullable()
|
||||||
table.string('confirmation_token').defaultTo(null).nullable()
|
table.string('confirmation_token').defaultTo(null).nullable()
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ export default class ApiTokens extends BaseSchema {
|
|||||||
public async up () {
|
public async up () {
|
||||||
this.schema.createTable(this.tableName, (table) => {
|
this.schema.createTable(this.tableName, (table) => {
|
||||||
table.increments('id').primary()
|
table.increments('id').primary()
|
||||||
table.integer('user_id').unsigned().references('id').inTable('users').onDelete('CASCADE')
|
table.integer('user_id')
|
||||||
|
.unsigned()
|
||||||
|
.references('id')
|
||||||
|
.inTable('users')
|
||||||
|
.onDelete('CASCADE')
|
||||||
table.string('name').notNullable()
|
table.string('name').notNullable()
|
||||||
table.string('type').notNullable()
|
table.string('type').notNullable()
|
||||||
table.string('token', 64).notNullable()
|
table.string('token', 64).notNullable()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export default class GuestbookMessages extends BaseSchema {
|
|||||||
.unsigned()
|
.unsigned()
|
||||||
.references('users.id')
|
.references('users.id')
|
||||||
.onDelete('CASCADE')
|
.onDelete('CASCADE')
|
||||||
table.text('message')
|
table.text('message').notNullable()
|
||||||
table.timestamps(true, true)
|
table.timestamps(true, true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export default class Translations extends BaseSchema {
|
|||||||
|
|
||||||
public async up () {
|
public async up () {
|
||||||
this.schema.createTable(this.tableName, (table) => {
|
this.schema.createTable(this.tableName, (table) => {
|
||||||
table.increments('id')
|
table.increments('id').primary()
|
||||||
table.string('code').notNullable()
|
table.string('code').notNullable()
|
||||||
table.string('french').defaultTo('Traduction manquante')
|
table.string('french').defaultTo('Traduction manquante')
|
||||||
table.string('english').defaultTo('Missing translation')
|
table.string('english').defaultTo('Missing translation')
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
|
||||||
|
|
||||||
export default class Projects extends BaseSchema {
|
|
||||||
protected tableName = 'projects'
|
|
||||||
|
|
||||||
public async up () {
|
|
||||||
this.schema.table(this.tableName, (table) => {
|
|
||||||
table.integer('file_id').unsigned().references('files.id').onDelete('CASCADE')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
public async down () {
|
|
||||||
this.schema.table(this.tableName, (table) => {
|
|
||||||
table.dropColumn('file_id')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,8 +5,8 @@ export default class Announces extends BaseSchema {
|
|||||||
|
|
||||||
public async up () {
|
public async up () {
|
||||||
this.schema.createTable(this.tableName, (table) => {
|
this.schema.createTable(this.tableName, (table) => {
|
||||||
table.increments('id')
|
table.increments('id').primary()
|
||||||
table.string('color')
|
table.string('color').notNullable()
|
||||||
table.string('hover_color')
|
table.string('hover_color')
|
||||||
table
|
table
|
||||||
.integer('translation_id')
|
.integer('translation_id')
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ export default class Skills extends BaseSchema {
|
|||||||
|
|
||||||
public async up () {
|
public async up () {
|
||||||
this.schema.createTable(this.tableName, (table) => {
|
this.schema.createTable(this.tableName, (table) => {
|
||||||
table.increments('id')
|
table.increments('id').primary()
|
||||||
table.string('name')
|
table.string('name').notNullable()
|
||||||
table
|
table
|
||||||
.integer('file_id')
|
.integer('file_id')
|
||||||
.unsigned()
|
.unsigned()
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export default class Informations extends BaseSchema {
|
|||||||
|
|
||||||
public async up () {
|
public async up () {
|
||||||
this.schema.createTable(this.tableName, (table) => {
|
this.schema.createTable(this.tableName, (table) => {
|
||||||
table.increments('id')
|
table.increments('id').primary()
|
||||||
table.integer('age').notNullable()
|
table.integer('age').notNullable()
|
||||||
table
|
table
|
||||||
.integer('translation_id')
|
.integer('translation_id')
|
||||||
|
|||||||
Reference in New Issue
Block a user