{"id":20157608,"url":"https://github.com/g4s8/android-migrator","last_synced_at":"2026-02-09T02:04:53.508Z","repository":{"id":52293758,"uuid":"77831813","full_name":"g4s8/Android-Migrator","owner":"g4s8","description":"Apply SQLite migrations to your Android database!","archived":false,"fork":false,"pushed_at":"2017-05-21T09:16:23.000Z","size":125,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-05T23:28:37.509Z","etag":null,"topics":["android","android-library","android-migrator","assets","library","migration","migrator","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Java","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/g4s8.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}},"created_at":"2017-01-02T12:26:23.000Z","updated_at":"2023-12-14T09:01:12.000Z","dependencies_parsed_at":"2022-09-05T22:11:49.343Z","dependency_job_id":null,"html_url":"https://github.com/g4s8/Android-Migrator","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/g4s8/Android-Migrator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2FAndroid-Migrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2FAndroid-Migrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2FAndroid-Migrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2FAndroid-Migrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/g4s8","download_url":"https://codeload.github.com/g4s8/Android-Migrator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2FAndroid-Migrator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29254306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T01:52:29.835Z","status":"online","status_checked_at":"2026-02-09T02:00:09.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["android","android-library","android-migrator","assets","library","migration","migrator","sqlite"],"created_at":"2024-11-13T23:47:05.562Z","updated_at":"2026-02-09T02:04:53.228Z","avatar_url":"https://github.com/g4s8.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Android-Migrator\nAndroid migrator will help you to apply migrations from assets files via default database framework (`SQLiteOpenHelper`).\n\n[![Build Status](https://img.shields.io/travis/g4s8/Android-Migrator.svg?style=flat-square)](https://travis-ci.org/g4s8/Android-Migrator)\n[![License](https://img.shields.io/github/license/g4s8/Android-Migrator.svg?style=flat-square)](https://github.com/g4s8/Android-Migrator/blob/master/LICENSE)\n[![Test Coverage](https://img.shields.io/codecov/c/github/g4s8/Android-Migrator.svg?style=flat-square)](https://codecov.io/github/g4s8/Android-Migrator?branch=master)\n[![Bintray](https://img.shields.io/bintray/v/g4s8/maven-android/com.g4s8.amigrator.svg?style=flat-square)](https://bintray.com/g4s8/maven-android/com.g4s8.amigrator/_latestVersion)\n\n## Setup\nAdd gradle dependency\n```gradle\ndependencies {\n    compile 'com.g4s8:amigrator:\u003cversion\u003e'\n}\n```\n[see latest release](https://github.com/g4s8/Android-Migrator/releases/latest)\n\nAdd migration files to assets folder \"migrations\" (folder name can be customized). \nEach migration file should be named with format: `\u003cversion\u003e.sql`, where visersion is integer number.\n```\nassets\n  migrations\n    1.sql\n    2.sql\n    3.sql\n```\n\nMigration files should be filled with sqlite statements, ended with semicolon: ';'. Migrator ignores empty lines and spaces.\nComments ('--') are not supported yet.\n```sql\nCREATE TABLE users (\n    id INTEGER PRIMARY KEY,\n    name TEXT\n);\n\nINSERT INTO users (name) VALUES ('Jimmy');\n```\n\nApply migrations in you android sqlite-helper.\n```java\nimport android.content.Context;\nimport android.database.sqlite.SQLiteDatabase;\nimport android.database.sqlite.SQLiteOpenHelper;\n\npublic final class Sqlite extends SQLiteOpenHelper {\n\n    private final SQLiteMigrations migrations;\n    private final int version;\n    \n    public Sqlite(final Context ctx, final int version) {\n        super(context, \"db_name\", null, version);\n        migrations = new SQLiteMigrations(ctx); // or provide custom assets folder as second parameter\n        this.version = version;\n    }\n    \n    @Override\n    public void onCreate(final SQLiteDatabase db) {\n        migrations.apply(db, 0, version);\n    }\n    \n    @Override\n    public void onUpgrade(\n        final SQLiteDatabase db,\n        final int oldVersion,\n        final int newVersion\n    ) {\n        migrations.apply(db, oldVersion, newVersion);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg4s8%2Fandroid-migrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg4s8%2Fandroid-migrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg4s8%2Fandroid-migrator/lists"}