I want to achive Single Table Inheritance in Go using gorm library, but i can't find a way to do it or any documentation related to it.
Do anyone have already done that or knows about it?
I tried gorm:"discriminator" and gorm:"discriminator:value" but it's not working.
Related
I have been struggling to work out a way of doing a simple update only when copying data to the dataverse/dynamics.
The only write behaviour it seems to support is "Upsert".
However in my scenario I don't want to insert a row if it doesnt already exist.
I cant see a way to do this and would appreciate some help or ideas.
Thanks!
I am able to create tables and load several of them with data but when I go to access the data again to retrieve data the program is telling the table does not exist.
I am creating the tables from within the viewcontroller. I read in one of these posts that it should not be done from within viewcontroller but from another class. My question is who should this be done. I would also like to be able to insert and retrieve data from a second viewcontroller.
How is this accomplished? What type of class needs to be set up to keep the database open throughout the entire program? I have searched the internet for answers but have not found what I am looking.
An example and some explanations would be most helpful.
If more information is needed I can provide.
Thank you in advance
I use stored proceduers on DB instance "A" to store data in GTT. To get the original data i have to go over a DB-Link to DB instance "B". That for i put together the whole query and send it to remote DB instance.
This works fine. But sometimes it seems that Oracle is not using the best way or correct indexes for queries. Is there a way to force Oracle to use specific indexes? I tried to use hints, but honestly I dind't understand the difference between all these options.
Thanks for helping me!
There is a huge temptation to optimize a query one way when you want it to work another way. Adding hints is a temporary solution which can backfire on you when the amount or type of data in the table changes or when you upgrade to a newer version with a newer optimizer.
First, determine that there is a problem. Are all queries taking too long? Just some? Only the first one?
The easiest thing to do is to make sure the indexes on that table are up to date. Then look at optimizing the query by using the explain plan feature to see what indexes are being used.
It's also prudent to examine your data to see if the query is selecting different things or different amounts of records if it is time based.
In the current project(which is live), we have a type CSCategory with the deployment table. CSCategory extends Category also there are many references to CSCategory from other types. It could be 1-1, 1-N or N-N.
Obvious, this leads to performance issue and we are facing it. So we want to remove the deployment table for CSCategory type.
I know this steps
Any better approach? or the only way is to export CSCategory data along with dependent types data and reimport it?
I have done what you have suggested in our project.
Since the records are already in Table_X, you would have to export the items of Type_X, remove the items of Type_X (which will remove them from Table_X), and reimport them as Type_Y. If there are other types dependent on them, you would have to consider them in the data migration as well.
After that, it should be safe to remove the deployment tag, and to drop the database table. If necessary, you have have to remove the orphaned types via HAC as well.
I can't think of another or better way of doing it.
I'm trying to make a database table for every single username. I see that for every username, I can add more columns in it's row, but I want to attribute a full table for each one. How can I do that?
Thanks,
Eli
First let me say, what you are trying to do sounds like really, really bad database design and you should rethink your idea of creating a table per user. To get help for this you should add way more detail about the reasoning to your question to get a good answer. As far as I know there is also a maximum number of classes you can create on Parse so sooner or later you will run into problems, either performance wise or due to technical limitations of the platform.
That being said, you can use the Schema API to programmatically create/delete/update tables of your Parse app. It always requires the master key, so doing this from the client side is not recommended for security reasons. You could put this into a Cloud Code function for example and call this one from your app/admin tool to create a new table for a user on the fly or delete a table of a user.
Again, better don't do it and think about a better way to design your database, it would be out of scope here to discuss it.