I'm a total beginner in Orchard and in MVC in general, but googleing this I haven't found a solution.
I created a new Orchard site from source and after a few days of creating HelloWorld-like modules/parts/widgets I decided I want to implement a multi-tenant solution.
Having already some content created which I don't want to lose, I'm wondering if I could somehow just rename all existing tables by adding a table prefix like 'Tenant1_' for all my DB tables?
I tried adding a DataPrefix to ~\Orchard.Web\App_Data\Sites\Default\Settings.txt and manually renamed all the tables in the DB, but that generated an "Invalid object name 'Orchard_Framework_ContentItemVersionRecord'." error.
My next step was going to be to try to add a new migration which would rename all the tables but I'm at a loss of what to do exactly. Am I trying to solve this in a totally wrong way?
I'm using SqlServer and VS2012.
Thanks.
I think manual renaming doesn't work because all table mappings are cached in ~\Orchard.Web\App_Data\Sites\Default\mappings.bin
Try to delete it.
Related
I have a couple of custom tables I created and a few screens, imports, etc. based on them. Then realized I didn't prefix with our own 2 character tenant. Seemed like a simple refactor but If I rename SQL tables and the DAC classes (I'm using extension library) then my ASPX/Screen editor is broken (did not rename Graphs or Graph views) Tried to modify ASPX markup and reload changed files but then I wound up with an empty screen in screen editor. I'm putting everything back and restoring from previous day package export for now. Any tips/tricks for renaming SQL/DAC classes. I looked at PXTableName attribute (to try to keep code the same and only change SQL tables) but could not understand why that requires another virtual/abstract class.
Update: Tried again and this time no problems just renaming DAC and SQL table. Not sure what mistake I made the first time.
Hy,
I'am trying to use Visual Studio 2012 database project to upgrade a database to a newer version but i'am having a weird problem.I select the source database then the target database and hit compare.Visual Studio generates the script with the differences and when i execute it fails because it tries to drop tables without first dropping the FK constraints that are on those tables.(normally it should first script all the constrains from a table,drop them,drop the table,after that create the new table and finally recreating the constraints)
Do you have any ideas why it tries to do directly drop table without dropping constraints first.
Am i missing some settings?
Sounds like a bug to me. Try posting the same question on the SSDT forum.
If you have access to a copy of SQL Compare, it might be worth trying the same comparison to see if this works better. If you're using a database project as a data source, you'll need to select "source control", then "scripts folder", and browse to the folder that contains the .sqlproj file. Here at Red Gate we're working on improving database project support in SQL Compare so we'd welcome any feedback or questions.
If the tables that are being dropped in your database are not in your schema definition and you have got the "DROP objects in target but not in project" option selected in the Deployment Options, then it will try to drop them.
Have you checked this is not the case?
Whenever i work with database generating code from data models, or scrips, i often get that problem, so i have an script just for deleting those keys, sometimes i have to drop my database manually rather than executing the query, because most of the times it does but not completely, so i first dro the database, generate the script and run the script just for erasing the keys
I have been working with some database first entity framework development against an exisiting database and lots of stored procedures. When I was doing my development I would get tt files created and these were causing conflicts with the edmx file.... I forget the exact message but many of the generated classes where being found twice. When trying to solve this problem I found that if I deleted the tt files it clear the problem up... and did not appear to have any down side with this.
My code is working and all is good.
But now I have gotten far enough along that others are trying to use my code for the first time... They get the code out of the repository and I am finding that on every machine but my original development machine the code compiles fine, but when attempting to run I am getting an error of
"Could not fidn the concetual model for type xxxxx"... I know this is related to the Entity Framework and in reading I am beginning to think this is being caused by not having the tt records on the other machines....
I don't know why it works on my machine and not others....Is it because I deleted the tt records? If so How can I generate new tt records from the edmx file? I have looked and not found anything on how to correct my mistake....
The second question is how can I keep the tt records and the edmx file from conflicting? My memory is that the tt records would create file...but then when I would update the edmx file it would start creating conflicts .... like the edmx and the tt records would out of sync...and the tt records were not being updated when the edmx file was.
This is all still development code....I am now looking at trying to do code first EF...I had read about this, but didn't think I could take advantage of it as ALL of the business logic is stored in stored procedures so I was going the database first route.... But this is not working as there are tons of GETS each of which has a slightly different set of attributes.... From what I have seen the database first works, but I am getting a whole lot of different classes when what I really need is a base class...maybe with optional or nullable values... and in same cases a full hierachy of classes... so now I am just now starting to read up on code first EF with using an existing database (which I hope supports stored procedures).
I have a document center and a custom content type. I can create the organizer rule and it routes the documents appropriately.
However, the issue that I am having seems to be with the automatic folder creation. When I create the rule, I specify only "%2" for the folder name. The column that I am using is a month. I've tried this two ways, having the value as a number or text, but I get the same issue. The folder is created as 'float; 2.00000000' or 'string; 12' instead of just 2 or 12.
Can anyone assist.
Thanks.
You should never create folder with number. Please use any prefix it will not create this problem. I have also face this problem and this was the best solution I have found for it.
I need to migrate Work Items from one TFS server to another TFS server. I tried migrating them using the TFSMigration tool available in CodePlex.
The problem I am encountering is the schema for the work item on the source TFS is different from the schema of the work item type on destination. I don't want the destination TFS server schema for the work item to be modified. The change in schema is one new column only, but still don't want to take that change.
In one blog it was said that we can do that using Excel but not much details were available. I am not sure we can even use Excel to migrate the entire history related to Excel.
Have a look at the TFS Integration Tools on VS gallery. This supports custom field mappings as part of a migration, documentation here (direct download).
I did this a while back and, not finding an appropriate tool, resorted to copying the title and description etc across manually, as we only had a few active work items at the time, so it only took about an hour.
however, if I need to do it again, I'll use the TFS API to read fields of interest and write them to the new database. that way any schema differences don't matter, and the process is automated but under your control. Search for studying work items with the TFS API for details - it's really very easy.
Of course with both of these approaches (and all the migration tools AFAIK) you will only get a snapshot of the data - all history will be lost (or at best you can query using AsOf to get historical data, but all the entries you make will be timestamped at the moment you write them, not with the historical time that the event originally occurred.)
You can use the Excel editor to edit the source query All Items "Open Query in Microsoft Excel". Then open the destination query All Items "Open Query in Microsoft Excel". Copy and paste the contents from one excel window to the other. Certain fields like attachments will not transfer.