
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
digit-migrate
Advanced tools
DigitCave provides a simple and flexible migration runner for managing SQL database schemas across multiple services. This document explains the entry script used to run migrations.
migrate.ts
#!/usr/bin/env ts-node
import dotenv from "dotenv";
dotenv.config();
import { authenticationDB, servicesDB } from "./config/db";
import { Schema } from "./config/migration/Schema";
import { Project } from "./entities/Project";
import { User } from "./entities/User";
export async function migrate() {
Schema.init({
dbConnections: {
default: servicesDB,
authentication: authenticationDB,
},
dialects: {
default: "mysql",
authentication: "mysql",
},
verbose: true,
shouldLog: false,
useBatch: true,
shouldSyncAll: true,
schemasWithFlags: [
{ fn: () => User.sync(), shouldSync: true },
{ fn: () => Project.sync(), shouldSync: true },
],
});
console.log("🚀 Starting schema migrations...");
await Schema.syncMarkedSchemas();
console.log("🎉 Migrations finished.");
}
migrate().catch((err) => {
console.error("❌ Migration failed:", err);
process.exit(1);
});
Environment Setup
Loads database credentials from .env
file using dotenv
.
Database Connections Two connections are configured:
servicesDB
→ The default databaseauthenticationDB
→ The authentication databaseSchema Initialization
The Schema.init()
method configures:
verbose
, shouldLog
)useBatch
, shouldSyncAll
)schemasWithFlags
)Migration Execution
Schema.syncMarkedSchemas()
runs all models flagged with shouldSync: true
.ts-node migrate.ts
Or, if installed globally / via npx
:
digitcave migrate
.env
fileDB_HOST=localhost
DB_USER=root
DB_PASSWORD=secret
DB_NAME=services
AUTH_DB_NAME=auth
🚀 Starting schema migrations...
🎉 Migrations finished.
If something fails:
❌ Migration failed: Error: Connection refused
./entities
:export class Product {
static async sync() {
console.log("🔄 Syncing Product schema...");
// schema logic here
}
}
migrate.ts
:schemasWithFlags: [
{ fn: () => User.sync(), shouldSync: true },
{ fn: () => Project.sync(), shouldSync: true },
{ fn: () => Product.sync(), shouldSync: true },
],
ts-node migrate.ts
Add a bin
entry in package.json
to run as a global tool:
"bin": {
"digitcave": "./migrate.ts"
}
Then:
npm install -g .
digitcave migrate
FAQs
DigitCave is a lightweight migration and database ORM for SQL databases.
The npm package digit-migrate receives a total of 30 weekly downloads. As such, digit-migrate popularity was classified as not popular.
We found that digit-migrate demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.