{"id":20918794,"url":"https://github.com/thegamecracks/sqlitediff","last_synced_at":"2026-01-08T04:40:41.771Z","repository":{"id":212204722,"uuid":"730943676","full_name":"thegamecracks/sqlitediff","owner":"thegamecracks","description":"A command-line program for generating SQLite schema diffs.","archived":false,"fork":false,"pushed_at":"2024-08-02T15:29:38.000Z","size":146,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T19:48:18.038Z","etag":null,"topics":["migration-tool","python","python-package","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Python","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/thegamecracks.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-13T02:39:45.000Z","updated_at":"2024-10-25T04:09:13.000Z","dependencies_parsed_at":"2023-12-21T09:23:14.729Z","dependency_job_id":"5ef52ac7-0785-4adc-993c-ba2f45a504be","html_url":"https://github.com/thegamecracks/sqlitediff","commit_stats":{"total_commits":117,"total_committers":1,"mean_commits":117.0,"dds":0.0,"last_synced_commit":"421c707c8010e6a8faeeac9cf8a88be4f05adcb1"},"previous_names":["thegamecracks/sqlitediff"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thegamecracks%2Fsqlitediff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thegamecracks%2Fsqlitediff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thegamecracks%2Fsqlitediff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thegamecracks%2Fsqlitediff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thegamecracks","download_url":"https://codeload.github.com/thegamecracks/sqlitediff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246149712,"owners_count":20731405,"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":["migration-tool","python","python-package","sqlite"],"created_at":"2024-11-18T16:39:59.940Z","updated_at":"2026-01-08T04:40:41.731Z","avatar_url":"https://github.com/thegamecracks.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqlitediff\n\n[![](https://img.shields.io/github/actions/workflow/status/thegamecracks/sqlitediff/pyright-lint.yml?style=flat-square\u0026label=pyright)](https://microsoft.github.io/pyright/#/)\n[![](https://img.shields.io/github/actions/workflow/status/thegamecracks/sqlitediff/python-test.yml?style=flat-square\u0026logo=pytest\u0026label=tests)](https://docs.pytest.org/en/stable/)\n\nA command-line program for generating SQLite schema diffs.\n\n\u003e [!NOTE]\n\u003e\n\u003e This project is not associated with the sqlitediff package on [PyPI](https://pypi.org/project/sqlitediff/),\n\u003e catering towards forensic analysis of SQLite databases. If you're interested\n\u003e in 5f0ne's source code, check out [his repository](https://github.com/5f0ne/sqlitediff)!\n\n```sql\n$ sqlitediff examples/user_group_1.sql examples/user_group_2.sql\nPRAGMA foreign_keys = off;\nBEGIN TRANSACTION;\n\n-- Modified Objects --\n\n-- Previous table schema for user:\n-- CREATE TABLE user (id INTEGER PRIMARY KEY, name TEXT);\nCREATE TABLE sqlitediff_temp (id INTEGER PRIMARY KEY, name TEXT NOT NULL);\nINSERT INTO sqlitediff_temp (id, name) SELECT id, name FROM user;\nDROP TABLE user;\nALTER TABLE sqlitediff_temp RENAME TO user;\n\n-- Restoring references to user:\nCREATE INDEX ix_user_name ON user (name);\n\n-- Previous view schema for user_group_kawaii:\n-- CREATE VIEW user_group_kawaii (id) AS\n--     SELECT user_id FROM user_group WHERE group_id = 1;\nDROP VIEW IF EXISTS user_group_kawaii;\nCREATE VIEW user_group_kawaii (id) AS\n    SELECT user_id FROM user_group WHERE group_id = 2;\n\n-- Previous trigger schema for add_user_to_kawaii_group:\n-- CREATE TRIGGER add_user_to_kawaii_group\n--     INSERT ON user\n--     BEGIN\n--         INSERT INTO user_group (user_id, group_id) VALUES (new.id, 1);\n--     END;\nDROP TRIGGER IF EXISTS add_user_to_kawaii_group;\nCREATE TRIGGER add_user_to_kawaii_group\n    INSERT ON user\n    BEGIN\n        INSERT INTO user_group (user_id, group_id) VALUES (new.id, 2);\n    END;\n\n-- New Objects --\n\nALTER TABLE \"group\" ADD COLUMN description TEXT NOT NULL DEFAULT '';\n\nCREATE INDEX ix_group_user ON user_group (group_id, user_id);\n\nCREATE VIEW user_group_all (id) AS\n    SELECT user_id FROM user_group WHERE group_id = 1;\n\nCREATE TRIGGER add_user_to_all_group\n    INSERT ON user\n    BEGIN\n        INSERT INTO user_group (user_id, group_id) VALUES (new.id, 1);\n    END;\n\n-- Please verify foreign keys before committing!\n-- The following pragma should return 0 rows:\nPRAGMA foreign_key_check;\n\nCOMMIT;\n```\n\nsqlitediff uses the [`sqlite_schema`] table to read your database structure\nand compare differences between tables, indices, views, and triggers.\nIt can parse DDL for tables to determine new, modified, or deleted columns\nand tries to produce [ALTER TABLE] statements where supported by SQLite.\nAdditionally, recommendations will be provided if sqlitediff detects\npotential issues with the output script such as table/column renames.\n\n[`sqlite_schema`]: https://sqlite.org/schematab.html\n[ALTER TABLE]: https://sqlite.org/lang_altertable.html\n\n## Usage\n\nAssuming you have [Python 3.8+](https://www.python.org/downloads/) and\n[Git](https://git-scm.com/), you can install this application with:\n\n```sh\npip install git+https://github.com/thegamecracks/sqlitediff@v0.1.7\n```\n\nAfter installation, the command-line interface can be used with `sqlitediff`\nor `python -m sqlitediff`. It can compare SQLite database files directly\nor take .sql scripts which are executed in-memory before comparison.\nRun [`sqlitediff --help`](/src/sqlitediff/__main__.py) for more information.\n\n\u003e [!WARNING]\n\u003e\n\u003e Do not run sqlitediff's output on a production database un-modified\n\u003e without first verifying that the script works on a copy. Some modifications\n\u003e by themselves can cause constraint violations or data loss due to ambiguity\n\u003e in how the changes should be applied or the order in which they are executed.\n\u003e In the worst-case scenario, you can use the output as a reference to write\n\u003e your own migration script.\n\n## License\n\nThis project is written under the [MIT] license.\n\n[MIT]: /LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthegamecracks%2Fsqlitediff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthegamecracks%2Fsqlitediff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthegamecracks%2Fsqlitediff/lists"}