Orchard CMS Migration - Check if column exists - orchardcms

Is there a standard way to check whether a column already exists in Orchard Migration before doing an altertable add column.

Related

Kentico - Unable to find a custom user column

I just took over a project from a developer who has already left an organisation and I'm doing some maintenance work in the project. I can see the following code in a custom web part
CurrentUserInfo CurrentUser = MembershipContext.AuthenticatedUser;
DateTime ExpirationDate = CurrentUser.GetValue("aps_expirationdate", DateTime.Now);
The strange thing is, I cannot seem to find this custom field 'aps_expirationdate' anywhere in the system or in the database.
I checked the following places but couldn't find it.
Checked Membership module 'User' class and 'User - Settings' class
Checked 'User' module
Did a manual Sql Search in the database to find a table with a column name 'aps_expirationdate'
but I cannot seem to find this column anywhere and the other strange thing is, when I debug the code it does return a date value. No bugs in the code so, cannot say that this is an invalid column name. Where else should I look?
Based on what you've put in your initial question, it sounds as if the column was added manually and not through the Kentico UI. In order for the data access layer or the Kentico API to know that field exists, the definition has to be stored within the Kentico module class and not just in the database.
Here's what I'd do to correct this:
Find what table the field exists in. If you want the custom field to be part of the User or User Settings objects then they need to be added to either the CMS_User or CMS_UserSetting table.
If the field does not exist in either the CMS_User or CMS_UserSetting table, then go to the Modules app in the Kentico UI.
In the Modules App, go to Membership > Classes > Users > Fields and add the aps_expirationdate field.
If you have data in the field aps_expirationdate in the other table, write a query to copy it from the other table to the CMS_User table.
Now the API call as noted above will work.
If the field is already in the CMS_User or CMS_UserSetting table, then you will have to do the following:
In SSMS, rename that field to aps_expirationdate_old.
In the Modules App, go to Membership > Classes > Users > Fields and add the aps_expirationdate field.
Assuming you have data in the aps_expirationdate_old field in the CMS_User or CMS_UserSetting table, write a query to copy it from the other table to the CMS_User table.
Your last bullet point states you "Did a manual Sql Search in the database to find a table with a column name 'aps_expirationdate'". This contradicts what you state at the end of your question which states "I cannot seem to find this column anywhere". If you cannot find what table the aps_expirationdate exists in, then check out the following SO answer to find that column in a given database.
https://stackoverflow.com/a/4849704/698678

How to add column in document library in SharePoint 2013

I am trying to make a customized site Content and I have made it successfully on Document library.While uploading it gets uploaded well but the by default behavior of document library shows me three but default column which is there in the image
1)Name
2)Modified
3)Modified By
I want to add 4th Column with user input named as a description.
Image is as follows:how to add Column in
From what I understood from your issue is, your column is getting created but not visible on view. When you create column column has property as SPField.ShowInDisplayForm , SPField.ShowInViewForms like properties. Its a Boolean value.

Add 'last updated' timestamp to Orchard CMS website

How do I add a last updated timestamp to the footer of my Orchard website? That is, the date when a change was made to the content via the CMS admin.
You don't have to add it, it's already there on the Common part, it's the published date if you want the date of the latest publication of the item, or the modified date if you really want the last time the item had any modification. Add this to a template override for the common part (parts.common.metadata.cshtml): #Model.ContentPart.PublishedUtc or #Model.ContentPart.ModifiedUtc

Why isn't my new SharePoint column showing as an option to add to lists on my site?

I'm using SP 2007. In one list, I've created a column called "Sponsoring Group". It's a choice-type using radio buttons, isn't required, allows fill-in choices, and contains a default value. As with other columns created on this site, I expected my new column to be available to existing and new lists via Settings > Add Columns from Site Columns, but I cannot find my new column...
What gives?
Based on the wording of your question, it sounds like you are creating a column on a list, then expecting it to magically become a site column?
You have to create the column as a site column. See this link for more details on how to do this:
http://office.microsoft.com/en-us/windows-sharepoint-services-help/create-a-site-column-HA010157769.aspx

How to filter a MOSS2007 Content Query Web Part using a custom column?

I am trying to setup a content query web part in MOSS that will display documents on a page based on a choice column that I created. I have created a "Page" column and added it as a core document column for my site. What I would like the CQWP to do is filter the document list that is displayed based on this Page column. However, this column does not show up as a filter in the CQWP on the page. I tried following the instructions in this question: Content Query WebPart - Grouping by custom column? to no avail. Does anyone have any ideas as to how I can accomplish this?
Have you tried CommonViewFields as suggested in the second answer from that other question? You can edit the property in SharePoint Designer or by exporting the web part, changing the CommonViewFields in Notepad, and then re-importing the web part. If CommonViewFields doesn't work, you can always modify the filter property directly in either SPD or using export-Notepad-import. Be sure you are pointing to a Content Type that includes your custom field.

Resources