{"id":23131711,"url":"https://github.com/peopledoc/django-json-dbindex","last_synced_at":"2025-07-02T03:04:35.962Z","repository":{"id":21269301,"uuid":"24585025","full_name":"peopledoc/django-json-dbindex","owner":"peopledoc","description":"Describe your database index in json files into your apps","archived":false,"fork":false,"pushed_at":"2016-09-19T07:46:33.000Z","size":81,"stargazers_count":2,"open_issues_count":4,"forks_count":0,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-05-20T16:53:29.985Z","etag":null,"topics":["approved-public","ghec-mig-migrated"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peopledoc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-29T08:00:23.000Z","updated_at":"2024-11-28T16:30:04.000Z","dependencies_parsed_at":"2022-09-14T13:53:29.113Z","dependency_job_id":null,"html_url":"https://github.com/peopledoc/django-json-dbindex","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/peopledoc/django-json-dbindex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peopledoc%2Fdjango-json-dbindex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peopledoc%2Fdjango-json-dbindex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peopledoc%2Fdjango-json-dbindex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peopledoc%2Fdjango-json-dbindex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peopledoc","download_url":"https://codeload.github.com/peopledoc/django-json-dbindex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peopledoc%2Fdjango-json-dbindex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263066557,"owners_count":23408387,"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":["approved-public","ghec-mig-migrated"],"created_at":"2024-12-17T11:15:56.996Z","updated_at":"2025-07-02T03:04:35.936Z","avatar_url":"https://github.com/peopledoc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Documentation Status](https://readthedocs.org/projects/django-json-dbindex/badge/?version=latest)](https://readthedocs.org/projects/django-json-dbindex/?badge=latest)\n[![Build Status](https://travis-ci.org/novafloss/django-json-dbindex.svg)](https://travis-ci.org/novafloss/django-json-dbindex)\n[![Coverage Status](https://coveralls.io/repos/novafloss/django-json-dbindex/badge.svg)](https://coveralls.io/r/novafloss/django-json-dbindex)\n\n**Project not maintained**, this project was created at PeopleDoc to\n  be used between a short time as a transition tool, it is not used\n  anymore and so not maintain.\n\n\n===================\ndjango-json-dbindex\n===================\n\nDescribe your database indexes in json files into your apps directory.\n\nDetailed documentation is in the \"docs\" directory.\n\nRequirements\n------------\n\nYou'll need the ``psycopg2`` package. You may want to install it via your system\npackages, but if you're working on a default virtualenv (no-site-packages),\nyou'll have to install ``postgresql-server-dev-*``. Especially if you want to\ntest the application via tox.\n\n\nQuick start\n-----------\n\n1. Add \"json_dbindex\" to your INSTALLED_APPS setting like this::\n\n    INSTALLED_APPS = (\n        ...\n        'json_dbindex',\n    )\n\n2. Run `python manage.py list_jsdbindex` to list all defined indexes.\n\n\nManagement commands\n-------------------\n\n* list_jsdbindex\n* create_jsdbindex\n* drop_jsdbindex\n* check_jsdbindex\n\n\nCreate indexes\n--------------\n\nCreate a file in you app directory called `dbindex_create.json` with\nfollowing contents\n\n```javascript\n\n[{\"name\": \"django_site_composite_idx\",\n  \"table\": \"django_site\",\n  \"columns\": [\"domain\",\"name\"],\n  \"predicat\": \"id \u003e 1000\",\n  \"unique\": true,\n  \"concurrently\": false,\n  \"using\": \"btree\",\n  \"database\": \"default\",\n  \"tablespace\": \"speedssd\"}]\n```\n\nor with an operator class on PostgreSQL for example\n\n```\n[{\"name\": \"django_site_composite_idx\",\n  \"table\": \"django_site\",\n  \"columns\": [{\"name\": \"gist_trgm_ops\"],\n  \"using\": \"GIST\",\n  \"extension\": \"pg_trgm\"}]\n```\n\nOnly fields, **name**, **table** and **columns** are mandatory.\n\n```shell\n$ python manage.py create_jsdbindex\n```\n\nThe **concurrently** option is set by default to *true*, do you really\nwant your index to be created without this option ?\n\nTrying to create an existing index will not generate an error, only a\nlogging at level notice will be raised.\n\n\nDrop indexes\n------------\n\nCreate a file in you app directory called `dbindex_drop.json` with\nfollowing contents.\n\n```javascript\n[{\"name\": \"django_site_composite_idx\"},\n {\"name\": \"django_site_domain_idx\"}]\n```\n\nOnly the name is required. In the above example two indexes will be\ndropped. Trying to drop a non existing index will not generate an\nerror, only a logging at level notice will be raised.\n\n```shell\n$ python manage.py drop_jsdbindex\n```\n\n\nTesting the app\n---------------\n\nYou'll need to install tox (globally or, preferrably in a virtualenv).\n\nThe python package ``psycopg2`` must be available.\n\nYou may want to setup a postgresql server somewhere. Its credentials may live\nin the ``/django-json-dbindex/demo/django_json_dbindex_demo/settings_local.py``\n\nExample:\n\n```\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql_psycopg2',\n        'NAME': 'json_dbindex',\n        'USER': 'postgres',\n        'PASSWORD': 'postgres',\n        'HOST': '127.0.0.1',\n        'PORT': '5432',\n    }\n}\n```\n\n\nYou'll need to create at least one \"json_dbindex\" database on your server. Or\nname it as you want.\n\nSimply run \"tox\" to execute tests and other builds.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeopledoc%2Fdjango-json-dbindex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeopledoc%2Fdjango-json-dbindex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeopledoc%2Fdjango-json-dbindex/lists"}