@buttersolutions/phanti

中文文档
0.2.0发布于 2022/04/13ISCCommonJS近 30 天下载 2.1万

Utilitary CLI to run mongo migrations using mongoose and typrescript

原始使用文档
文档目录4 节
  1. Installation
  2. Migration
  3. How to create a migration
  4. How to run migrations

Phanti

Phanti is an online migration tool for MongoDB using typescript. Currenty, it only supports migration, but later it will also support seeding.

Installation

To install our CLI, you can run:

npm install --global @buttersolutions/phanti ts-node

Migration

Migration are used to track the schema changes in our database. Although MongoDB is a document based database, not having track to what were the schema changes and possible reverts to those could lead to errors.

How to create a migration

NOTE: First you need to create a migration directory on the root of your project

To create a migration, simply run:

phanti migration create <name>

For example

phanti migration create add-users-surname

The command above will create the file migrations/<timestamp>-add-users-surname.ts with a template so you can write your migrations.

How to run migrations

NOTE: An example on how to write migration is in the examples directory on this repostitory

To run all available migrations, simply run:

phanti migration run -d "<database_url>"

The command above will run all migrations that haven't been run yet according to the MetadataMigration collection in your database, which are all the migrations created after the last saved date on the collection metioned above.

版本与发布记录

@buttersolutions/phanti 共发布 5 个版本,首次发布于 2022/03/28;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.2.0latest2022/04/134 年前
0.1.12022/04/054 年前
0.1.02022/03/314 年前
0.0.22022/03/314 年前
0.0.12022/03/284 年前

关于 @buttersolutions/phanti 的常见问题

@buttersolutions/phanti 是什么?

Utilitary CLI to run mongo migrations using mongoose and typrescript

如何安装 @buttersolutions/phanti?

在项目目录运行 npm install @buttersolutions/phanti,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 phanti,可以用 npx phanti 直接运行。

@buttersolutions/phanti 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/buttersolutions__phanti 是否存在。

@buttersolutions/phanti 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@buttersolutions/phanti 可以商用吗?

@buttersolutions/phanti 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@buttersolutions/phanti 的下载量有多少?

根据 npm 官方下载统计,@buttersolutions/phanti 在 2026/10/09 – 2026/11/07 这 30 天内被下载 21,315 次,日均约 711 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@buttersolutions/phanti 还在维护吗?

最新版本 0.2.0 发布于 2022/04/13(4 年前);至今共发布 5 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/03/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。