{"id":31137094,"url":"https://github.com/avdata99/ckan-migrator","last_synced_at":"2025-09-18T08:11:17.769Z","repository":{"id":311205795,"uuid":"1042366055","full_name":"avdata99/ckan-migrator","owner":"avdata99","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-31T19:47:44.000Z","size":57,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-31T20:43:22.240Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/avdata99.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-21T22:50:39.000Z","updated_at":"2025-08-31T18:52:08.000Z","dependencies_parsed_at":"2025-08-31T20:30:29.769Z","dependency_job_id":null,"html_url":"https://github.com/avdata99/ckan-migrator","commit_stats":null,"previous_names":["avdata99/ckan-migrator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/avdata99/ckan-migrator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avdata99%2Fckan-migrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avdata99%2Fckan-migrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avdata99%2Fckan-migrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avdata99%2Fckan-migrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avdata99","download_url":"https://codeload.github.com/avdata99/ckan-migrator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avdata99%2Fckan-migrator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275732391,"owners_count":25518099,"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","status":"online","status_checked_at":"2025-09-18T02:00:09.552Z","response_time":77,"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":[],"created_at":"2025-09-18T08:11:12.345Z","updated_at":"2025-09-18T08:11:17.761Z","avatar_url":"https://github.com/avdata99.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CKAN Migrator\n\nThis repo helps with the migration of CKAN instances when you have a very old version of CKAN\nand need to upgrade to a newer version.  \n\n## Import old DB\n\nMove you CKAN DB dump to `docker/dump/db.dump`.  \n\nStart the container with `docker compose up`.  \n\nThen, restore the database using:\n\n```bash\ndocker compose exec postgres-old \\\n    pg_restore --verbose --clean \\\n    --if-exists --no-owner --no-acl \\\n    --dbname=old_ckan_db \\\n    --username=postgres \\\n    /dump/db.dump\n```\n\n## Run the migration script\n\nInstall the required dependencies\n\n```bash\ncd scripts\npip install -r requirements.txt\n```\n\n### Analyze old data\n\nExport all data from old database (do not migrate)\n\n```bash\npython migrate.py --mode all\n```\n\n### Analyze old database structure\n\nExport all db structure from old database (do not migrate)\n\n```bash\npython migrate.py --mode structure\n```\n\n### Analyze both old and new database structures\n\nExport db structure from both databases for comparison (do not migrate)\nOptional: Include new database parameters to also get the structure\nof the new CKAN version database.  \n\n```bash\npython migrate.py --mode structure \\\n    --new-host localhost \\\n    --new-port 8012 \\\n    --new-dbname ckan_test \\\n    --new-user ckan_default \\\n    --new-password pass\n```\n\n#### Structure sample\n\nYou can see some database structure samples and diffs here:\n\n - [2.6.2 structure](/scripts/ckan_migrate/data-sample/database_report_2.6.2.md)\n - [2.11.3 structure](/scripts/ckan_migrate/data-sample/database_report_2.11.3.md)\n - [2.6.2 - 2.11.3 diff](/scripts/ckan_migrate/data-sample/diff-2.6.2-2.11.3.md)\n\n### Output Files\n\nThe script generates several output files:\n\n1. **`database_report.md`** - Comprehensive markdown report with:\n   - Database overview\n   - Table summaries (name, row count, column count)\n   - Detailed column information for each table\n   - Summary statistics\n\n2. **`tables_info.json`** - JSON file with detailed table metadata:\n   - Column names, types, nullability, defaults\n   - Row counts for each table\n\n3. **`extracted_data/` directory** (if data extraction is enabled):\n   - `{table_name}.csv` - CSV files for each table\n   - `{table_name}.json` - JSON files for each table\n\n### Full migration\n\n```bash\npython migrate.py --mode migrate \\\n    --new-host localhost \\\n    --new-port 8012 \\\n    --new-dbname ckan_test \\\n    --new-user ckan_default \\\n    --new-password pass\n```\n\n### Move static files\n\n```bash\nrsync -av --progress /old-var/lib/ckan/ /new-var/lib/ckan/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favdata99%2Fckan-migrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favdata99%2Fckan-migrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favdata99%2Fckan-migrator/lists"}