second time model changes in codefirst - asp.net-mvc

I initially generated configuration and Initialcreate classes successfully by mapping the model.
Now I changed the model (by adding one more property) and tried to execute below commands in project manager console.
The commands I have tried:
PM> add-migration
cmdlet Add-Migration at command pipeline position 1
Supply values for the following parameters:
Name: Configuration
Scaffolding migration 'Configuration'.
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running `Add-Migration Configuration` again.
PM> update-database -verbose
Using StartUp project 'Demo'.
The project 'Demo' failed to build.
PM>
When I tried to execute add-migration command then it generated a partial class with same name as Configuration.cs. Now I found two Configuration files but inheritance is different between both classes. What should I do or what am I doing in wrong manner?
After that I executed the commands again with different name and it worked but when I executed the command Update-database then received an error which I mentioned below:
Table registeration already exists

Use
add-migration YourMigrationName -force

Related

TF.exe label - Workspace mapping required when creating a label for a server item?

In my TFS release i added a script to create a label when a certain environment succeeds.
This label is apply on a given server item and for a specific Changeset.
The TF.exe command looks like this:
tf.exe label Main-Approved $/MyProject/Main /recursive /version:C124730 /comment:"Approved by Main Release" /collection:http://tfsserver:port/tfs/MyCollection
However when run from the release i get the following error message return by TF.exe:
Error: There is no working folder mapping for D:\Agent-Default_work\r144\a\by.
Running this exact command localy works fine and creates the label.
I don't understand why i would need to create a workspace and some folder mapping in order to apply a label on a Server item (using $/...) for a specific changeset?
Any help would be appreciated.
Thanks!
So i was using a Python script to run the command.
I tried changing it to a powershell script and it works.
My guess is that in python the strings were passed incorrectly someone. I feel like the workspace 'by' was in fact my command wrongly parsed by the intepreter and considered an argument in tf.exe.

How do I get flyway.cmd to fail a build when no migration is necessary?

I've built a pipeline in Jenkins that uses Flyway. I'd like to run a command that returns a positive exit code so that the build step fails if no database migration is necessary.
I could of course run flyway migrate and it would harmlessly do nothing, but I'd like to flag this to the end user as a problem if they're trying to deploy for no reason.
You can use validate for this. If the exit code is 0 then no pending migrations have been found.

Changing default location of Quartz job creation

I have the following directory structure in eclipse (groovy project)
grails-app/jobs/File1/ABC/D
grails-app/jobs/File2/DEF/G
I am using the following command to generate Quartz Job :
grails create-job Name_Of_Job
By default it is creating the new job inside
grails-app/jobs/File2/DEF/G/Name_Of_Job
but i want it to be created inside D folder at
gails-app/jobs/File1/ABC/D.
How do i change the location where the Quartz job is created, i tried using
grails create-job c://projectname//Folder//grails-app//jobs//File1//ABC//D//Name_Of_Job
but this does not work it treats file location as name of job
I think you should enter a package name in the grails command (similar to e.g. create-domain-class)
This should work:
grails create-job File1.ABC.D.Name_Of_Job

How to debug Code First Migration

I am using the Code First Migration in my project.
In the first migration file we are executing the .sql files, these are executing perfectly.
But when I execute the new .sql file in the latest migration file those are not execute and there is no error in the package manager console.
Is there a way to debug the migration file step by step?
Thanks

Mogenerator ios

I installed Mogenerator. Now what do I do? How do I use it?
The first problem I have is that I have no idea check the chekbox "run scripts only when installing" for mogenerator or not ?
To which checkbox exactly are you referring? One on a "Run Script" build phase within Xcode?
Mogenerator is a tool for generating model classes from your Core Data model. Since it does not yet have an Xcode 4 compatible plugin you want to run it as a command line tool whenever you make changes to your Core Data model.
You could do so in a Run Script build phase. In that case you would probably not want to wait until you are installing the app as you would then not have access to newly added properties on your model classes until you ran an install build. Instead you really want the script to run when you have made any changes to your Core Data model and before you start compiling your project.
I find Core Data changes to be relatively infrequent so I might choose to run mogenerator manually when I make a change rather than rerunning it unnecessarily on every build. I'd probably save my mogenerator command line setting in a shell script or rake task but alternately you might follow John Blanco's example and create a new build target containing only your mogenerator Run Script build phase so you can run it on demand from within Xcode: http://raptureinvenice.com/getting-started-with-mogenerator/

Resources