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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@whi/dbv

v0.1.1

Published

An agnostic database versioning tool designed for predictable upgrading/downgrading of database schema and content

Downloads

2

Readme

#+SETUPFILE: https://mjbrisebois.github.io/org-html-themes/setup/theme-readtheorg.setup

#+TITLE: Database Version Management (dbv) #+SUBTITLE: Command line tool for safely running migration scripts #+DESCRIPTION: Command line tool for safely running migration scripts

#+AUTHOR: Matthew Brisebois #+EMAIL: [email protected]

#+HTML_LINK_HOME: ./index.html #+HTML_LINK_UP: ./index.html

  • Overview

    A database agnostic version control framework with deterministic state detection.

** How does it work?

~./revisions~ directory. Files are sorted by a timestamp

** Rules / Guidelines

Inspired by [[https://odetocode.com/blogs/scott/archive/2008/02/02/versioning-databases-change-scripts.aspx][K. Scott Allen - Versioning databases: change scripts]]

  1. Database migration must be tracked with source control. This will ensure that developers properly merge and resolve conflicting database migrations before updating the production branch.
  2. Once a script is published into the master (production) branch, it cannot be changed! Someone who is running a production version of the database must never have to uninstall an update.
  3. Shared databases must have shared version tracking. The responsibility of updating the version should reside with the tool that applies the updates.
  4. Always backup a production database before applying a change script. If a change script happens to fail with an error, you can at least get the database back into a known state.
  5. Every upgrade should have validation tests to confirm it's success.

*** Immutable update files

The contents of an update file should be hashed and (manually) saved.  When doing a rollback,
the hash can be compared to verify that the update file is indeed the same as when the update
was executed.

*** The database context

To remain completely agnostic, the database connection should be defined in the initial
configuration and passed to each method as the the context.  There will be no assumptions about
the database and no API for interacting with database objects.

#+begin_src toml
[adapters]
default = "@dbv/mssql-adapter"
#+end_src

*** Detect version or centralized version tracking

**** Schema change log table

*** Database table design

- Version
- Activity log
- 

** Recommended structure

*** Dedicated Source Control

Separate source control for database scripts so that commits and branches don't get mixed up
with implementation.

: project/.git
: project-database/.git

This will also enable you to use your existing source control system instead of learning a new
one specifically for databases, such as ~klonio~ (intended to be a git for databases).

*** Local build vs shared build

  • API Reference

** Migration file naming syntax

: ..-<name [dashes become spaces]>.js

Example: : 1.0.0-build.js

** Version package object

Example: #+begin_src javascript { name: "build", path: "./versions/1.0.0-build.js", version: { name: "1.0.0", major: 1, minor: 0, patch: 0, }, module: require( './versions/1.0.0-build.js' ), } #+end_src

** Adapter *** ~ context~ *** ~ contextID~ *** ~ teardown~ *** ~ currentVersion~ *** ~ setVersion~ *** ~ isInstalled~ *** ~ install~ *** ~ uninstall~

** Version script ~this~ context will always be the version package object.

*** ~check( ctx )~ *** ~upgrade( ctx )~ *** ~downgrade( ctx )~ *** ~validation( ctx, action )~