如何 运行 意外删除的特定迁移 table
How to run a specific migration of an accidentally dropped table
我在使用 mysql 命令行时不小心掉了一个 table。幸运的是 table 是空的。
但我需要这个 table 回来。所以我想重新 运行 只迁移那个 table,而不是其他 table,因为它们仍然存在。
当我运行knex migrate:latest
时,它returns"Already up to date"。如果我 npm run migrate name-of-specific-miration-file
.
也一样
我用的是knex。我怎样才能 运行 只有我想要的特定迁移文件 运行?
我通过以下操作让它工作:
- 在 MySql 命令行上:
create table my_table_name (hello text);
- 在终端中:
knex migrate:down name_of_migration_file.js
- 在终端中:
knex migrate:up name_of_migration_file.js
我在使用 mysql 命令行时不小心掉了一个 table。幸运的是 table 是空的。
但我需要这个 table 回来。所以我想重新 运行 只迁移那个 table,而不是其他 table,因为它们仍然存在。
当我运行knex migrate:latest
时,它returns"Already up to date"。如果我 npm run migrate name-of-specific-miration-file
.
我用的是knex。我怎样才能 运行 只有我想要的特定迁移文件 运行?
我通过以下操作让它工作:
- 在 MySql 命令行上:
create table my_table_name (hello text);
- 在终端中:
knex migrate:down name_of_migration_file.js
- 在终端中:
knex migrate:up name_of_migration_file.js