Comments (4)
fixed by
TS_NODE_DEV=1 tsx src/index.ts up
lol
from mongo-migrate-ts.
User
tsx src/index.ts new
instead of mongo-migrate
command and src/index.ts
like
import { mongoMigrateCli } from 'mongo-migrate-ts';
mongoMigrateCli({
uri: 'mongodb://username:[email protected]:27017',
database: 'db',
migrationsDir: __dirname + '/../migrations',
migrationsCollection: 'migrations_collection',
});
finally to apply migrations
tsx src/index.ts up
from mongo-migrate-ts.
I tested and it does not works with tsx
.
Problem is with migrations detection because of line
const fileExt = (0, isTsNode_1.isTsNode)() ? new RegExp(/\.ts$/i) : new RegExp(/\.js$/i);
in loadMigrations
function.
Ther is js
extension detected in tsx
because of output of function isTsNode_1.isTsNode
where
const isTsNode_1 = require("./utils/isTsNode");
which is implemented as
const isTsNode = () => {
const symbol = Symbol.for('ts-node.register.instance');
return !!process[symbol] || !!process.env.TS_NODE_DEV;
};
from mongo-migrate-ts.
Yes, it supports ts-node, I haven't tried tsx, but I think this is a good workaround
from mongo-migrate-ts.
Related Issues (20)
- Migrate process fails with replica set connection string HOT 1
- ERR_REQUIRE_ESM after installing globally HOT 4
- Run up and down programatically? HOT 1
- Error: Cannot find module 'mongodb' HOT 4
- Use .env variable to set a DB URI HOT 7
- Sample migration file HOT 1
- Error executing migrations HOT 1
- No migrations found HOT 2
- Transactions support HOT 4
- Down Function does not seem to work HOT 1
- add glob option to pick migrations HOT 3
- Can't be used from CI/CD platform (always returns a zero exit code) HOT 1
- The automated release is failing 🚨
- No migrations found HOT 3
- Add nested migration directories support HOT 2
- Migrations exception handling HOT 1
- Support for .env?
- MongoDB version constraint HOT 2
- Custom timestamp format for files generated by command "new" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongo-migrate-ts.