-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support for custom indexes #6359
Comments
I'm cool with that. Any thoughts on how we can do composite indexes? I struggled with that in the initial build and couldn't think of a nice way to express it in a collection so I left it out. |
yeah composites are tricky. I would be happy a new option indexes:[
//a composite index
{
attributes: ['attribute1', 'attribute2' ...]
unique: boolean
}, But then what if we needed a composite index With custom indexes? indexes:[
//a composite index
{
attributes: [
{
name: 'attribute1',
type: '2dsphere'
},
{
name: 'attribute1',
type: 'hash'
}
]
unique: boolean
}
] A bit messy but i think anyway you do its going to get a bit ugly. What do you think? |
what about having support for concurrent indexes (postgres) or background (mongo), etc? |
What happened with this? It's been closed but I have no idea if this got implemented or not. Update: If not, I'd like to propose allowing |
It will eventually be pushed to Trello as a FR. |
I've seen multiple issues closed like this the past days. May I suggest to at least leave a note as to why an issue is going to be On Tue, Jun 17, 2014 at 9:45 PM, Courtney Wyrtzen notifications@github.com
|
@gebrits we understand your concern and possible frustration. Thanks for your participation in the support community! This particular issue did have some discussion but, as you see was referenced in January and then trailed off. As you probably already know, closed issues are still searchable. Also, you are welcome to reopen ANY issue and restart a discussion if you feel we have closed it prematurely. That gets the conversation going again. On other issues you have seen, we do our best to reach out to the OP before we close up but that doesn't mean it can't be reopened. Contribution Guide | Stackoverflow | Google Group | Trello | IRC | Build Status |
Also, the FR milestone stays intact so they can be searched that way, too. (If you find one where this is not the case it was just a clerical error)~ |
When I google for waterline issues or features, I never see Trello in the search results. I always see github. It's annoying and confusing to have two places to discuss and report issues and features. Morever, the link you posted is returning 404 for me: https://trello.com/c/4ApPbu5C |
The link isn't working indeed, verified. It's probably a private board, or it has been moved by now. @tjwebb Cards on Trello can be moved / renamed etc. So it doesn't make sense to show up in google. I do agree that it's annoying to keep track of these things in two different places. |
@tjwebb and @RWOverdijk YES, good catch. We recently stopped using the Trello board and my new signature as of a few days ago removes this as an option. We are still honing the best way to respond to the needs of the community. Right now IRC Channel and Stack for support questions and GitHub for FR and Bugs are our main forums. I know it can be frustrating when you need immediate help. I can tell you that we work as diligently as possible to respond in a timely manner. The needs of the community are important to us~ Sails v0.10 is here: Upgrade | Contribution Guide | Stackoverflow | Google Group | IRC | Build Status |
To anyone googling and ending up here, I recommend IRC. I'm active at least 10 hours a day (work week, weekends a lot, too) and there are others that are really actively there as well. I've decided to start blogging about FAQ in the channel as an archive. |
IRC communication is ephemeral, which has the effect of making an ostensibly "public" conversation inaccessible to everyone who doesn't happen to be right there on that IRC channel at that time. This is especially problematic for a global community spanning many time zones. It leaves people out of the conversation. This issue right here is certainly a feature request. Continuing the discussion here ensures that Googlers who end up here end up in the discussion, which is probably what they wanted anyway. |
@tjwebb this is marked as a FR for all posterity (truly, I'm not just being snarky). Closed issues show up in search results. Once a member of the core team has marked it as a FR, we close it so that we can see that someone has addressed and discussed it (see @particlebanana comments above, plus he marked it as a FR so that helps me know what to do with it). The discussion can always continue. We are working out a permanent system to log FR. In fact, some of them may have been implemented in the new release so we now have that as part of our plan, to see what's been implemented and what lies ahead. The FR system is in place but we are smoothing out the kinks and eventually we will ask people to use it to log their own FR. Is there anything else I can do for you? That's what I am here for. |
Nope, I'm just following this issue. Thanks |
Just FYI, this Trello card was in the archive - it may have been moved and that's why the link was broken but we did have it logged at one point (that system didn't develop - we're working on logging them another way) just curious to see if you can access this: https://trello.com/c/lLXdNXtm (pretty sure it wasn't made public yet or it has been made private since it was created) |
Yea, in postgres at least, there's no possible way to re-create this: CONSTRAINT mytable_pkey PRIMARY KEY (mytable_id, mytable_foo, mytable_bar), It's kind of a problem. |
Guys, is there any progress on this? |
The current system for handling FR is here: https://github.com/balderdashy/sails/blob/master/ROADMAP.md |
+1, would like to see this opened back up. If it were implemented for primary keys as well as any index, how should the model be referenced in an association? |
+1 for composite keys |
To add my word, I currently want to inherit a model. I assume it is not possible for the moment, but raw SQL in the model definition would do it, see this post on stackoverflow. I am therefore following the evolution of this thread! |
+1 |
2 similar comments
+1 |
+1 |
Noted~ |
I did some hunting for you all and this is the word: for now that is something you can't model in the model definition. You can always add it manually or in your bootstrap. We would accept a pull request for it though. |
yeah. I switched my project from Laravel to Sails about 2 months ago. I'm starting to wonder if I made a mistake. |
@gadidev I have to admit it has been quiet for a bit. But rest assured, things are being picked up again. I for one am still here :) I too think this is a useful feature (which I'll be needing really soon). I think we have two options here: Option 1: Extend the behavior of index. Allow for an index identifier to be set, and group indexes by that identifier. E.g. {
gender: {type: 'string', index: {name: 'idx_gender_age'}}, // Object could also just be a string
age: {type: 'integer', index: {name: 'idx_gender_age'}} // Object could also just be a string
}; Option 2: Add a {
indexes: {
idx_gender_age: ['gender', 'age']
},
attributes: {
gender: 'string',
age: 'integer'
}
} I prefer option 2. Implementing support for this shouldn't be too tricky, but isn't BC either way (if someone is using the properties right now, or incorrectly using index). Also this would have to be implemented on the adapter level. Thoughts? |
I too prefer #2. #1 seems clunky |
@gadidev Good one! We'd also need support for index type. |
+1 |
+1 Was this added? because all comments point to here, but this issue is closed. |
I agree this is a really important feature, which, among others, Waterline doesn't support yet but should. On our projects, we are currently discussing about replacing Waterline with Knex or Sequelize. |
It's perfectly reasonable to use Waterline as an ORM and Knex to help On Thu, Jul 21, 2016 at 11:16 AM, Jeremy TRUFIER notifications@github.com
|
@devinivy Totally using Knex for migrations right now, when I said Knex, I wanted to say Bookshelfjs, the ORM based on it. We didn't dig too much, but it seems worth discussions. |
Feels pretty bad when you start working with JavaScript, get crazy excited and bump into an issue like this in the middle of a project. I'm not here to be a fanboy, but I'd suggest you guys to use Hibernate/Doctrine as a benchmark to Waterline. Some really important features (and composite key is just one of many I needed) were not developed. The framework is well developed and easy to use, but it's pending on some really important features guys. |
@sio-iago Perhaps not the place to mention this, but you might want to star wetland. We're currently actively developing it so it should come out soon(ish). It'll first be a drop in replacement (more or less) for waterline. The reason I mention it is because it's closely modeled to the jpa-spec (570 pages of goodness), borrowing principles from doctrine, and that you mentioned doctrine. I thought, perhaps you might want to weigh in on the development (or brainstorm a bit). If so, you can find me here. |
Ran into this trying to hook sails up to a legacy database. Not sure what I'm going to do now. |
@jvanalst either cry or use knex/bookshelf. |
Is this issue fixed ? |
@arunramachandran15 Like previous answer, it's not fixed and I don't think it will be before a long time. Anyway it is not a major issue, since this notion of indexes is only used to automaticaly change the schemas of your database in your DEV environment. If you need good indexes, it means you expect to have a lot of data, thus you can not rely on waterline mecanism to upgrade your database (I explain why at the end of this message). You should use sails-migration (which uses Knex) to create a file each time you need to change the schema of your database. You can do pretty much what you want, as well as multi key indexes. It's the recommended solution, and plus it allow you a great control over your schema by giving you the possibility to rollback to a previous migration. You should always have
It may be great in development, but totaly not viable once you have a lot of datas in production. |
The solution we ended up settling on for composite primary keys was to add new id row to the database that was a combination of id1 & id2 (e.g. id = id1*10000 + id2). It's hackney'd and very specific to our situation (since id2 will never realistically be above 9999). But it gets us up and running quickly with legacy data. |
+1 on adding support for this... |
+1. I am building a real time chat app and store all the messages of the users in database. So my db has a table "Conversations" with two fields userA and userB(users having conversation with each other) and this pair should be unique, pls could anyone advice how to solve this in Waterline(the solution with direct constraints to db isn't so elegant)? |
@rassulcrowe Like I said before, the solution using directly the DB with migrations (with knee) is elegant and very clean because waterline handles migrations really poorly and should only be used in safe mode. You can eventually add a custom validation to check the DB for duplicate on inserting. |
+1 |
If you're not using legacy db, the solution is to abandon REST and just use RPC. Who cares. Not me! |
So I just read the whole thread. I wanna +1 but I'm gonna check out the other suggested ORM/ODM because it's kinda clear this functionality is not going to be implemented |
Conversation started 4 years and 8 months ago and no definite answer yet. |
That's about how long ago i last used Sails.js or Waterline. They were decent open source projects back in the day, but getting traction on maintenance & support for valuable issues / feature gaps was never a good story. Just setting expectations. |
+1 |
5 years, wow |
It's 7 years. This would still be a good feature to add. |
Just short of 11! 🤡 |
It would be nice to be able to specify custom indexes. so for example
index: "customIndex"
the stringcustomIndex
would get passed along to the adapter.If the index was a bool then the current behavior would hold.
The text was updated successfully, but these errors were encountered: