export async function up(knex: Knex) { if(await knex.schema.hasTable('teachers')){ await knex.schema.alterTable('teachers',(table)=>{ table.renameColumn("name","teacher_name"); table.decimal("level",3).alter(); }); } }; export async function down(knex: Knex) { if(await knex.schema.hasTable("teachers")){ await knex.schema.alterTable('teachers',(table)=>{ table.renameColumn("teacher_name","name"); table.string("level").alter(); }); } };
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter