{"id":22703938,"url":"https://github.com/2do2go/east-sqlite","last_synced_at":"2025-06-21T07:07:07.262Z","repository":{"id":11408694,"uuid":"13857591","full_name":"2do2go/east-sqlite","owner":"2do2go","description":"sqlite adapter for \"east\"","archived":false,"fork":false,"pushed_at":"2014-09-24T13:54:35.000Z","size":229,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-21T07:07:01.121Z","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":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2do2go.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-25T10:18:59.000Z","updated_at":"2016-06-14T11:39:57.000Z","dependencies_parsed_at":"2022-09-26T17:51:48.144Z","dependency_job_id":null,"html_url":"https://github.com/2do2go/east-sqlite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/2do2go/east-sqlite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2do2go%2Feast-sqlite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2do2go%2Feast-sqlite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2do2go%2Feast-sqlite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2do2go%2Feast-sqlite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2do2go","download_url":"https://codeload.github.com/2do2go/east-sqlite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2do2go%2Feast-sqlite/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261080621,"owners_count":23106601,"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-12-10T08:13:14.112Z","updated_at":"2025-06-21T07:07:02.252Z","avatar_url":"https://github.com/2do2go.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# east sqlite\n\nsqlite adapter for [east](https://github.com/okv/east) (node.js database migration tool) which uses \n[node-sqlite3](https://github.com/mapbox/node-sqlite3)\n\nAll executed migrations names will be stored at `_migrations` table in the\ncurrent database. Object with following properties will be passed to `migrate`\nand `rollback` functions:\n\n* `db` - instance of [node-sqlite3](http://github.com/mapbox/node-sqlite3/wiki/API#databaserunsql-param--callback)\n\n\n## Installation\n\n```sh\nnpm install east east-sqlite -g\n```\n\nalternatively you could install it locally\n\n\n## Usage\n\ngo to project dir and run\n\n```sh\neast init\n```\n\ncreate `.eastrc` file at current directory\n\n```js\n{\n\t\"adapter\": \"east-sqlite\",\n\t\"dbFile\": \"\"\n}\n```\n\nwhere `dbFile` is file of database which you want to migrate\n\nnow we can create some migrations\n\n```sh\neast create apples\neast create bananas\n```\n\ncreated files will looks like this one\n\n```js\nexports.migrate = function(client, done) {\n\tvar db = client.db;\n\tdone();\n};\n\nexports.rollback = function(client, done) {\n\tvar db = client.db;\n\tdone();\n};\n```\n\nedit created files and insert  \n\nto 1_apples\n\n```js\nexports.migrate = function(client, done) {\n\tvar db = client.db;\n\tvar sqlStr = 'insert into things values($id, $name, $color)';\n\tdb.run(sqlStr, {\n\t\t$id: 1,\n\t\t$name: 'apple',\n\t\t$color: 'red'\n\t}, function(err) {\n\t\tif (err) return done(err);\n\t\tdb.run(sqlStr, {\n\t\t\t$id: 2,\n\t\t\t$name: 'apple',\n\t\t\t$color: 'green'\n\t\t}, done);\n\t});\n};\n\nexports.rollback = function(client, done) {\n\tvar db = client.db;\n\tdb.run('delete from things where id in (1, 2)', done);\n};\n```\n\nto 2_bananas\n\n```js\nexports.migrate = function(client, done) {\n\tvar db = client.db;\n\tdb.run('insert into things values($id, $name, $color)', {\n\t\t$id: 3,\n\t\t$name: 'banana',\n\t\t$color: 'yellow'\n\t}, done);\n};\n\nexports.rollback = function(client, done) {\n\tvar db = client.db;\n\tdb.run('delete from things where id=3', done);\n};\n```\n\nnow we can execute our migrations\n\n```sh\neast migrate\n```\n\noutput\n\n```sh\ntarget migrations:\n\t1_apples\n\t2_bananas\nmigrate `1_apples`\nmigration done\nmigrate `2_bananas`\nmigration done\n```\n\nand roll them back\n\n```sh\neast rollback\n```\n\noutput\n\n```sh\ntarget migrations:\n\t2_bananas\n\t1_apples\nrollback `2_bananas`\nmigration successfully rolled back\nrollback `1_apples`\nmigration successfully rolled back\n```\n\nyou can specify one or several particular migrations for migrate/rollback e.g.\n\n```sh\neast migrate 1_apples\n```\n\nor\n\n```sh\neast migrate 1_apples 2_bananas\n```\n\nRun `east -h` to see all commands, `east \u003ccommand\u003e -h` to see detail command help,\nsee also [east page](https://github.com/okv/east#usage) for command examples.\n\n\n## Running test\n\nrun [east](https://github.com/okv/east#running-test) tests with this adapter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2do2go%2Feast-sqlite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2do2go%2Feast-sqlite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2do2go%2Feast-sqlite/lists"}