{"id":14384567,"url":"https://github.com/smooth-code/knex-scripts","last_synced_at":"2025-04-23T02:30:27.349Z","repository":{"id":66076935,"uuid":"120466525","full_name":"smooth-code/knex-scripts","owner":"smooth-code","description":"Knex utilities to interact with Postgres database 🗄","archived":false,"fork":false,"pushed_at":"2022-11-01T16:44:38.000Z","size":930,"stargazers_count":12,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T06:22:19.703Z","etag":null,"topics":["create","dump","knex","knexjs","load","postgres","truncate"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smooth-code.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-02-06T14:06:48.000Z","updated_at":"2024-08-22T22:12:16.000Z","dependencies_parsed_at":"2023-03-10T23:36:33.218Z","dependency_job_id":null,"html_url":"https://github.com/smooth-code/knex-scripts","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smooth-code%2Fknex-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smooth-code%2Fknex-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smooth-code%2Fknex-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smooth-code%2Fknex-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smooth-code","download_url":"https://codeload.github.com/smooth-code/knex-scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250357472,"owners_count":21417279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["create","dump","knex","knexjs","load","postgres","truncate"],"created_at":"2024-08-28T18:01:28.795Z","updated_at":"2025-04-23T02:30:26.910Z","avatar_url":"https://github.com/smooth-code.png","language":"JavaScript","readme":"# Knex Scripts\n\n[![Build Status](https://travis-ci.org/smooth-code/knex-scripts.svg?branch=master)](https://travis-ci.org/smooth-code/knex-scripts)\n\nKnex utilities to interact with Postgres database.\n\n```\nnpm install knex-scripts\n```\n\n## Command Line Usage\n\n```\n  Usage: cli [options] [command]\n\n\n  Options:\n\n  -V, --version               output the version number\n  --docker                    Use docker.\n  --docker-service [service]  Docker service name, default: \"postgres\".\n  --knexfile [path]           Specify the knexfile path.\n  --cwd [path]                Specify the working directory.\n  --env [name]                environment, default: process.env.NODE_ENV || development\n  -h, --help                  output usage information\n\n\n  Commands:\n\n  create           Create database.\n  drop             Drop database.\n  dump             Dump database.\n  load             Load database.\n  check-structure  Check structure.\n  truncate         Truncate all tables.\n```\n\n## Node API Usage\n\n```js\nimport knex from 'knex'\nimport { truncate } from 'knex-scripts'\nimport config from './knexfile'\n\n// Truncate all database\ntruncate({ getKnex: () =\u003e knex(config) })\n  .then(() =\u003e console.log('Truncated'))\n  .catch(console.error)\n```\n\n## Configuration\n\n```js\n// knexfile.js\nconst config = {\n  knexScripts: {\n    docker: false,\n    structurePath: 'db/structure.sql',\n  },\n  development: {\n    client: 'postgresql',\n    connection: {\n      user: 'postgres',\n      database: 'development',\n      timezone: 'utc',\n    },\n  },\n}\n\nmodule.exports = config\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmooth-code%2Fknex-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmooth-code%2Fknex-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmooth-code%2Fknex-scripts/lists"}