Acumatica: Procedure to rename a table in SQL without breaking screens, etc - acumatica

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.

Related

Tabulator - Download and re-use changes

I am new to Tabulator and started building my first project. While usage and setup is very intuitive and nicely built I struggle with one concept. I want to keep changes and entries I made to the table and load them again when re-opening the page.
My first thought was to download all entries as csv or xls and then import either from an array/JSON or from an HTML table. Is this the preferred way or is there another method I can use?
Thanks!
Note: I am using version 4.1
Tabulator doesn't include what you are looking for. However, you can use Tabulator to retrieve the table's values. As for saving and restoring the edited data, you may want to use your browser's localStorage: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

Update database with visual studio database projects

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

How to change a DB table name in Orchard (add table prefix)?

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.

How to make SubSonic 3.0 generate .cs files for each class/table instead instead of single ActiveRecord.cs

I have been using SubSonic 2 on several projects before but with the new SubSonic 3 I have implemented in 2 projects. However, my question has always been is if I can change the the output T4 template to generate a class file for each table instead of single ActiveRecord.cs file. I want to use it in a very large project and I can see where is not practical to have 80+ tables in a single file. I prefer to have separate class files.
Would I need to change SubSonic.Core?
If its not possible, please let me know.
Thanks
Why does it matter how many files there are if the code is entirely generated? What practical difference is there?
You can change the templates to output multiple files. No changes would be required to the SubSonic dll, just the T4 Templates.
However, I fail to see how it is worth even just the time to post the question here, much less the time required to actually make those changes.
There is a way to do this, if you rewrite the T4s to follow this example. However, I think there is an issue that may arise when you drop a table, the previously created .cs file for that table will not be removed. I think you would have to further edit the T4 to start by deleting all its previously generated files.

Restrictions on Table Names

Are there any restrictions on the names of tables, or issues with certain names when working with SubSonic?
I have table called 'Activity' and SubSonic doesn't seem to recognise it. When it was called 'Activities' it worked fine.
Basically I am wanting to go with singular table names as a convention (and the other conventions as detailed in the SubSonic Conventions blog post) and added fixPluralClassNames="false" to the web.config (because I have a table called 'Focus', which SubSonic kept naming 'Focu')
Generally, reserved words in C# are not allowed as table names. I'm not sure why Activity would be a problem though. The first thing to check when a table is not generated is that the table has a primary key.
One common problem that I ran into was it would not work if my tables begin with special characters or numbers. Changing that fixed it on my end. Apart from that I did not run into any other issues.
Clearing files in the Temporary ASP.NET Files folder (After closing Visual Studio), or changing the .abp file seems to be a valid fix to this.

Resources