aboutsummaryrefslogtreecommitdiffstats
path: root/database/migrations/1566554231482_recipe_schema.ts
blob: 3a9784ddc510fc4131bcc2a9c169e4a006298f0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import BaseSchema from '@ioc:Adonis/Lucid/Schema';

export default class extends BaseSchema {
  protected tableName = 'recipes';

  public async up(): Promise<void> {
    this.schema.createTable(this.tableName, table => {
      table.increments();
      table.string('name', 80).notNullable();
      table.string('recipeId', 254).notNullable().unique();
      table.json('data');
      table.timestamps();
    });
  }

  public async down(): Promise<void> {
    this.schema.dropTable(this.tableName);
  }
}