MeanJS: Generate the Sub-CRUD-Module with the generator? - angularjs

I have a CRUD-entity with a strong relationship to another entity, like comments only be posted and viewed above an article.
I want to use document db structure. Every comment should be saved in its article. I dont want to have a comments collection in which every comment is saved and referenced from the articles collection, like a relational db structure would suggest.
My question now is: What is the best practice to create a document style sub crud module in MEAN.JS?
Should I...
generate it, disable the creation in the collection and link the angular-controllers/views across the modules?
generate it, disable the creation in the collection and move the files to the father crud module?
refrain from generating it, create all needed files direct in the father module?

Create all needed files direct in the father module.
I did something similar to avoid referencing to other documents, you can edit the module schema to embed a schema into a schema, check this link:
http://www.jonahnisenson.com/schema-within-a-schema-use-embedded-documents-in-mongoosemongo/

You don't have to generate a separate CRUD Module for it. Generate a normal CRUD Module for the Articles and in the server sub-folder, you can create the model of the comments. After creating the Comments Model, You can then create another Model for Articles and then you refer to the Comments Model as part of the Article Model.

Related

How to handle inheritnace with Prisma?

is there a way to manage inheritance in prisma ?
I have a table baseUser which contains some basic columns like name, email, password,... I also have a second table which represents a customer and I want it to contain all baseUser columns without duplication. I've tried to set a one-to-one relation but I wondered if there is any other solution like inheritance for instance.
Thanks in advance.
Inheritance is not currently supported in Prisma.
There is an existing issue which describes progress and ideas on how schema.prisma file can support implementing interfaces where multiple models could implement the same interface.
Inheritance GitHub Issue

WP: How to delete unused taxonomies and terms from the DB?

while working on my basic website and creating a custom plugin to add different taxonomies and custom post types, I ended up with several entries in the database that are not useful anymore.
I'm wondering if there's a nice way of deleting them.
Using plugins to clean up the database doesn't work, because these search for orphaned contents. But these taxonomies do exist along with their terms, and I guess there is no reason to consider them orphaned.
They were created with "register_taxonomy" and afterwards added the terms manually.
Thanks a lot!

In joomla components, where should i store the database functions, and how to call them?

I am now building my first joomla component.
I have 3 tables in it:
__questions
__resaults
__display
I also need the Joomla user table:
__users
I have a single view:
view.questions.html
this view gets data and also needs some database functions. It needs to:
Get information from the user table.
Get information from the resaults table
Get information from the display table
-SET- information to the reaults table
Now, I know Joomla is built with MVC architecture. This, I assume, means no dealing with database in views.
Where should I store the database hendling functions, and how can I call them in the front end?
The function dealing with questions is in the question view model, no problem, but what about the other tables? Should I put the functions dealing with them in the question model as well, the helper file, or make models for each other table, and call them from the question view? If i should make other models, how do I call them from the question view?
Thank you very much for your help!
Create a model for each table.
You will then instantiate them from the controller to make them available to the views.
You can save a lot of time and also learn a lot by using the Component Creator: http://www.notwebdesign.com/joomla-component-creator/ It will do all the MVC stuff for you.

cakephp plugin calls a model I already have set up

In my cakePHP app I am implementing Miles Johson's Forum Plugin (http://milesj.me/code/cakephp/forum).
It creates a model named Profile in the plugin. I already have a model named Profile in my normal app, and as a result am getting a lot of errors when I use the forum. Combining the two models into one doesn't seem like a good option because they are used for very different purposes.
Is there an easy way to change model names in a plugin without hours of searching for every instance of "Profile" or "Forum.Profile" and changing it to "ForumProfile" and "Forum.ForumProfile"?
Thanks!
You could try to add another connection to your database.php, something like 'forums' and configure it to use a prefix 'forums_'. In the ForumsAppModel override the constructor and use your forums connection and prefix. You'll need to prefix all you forum tables with 'forums_'.
I do not understand why the forum plugin was not directly done with prefixes for the tables and everything.

CoreData migration & data mapping: creating a new entity from existing attribute

I really hope someone will be able to help me out with this.
I am trying to create a data mapping model (for an iOs app) in Xcode for the first time.
This should be a very simple migration (although not covered by lightweight migration); here is what I originally had and what the new database looks like:
What changed:
I have a new attribute (DBdisplayOrder), which is optional
I have a new to-many relationship. I would like to move the old database's DBreminder (NSDate) attribute to the new DBreminderDate. Both attributes in the new table are optional.
So basically I only need to copy data from one attribute, which now resides in a new entity.
I would be very grateful if someone could point me in the right direction, or just recommend a good resource to study from and get started.
I have sold this problem using a great description found here.
Update: (Fixed link to what appears to be the same blog post)
Here is the working mapping model:
I hope it helps someone.
Creating a mapping model can get fairly involved. I would start with the Core Data Model Versioning and Data Migration Programming Guide
In this particular case you will need to create an explicit mapping model, then you will have to create an entity mappings that describes both your original entity and the new target entity you want to move the attribute to. Then create a property mapping for that particular attribute.

Resources