diff options
Diffstat (limited to 'database/migrations/1566554231482_recipe_schema.ts')
-rw-r--r-- | database/migrations/1566554231482_recipe_schema.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/database/migrations/1566554231482_recipe_schema.ts b/database/migrations/1566554231482_recipe_schema.ts new file mode 100644 index 0000000..3a9784d --- /dev/null +++ b/database/migrations/1566554231482_recipe_schema.ts | |||
@@ -0,0 +1,19 @@ | |||
1 | import BaseSchema from '@ioc:Adonis/Lucid/Schema'; | ||
2 | |||
3 | export default class extends BaseSchema { | ||
4 | protected tableName = 'recipes'; | ||
5 | |||
6 | public async up(): Promise<void> { | ||
7 | this.schema.createTable(this.tableName, table => { | ||
8 | table.increments(); | ||
9 | table.string('name', 80).notNullable(); | ||
10 | table.string('recipeId', 254).notNullable().unique(); | ||
11 | table.json('data'); | ||
12 | table.timestamps(); | ||
13 | }); | ||
14 | } | ||
15 | |||
16 | public async down(): Promise<void> { | ||
17 | this.schema.dropTable(this.tableName); | ||
18 | } | ||
19 | } | ||