parse-community / parse-community/parse-server

Allow to create unique indexes

Open
#7,289 10 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

New Feature / Enhancement Checklist
Current Limitation

parse-server is currently lacking a way to update DB schema. #7091 should address most of this issue, but unfortunatly, it does not seems like there is a way to add uniqueIndex despite being able to do so with the mongo client and postgre

db.collection.createIndex( <key and index type specification>, { unique: true } )
Feature / Enhancement Description

Add a isUniqueIndex parameter

SchemaController.createIndex(className, index , isUniqueIndex) {} 

Or even better, add an options parameter. The downside of this would be that itwould probably cause problems in inter-compatibility between mongo and postgre

 createIndex(className, index , options)
Example Use Case
schema.createIndex("_User" , {username:1} , true)
// or
schema.createIndex("_User" , {username:1} , {unique: true} )
Alternatives / Workarounds

We need to bypass the Parse Schema logic and implement it with manual migrations ... its a real pain !

3rd Party References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the SchemaController.createIndex entry point named in the issue and trace how schema indexes are handled for MongoDB and PostgreSQL. Compare the proposed boolean and options forms, then define completion as a consistent way for schema.createIndex to request unique indexes across the supported databases, with coverage for the resulting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, nodejs, postgresql
Domain
backend-api-design, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.