示例#1
0
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            AddColumn("dbo.FinancialTransaction", "Status", c => c.String(maxLength: 50));
            AddColumn("dbo.FinancialTransaction", "StatusMessage", c => c.String(maxLength: 200));

            // Update the attributes for the download payments job
            RockMigrationHelper.UpdateEntityAttribute("Rock.Model.ServiceJob", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Class", "Rock.Jobs.GetScheduledPayments", "Days Back", "The number of days prior to the current date to use as the start date when querying for scheduled payments that were processed.", 1, "7", "F05BE4DB-6375-4712-9B81-73A836EEF19F");
            RockMigrationHelper.UpdateEntityAttribute("Rock.Model.ServiceJob", "9C204CD0-1233-41C5-818A-C5DA439445AA", "Class", "Rock.Jobs.GetScheduledPayments", "Batch Name Prefix", "The batch prefix name to use when creating a new batch", 2, "Online Giving", "948A4C22-0E66-495E-B7A8-AAE852170211");
            RockMigrationHelper.UpdateEntityAttribute("Rock.Model.ServiceJob", "08F3003B-F3E2-41EC-BDF1-A2B7AC2908CF", "Class", "Rock.Jobs.GetScheduledPayments", "Receipt Email", "The system email to use to send the receipts.", 3, "", "95B950BF-3452-4088-98C4-48888C6ADBEF");
            RockMigrationHelper.UpdateAttributeQualifier("948A4C22-0E66-495E-B7A8-AAE852170211", "ispassword", "False", "2613DC3E-E716-43EC-861E-F73872910E53");

            // Create the payment download job if it hasn't been created yet (as inactive)
            Sql(@"
    DECLARE @AttributeId int
    DECLARE @JobId int = ( SELECT TOP 1 [Id] FROM [ServiceJob] WHERE [Class] = 'Rock.Jobs.GetScheduledPayments' )
    IF @JobId IS NULL
    BEGIN

	    -- Suggestion Notification Job
	    INSERT INTO [ServiceJob] ( [IsSystem], [IsActive], [Name], [Description], [Class], [CronExpression], [Guid], [NotificationStatus] )
	    VALUES ( 0, 0, 'Download Payments', 'Downloads any payments that have been processed for the active scheduled transactions.',
		    'Rock.Jobs.GetScheduledPayments','0 0 5 ? * MON-FRI *','43044F38-F357-4CF4-995D-C60D4724C97E', 3 )
	    SET @JobId = SCOPE_IDENTITY()

	    -- Days Back attribute
	    SET @AttributeId = ( SELECT TOP 1 [Id] FROM [Attribute] WHERE [Guid] = 'F05BE4DB-6375-4712-9B81-73A836EEF19F' )
	    IF @AttributeId IS NOT NULL
	    BEGIN
		    INSERT INTO [AttributeValue] ( [IsSystem], [AttributeId], [EntityId], [Value], [Guid] )
		    VALUES ( 0, @AttributeId, @JobId, '7', NEWID() )
	    END

	    -- Batch Name Prefix attribute
	    SET @AttributeId = ( SELECT TOP 1 [Id] FROM [Attribute] WHERE [Guid] = '948A4C22-0E66-495E-B7A8-AAE852170211' )
	    IF @AttributeId IS NOT NULL
	    BEGIN
		    INSERT INTO [AttributeValue] ( [IsSystem], [AttributeId], [EntityId], [Value], [Guid] )
		    VALUES ( 0, @AttributeId, @JobId, 'Online Giving', NEWID() )
	    END

	    -- Receipt Email
	    SET @AttributeId = ( SELECT TOP 1 [Id] FROM [Attribute] WHERE [Guid] = '95B950BF-3452-4088-98C4-48888C6ADBEF' )
	    IF @AttributeId IS NOT NULL
	    BEGIN
		    INSERT INTO [AttributeValue] ( [IsSystem], [AttributeId], [EntityId], [Value], [Guid] )
		    VALUES ( 0, @AttributeId, @JobId, '7dbf229e-7dee-a684-4929-6c37312a0039', NEWID() )
	    END

    END

");
            // Add a route to transaction detail page
            RockMigrationHelper.AddPageRoute("B67E38CB-2EF1-43EA-863A-37DAA1C7340F", "Transaction/{transactionId}", "C1F02FA3-DD60-4D43-95AE-A4F4B3A63990");

            // Attrib for BlockType: Scheduled Payment Download:Receipt Email
            RockMigrationHelper.AddBlockTypeAttribute("71FF09C3-3E50-4E97-9329-3CD57AACCA53", "08F3003B-F3E2-41EC-BDF1-A2B7AC2908CF", "Receipt Email", "ReceiptEmail", "", "The system email to use to send the receipts.", 2, @"", "E67E6D3E-6EB1-433B-9244-585BB4AB8414");

            // Attrib Value for Block:Scheduled Payment Download, Attribute:Receipt Email Page: Download Payments, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("A55A9614-9D89-4D56-A022-D15BD6472C62", "E67E6D3E-6EB1-433B-9244-585BB4AB8414", @"7dbf229e-7dee-a684-4929-6c37312a0039");
        }
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            AddColumn("dbo.FinancialPersonBankAccount", "AccountNumberMasked", c => c.String(nullable: false));

            // Transaction Matching and Bank Account List related
            RockMigrationHelper.AddPage("606BDA31-A8FE-473A-B3F8-A00ECF7E06EC", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "Transaction Matching", "", "CD18FE52-8D6A-49C9-81BF-DF97C5BA0302", "fa fa-money");   // Site:Rock RMS
            RockMigrationHelper.UpdateBlockType("Transaction Matching", "Used to match transactions to an individual and allocate the check amount to financial account(s).", "~/Blocks/Finance/TransactionMatching.ascx", "Finance", "1A8BEE2A-E5BE-4BA5-AFDB-E9C9278419BA");
            RockMigrationHelper.UpdateBlockType("Bank Account List", "Lists bank accounts for a person", "~/Blocks/Crm/PersonDetail/BankAccountList.ascx", "CRM > Person Detail", "C4191011-0391-43DF-9A9D-BE4987C679A4");

            // Add Block to Page: Transaction Matching, Site: Rock RMS
            RockMigrationHelper.AddBlock("CD18FE52-8D6A-49C9-81BF-DF97C5BA0302", "", "1A8BEE2A-E5BE-4BA5-AFDB-E9C9278419BA", "Transaction Matching", "Main", "", "", 0, "A18A0A0A-0B71-43B4-B830-44B802C272D4");

            // Add Block to Page: Contributions, Site: Rock RMS
            RockMigrationHelper.AddBlock("53CF4CBE-85F9-4A50-87D7-0D72A3FB2892", "", "C4191011-0391-43DF-9A9D-BE4987C679A4", "Bank Account List", "SectionC1", "", "", 2, "7C698D61-81C9-4942-BFE3-9839130C1A3E");

            // Attrib for BlockType: Transaction Matching:Accounts
            RockMigrationHelper.AddBlockTypeAttribute("1A8BEE2A-E5BE-4BA5-AFDB-E9C9278419BA", "17033CDD-EF97-4413-A483-7B85A787A87F", "Accounts", "Accounts", "", "Select the accounts that check amounts can be allocated to.  Leave blank to show all accounts", 0, @"", "1EA5E62A-0FFE-4427-A0D1-1624A9478440");

            // Attrib for BlockType: Transaction Matching:Add Family Link
            RockMigrationHelper.AddBlockTypeAttribute("1A8BEE2A-E5BE-4BA5-AFDB-E9C9278419BA", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Add Family Link", "AddFamilyLink", "", "Select the page where a new family can be added. If specified, a link will be shown which will open in a new window when clicked", 0, @"6a11a13d-05ab-4982-a4c2-67a8b1950c74,af36e4c2-78c6-4737-a983-e7a78137ddc7", "D4909540-9D01-4BC6-8CFF-851BE101A821");


            //// Misc Catchups

            //
            RockMigrationHelper.UpdateBlockType("Scheduled Transaction Summary", "Block that shows a summary of the scheduled transactions for the currently logged in user.", "~/Blocks/Finance/ScheduledTransactionSummary.ascx", "Finance", "3FC83F0E-8BAA-4CB3-BAD0-0CFBE0E621AA");

            // Attrib for BlockType: Batch List:Show Accounting Code
            RockMigrationHelper.AddBlockTypeAttribute("AB345CE7-5DC6-41AF-BBDC-8D23D52AFE25", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Show Accounting Code", "ShowAccountingCode", "", "Should the accounting code column be displayed.", 1, @"False", "E155892B-D165-4455-9B04-8A8E3B7240D3");
        }
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            CreateTable(
                "dbo.BenevolenceRequestDocument",
                c => new
            {
                Id = c.Int(nullable: false, identity: true),
                BenevolenceRequestId = c.Int(nullable: false),
                BinaryFileId         = c.Int(nullable: false),
                Order                   = c.Int(),
                CreatedDateTime         = c.DateTime(),
                ModifiedDateTime        = c.DateTime(),
                CreatedByPersonAliasId  = c.Int(),
                ModifiedByPersonAliasId = c.Int(),
                Guid        = c.Guid(nullable: false),
                ForeignId   = c.Int(),
                ForeignGuid = c.Guid(),
                ForeignKey  = c.String(maxLength: 100),
            })
            .PrimaryKey(t => t.Id)
            .ForeignKey("dbo.BenevolenceRequest", t => t.BenevolenceRequestId, cascadeDelete: true)
            .ForeignKey("dbo.BinaryFile", t => t.BinaryFileId)
            .ForeignKey("dbo.PersonAlias", t => t.CreatedByPersonAliasId)
            .ForeignKey("dbo.PersonAlias", t => t.ModifiedByPersonAliasId)
            .Index(t => t.BenevolenceRequestId)
            .Index(t => t.BinaryFileId)
            .Index(t => t.CreatedByPersonAliasId)
            .Index(t => t.ModifiedByPersonAliasId)
            .Index(t => t.Guid, unique: true)
            .Index(t => t.ForeignId)
            .Index(t => t.ForeignGuid)
            .Index(t => t.ForeignKey);

            AddColumn("dbo.BenevolenceRequest", "ProvidedNextSteps", c => c.String());
            AddColumn("dbo.BenevolenceRequest", "CampusId", c => c.Int());
            CreateIndex("dbo.BenevolenceRequest", "CampusId");
            AddForeignKey("dbo.BenevolenceRequest", "CampusId", "dbo.Campus", "Id");

            RockMigrationHelper.UpdateBinaryFileType(Rock.SystemGuid.EntityType.STORAGE_PROVIDER_DATABASE, "Benevolence Request Documents", "Related documents for benevolence requests.", "fa fa-files-o", Rock.SystemGuid.BinaryFiletype.BENEVOLENCE_REQUEST_DOCUMENTS, false, true);

            // add security to the document
            RockMigrationHelper.AddSecurityAuthForBinaryFileType(Rock.SystemGuid.BinaryFiletype.BENEVOLENCE_REQUEST_DOCUMENTS, 0, "View", true, Rock.SystemGuid.Group.GROUP_BENEVOLENCE, Model.SpecialRole.None, "3EF0EE1E-A2F5-0C95-48AA-3B1FD2A6E5A1");
            RockMigrationHelper.AddSecurityAuthForBinaryFileType(Rock.SystemGuid.BinaryFiletype.BENEVOLENCE_REQUEST_DOCUMENTS, 1, "View", true, Rock.SystemGuid.Group.GROUP_ADMINISTRATORS, Model.SpecialRole.None, "4D486E0B-FD09-61A6-463C-10022C0C68AA");
            RockMigrationHelper.AddSecurityAuthForBinaryFileType(Rock.SystemGuid.BinaryFiletype.BENEVOLENCE_REQUEST_DOCUMENTS, 2, "View", false, "", Model.SpecialRole.AllUsers, "7A7A6C2A-5032-07AD-428F-3695F726E6A7");

            // enable show on grid field on the attributes page
            RockMigrationHelper.AddBlockTypeAttribute("E5EA2F6D-43A2-48E0-B59C-4409B78AC830", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Enable Show In Grid", "EnableShowInGrid", "", "Should the 'Show In Grid' option be displayed when editing attributes?", 2, @"False", "920FE120-AD75-4D5C-BFE0-FA5745B1118B");
            RockMigrationHelper.AddBlockAttributeValue("1B8BA918-FEE5-4B69-966C-3D79D555A761", "920FE120-AD75-4D5C-BFE0-FA5745B1118B", @"True");   // Enable Show In Grid

            // move the entity attributes page under 'System Settings'
            Sql(@"DECLARE @EntityAttributesPageId int = (SELECT TOP 1 [Id] FROM [Page] WHERE [Guid] = '23507C90-3F78-40D4-B847-6FE8941FCD32')
DECLARE @SystemsSettingPageId int = (SELECT TOP 1 [Id] FROM [Page] WHERE [Guid] = 'C831428A-6ACD-4D49-9B2D-046D399E3123')

UPDATE [Page]
	SET [ParentPageId] = @SystemsSettingPageId
WHERE 
	[Id] = @EntityAttributesPageId"    );
        }
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            RockMigrationHelper.UpdateEntityAttribute("Rock.Model.ServiceJob", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Class", "Rock.Jobs.ProcessSignatureDocuments", "Resend Invite After Number Days", "Number of days after sending last invite to sign, that a new invite should be resent.", 0, "5", "8B5EB6D6-12D1-4889-BBF4-89B85AC81142");
            RockMigrationHelper.UpdateEntityAttribute("Rock.Model.ServiceJob", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Class", "Rock.Jobs.ProcessSignatureDocuments", "Max Invites", "Maximum number of times an invite should be sent", 1, "3", "04724293-AEF7-4B85-AE64-1F0F5CB801E2");

            Sql(@"
    DECLARE @JobId int = ( SELECT TOP 1 [Id] FROM [ServiceJob] WHERE [Class] = 'Rock.Jobs.ProcessSignatureDocuments' )
    IF @JobId IS NULL
    BEGIN

	    -- Suggestion Notification Job
	    INSERT INTO [ServiceJob] ( [IsSystem], [IsActive], [Name], [Description], [Class], [CronExpression], [Guid], [NotificationStatus] )
	    VALUES ( 0, 1, 'Process Signature Documents', 'Sends any digital signature invites that need to be sent for groups that require a signed document.',
		    'Rock.Jobs.ProcessSignatureDocuments','0 0 9 1/1 * ? *','77B2F2D4-D188-4716-9A79-F93AD4673F8C', 3 )
	    SET @JobId = SCOPE_IDENTITY()

	    DECLARE @AttributeId int

	    -- Resend Invite After Number Days attribute
	    SET @AttributeId = ( SELECT TOP 1 [Id] FROM [Attribute] WHERE [Guid] = '8B5EB6D6-12D1-4889-BBF4-89B85AC81142' )
	    IF @AttributeId IS NOT NULL
	    BEGIN
		    INSERT INTO [AttributeValue] ( [IsSystem], [AttributeId], [EntityId], [Value], [Guid] )
		    VALUES ( 0, @AttributeId, @JobId, '5', NEWID() )
	    END

	    -- Max Invites attribute
	    SET @AttributeId = ( SELECT TOP 1 [Id] FROM [Attribute] WHERE [Guid] = '04724293-AEF7-4B85-AE64-1F0F5CB801E2' )
	    IF @AttributeId IS NOT NULL
	    BEGIN
		    INSERT INTO [AttributeValue] ( [IsSystem], [AttributeId], [EntityId], [Value], [Guid] )
		    VALUES ( 0, @AttributeId, @JobId, '3', NEWID() )
	    END

    END
");
            // JE - Reset the History Categories Page to Category Manager
            Sql(@"
    DECLARE @CategoryPageId int = (SELECT TOP 1 [Id] FROM [Page] WHERE [Guid] = '95ACFF8C-B9EE-41C6-BAC0-D117D6E1FADC')

    -- update the page name
    UPDATE [Page]
    SET [BrowserTitle] = 'Category Manager', [PageTitle] = 'Category Manager', [InternalName] = 'Category Manager'
    WHERE [Id] = @CategoryPageId

    -- update the block settings
    DECLARE @CategoryBlockTypeId int = (SELECT TOP 1 [Id] FROM [BlockType] WHERE [Guid] = '620FC4A2-6587-409F-8972-22065919D9AC')
    DECLARE @EntityTypeBlockAttributeId int = (SELECT [Id] FROM [Attribute] WHERE [EntityTypeQualifierColumn] = 'BlockTypeId' AND [EntityTypeQualifierValue] = @CategoryBlockTypeId AND [Key] = 'EntityType')

    DECLARE @CategoryBlockId int = (SELECT TOP 1 [Id] FROM [Block] WHERE [PageId] = @CategoryPageId AND [BlockTypeId] = @CategoryBlockTypeId)

    DELETE FROM [AttributeValue] 
    WHERE [AttributeId] = @EntityTypeBlockAttributeId AND [EntityId] = @CategoryBlockId
");

            // TC - Migration for the 'Hide Attachment Uploader' Pull Request
            RockMigrationHelper.AddBlockTypeAttribute("D9834641-7F39-4CFA-8CB2-E64068127565", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Show Attachment Uploader", "ShowAttachmentUploader", "", "Should the attachment uploader be shown for email communications.", 6, @"True", "068DF91F-EDA8-49C1-963B-AB34AA12DE5E");
        }
示例#5
0
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            AddColumn("dbo.Group", "IsPublic", c => c.Boolean(nullable: false, defaultValue: true));

            RockMigrationHelper.AddBlockTypeAttribute("1A8BEE2A-E5BE-4BA5-AFDB-E9C9278419BA", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Add Business Link", "AddBusinessLink", "", "Select the page where a new business can be added. If specified, a link will be shown which will open in a new window when clicked", 0, @"", "B5327385-CD67-4519-B83D-1DA1E438356F");

            // Add Business Link value (of the existing Business Detail page) on the existing TransactionMatching block instance
            RockMigrationHelper.AddBlockAttributeValue("A18A0A0A-0B71-43B4-B830-44B802C272D4", "B5327385-CD67-4519-B83D-1DA1E438356F", @"d2b43273-c64f-4f57-9aae-9571e1982bac");
        }