mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 12:14:33 +01:00
@@ -5,7 +5,7 @@ export default class Locations extends BaseSchema {
|
||||
|
||||
public async up () {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id')
|
||||
table.increments('id').primary()
|
||||
table.string('place')
|
||||
table.string('left')
|
||||
table.date('since')
|
||||
|
||||
@@ -5,7 +5,7 @@ export default class Forms extends BaseSchema {
|
||||
|
||||
public async up () {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id')
|
||||
table.increments('id').primary()
|
||||
table.string('name')
|
||||
table.string('email')
|
||||
table.string('subject')
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
||||
|
||||
export default class GoldenMessages extends BaseSchema {
|
||||
protected tableName = 'golden_messages'
|
||||
|
||||
public async up () {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id')
|
||||
table.integer('user_id').notNullable()
|
||||
table.string('message')
|
||||
table.timestamps()
|
||||
})
|
||||
}
|
||||
|
||||
public async down () {
|
||||
this.schema.dropTable(this.tableName)
|
||||
}
|
||||
}
|
||||
22
database/migrations/1625146912533_guestbook_messages.ts
Normal file
22
database/migrations/1625146912533_guestbook_messages.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
||||
|
||||
export default class GuestbookMessages extends BaseSchema {
|
||||
protected tableName = 'guestbook_messages'
|
||||
|
||||
public async up() {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id').primary()
|
||||
table
|
||||
.integer('user_id')
|
||||
.unsigned()
|
||||
.references('users.id')
|
||||
.onDelete('CASCADE')
|
||||
table.string('message')
|
||||
table.timestamps(true, true)
|
||||
})
|
||||
}
|
||||
|
||||
public async down() {
|
||||
this.schema.dropTable(this.tableName)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user