npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@structure-ai/migrations

v0.0.9

Published

Versioned, ordered SQL migrations on @effect/sql Migrator: in-code Effect migrations, status reporting, CLI command group, explicit startup layer.

Readme

@structure-ai/migrations

Versioned, ordered, forward-only SQL migrations on @effect/sql's Migrator. Dialect-agnostic: the package depends only on @effect/sql, and apps provide whichever SqlClient layer they already use (@effect/sql-sqlite-bun, @effect/sql-pg, ...). Applied migrations are recorded in a bookkeeping table; concurrent runners are lock-protected, so a second runner fails instead of double-applying.

There is no down: per the delivery policy, irreversible changes roll forward with a new migration, never a rollback. Each run invocation is one transaction — if any migration in the batch fails, the whole batch rolls back (all-or-nothing), and the failure surfaces as a fatal defect rather than a recoverable error.

Usage

import * as SqlClient from "@effect/sql/SqlClient";
import { defineMigration, layer, makeSet, run } from "@structure-ai/migrations";
import { Effect } from "effect";

const migrations = makeSet([
  defineMigration(1, "create_users",
    Effect.flatMap(SqlClient.SqlClient, (sql) => sql`CREATE TABLE users (id TEXT PRIMARY KEY)`)),
  defineMigration(2, "add_email",
    Effect.flatMap(SqlClient.SqlClient, (sql) => sql`ALTER TABLE users ADD COLUMN email TEXT`)),
]);

// explicit run (deploy job, single writer's startup):
const applied = yield* run(migrations);
// or as a layer in the ONE process allowed to migrate:
const MigrateLayer = layer(migrations);

CLI integration (subpath export, pairs with @structure-ai/cli):

import { migrationsCommand } from "@structure-ai/migrations/cli";
// <app> migrations up | <app> migrations status
const cmd = migrationsCommand(migrations);

Exports

| Export | What it is | | --- | --- | | defineMigration(id, name, up) | One forward migration; up is an Effect using SqlClient. Ids are integers ≥ 1, ordered. | | makeSet(migrations) | Validates (unique ids, listing every problem) and orders the set. | | run(set, { table? }) | Applies pending migrations in order; returns the [id, name] pairs applied. Creates the bookkeeping table when missing — safe as the very first run on a fresh database. Fails with the library's MigrationError (locked, failed, ...). | | layer(set, options?) | Runs migrations during layer construction — include it only in the process explicitly allowed to migrate. | | status(set, options?) | { applied, pending } report; a missing bookkeeping table reads as nothing applied. | | migrationsCommand(set, options?) (from ./cli) | Ready-made migrations up / migrations status command group. |

For incompatible schema changes follow expand → migrate/backfill → switch readers/writers → contract, each step its own migration.