-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Should we create a Schema class? #7
Comments
How to create different models on different files? Because the way relationship works its verry probably that a model reffer another model and vice-versa |
Its not needed any more, once you can create relationship that will be lazily evaluated. |
I agree with the idea of creating a class that is a collection of models. How about we use 'Collection' as the name instead of 'Schema'? Especially since we may need to use that term somewhere else in the code. Collections would work like this: Collections and models in one file:
Or in multiple files:
And objects can be versioned, ala:
|
The issue of getting two versions of the same Model or Collection to interoperate (migrations perhaps) is a critical issue that should be discussed if this is to be carried further. |
what about |
Fine with me, but why the change in case? |
|
I like the way @Xliff is thinking. Whether we say In fact, I really like the idea of having a We could go as far as to say, if you are related to a model not in your schema, you can't use it (rather than trying to look for it). |
I don't know that having different versions of the same model at the same time even makes sense. Taking a cue from DBIx::Class in Perl 5 land, the entire schema has a single version, since the status of all tables in the database determines whether or not they will work together. The model classes that we create relate directly to a real-world table in a database somewhere. Only the matching versions of the models themselves are guaranteed to work with the corresponding table in the database. If we update a model and deploy the new table structure to an existing database, the old version of the model cannot (in the general case) work with this new table structure. Ultimately, I don't think it makes any sense to support different versions of the same model in the same schema (or collection or whatever). However, you could easily create a schema that contains an old version of the model and works on an old version of the database. I propose the database handle be part of the instantiated schema object.
And then elsewhere, you can create a schema that is compatible with an outdated database:
|
The idea of using different versions would be to support migrations (#15) |
Maybe schema should be a CompUnit::Repository? |
Yeah it wouldn't be dissimilar to a plugin loader with some additional metadata. |
No description provided.
The text was updated successfully, but these errors were encountered: