{"id":15364423,"url":"https://github.com/xadillax/hb-database-scripter","last_synced_at":"2026-02-28T22:32:10.091Z","repository":{"id":20371503,"uuid":"23646911","full_name":"XadillaX/hb-database-scripter","owner":"XadillaX","description":"The database upgrade script executer.","archived":false,"fork":false,"pushed_at":"2024-07-03T03:26:09.000Z","size":11,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-19T09:38:05.447Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"hybridgroup/cylon","license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XadillaX.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-09-04T03:20:42.000Z","updated_at":"2017-05-12T02:28:51.000Z","dependencies_parsed_at":"2024-10-16T06:41:05.066Z","dependency_job_id":null,"html_url":"https://github.com/XadillaX/hb-database-scripter","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"894ff7c865533f1e98d148c73b63d8e399fabb05"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XadillaX%2Fhb-database-scripter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XadillaX%2Fhb-database-scripter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XadillaX%2Fhb-database-scripter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XadillaX%2Fhb-database-scripter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XadillaX","download_url":"https://codeload.github.com/XadillaX/hb-database-scripter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240710061,"owners_count":19845039,"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":[],"created_at":"2024-10-01T13:11:43.225Z","updated_at":"2025-11-18T22:04:54.674Z","avatar_url":"https://github.com/XadillaX.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HB Database Scripter\n\nThe database upgrade script executer.\n\n## Useness\n\nImagine you have several SQLs to execute to upgrade your database or table:\n\n```sql\nALTER TABLE `commoditlow` ADD `buy_link_mobile` TEXT DEFAULT NULL;\nALTER TABLE `boards` ADD `is_commoditlow_board` TINYINT(1) NOT NULL DEFAULT 0;\n```\n\nYou want write down a script which you can run directly:\n\n```sh\n$ node script.js\n```\n\nYou may use this module.\n\n## Installation\n\n```sh\n$ npm install hb-database-scripter\n```\n\n## APIs\n\n### Scripter\n\n#### Constructor\n\n```javascript\nvar Scripter = require(\"hb-database-scripter\");\nvar scripter = new Scripter(processor);\n```\n\nMake sure that `processor` is a function which is truelly run your sqls and the arguments are `sql` and a `callback`.\n\n\u003e Eg.\n\u003e\n\u003e Imagine your project has a global object db, and it may use as below:\n\u003e\n\u003e ```javascript\n\u003e db.query(sql, function(err) { /** do sth... */ });\n\u003e ```\n\u003e\n\u003e Then you can use `db.query.bind(db)` as your processor.\n\n#### push\n\nPush your SQLs.\n\n```javascript\nscripter.push(\"ALTER TABLE `commoditlow` ADD `buy_link_mobile` TEXT DEFAULT NULL;\");\nscripter.push(\"ALTER TABLE `boards` ADD `is_commoditlow_board` TINYINT(1) NOT NULL DEFAULT 0;\");\n```\n\n#### exec\n\nExecute your SQLs that you pushed parallelly:\n\n```javascript\nscripter.exec(function() {\n    process.exit(0);\n});\n```\n\n## Who Uses This?\n\n+ Huaban.com\n+ maybe, you.\n\n## Contribution\n\nYou're welcome to fork and pull requests!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxadillax%2Fhb-database-scripter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxadillax%2Fhb-database-scripter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxadillax%2Fhb-database-scripter/lists"}