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

xeplr-database-helpers

v1.0.17

Published

Database Helpers with KnexJS

Downloads

116

Readme

HOW TO SET UP THE KNEX:

Knex's two things are important. Models, and migration.

I love its migration.

Here is how to set up.

Step 1. Always build the knex using Yalc. yarn run publish-local ==> it will store the dist/js files in the yalc folder Step 2. Include this in your project. run this command: yalc add x-database-helpers@ Step 3. One the DB is connected, next is to create a migration friendly project Step 4. For that, create a folder named db [better to keep it separate] Step 5. there, make two folders, models, and migrations. Migrations is the folder where we will create migration. Step 6. There is a file in knex, called knex.migrations. This makes and runs the migration files. Step 7. Make a migration file. Run this command: node ./node_modules/x-database-helpers/dist/dbHelper/knex/knex.migrations.js --command=create --server=localhost --db=ollari --username=ollari --pwd=ollari --port=5433 --mdirectory=/Users/vikasbhandari/Dropbox/ollari/ollari-be/db/migrations/

Step 8. Make sure you are creating migrations in your folder, because that is what you will be building Step 9. you can also add this entry in package.json, so that you don't have to run this yourself again "makemigration": "rm -R ./db/migrations/jsmigrations && yarn --cwd=./db/migrations/ run build && node ./node_modules/x-database-helpers/dist/dbHelper/knex/knex.migrations.js --command=create --server=localhost --db=ollari --username=ollari --pwd=ollari --port=5433 --mdirectory=/Users/vikasbhandari/Dropbox/ollari/ollari-be/db/migrations/jsmigrations", Step 10. When you create a migration, it will create a blank migration file, with up and down function. Step 11. If you are creating lot of tables in one go, you can use the columnInfo array which will create the tables using arrays. Example is added when the migration file is added

Step 12. If you don't want to create the columns manually, you can also use migration.helper file to create Json for columnInfos. Example: const columnInfoInString = [ 'tag-true-tagName-string-100-notnullable', 'tag-true-tagDescription-string-1000', 'badge-true-badgeName-string-100-notnullable', 'badge-true-badgeDescription-string-1000', 'productCategory-true-productCategoryName-string-100-notnullable', 'productCategory-true-productCategoryDescription-string-1000',]

Step 13. Once you have edited the migration, you will need to run the migration. As soon as you run the migration, it will update the DB