All files / services/blog/migrations 20200607003345_init.ts

0% Statements 0/10
100% Branches 0/0
0% Functions 0/3
0% Lines 0/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19                                     
import * as Knex from "knex";
 
export async function up(knex: Knex): Promise<any> {
  await knex.schema.createTable("blog_posts", function(table) {
    table.string("postId").primary();
 
    table.string("title").notNullable();
    table.string("summary", 1024).notNullable();
    table.text("content").notNullable();
 
    table.dateTime("updatedAt").notNullable();
    table.dateTime("createdAt").notNullable();
  });
}
 
export async function down(knex: Knex): Promise<any> {
  await knex.schema.dropTable("blog_posts");
}