mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-27 18:10:27 +01:00
Added Experiences and Formations
This commit is contained in:
25
database/migrations/1629143076777_experiences.ts
Normal file
25
database/migrations/1629143076777_experiences.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
||||
|
||||
export default class Experiences extends BaseSchema {
|
||||
protected tableName = 'experiences'
|
||||
|
||||
public async up () {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id').primary()
|
||||
table
|
||||
.increments('title_id')
|
||||
.unsigned()
|
||||
.references('translations.id')
|
||||
.onDelete('CASCADE')
|
||||
table.string('company').notNullable()
|
||||
table.string('location').notNullable()
|
||||
table.string('begin_date').notNullable()
|
||||
table.string('end_date').defaultTo('Today').notNullable()
|
||||
table.timestamps(true, true)
|
||||
})
|
||||
}
|
||||
|
||||
public async down () {
|
||||
this.schema.dropTable(this.tableName)
|
||||
}
|
||||
}
|
||||
29
database/migrations/1629145139594_formations.ts
Normal file
29
database/migrations/1629145139594_formations.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
||||
|
||||
export default class Formations extends BaseSchema {
|
||||
protected tableName = 'formations'
|
||||
|
||||
public async up () {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id').primary()
|
||||
table
|
||||
.integer('title_id')
|
||||
.unsigned()
|
||||
.references('translations.id')
|
||||
.onDelete('CASCADE')
|
||||
table
|
||||
.integer('description_id')
|
||||
.unsigned()
|
||||
.references('translations.id')
|
||||
.onDelete('CASCADE')
|
||||
table.string('location').notNullable()
|
||||
table.string('begin_date').notNullable()
|
||||
table.string('end_date').defaultTo('Today').notNullable()
|
||||
table.timestamps(true, true)
|
||||
})
|
||||
}
|
||||
|
||||
public async down () {
|
||||
this.schema.dropTable(this.tableName)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user