TopGit theo dõi meteor/meteor-migrations trên GitHub, đã đạt 243 sao. Simple migration system for Meteor
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
A simple migration system for Meteor supporting up/downwards migrations and command line usage. There is also a fork available for use outside of Meteor.
Installation
Meteor Migrations can be installed through Meteor's package manager. Type:
$ meteor add percolate:migrations
API
Basics
To write a simple migration, somewhere in the server section of your project define:
Migrations.add({
version: 1,
up: function() {//code to migrate up to version 1}
});
A more complete set of migrations might look like:
Migrations.add({
version: 1,
name: 'Adds pants to some people in the db.',
up: function() {//code to migrate up to version 1}
down: function() {//code to migrate down to version 0}
});
Migrations.add({
version: 2,
name: 'Adds a hat to all people in the db who are wearing pants.',
up: function() {//code to migrate up to version 2}
down: function() {//code to migrate down to version 1}
});
As in 'Basics', you can migrate to the latest by running:
Note: Migrations should be run from Meteor.startup to allow for log output configuration.
By specifying a version, you can migrate directly to that version (if possible). The migrations system will automatically determine which direction to migrate in.
In the above example, you could migrate directly to version 2 by running:
Migrations.migrateTo(2);
If you wanted to undo all of your migrations, you could migrate back down to version 0 by running:
Migrations.migrateTo(0);
Sometimes (usually when somethings gone awry), you may need to re-run a migration. You can do this with the rerun subcommand, like:
Migrations.migrateTo('3,rerun');
NOTE: You cannot create your own migration at version 0. This version is reserved by migrations for a 'vanilla' system, that is, one without any migrations applied.
To see what version the database is at, call:
Migrations.getVersion();
Configuration
You can configure Migrations with the config method. Defaults are:
Migrations.config({
// Log job run details to console
log: true,
// Use a custom logger function (defaults to Meteor's logging package)
logger: null,
// Enable/disable logging "Not migrating, already at version {number}"
logIfLatest: true,
// migrations collection name to use in the database
collectionName: "migrations"
});
Logging
Migrations uses Meteor's logging package by default. If you want to use your
own logger (for sending to other consumers or similar) you can do so by
configuring the logger option.
Migrations expects a function as logger, and will pass arguments to it for
you to take action on.
The opts object passed to MyLogger above includes level, message, and tag.
level will be one of info, warn, error, debug.
message is something like Finished migrating..
tag will always be "Migrations" (handy for filtering).
Custom collection name
By default, the collection name is migrations. There may be cases where this is inadequate such as using the same Mongo database for multiple Meteor applications that each have their own set of migrations that need to be run.
Command line use
*** DEPRECATED ***
This info is for pre 0.9 users as post 0.9 the migrate.sh script is no longer included in the package folder.
You can also run migrations from the command line using the included shell script. This will
Migrations set a lock when they are migrating, to prevent multiple instances of your clustered app from running migrations simultaneously. If your migrations throw an exception, you will need to manually remove the lock (and ensure your db is still consistent) before re-running the migration.
From the mongo shell update the migrations collection like this:
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/meteor/meteor-migrations là nguồn chính thức.
meteor/meteor-migrations có bao nhiêu sao?
meteor/meteor-migrations có 243 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/meteor/meteor-migrations. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
meteor/meteor-migrations có những chủ đề gì?
GitHub topics của meteor/meteor-migrations: "hacktoberfest", "meteor". TopGit xếp repo vào nhóm mã nguồn mở.
meteor/meteor-migrations có phải mã nguồn mở không?
Có — meteor/meteor-migrations phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/meteor/meteor-migrations.
meteor/meteor-migrations có trang demo không?
Dự án có trang chủ ở https://atmospherejs.com/percolate/migrations. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
meteor/meteor-migrations còn đang phát triển không?
Commit gần nhất trên meteor/meteor-migrations là 8 tháng trước (theo timestamp GitHub). Repo có 58 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc đầy đủ README ở tab phía trên.
meteor-migrations có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về meteor-migrations.