This project is read-only.

Orchard can't detect Migrations.cs

Topics: Troubleshooting, Writing modules
Aug 9, 2013 at 10:00 PM
I added a Migrations.cs file to my Orchard module using the Orchard console but my site crashes. Running in debug mode indicates that Orchard failed to find the Migrations.cs file I added:
namespace PortfolioProjects {
    public class Migrations : DataMigrationImpl {

        public int Create() {
            // Creating table PortfolioProjectRecord
            SchemaBuilder.CreateTable("PortfolioProjectRecord", table => table
                .Column("Title", DbType.String)
                .Column("Company", DbType.String)
                .Column("Description", DbType.String)
                .Column("Technologies", DbType.String)
                .Column("FileLibrary", DbType.String)
                .Column("DeveloperInfo", DbType.String)
                .Column("WidgetDemo", DbType.String)
                .Column("TeamMemberIds", DbType.String)
                .Column("Active", DbType.Boolean)
                .Column("Logo", DbType.String)

                typeof(PortfolioProjectPart).Name, cfg => cfg.Attachable());

            return 1;
Aug 10, 2013 at 12:00 AM
Was it added to the project?
Aug 12, 2013 at 3:11 PM
Edited Aug 12, 2013 at 5:27 PM
I added it with the console, which I assume did it automatically as it had worked previously. I had made some changes since then though. The file is currently included in the project but if Orchard does some additional work behind the scenes I am unaware if that action was performed.

To be more specific:

I can enable the module and add it as a content part. But when trying to create or modify existing content with the dashboard it throws that exception.

EDIT: I recreated a new module with no migration exception. However, the migration still appears to not work as every text field input never gets set and Orchard responds to content updates with a single, empty, error message. It does work with a checkbox field as the only input though.

Images for reference:

Aug 12, 2013 at 7:47 PM
What is the exception and stack trace?
Aug 12, 2013 at 8:01 PM
Edited Aug 12, 2013 at 8:01 PM
There's no longer any exception, the message is just thrown like that.
Aug 12, 2013 at 8:06 PM
I'm sorry, but you're not giving enough information about what the module is supposed to do, and how it doesn't do it.
Aug 12, 2013 at 8:09 PM
The module only needs to render the input title and other fields. It also conditionally renders information if the "Active" field is set to true.
Aug 12, 2013 at 8:13 PM
The problem was that the default "Title" field from the content was interfering with the custom "Title" field.