public override void Up() { Sql("DELETE FROM dbo.__MigrationHistory WHERE [MigrationId] = '201605191108426_Update-VSC-Trigger'"); Sql("DELETE FROM dbo.__MigrationHistory WHERE [MigrationId] = '201605201155561_Update-VSC-Trigger'"); Sql("DELETE FROM dbo.__MigrationHistory WHERE [MigrationId] = '201605201300419_Update-VSC-Trigger'"); Sql("DELETE FROM dbo.__MigrationHistory WHERE [MigrationId] = '201605250903571_Update-VSC-Trigger'"); Sql("DROP TRIGGER [ValuationScoreCards.Modified]"); Sql(ResourceReader.GetContentsOfResource("20160519_Trigger_ValuationScorecards_v2.Modified.sql")); }
public override void Up() { AddColumn("dbo.Institutions", "NumberOfScoreCards", c => c.Int(nullable: false)); AddColumn("dbo.UserProfiles", "NumberOfScoreCards", c => c.Int(nullable: false)); CreateIndex("dbo.Institutions", "NumberOfScoreCards", unique: false); CreateIndex("dbo.UserProfiles", "NumberOfScoreCards", unique: false); Sql(ResourceReader.GetContentsOfResource("20140523_Trigger_BaseScorecards.Published.sql")); Sql(ResourceReader.GetContentsOfResource("20140523_Trigger_ValuationScorecards.Published.sql")); Sql(ResourceReader.GetContentsOfResource("UpdateTotalNumberOfScoreCards.sql")); }
public override void Up() { DropForeignKey("dbo.JournalScores", "JournalId", "dbo.Journals"); DropForeignKey("dbo.Journals", "JournalScoreId", "dbo.JournalScores"); DropIndex("dbo.Journals", new[] { "JournalScoreId" }); DropIndex("dbo.JournalScores", new[] { "JournalId" }); AddColumn("dbo.Journals", "OverallScore_AverageScore", c => c.Single(nullable: false)); AddColumn("dbo.Journals", "OverallScore_TotalScore", c => c.Int(nullable: false)); AddColumn("dbo.Journals", "EditorialInformationScore_AverageScore", c => c.Single(nullable: false)); AddColumn("dbo.Journals", "EditorialInformationScore_TotalScore", c => c.Int(nullable: false)); AddColumn("dbo.Journals", "PeerReviewScore_AverageScore", c => c.Single(nullable: false)); AddColumn("dbo.Journals", "PeerReviewScore_TotalScore", c => c.Int(nullable: false)); AddColumn("dbo.Journals", "GovernanceScore_AverageScore", c => c.Single(nullable: false)); AddColumn("dbo.Journals", "GovernanceScore_TotalScore", c => c.Int(nullable: false)); AddColumn("dbo.Journals", "ProcessScore_AverageScore", c => c.Single(nullable: false)); AddColumn("dbo.Journals", "ProcessScore_TotalScore", c => c.Int(nullable: false)); AddColumn("dbo.Journals", "ValuationScore_AverageScore", c => c.Single(nullable: false)); AddColumn("dbo.Journals", "ValuationScore_TotalScore", c => c.Int(nullable: false)); AddColumn("dbo.Journals", "NumberOfBaseReviewers", c => c.Int(nullable: false)); AddColumn("dbo.Journals", "NumberOfValuationReviewers", c => c.Int(nullable: false)); AlterColumn("dbo.Journals", "JournalScoreId", c => c.Int(nullable: false)); Sql("UPDATE j SET " + "j.[NumberOfBaseReviewers] = s.[NumberOfBaseReviewers], " + "j.[OverallScore_AverageScore] = s.[OverallScore_AverageScore], " + "j.[OverallScore_TotalScore] = s.[OverallScore_TotalScore], " + "j.[EditorialInformationScore_AverageScore] = s.[EditorialInformationScore_AverageScore], " + "j.[EditorialInformationScore_TotalScore] = s.[EditorialInformationScore_TotalScore], " + "j.[PeerReviewScore_AverageScore] = s.[PeerReviewScore_AverageScore], " + "j.[PeerReviewScore_TotalScore] = s.[PeerReviewScore_TotalScore], " + "j.[GovernanceScore_AverageScore] = s.[GovernanceScore_AverageScore], " + "j.[GovernanceScore_TotalScore] = s.[GovernanceScore_TotalScore], " + "j.[ProcessScore_AverageScore] = s.[ProcessScore_AverageScore], " + "j.[ProcessScore_TotalScore] = s.[ProcessScore_TotalScore], " + "j.[ValuationScore_AverageScore] = s.[ValuationScore_AverageScore], " + "j.[ValuationScore_TotalScore] = s.[ValuationScore_TotalScore], " + "j.[NumberOfValuationReviewers] = s.[NumberOfValuationReviewers] " + "FROM [dbo].[Journals] j " + "INNER JOIN [dbo].[JournalScores] s ON s.[JournalId] = j.[Id] "); Sql("DROP TRIGGER [ScoreCards.Published]"); Sql("DROP TRIGGER [ScoreCards.Deleted]"); Sql("DROP TRIGGER [ValuationScoreCards.Published]"); Sql("DROP TRIGGER [ValuationScoreCards.Deleted]"); Sql(ResourceReader.GetContentsOfResource("20160329_Trigger_BaseScorecards.Modified.sql")); Sql(ResourceReader.GetContentsOfResource("20160329_Trigger_ValuationScorecards.Modified.sql")); DropTable("dbo.JournalScores"); }
public override void Up() { DropForeignKey("dbo.Journals", "JournalPriceId", "dbo.JournalPrices"); DropForeignKey("dbo.Journals", "JournalScoreId", "dbo.JournalScores"); DropForeignKey("dbo.BaseJournalPrices", "ScoreCardId", "dbo.ScoreCards"); DropForeignKey("dbo.BaseJournalPrices", "UserProfileId", "dbo.UserProfiles"); DropForeignKey("dbo.BaseJournalPrices", "JournalId", "dbo.Journals"); DropForeignKey("dbo.ValuationQuestionScores", "QuestionId", "dbo.Questions"); DropForeignKey("dbo.BaseQuestionScores", "QuestionId", "dbo.Questions"); DropForeignKey("dbo.BaseQuestionScores", "BaseScoreCardId", "dbo.BaseScoreCards"); DropForeignKey("dbo.BaseScoreCards", "JournalId", "dbo.Journals"); DropForeignKey("dbo.BaseScoreCards", "ScoreCardVersionId", "dbo.ScoreCardVersions"); DropForeignKey("dbo.BaseScoreCards", "UserProfileId", "dbo.UserProfiles"); DropForeignKey("dbo.InstitutionJournals", "UserProfileId", "dbo.UserProfiles"); DropForeignKey("dbo.JournalScores", "JournalId", "dbo.Journals"); Sql(ResourceReader.GetContentsOfResource("Copy after split JSC.sql")); AddForeignKey("dbo.ValuationScoreCards", "UserProfileId", "dbo.UserProfiles", "Id"); AddForeignKey("dbo.ValuationScoreCards", "JournalId", "dbo.Journals", "Id"); AddForeignKey("dbo.ValuationScoreCards", "VersionId", "dbo.ScoreCardVersions", "Id"); AddForeignKey("dbo.ValuationQuestionScores", "QuestionId", "dbo.Questions", "Id"); AddForeignKey("dbo.ValuationQuestionScores", "ValuationScoreCardId", "dbo.ValuationScoreCards", "Id"); AddForeignKey("dbo.ValuationJournalPrices", "JournalId", "dbo.Journals", "Id"); AddForeignKey("dbo.ValuationJournalPrices", "UserProfileId", "dbo.UserProfiles", "Id"); AddForeignKey("dbo.ValuationJournalPrices", "ValuationScoreCardId", "dbo.ValuationScoreCards", "Id"); AddForeignKey("dbo.BaseJournalPrices", "JournalId", "dbo.Journals", "Id"); AddForeignKey("dbo.BaseJournalPrices", "UserProfileId", "dbo.UserProfiles", "Id"); AddForeignKey("dbo.BaseJournalPrices", "BaseScoreCardId", "dbo.BaseScoreCards", "Id"); AddForeignKey("dbo.Journals", "JournalScoreId", "dbo.JournalScores", "Id"); AddForeignKey("dbo.BaseQuestionScores", "QuestionId", "dbo.Questions", "Id"); AddForeignKey("dbo.BaseQuestionScores", "BaseScoreCardId", "dbo.BaseScoreCards", "Id"); AddForeignKey("dbo.BaseScoreCards", "JournalId", "dbo.Journals", "Id"); AddForeignKey("dbo.BaseScoreCards", "VersionId", "dbo.ScoreCardVersions", "Id"); AddForeignKey("dbo.BaseScoreCards", "UserProfileId", "dbo.UserProfiles", "Id"); AddForeignKey("dbo.InstitutionJournals", "UserProfileId", "dbo.UserProfiles", "Id"); AddForeignKey("dbo.JournalScores", "JournalId", "dbo.Journals", "Id"); }
public override void Up() { DropForeignKey("dbo.JournalPrices", "ScoreCardId", "dbo.ScoreCards"); DropForeignKey("dbo.JournalPrices", "UserProfileId", "dbo.UserProfiles"); DropForeignKey("dbo.JournalPrices", "Id", "dbo.Journals"); DropForeignKey("dbo.QuestionScores", "QuestionId", "dbo.Questions"); DropForeignKey("dbo.QuestionScores", "ScoreCardId", "dbo.ScoreCards"); DropForeignKey("dbo.ScoreCards", "JournalId", "dbo.Journals"); DropForeignKey("dbo.ScoreCards", "VersionId", "dbo.ScoreCardVersions"); DropForeignKey("dbo.ScoreCards", "UserProfileId", "dbo.UserProfiles"); RenameTable(name: "dbo.ScoreCards", newName: "BaseScoreCards"); RenameTable(name: "dbo.JournalPrices", newName: "BaseJournalPrices"); RenameTable(name: "dbo.QuestionScores", newName: "BaseQuestionScores"); RenameColumn(table: "dbo.BaseQuestionScores", name: "ScoreCardId", newName: "BaseScoreCardId"); RenameColumn(table: "dbo.BaseJournalPrices", name: "ScoreCardId", newName: "BaseScoreCardId"); RenameColumn(table: "dbo.Journals", name: "JournalPriceId", newName: "BaseJournalPriceId"); //RenameIndex(table: "dbo.Journals", name: "IX_JournalPriceId", newName: "IX_BaseJournalPriceId"); //RenameIndex(table: "dbo.BaseJournalPrices", name: "IX_ScoreCardId", newName: "IX_BaseScoreCardId"); //RenameIndex(table: "dbo.BaseQuestionScores", name: "IX_ScoreCardId", newName: "IX_BaseScoreCardId"); CreateTable( "dbo.ValuationScoreCards", c => new { Id = c.Int(nullable: false, identity: true), DateStarted = c.DateTime(nullable: false), DateExpiration = c.DateTime(), DatePublished = c.DateTime(), Remarks = c.String(), PriceRemarks = c.String(), UserProfileId = c.Int(nullable: false), JournalId = c.Int(nullable: false), VersionId = c.Int(nullable: false), Score_ValuationScore_AverageScore = c.Single(), Score_ValuationScore_TotalScore = c.Int(), State = c.Int(nullable: false), Submitted = c.Boolean(nullable: false), Editor = c.Boolean(nullable: false), BaseScoreCardId = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .Index(t => t.UserProfileId) .Index(t => t.JournalId) .Index(t => t.VersionId); CreateTable( "dbo.ValuationQuestionScores", c => new { Id = c.Int(nullable: false, identity: true), Score = c.Int(nullable: false), ValuationScoreCardId = c.Int(nullable: false), QuestionId = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.Questions", t => t.QuestionId, cascadeDelete: true) .Index(t => t.ValuationScoreCardId) .Index(t => t.QuestionId); CreateTable( "dbo.ValuationJournalPrices", c => new { Id = c.Int(nullable: false, identity: true), DateAdded = c.DateTime(nullable: false), Price_Amount = c.Decimal(precision: 18, scale: 2), Price_Currency = c.Int(), Price_FeeType = c.Int(), JournalId = c.Int(nullable: false), ValuationScoreCardId = c.Int(nullable: false), UserProfileId = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .Index(t => t.JournalId) .Index(t => t.ValuationScoreCardId) .Index(t => t.UserProfileId); AddColumn("dbo.Journals", "ValuationJournalPriceId", c => c.Int()); RenameColumn(table: "dbo.JournalScores", name: "NumberOfReviewers", newName: "NumberOfBaseReviewers"); AddColumn("dbo.JournalScores", "NumberOfValuationReviewers", c => c.Int(nullable: false)); RenameColumn(table: "dbo.UserProfiles", name: "NumberOfScoreCards", newName: "NumberOfBaseScoreCards"); AddColumn("dbo.UserProfiles", "NumberOfValuationScoreCards", c => c.Int(nullable: false)); RenameColumn(table: "dbo.Institutions", name: "NumberOfScoreCards", newName: "NumberOfBaseScoreCards"); AddColumn("dbo.Institutions", "NumberOfValuationScoreCards", c => c.Int(nullable: false)); CreateIndex("dbo.Journals", "ValuationJournalPriceId"); AlterColumn("dbo.Institutions", "NumberOfBaseScoreCards", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.Institutions", "NumberOfValuationScoreCards", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.UserProfiles", "NumberOfBaseScoreCards", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.UserProfiles", "NumberOfValuationScoreCards", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "NumberOfBaseReviewers", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "NumberOfValuationReviewers", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "NumberOfBaseReviewers", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "NumberOfValuationReviewers", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "OverallScore_AverageScore", c => c.Single(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "EditorialInformationScore_AverageScore", c => c.Single(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "PeerReviewScore_AverageScore", c => c.Single(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "GovernanceScore_AverageScore", c => c.Single(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "ProcessScore_AverageScore", c => c.Single(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "ValuationScore_AverageScore", c => c.Single(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "OverallScore_TotalScore", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "EditorialInformationScore_TotalScore", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "PeerReviewScore_TotalScore", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "GovernanceScore_TotalScore", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "ProcessScore_TotalScore", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.JournalScores", "ValuationScore_TotalScore", c => c.Int(nullable: false, defaultValue: 0)); AlterColumn("dbo.BaseJournalPrices", "Price_FeeType", c => c.Int(nullable: true)); Sql(ResourceReader.GetContentsOfResource("20140409_Trigger_BaseScorecards.Published.sql")); Sql(ResourceReader.GetContentsOfResource("20140409_Trigger_ValuationScorecards.Published.sql")); }
public override void Up() { CreateTable( "dbo.Journals", c => new { Id = c.Int(nullable: false, identity: true), Title = c.String(nullable: false, maxLength: 1000), ISSN = c.String(nullable: false, maxLength: 32), Link = c.String(nullable: false), DateAdded = c.DateTime(nullable: false), CountryId = c.Int(nullable: false), PublisherId = c.Int(nullable: false), JournalScoreId = c.Int(), JournalPriceId = c.Int(), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.Countries", t => t.CountryId, cascadeDelete: true) .ForeignKey("dbo.Publishers", t => t.PublisherId, cascadeDelete: true) .ForeignKey("dbo.JournalScores", t => t.JournalScoreId) .ForeignKey("dbo.JournalPrices", t => t.JournalPriceId) .Index(t => t.CountryId) .Index(t => t.PublisherId) .Index(t => t.JournalScoreId) .Index(t => t.JournalPriceId) .Index(t => t.ISSN, unique: true); CreateTable( "dbo.Countries", c => new { Id = c.Int(nullable: false, identity: true), Name = c.String(nullable: false, maxLength: 255), }) .PrimaryKey(t => t.Id) .Index(t => t.Name, unique: true); CreateTable( "dbo.Publishers", c => new { Id = c.Int(nullable: false, identity: true), Name = c.String(nullable: false, maxLength: 255), }) .PrimaryKey(t => t.Id) .Index(t => t.Name, unique: true); CreateTable( "dbo.JournalScores", c => new { Id = c.Int(nullable: false, identity: true), OverallScore_AverageScore = c.Single(nullable: false), OverallScore_TotalScore = c.Int(nullable: false), EditorialInformationScore_AverageScore = c.Single(nullable: false), EditorialInformationScore_TotalScore = c.Int(nullable: false), PeerReviewScore_AverageScore = c.Single(nullable: false), PeerReviewScore_TotalScore = c.Int(nullable: false), GovernanceScore_AverageScore = c.Single(nullable: false), GovernanceScore_TotalScore = c.Int(nullable: false), ProcessScore_AverageScore = c.Single(nullable: false), ProcessScore_TotalScore = c.Int(nullable: false), ValuationScore_AverageScore = c.Single(nullable: false), ValuationScore_TotalScore = c.Int(nullable: false), NumberOfReviewers = c.Int(nullable: false), JournalId = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.Journals", t => t.JournalId, cascadeDelete: false) .Index(t => t.JournalId) .Index(t => t.NumberOfReviewers); CreateTable( "dbo.JournalPrices", c => new { Id = c.Int(nullable: false, identity: true), DateAdded = c.DateTime(nullable: false), Price_Amount = c.Decimal(precision: 18, scale: 2), Price_Currency = c.Int(), Price_FeeType = c.Int(), JournalId = c.Int(nullable: false), ScoreCardId = c.Int(nullable: false), UserProfileId = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.UserProfiles", t => t.UserProfileId, cascadeDelete: true) .ForeignKey("dbo.ScoreCards", t => t.ScoreCardId, cascadeDelete: true) .ForeignKey("dbo.Journals", t => t.JournalId, cascadeDelete: false) .Index(t => t.UserProfileId) .Index(t => t.ScoreCardId) .Index(t => t.JournalId) .Index(t => new { t.JournalId, t.UserProfileId }); CreateTable( "dbo.ScoreCards", c => new { Id = c.Int(nullable: false, identity: true), DateStarted = c.DateTime(nullable: false), DateExpiration = c.DateTime(), DatePublished = c.DateTime(), Remarks = c.String(), UserProfileId = c.Int(nullable: false), JournalId = c.Int(nullable: false), VersionId = c.Int(nullable: false), Score_OverallScore_AverageScore = c.Single(), Score_OverallScore_TotalScore = c.Int(), Score_EditorialInformationScore_AverageScore = c.Single(), Score_EditorialInformationScore_TotalScore = c.Int(), Score_PeerReviewScore_AverageScore = c.Single(), Score_PeerReviewScore_TotalScore = c.Int(), Score_GovernanceScore_AverageScore = c.Single(), Score_GovernanceScore_TotalScore = c.Int(), Score_ProcessScore_AverageScore = c.Single(), Score_ProcessScore_TotalScore = c.Int(), Score_ValuationScore_AverageScore = c.Single(), Score_ValuationScore_TotalScore = c.Int(), State = c.Int(nullable: false), Submitted = c.Boolean(nullable: false), Editor = c.Boolean(nullable: false), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.UserProfiles", t => t.UserProfileId, cascadeDelete: false) .ForeignKey("dbo.Journals", t => t.JournalId, cascadeDelete: true) .ForeignKey("dbo.ScoreCardVersions", t => t.VersionId, cascadeDelete: true) .Index(t => t.UserProfileId) .Index(t => t.JournalId) .Index(t => t.VersionId) .Index(t => t.DatePublished) .Index(t => new { t.JournalId, t.UserProfileId }) .Index(t => new { t.JournalId, t.State }) .Index(t => new { t.UserProfileId, t.State }) .Index(t => new { t.UserProfileId, t.JournalId, t.VersionId }, unique: true); CreateTable( "dbo.UserProfiles", c => new { Id = c.Int(nullable: false, identity: true), UserName = c.String(nullable: false, maxLength: 255), DisplayName = c.String(nullable: false, maxLength: 255), Email = c.String(maxLength: 255), DateRegistered = c.DateTime(nullable: false), NumberOfScoreCards = c.Int(nullable: false), InstitutionId = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.Institutions", t => t.InstitutionId, cascadeDelete: true) .Index(t => t.InstitutionId) .Index(t => t.DisplayName); CreateTable( "dbo.Institutions", c => new { Id = c.Int(nullable: false, identity: true), Name = c.String(nullable: false, maxLength: 255), ShortName = c.String(nullable: false, maxLength: 255), NumberOfScoreCards = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .Index(t => t.Name, unique: true); CreateTable( "dbo.InstitutionJournals", c => new { Id = c.Int(nullable: false, identity: true), DateAdded = c.DateTime(nullable: false), Link = c.String(nullable: false), InstitutionId = c.Int(nullable: false), JournalId = c.Int(nullable: false), UserProfileId = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.Institutions", t => t.InstitutionId, cascadeDelete: true) .ForeignKey("dbo.Journals", t => t.JournalId, cascadeDelete: true) .ForeignKey("dbo.UserProfiles", t => t.UserProfileId, cascadeDelete: false) .Index(t => t.InstitutionId) .Index(t => t.JournalId) .Index(t => t.UserProfileId) .Index(t => t.DateAdded) .Index(t => new { t.InstitutionId, t.JournalId }, unique: true); CreateTable( "dbo.ScoreCardVersions", c => new { Id = c.Int(nullable: false, identity: true), Number = c.Int(nullable: false), OverallNumberOfQuestions = c.Int(nullable: false), EditorialInformationNumberOfQuestions = c.Int(nullable: false), PeerReviewNumberOfQuestions = c.Int(nullable: false), GovernanceNumberOfQuestions = c.Int(nullable: false), ProcessNumberOfQuestions = c.Int(nullable: false), ValuationNumberOfQuestions = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .Index(t => t.Number, unique: true); CreateTable( "dbo.QuestionScores", c => new { Id = c.Int(nullable: false, identity: true), Score = c.Int(nullable: false), ScoreCardId = c.Int(nullable: false), QuestionId = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.ScoreCards", t => t.ScoreCardId, cascadeDelete: true) .ForeignKey("dbo.Questions", t => t.QuestionId, cascadeDelete: true) .Index(t => t.ScoreCardId) .Index(t => t.QuestionId) .Index(t => new { t.ScoreCardId, t.QuestionId }, unique: true); CreateTable( "dbo.Questions", c => new { Id = c.Int(nullable: false, identity: true), Key = c.Int(nullable: false), Category = c.Int(nullable: false), }) .PrimaryKey(t => t.Id) .Index(t => t.Key, unique: true); CreateTable( "dbo.Languages", c => new { Id = c.Int(nullable: false, identity: true), Name = c.String(nullable: false, maxLength: 255), }) .PrimaryKey(t => t.Id) .Index(t => t.Name, unique: true); CreateTable( "dbo.Subjects", c => new { Id = c.Int(nullable: false, identity: true), Name = c.String(nullable: false, maxLength: 255), }) .PrimaryKey(t => t.Id) .Index(t => t.Name, unique: true); CreateTable( "dbo.LanguageJournals", c => new { Language_Id = c.Int(nullable: false), Journal_Id = c.Int(nullable: false), }) .PrimaryKey(t => new { t.Language_Id, t.Journal_Id }) .ForeignKey("dbo.Languages", t => t.Language_Id, cascadeDelete: true) .ForeignKey("dbo.Journals", t => t.Journal_Id, cascadeDelete: true) .Index(t => t.Language_Id) .Index(t => t.Journal_Id); CreateTable( "dbo.SubjectJournals", c => new { Subject_Id = c.Int(nullable: false), Journal_Id = c.Int(nullable: false), }) .PrimaryKey(t => new { t.Subject_Id, t.Journal_Id }) .ForeignKey("dbo.Subjects", t => t.Subject_Id, cascadeDelete: true) .ForeignKey("dbo.Journals", t => t.Journal_Id, cascadeDelete: true) .Index(t => t.Subject_Id) .Index(t => t.Journal_Id); Sql(ResourceReader.GetContentsOfResource("201403171503325_InitialCreate_function_MinimumFloat.sql")); Sql(ResourceReader.GetContentsOfResource("201403171503325_InitialCreate_trigger_Scorecards.Published.sql")); Sql(ResourceReader.GetContentsOfResource("201403171503325_InitialCreate_MembershipTables.sql")); }
public override void Down() { Sql("DROP TRIGGER [ValuationScoreCards.Modified]"); Sql(ResourceReader.GetContentsOfResource("20160329_Trigger_ValuationScorecards.Modified.sql")); }
public override void Up() { Sql(ResourceReader.GetContentsOfResource("20151029_Trigger_UserProfiles.Updated.sql")); Sql(ResourceReader.GetContentsOfResource("20151029_Trigger_UserProfiles.Deleted.sql")); }
static string GetJournalTocsNext500Xml() { return(ResourceReader.GetContentsOfResource("JournalTocs-setup-next-500.xml")); }
private static string GetUlrichsJournalXmlWithoutPublisher() { return(ResourceReader.GetContentsOfResource("ulrichsjournalwithoutpublisher.xml")); }
private static string GetUlrichsJournalXmlWithCeasedAlternateEdition() { return(ResourceReader.GetContentsOfResource("ulrichsjournalwithceasedalternateedition.xml")); }
private static string GetUlrichsJournalXmlWithoutAlternateEditions() { return(ResourceReader.GetContentsOfResource("ulrichsjournalwithoutalternateeditions.xml")); }
private static string GetUlrichsXml() { return(ResourceReader.GetContentsOfResource("ulrichs.xml")); }
static string GetJournalTocsNextXml() { return(ResourceReader.GetContentsOfResource("JournalTocs-setup-next-500.xml").Replace("&", "&")); }
public override void Down() { Sql(ResourceReader.GetContentsOfResource("20151026_Trigger_BaseScorecards.Published.sql")); Sql(ResourceReader.GetContentsOfResource("20151026_Trigger_ValuationScorecards.Published.sql")); }
public override void Up() { Sql(ResourceReader.GetContentsOfResource("20151027_Trigger_BaseScorecards.Deleted.sql")); Sql(ResourceReader.GetContentsOfResource("20151027_Trigger_ValuationScorecards.Deleted.sql")); }
private static string GetDoajCsv() { return(ResourceReader.GetContentsOfResource("doaj.csv")); }
static string GetJournalTocsNoMoreItemsNotice() { return(ResourceReader.GetContentsOfResource("JournalTocs-no-more-items-notice.xml")); }
public override void Down() { Sql("DROP TRIGGER [BaseScoreCards.Modified]"); Sql("DROP TRIGGER [ValuationScoreCards.Modified]"); CreateTable( "dbo.JournalScores", c => new { Id = c.Int(nullable: false, identity: true), OverallScore_AverageScore = c.Single(nullable: false), OverallScore_TotalScore = c.Int(nullable: false), EditorialInformationScore_AverageScore = c.Single(nullable: false), EditorialInformationScore_TotalScore = c.Int(nullable: false), PeerReviewScore_AverageScore = c.Single(nullable: false), PeerReviewScore_TotalScore = c.Int(nullable: false), GovernanceScore_AverageScore = c.Single(nullable: false), GovernanceScore_TotalScore = c.Int(nullable: false), ProcessScore_AverageScore = c.Single(nullable: false), ProcessScore_TotalScore = c.Int(nullable: false), ValuationScore_AverageScore = c.Single(nullable: false), ValuationScore_TotalScore = c.Int(nullable: false), NumberOfBaseReviewers = c.Int(nullable: false), NumberOfValuationReviewers = c.Int(nullable: false), JournalId = c.Int(nullable: false), }) .PrimaryKey(t => t.Id); AlterColumn("dbo.Journals", "JournalScoreId", c => c.Int()); Sql("INSERT INTO [dbo].[JournalScores] (" + "[NumberOfBaseReviewers], " + "[OverallScore_AverageScore], " + "[OverallScore_TotalScore], " + "[EditorialInformationScore_AverageScore], " + "[EditorialInformationScore_TotalScore], " + "[PeerReviewScore_AverageScore], " + "[PeerReviewScore_TotalScore], " + "[GovernanceScore_AverageScore], " + "[GovernanceScore_TotalScore], " + "[ProcessScore_AverageScore], " + "[ProcessScore_TotalScore], " + "[ValuationScore_AverageScore], " + "[ValuationScore_TotalScore], " + "[NumberOfValuationReviewers], " + "[JournalId]) " + "SELECT " + "j.[NumberOfBaseReviewers], " + "j.[OverallScore_AverageScore], " + "j.[OverallScore_TotalScore], " + "j.[EditorialInformationScore_AverageScore], " + "j.[EditorialInformationScore_TotalScore], " + "j.[PeerReviewScore_AverageScore], " + "j.[PeerReviewScore_TotalScore], " + "j.[GovernanceScore_AverageScore], " + "j.[GovernanceScore_TotalScore], " + "j.[ProcessScore_AverageScore], " + "j.[ProcessScore_TotalScore], " + "j.[ValuationScore_AverageScore], " + "j.[ValuationScore_TotalScore], " + "j.[NumberOfValuationReviewers], " + "j.[Id] " + "FROM [dbo].[Journals] j"); Sql("UPDATE [dbo].[Journals] SET [JournalScoreId] = (SELECT TOP 1 [Id] FROM [dbo].[JournalScores] WHERE [JournalId] = [dbo].[Journals].[Id])"); DropColumn("dbo.Journals", "NumberOfValuationReviewers"); DropColumn("dbo.Journals", "NumberOfBaseReviewers"); DropColumn("dbo.Journals", "ValuationScore_TotalScore"); DropColumn("dbo.Journals", "ValuationScore_AverageScore"); DropColumn("dbo.Journals", "ProcessScore_TotalScore"); DropColumn("dbo.Journals", "ProcessScore_AverageScore"); DropColumn("dbo.Journals", "GovernanceScore_TotalScore"); DropColumn("dbo.Journals", "GovernanceScore_AverageScore"); DropColumn("dbo.Journals", "PeerReviewScore_TotalScore"); DropColumn("dbo.Journals", "PeerReviewScore_AverageScore"); DropColumn("dbo.Journals", "EditorialInformationScore_TotalScore"); DropColumn("dbo.Journals", "EditorialInformationScore_AverageScore"); DropColumn("dbo.Journals", "OverallScore_TotalScore"); DropColumn("dbo.Journals", "OverallScore_AverageScore"); CreateIndex("dbo.JournalScores", "JournalId"); CreateIndex("dbo.Journals", "JournalScoreId"); AddForeignKey("dbo.Journals", "JournalScoreId", "dbo.JournalScores", "Id"); AddForeignKey("dbo.JournalScores", "JournalId", "dbo.Journals", "Id", cascadeDelete: true); Sql(ResourceReader.GetContentsOfResource("20151026_Trigger_BaseScorecards.Published.sql")); Sql(ResourceReader.GetContentsOfResource("20151027_Trigger_BaseScorecards.Deleted.sql")); Sql(ResourceReader.GetContentsOfResource("20151026_Trigger_ValuationScorecards.Published.sql")); Sql(ResourceReader.GetContentsOfResource("20151027_Trigger_ValuationScorecards.Deleted.sql")); }