Esempio n. 1
0
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            AddColumn("dbo.WorkflowActivity", "AssignedPersonAliasId", c => c.Int());
            AddColumn("dbo.WorkflowActivity", "AssignedGroupId", c => c.Int());
            CreateIndex("dbo.WorkflowActivity", "AssignedPersonAliasId");
            CreateIndex("dbo.WorkflowActivity", "AssignedGroupId");
            AddForeignKey("dbo.WorkflowActivity", "AssignedGroupId", "dbo.Group", "Id");
            AddForeignKey("dbo.WorkflowActivity", "AssignedPersonAliasId", "dbo.PersonAlias", "Id");

            RockMigrationHelper.AddDefinedType_pre201409101843015("Global", "CSS Classes", "Contain common css class definitions", "407A3A73-A3EF-4970-B856-2A33F62AC72E", @"");
            RockMigrationHelper.AddDefinedTypeAttribute("407A3A73-A3EF-4970-B856-2A33F62AC72E", "9C204CD0-1233-41C5-818A-C5DA439445AA", "CSS Class", "CSSClass", "The css class", 28, "", "6FF59F53-28EA-4BFE-AFE1-A459CC588495");
            RockMigrationHelper.AddDefinedValue_pre20140819("407A3A73-A3EF-4970-B856-2A33F62AC72E", "Primary Button", "", "FDC397CD-8B4A-436E-BEA1-BCE2E6717C03", false);
            RockMigrationHelper.AddDefinedValueAttributeValue("FDC397CD-8B4A-436E-BEA1-BCE2E6717C03", "6FF59F53-28EA-4BFE-AFE1-A459CC588495", @"btn btn-primary");
            RockMigrationHelper.AddDefinedValue_pre20140819("407A3A73-A3EF-4970-B856-2A33F62AC72E", "Red Button", "", "FDEB8E6C-70C3-4033-B307-7D0DEE1AC29D", false);
            RockMigrationHelper.AddDefinedValueAttributeValue("FDEB8E6C-70C3-4033-B307-7D0DEE1AC29D", "6FF59F53-28EA-4BFE-AFE1-A459CC588495", @"btn btn-danger");

            RockMigrationHelper.AddDefinedType_pre201409101843015("Location", "Countries", "Defines how addresses are displayed and formatted for each country", "D7979EA1-44E9-46E2-BF37-DDAF7F741378", @"");
            RockMigrationHelper.AddDefinedTypeAttribute("D7979EA1-44E9-46E2-BF37-DDAF7F741378", "9C204CD0-1233-41C5-818A-C5DA439445AA", "Abbreviation", "Abbreviation", "The abbreviation for the country", 0, "", "DA46DC37-5398-4520-B6A5-6E57C9C46F7A");
            RockMigrationHelper.AddDefinedTypeAttribute("D7979EA1-44E9-46E2-BF37-DDAF7F741378", "9C204CD0-1233-41C5-818A-C5DA439445AA", "Postal Code Label", "PostalCodeLabel", "The label to use for the Postal Code (Zip) field", 2, "Zip", "7D785A5D-53CA-4FEC-BC88-DFBD7439B547");
            RockMigrationHelper.AddDefinedTypeAttribute("D7979EA1-44E9-46E2-BF37-DDAF7F741378", "9C204CD0-1233-41C5-818A-C5DA439445AA", "State Label", "StateLabel", "The label to use for the 'state' field", 1, "State", "A4E00B14-8CFF-4719-A43F-462851C7BBEF");
            RockMigrationHelper.AddDefinedTypeAttribute("D7979EA1-44E9-46E2-BF37-DDAF7F741378", "C28C7BF3-A552-4D77-9408-DEDCF760CED0", "Address Format", "AddressFormat", "The Liquid syntax to use for formatting addresses", 3, @"
{{ Street1 }} 
{{ Street2 }}
{{ City }}, {{ State }} {{ Zip }}
", "B6EF4138-C488-4043-A628-D35F91503843");
            RockMigrationHelper.AddDefinedValue_pre20140819("D7979EA1-44E9-46E2-BF37-DDAF7F741378", "United States", "United States", "F4DAEB01-A0E5-426A-A425-7F6D21DF1CE7", false);
            RockMigrationHelper.AddDefinedValueAttributeValue("F4DAEB01-A0E5-426A-A425-7F6D21DF1CE7", "DA46DC37-5398-4520-B6A5-6E57C9C46F7A", @"US");
            RockMigrationHelper.AddDefinedValueAttributeValue("F4DAEB01-A0E5-426A-A425-7F6D21DF1CE7", "A4E00B14-8CFF-4719-A43F-462851C7BBEF", @"State");
            RockMigrationHelper.AddDefinedValueAttributeValue("F4DAEB01-A0E5-426A-A425-7F6D21DF1CE7", "7D785A5D-53CA-4FEC-BC88-DFBD7439B547", @"Zip");
            RockMigrationHelper.AddDefinedValueAttributeValue("F4DAEB01-A0E5-426A-A425-7F6D21DF1CE7", "B6EF4138-C488-4043-A628-D35F91503843", @"{{ Street1 }} 
{{ Street2 }}
{{ City }}, {{ State }} {{ Zip }}");

            RockMigrationHelper.AddDefinedValue_pre20140819("D7979EA1-44E9-46E2-BF37-DDAF7F741378", "Canada", "Canada", "60D86635-8E4A-4F4B-8052-26048DAE0335", false);
            RockMigrationHelper.AddDefinedValueAttributeValue("60D86635-8E4A-4F4B-8052-26048DAE0335", "DA46DC37-5398-4520-B6A5-6E57C9C46F7A", @"CA");
            RockMigrationHelper.AddDefinedValueAttributeValue("60D86635-8E4A-4F4B-8052-26048DAE0335", "A4E00B14-8CFF-4719-A43F-462851C7BBEF", @"Province");
            RockMigrationHelper.AddDefinedValueAttributeValue("60D86635-8E4A-4F4B-8052-26048DAE0335", "7D785A5D-53CA-4FEC-BC88-DFBD7439B547", @"Postal Code");
            RockMigrationHelper.AddDefinedValueAttributeValue("60D86635-8E4A-4F4B-8052-26048DAE0335", "B6EF4138-C488-4043-A628-D35F91503843", @"{{ Street1 }} 
{{ Street2 }}
{{ City }}, {{ State }} {{ Zip }}
{{ Country }}");

            RockMigrationHelper.AddDefinedTypeAttribute("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "59D5A94C-94A0-4630-B80A-BB25697D74C7", "Country", "Country", "The country that the 'state' belongs to", 29, "f4daeb01-a0e5-426a-a425-7f6d21df1ce7", "3B234A62-B87D-47CD-A33F-32CC6C840A02");
            RockMigrationHelper.AddAttributeQualifier("3B234A62-B87D-47CD-A33F-32CC6C840A02", "allowmultiple", "False", "0177244E-D113-4752-8C89-2DD05BA5FAE0");
            RockMigrationHelper.AddAttributeQualifier("3B234A62-B87D-47CD-A33F-32CC6C840A02", "definedtype", "46", "50019CC0-BBD9-4CE8-B04D-15DD9698F8BD");

            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "AB", "Alberta", "50ABDD73-C7BF-4439-994F-EE3ADD60910B");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "BC", "British Columbia", "2651DEE8-30D6-477D-88CA-48EBA769683E");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "MB", "Manitoba", "5A59DC0E-97E0-45EA-83CD-586EB9D4BD49");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "NB", "New Brunswick", "C975FD3B-2A25-473A-8CD4-ABBCD0757CA0");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "NL", "Newfoundland and Labrador", "C8ABE4D8-6B88-47ED-80DB-CDF8EEF47A7F");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "NT", "Northwest Territories", "67E0BC8B-BE23-40B0-ADB1-ACA50CEF8825");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "NS", "Nova Scotia", "F91359C1-D6F9-495E-A475-9D7DEF7AA67B");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "NU", "Nunavut", "B6AC22E5-676E-4FB9-909D-4E047A21B703");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "ON", "Ontario", "0EF0F132-69C3-480F-801A-59145F417277");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "PE", "Prince Edward Island", "25DE8C9B-9F69-4B4E-A21F-D976FE1D0D41");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "QC", "Quebec", "BE1A052A-ABCD-48C2-AA04-BDE4F394D001");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "SK", "Saskatchewan", "63B48AA0-8904-4415-9F5E-7218454D3D0F");
            RockMigrationHelper.AddDefinedValue_pre20140819("C3A20D2D-AEAF-4E2B-A1D9-2E072CEFC2BB", "YT", "Yukon", "91D87671-F309-4908-ABE1-57FA27B2C7F6");

            RockMigrationHelper.AddDefinedValueAttributeValue("0EF0F132-69C3-480F-801A-59145F417277", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("BE1A052A-ABCD-48C2-AA04-BDE4F394D001", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("F91359C1-D6F9-495E-A475-9D7DEF7AA67B", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("C975FD3B-2A25-473A-8CD4-ABBCD0757CA0", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("5A59DC0E-97E0-45EA-83CD-586EB9D4BD49", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("2651DEE8-30D6-477D-88CA-48EBA769683E", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("25DE8C9B-9F69-4B4E-A21F-D976FE1D0D41", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("63B48AA0-8904-4415-9F5E-7218454D3D0F", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("50ABDD73-C7BF-4439-994F-EE3ADD60910B", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("C8ABE4D8-6B88-47ED-80DB-CDF8EEF47A7F", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("67E0BC8B-BE23-40B0-ADB1-ACA50CEF8825", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("91D87671-F309-4908-ABE1-57FA27B2C7F6", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");
            RockMigrationHelper.AddDefinedValueAttributeValue("B6AC22E5-676E-4FB9-909D-4E047A21B703", "3B234A62-B87D-47CD-A33F-32CC6C840A02", "60D86635-8E4A-4F4B-8052-26048DAE0335");

            Sql(@"
    UPDATE [Attribute] SET [IsGridColumn] = 1
    WHERE [Guid] IN ( '6FF59F53-28EA-4BFE-AFE1-A459CC588495', 'DA46DC37-5398-4520-B6A5-6E57C9C46F7A', '7D785A5D-53CA-4FEC-BC88-DFBD7439B547', 'A4E00B14-8CFF-4719-A43F-462851C7BBEF', '3B234A62-B87D-47CD-A33F-32CC6C840A02')
");

            RockMigrationHelper.AddPage("98163C8B-5C91-4A68-BB79-6AD948A604CE", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "Workflow", "", "CDB27DB2-977C-415A-AED5-D0751DFD5DF2", "");         // Site:Rock RMS
            RockMigrationHelper.AddPage("CDB27DB2-977C-415A-AED5-D0751DFD5DF2", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "Workflows", "", "6510AB6B-DFB4-4DBF-9F0F-7EA598E4AC54", "");        // Site:Rock RMS
            RockMigrationHelper.AddPage("6510AB6B-DFB4-4DBF-9F0F-7EA598E4AC54", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "Manage Workflows", "", "61E1B4B6-EACE-42E8-A2FB-37465E6D0004", ""); // Site:Rock RMS
            RockMigrationHelper.AddPage("61E1B4B6-EACE-42E8-A2FB-37465E6D0004", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "Workflow Entry", "", "0550D2AA-A705-4400-81FF-AB124FDF83D7", "");   // Site:Rock RMS
            RockMigrationHelper.AddPage("61E1B4B6-EACE-42E8-A2FB-37465E6D0004", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "Workflow Detail", "", "BA547EED-5537-49CF-BD4E-C583D760788C", "");  // Site:Rock RMS

            RockMigrationHelper.UpdateBlockType("Workflow Entry", "Used to enter information for a workflow form entry action.", "~/Blocks/Core/WorkflowEntry.ascx", "Core", "A8BD05C8-6F89-4628-845B-059E686F089A");
            RockMigrationHelper.UpdateBlockType("Workflow Navigation", "Block for navigating workflow types and launching and/or managing workflows.", "~/Blocks/Core/WorkflowNavigation.ascx", "Core", "DDC6B004-9ED1-470F-ABF5-041250082168");

            // Add Block to Page: Workflow Entry, Site: Rock RMS
            RockMigrationHelper.AddBlock("0550D2AA-A705-4400-81FF-AB124FDF83D7", "", "A8BD05C8-6F89-4628-845B-059E686F089A", "Workflow Entry", "Main", "", "", 0, "29D1A3BC-9D08-4782-8B01-FE5DC6FCF367");
            // Add Block to Page: Manage Workflows, Site: Rock RMS
            RockMigrationHelper.AddBlock("61E1B4B6-EACE-42E8-A2FB-37465E6D0004", "", "C86C80DF-F2FD-47F8-81CF-7C5EA4100C3B", "Workflow List", "Main", "", "", 0, "BCC61035-DA99-47EE-A376-71D430455DB4");
            // Add Block to Page: Workflows, Site: Rock RMS
            RockMigrationHelper.AddBlock("6510AB6B-DFB4-4DBF-9F0F-7EA598E4AC54", "", "DDC6B004-9ED1-470F-ABF5-041250082168", "Workflow Navigation", "Main", "", "", 0, "2D20CEC4-328E-4C2B-8059-78DFC49D8E35");

            // Attrib for BlockType: Workflow Entry:Workflow Type
            RockMigrationHelper.AddBlockTypeAttribute("A8BD05C8-6F89-4628-845B-059E686F089A", "46A03F59-55D3-4ACE-ADD5-B4642225DD20", "Workflow Type", "WorkflowType", "", "Type of workflow to start.", 0, @"", "2F1D98C4-A8EF-4680-9F64-11BFC28D5597");
            // Attrib for BlockType: Workflow Navigation:Manage Page
            RockMigrationHelper.AddBlockTypeAttribute("DDC6B004-9ED1-470F-ABF5-041250082168", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Manage Page", "ManagePage", "", "Page used to manage workflows of the selected type.", 0, @"", "6B8E6B05-87E6-4CA0-9A44-861184E3A34C");
            // Attrib for BlockType: Workflow Navigation:Entry Page
            RockMigrationHelper.AddBlockTypeAttribute("DDC6B004-9ED1-470F-ABF5-041250082168", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Entry Page", "EntryPage", "", "Page used to launch a new workflow of the selected type.", 0, @"", "DABA0448-C967-4E9D-863E-59C95059935A");
            // Attrib for BlockType: Workflow List:Entry Page
            RockMigrationHelper.AddBlockTypeAttribute("C86C80DF-F2FD-47F8-81CF-7C5EA4100C3B", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Entry Page", "EntryPage", "", "Page used to launch a new workflow of the selected type.", 0, @"", "630AF4C8-6DA1-4BC2-8D38-283D7EF3DD43");
            // Attrib Value for Block:Attribute Values, Attribute:Category Page: Extended Attributes, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("DCA9E640-B5EA-4C73-90BC-4A91330528D5", "EC43CF32-3BDF-4544-8B6A-CE9208DD7C81", @"dd8f467d-b83c-444f-b04c-c681167046a1");
            // Attrib Value for Block:Workflow Entry, Attribute:Workflow Type Page: Workflow Entry, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("29D1A3BC-9D08-4782-8B01-FE5DC6FCF367", "2F1D98C4-A8EF-4680-9F64-11BFC28D5597", @"");
            // Attrib Value for Block:Workflow List, Attribute:Entry Page Page: Manage Workflows, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("BCC61035-DA99-47EE-A376-71D430455DB4", "630AF4C8-6DA1-4BC2-8D38-283D7EF3DD43", @"0550d2aa-a705-4400-81ff-ab124fdf83d7");
            // Attrib Value for Block:Workflow List, Attribute:Detail Page Page: Manage Workflows, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("BCC61035-DA99-47EE-A376-71D430455DB4", "C0BA339B-10C5-4609-B806-D192C733FFF1", @"ba547eed-5537-49cf-bd4e-c583d760788c");
            // Attrib Value for Block:Workflow Navigation, Attribute:Manage Page Page: Workflows, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("2D20CEC4-328E-4C2B-8059-78DFC49D8E35", "6B8E6B05-87E6-4CA0-9A44-861184E3A34C", @"61e1b4b6-eace-42e8-a2fb-37465e6d0004");
            // Attrib Value for Block:Workflow Navigation, Attribute:Entry Page Page: Workflows, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("2D20CEC4-328E-4C2B-8059-78DFC49D8E35", "DABA0448-C967-4E9D-863E-59C95059935A", @"0550d2aa-a705-4400-81ff-ab124fdf83d7");
            RockMigrationHelper.UpdateFieldType("Comparison", "", "Rock", "Rock.Field.Types.ComparisonFieldType", "3C742B81-3C55-48B8-A7CD-E7762EA5BB91");
            RockMigrationHelper.UpdateFieldType("Metric Entity", "", "Rock", "Rock.Field.Types.MetricEntityFieldType", "3A7FB32E-1CCD-4F79-B085-BDBADEB56CCF");
            RockMigrationHelper.UpdateFieldType("Workflow Activity", "", "Rock", "Rock.Field.Types.WorkflowActivityFieldType", "739FD425-5B8C-4605-B775-7E4D9D4C11DB");
            RockMigrationHelper.UpdateFieldType("Workflow Attribute", "", "Rock", "Rock.Field.Types.WorkflowAttributeFieldType", "33E6DF69-BDFA-407A-9744-C175B60643AE");
            RockMigrationHelper.UpdateFieldType("Metrics", "", "Rock", "Rock.Field.Types.MetricsFieldType", "3AF9AD35-9F3E-4497-BFDE-60C6C1827653");
            RockMigrationHelper.UpdateFieldType("Entity", "", "Rock", "Rock.Field.Types.EntityFieldType", "B50968BD-7643-4288-9237-6E89D2065363");
            RockMigrationHelper.UpdateFieldType("Metric Categories", "", "Rock", "Rock.Field.Types.MetricCategoriesFieldType", "F5334A8E-B7E2-415C-A6EC-A6D8FA5341C4");
            RockMigrationHelper.UpdateFieldType("Workflow Text Or Attribute", "", "Rock", "Rock.Field.Types.WorkflowTextOrAttributeFieldType", "3B1D93D7-9414-48F9-80E5-6A3FC8F94C20");
            RockMigrationHelper.UpdateFieldType("Sliding Date Range", "", "Rock", "Rock.Field.Types.SlidingDateRangeFieldType", "55810BC5-45EA-4044-B783-0CCE0A445C6F");
        }
Esempio n. 2
0
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            // Update the schema for all stored procedures and functions to be 'dbo'
            Sql(@"
    DECLARE 
	    @SchemaName varchar(max),
	    @ObjectName varchar(max),
	    @Sql varchar(max)

    DECLARE schema_cursor CURSOR FOR
	    SELECT S.[Name], O.[Name]
	    FROM sys.all_objects O
	    INNER JOIN sys.schemas S ON S.[schema_id] = O.[schema_id]
	    WHERE O.[Type] IN ( 'FN', 'P', 'TF')
	    AND S.[name] NOT IN ('sys','dbo')

    OPEN schema_cursor 
    FETCH NEXT FROM schema_cursor INTO @SchemaName, @ObjectName

    WHILE @@FETCH_STATUS = 0
    BEGIN
	
	    BEGIN TRY
		    SELECT @SQL = 'ALTER SCHEMA dbo TRANSFER [' + @SchemaName  + '].[' + @ObjectName + ']'
		    EXEC (@SQL)
        END TRY
        BEGIN CATCH
        END CATCH
    
	    FETCH NEXT FROM schema_cursor INTO @SchemaName, @ObjectName

    END

    CLOSE schema_cursor
    DEALLOCATE schema_cursor

");

            #region Add Activated by Activity property

            AddColumn("dbo.WorkflowActivity", "ActivatedByActivityId", c => c.Int());
            CreateIndex("dbo.WorkflowActivity", "ActivatedByActivityId");
            AddForeignKey("dbo.WorkflowActivity", "ActivatedByActivityId", "dbo.WorkflowActivity", "Id");

            #endregion

            #region Convert Safe Sender Domains to Defined Type

            RockMigrationHelper.AddDefinedType_pre201409101843015("Communication", "Safe Sender Domains", @"
Are the domains that can be used to send emails.  If an Email communication is created with a From Address that is not from 
one of these domains, the Organization Email global attribute value will be used instead for the From Address and the original 
value will be used as the Reply To address.  This is to help reduce the likelihood of communications being rejected by the 
receiving email servers.", "DB91D0E9-DCA6-45A9-8276-AEF032BE8AED");
            RockMigrationHelper.AddPage("199DC522-F4D6-4D82-AF44-3C16EE9D2CDA", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "Safe Sender Domains", "", "B90576B0-110E-4DC0-8EB8-4668C5238508", "fa fa-check");
            RockMigrationHelper.AddBlock("B90576B0-110E-4DC0-8EB8-4668C5238508", "", "08C35F15-9AF7-468F-9D50-CDFD3D21220C", "Defined Type Detail", "Main", "", "", 0, "74583AD9-36F5-44CE-9346-AA009440A49A");
            RockMigrationHelper.AddBlockAttributeValue("74583AD9-36F5-44CE-9346-AA009440A49A", "0305EF98-C791-4626-9996-F189B9BB674C", @"DB91D0E9-DCA6-45A9-8276-AEF032BE8AED");
            RockMigrationHelper.AddBlock("B90576B0-110E-4DC0-8EB8-4668C5238508", "", "0AB2D5E9-9272-47D5-90E4-4AA838D2D3EE", "Defined Value List", "Main", "", "", 1, "840878A8-6CFF-4A9E-B9E7-48D33E37959C");
            RockMigrationHelper.AddBlockAttributeValue("840878A8-6CFF-4A9E-B9E7-48D33E37959C", "9280D61F-C4F3-4A3E-A9BB-BCD67FF78637", @"DB91D0E9-DCA6-45A9-8276-AEF032BE8AED");

            Sql(@"
    DECLARE @DefinedTypeId int = ( SELECT TOP 1 [Id] FROM [DefinedType] WHERE [Guid] = 'DB91D0E9-DCA6-45A9-8276-AEF032BE8AED' )
    DECLARE @AttributeId int = ( SELECT TOP 1 [Id] FROM [Attribute] WHERE [Guid] = 'CDD29C51-5D33-435F-96AB-2C06BA772F88' )
    DECLARE @Domains varchar(8000) = ( SELECT TOP 1 [Value] FROM [AttributeValue] WHERE [AttributeId] = @AttributeId )
    DECLARE @Domain varchar(1000)
    WHILE LEN(@Domains) > 0
    BEGIN
        SET @Domain= LEFT(@Domains, ISNULL(NULLIF(CHARINDEX(',', @Domains) - 1, -1), LEN(@Domains)))
        SET @Domains = SUBSTRING(@Domains,ISNULL(NULLIF(CHARINDEX(',', @Domains), 0), LEN(@Domains)) + 1, LEN(@Domains))
		INSERT INTO [DefinedValue] ( [IsSystem], [DefinedTypeId], [Order], [Value], [Guid] )
        SELECT 0, @DefinedTypeId, 0, @Domain, NEWID()
    END
");
            RockMigrationHelper.DeleteAttribute("CDD29C51-5D33-435F-96AB-2C06BA772F88");

            #endregion

            #region Workflow Action Rename

            Sql(@"
    UPDATE [EntityType] SET [FriendlyName] = 'Send SMS'
    WHERE [Name] = 'Rock.Workflow.Action.SendSms'

    UPDATE [EntityType]	SET [FriendlyName] = 'Set Workflow Name'
	WHERE [Name] = 'Rock.Workflow.Action.SetName'

    UPDATE [EntityType]	SET [FriendlyName] = 'Assign Activity From Attribute Value'
	WHERE [Name] = 'Rock.Workflow.Action.AssignActivityToAttributeValue'
");
            #endregion
        }
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            RockMigrationHelper.AddDefinedType_pre201409101843015("Global", "REST CORS Domains (Advanced)", @"
Lists the external domains that are authorized to access the REST API through ""cross-origin resource sharing"" (CORS).", "DF7C8DF7-49F9-4858-9E5D-20842AF65AD8", @"
When a browser encounters a script that originated from another domain trying to access the Rock REST API, the browser will query Rock (using CORS) to check 
if that request should be allowed. By default Rock will deny access to the API through this type of cross-site request. To override this behavior, add the domains that
should be allowed to make this type of request to the list of values below. This will enable CORS for just those domains. Note: This only applies to REST calls made 
through scripts downloaded from another domain to a browser. It does not apply to REST calls made directly from another external server or application. That type of
request is allowed by default (but still controlled through security).");

            RockMigrationHelper.AddPage("91CCB1C9-5F9F-44F5-8BE2-9EC3A3CFD46F", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "REST CORS Domains", "", "B03A8C4E-E394-44B0-B7CC-89B74C79C325", "fa fa-sign-in"); // Site:Rock RMS
            // Add Block to Page: REST CORS Domains, Site: Rock RMS
            RockMigrationHelper.AddBlock("B03A8C4E-E394-44B0-B7CC-89B74C79C325", "", "0AB2D5E9-9272-47D5-90E4-4AA838D2D3EE", "Defined Value List", "Main", "", "", 1, "BC6CE880-382B-4DF2-8C10-B7F7C1DEC9FB");
            // Add Block to Page: REST CORS Domains, Site: Rock RMS
            RockMigrationHelper.AddBlock("B03A8C4E-E394-44B0-B7CC-89B74C79C325", "", "08C35F15-9AF7-468F-9D50-CDFD3D21220C", "Defined Type Detail", "Main", "", "", 0, "EF27C0E7-9D1A-41AB-970B-C854299CE667");
            // Attrib Value for Block:Defined Value List, Attribute:Defined Type Page: REST CORS Domains, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("BC6CE880-382B-4DF2-8C10-B7F7C1DEC9FB", "9280D61F-C4F3-4A3E-A9BB-BCD67FF78637", @"df7c8df7-49f9-4858-9e5d-20842af65ad8");
            // Attrib Value for Block:Defined Type Detail, Attribute:Defined Type Page: REST CORS Domains, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("EF27C0E7-9D1A-41AB-970B-C854299CE667", "0305EF98-C791-4626-9996-F189B9BB674C", @"df7c8df7-49f9-4858-9e5d-20842af65ad8");


            Sql(@"
/* Move Communications Under People */
UPDATE [Page]
SET [ParentPageId] = (SELECT [Id] FROM [Page] WHERE [Guid] = '97ECDC48-6DF6-492E-8C72-161F76AE111B')
WHERE 
	[Id] = (SELECT [Id] FROM [Page] WHERE [Guid] = '7F79E512-B9DB-4780-9887-AD6D63A39050')

/* Move Prayer Under People */
UPDATE [Page]
SET [ParentPageId] = (SELECT [Id] FROM [Page] WHERE [Guid] = 'B0F4B33D-DD11-4CCC-B79D-9342831B8701')
WHERE 
	[Id] = (SELECT [Id] FROM [Page] WHERE [Guid] = '1A3437C8-D4CB-4329-A366-8D6A4CBF79BF')

UPDATE [DefinedType] SET [HelpText] = 'chart styles are defined with a json object. click the ''show/hide fields'' button below to view an example with all the available chart style fields.
<p>
    <a data-toggle=""collapse""  href=""#collapsefields"" class=''btn btn-action btn-xs''>show/hide  fields</a>
</p>

<div id=""collapsefields"" class=""panel-collapse collapse"">
<pre>
{
  ""seriescolors"": [
    ""#00cc00"",
    ""#007a00"",
    ""#005500"",
    ""#4db84d""
  ],
  ""goalseriescolor"": ""blue"",
  ""grid"": {  
    ""colorgradient"": null,
    ""color"": ""black"",
    ""backgroundcolorgradient"": [""rgba(0, 125, 0, .2)"", ""rgba(0,255,0,.1)"", ""rgba(0,125,0,.01)""],
    ""backgroundcolor"": null,
    ""borderwidth"": {
      ""top"": 0,
      ""right"": 0,
      ""bottom"": 1,
      ""left"": 1
    },
    ""bordercolor"": {
      ""top"": null,
      ""right"": null,
      ""bottom"": ""green"",
      ""left"": ""black""
    }
  },
  ""xaxis"": {
    ""color"": ""#99c2ff"",
    ""font"": {
      ""size"": null,
      ""family"": null,
      ""color"": ""#336600""
    },
    ""datetimeformat"": ""%b %d, %y""
  },
  ""yaxis"": {
    ""color"": ""#99c2ff"",
    ""font"": {
      ""size"": null,
      ""family"": null,
      ""color"": ""#336600""
    },
    ""datetimeformat"": null
  },
  ""fillopacity"": 0.2,
  ""fillcolor"": null,
  ""legend"": {
    ""backgroundcolor"": ""transparent"",
    ""backgroundopacity"": null,
    ""labelboxbordercolor"": null
  },
  ""title"": {
    ""font"": {
      ""size"": 18,
      ""family"": ""terminal"",
      ""color"": ""#296629""
    },
    ""align"": ""left""
  },
  ""subtitle"": {
    ""font"": {
      ""size"": 12,
      ""family"": ""terminal"",
      ""color"": ""#00cc66""
    },
    ""align"": ""right""
  }
}
</pre>

datetimeformat of the xaxis and yaxis supports the following specifiers.  for example ""%b %d, %y"" will output something like ''december 25, 2014''
<pre>
%a: weekday name (customizable)
%b: month name (customizable)
%d: day of month, zero-padded (01-31)
%e: day of month, space-padded ( 1-31)
%h: hours, 24-hour time, zero-padded (00-23)
%i: hours, 12-hour time, zero-padded (01-12)
%m: month, zero-padded (01-12)
%m: minutes, zero-padded (00-59)
%q: quarter (1-4)
%s: seconds, zero-padded (00-59)
%y: year (two digits)
%y: year (four digits)
%p: am/pm
%p: am/pm (uppercase version of %p)
%w: weekday as number (0-6, 0 being sunday)
</pre>
</div>' WHERE [Guid] = 'FC684FD7-FE68-493F-AF38-1656FBF67E6B'
");
        }
Esempio n. 4
0
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            RockMigrationHelper.AddDefinedType_pre201409101843015("Global", "Chart Styles", "Defines a listing of various chart styles to be used as configuration for blocks that render charts", "FC684FD7-FE68-493F-AF38-1656FBF67E6B", @"Chart styles are defined with a JSON object. Click the ''Show/Hide Fields'' button below to view an example with all the available chart style fields.

<p>
    <a data-toggle=""collapse""  href=""#collapseFields"" class=''btn btn-action btn-xs''>Show/Hide  Fields</a>
</p>

<div id=""collapseFields"" class=""panel-collapse collapse"">
<pre>
{
  ""SeriesColors"": [
    ""#00CC00"",
    ""#007A00"",
    ""#005500"",
    ""#4DB84D""
  ],
  ""GoalSeriesColor"": ""blue"",
  ""Grid"": {  
    ""ColorGradient"": null,
    ""Color"": ""black"",
    ""BackgroundColorGradient"": [""RGBA(0, 125, 0, .2)"", ""RGBA(0,255,0,.1)"", ""RGBA(0,125,0,.01)""],
    ""BackgroundColor"": null,
    ""BorderWidth"": {
      ""top"": 0,
      ""right"": 0,
      ""bottom"": 1,
      ""left"": 1
    },
    ""BorderColor"": {
      ""top"": null,
      ""right"": null,
      ""bottom"": ""green"",
      ""left"": ""black""
    }
  },
  ""XAxis"": {
    ""Color"": ""#99C2FF"",
    ""Font"": {
      ""Size"": null,
      ""Family"": null,
      ""Color"": ""#336600""
    }
  },
  ""YAxis"": {
    ""Color"": ""#99C2FF"",
    ""Font"": {
      ""Size"": null,
      ""Family"": null,
      ""Color"": ""#336600""
    }
  },
  ""FillOpacity"": 0.2,
  ""FillColor"": null,
  ""Legend"": {
    ""BackgroundColor"": ""transparent"",
    ""BackgroundOpacity"": null,
    ""LabelBoxBorderColor"": null
  },
  ""Title"": {
    ""Font"": {
      ""Size"": 18,
      ""Family"": ""Terminal"",
      ""Color"": ""#296629""
    },
    ""Align"": ""left""
  },
  ""Subtitle"": {
    ""Font"": {
      ""Size"": 12,
      ""Family"": ""Terminal"",
      ""Color"": ""#00CC66""
    },
    ""Align"": ""right""
  }
}
</pre>
</div>");
            RockMigrationHelper.AddDefinedTypeAttribute("FC684FD7-FE68-493F-AF38-1656FBF67E6B", "1D0D3794-C210-48A8-8C68-3FBEC08A6BA5", "Chart Style", "ChartStyle", "", 26, "{}", "173E1A89-A84E-48EC-BFD5-0C8D65A84276");
            RockMigrationHelper.AddAttributeQualifier("173E1A89-A84E-48EC-BFD5-0C8D65A84276", "editorHeight", "", "AB54A928-73C8-4172-97A5-1A1C0C7F4439");
            RockMigrationHelper.AddAttributeQualifier("173E1A89-A84E-48EC-BFD5-0C8D65A84276", "editorMode", "4", "8DCD60DF-C48C-41FA-A9B0-978855A3FB47");
            RockMigrationHelper.AddAttributeQualifier("173E1A89-A84E-48EC-BFD5-0C8D65A84276", "editorTheme", "0", "7C894CCE-5BC6-4A12-A9F4-BBBC27672A23");
            RockMigrationHelper.AddDefinedValue_pre20140819("FC684FD7-FE68-493F-AF38-1656FBF67E6B", "Flot", "The standard Flot chart style", "B45DA8E1-B9A6-46FD-9A2B-E8440D7D6AAC", false);
            RockMigrationHelper.AddDefinedValue_pre20140819("FC684FD7-FE68-493F-AF38-1656FBF67E6B", "Rock", "The default styling for Rock charts.", "2ABB2EA0-B551-476C-8F6B-478CD08C2227", false);
            RockMigrationHelper.AddDefinedValueAttributeValue("2ABB2EA0-B551-476C-8F6B-478CD08C2227", "173E1A89-A84E-48EC-BFD5-0C8D65A84276", @"{
  ""SeriesColors"": [
    ""#8498ab"",
    ""#a4b4c4"",
    ""#b9c7d5"",
    ""#c6d2df"",
    ""#d8e1ea""
  ],
  ""GoalSeriesColor"": ""red"",
  ""Grid"": {
    ""ColorGradient"": null,
    ""Color"": null,
    ""BackgroundColorGradient"": null,
    ""BackgroundColor"": ""transparent"",
    ""BorderWidth"": {
      ""top"": 0,
      ""right"": 0,
      ""bottom"": 1,
      ""left"": 1
    },
    ""BorderColor"": null
  },
  ""XAxis"": {
    ""Color"": ""rgba(81, 81, 81, 0.2)"",
    ""Font"": {
      ""Size"": 10,
      ""Family"": null,
      ""Color"": ""#515151""
    },
    ""DateTimeFormat"": ""%b %e,<br />%Y""
  },
  ""YAxis"": {
    ""Color"": ""rgba(81, 81, 81, 0.2)"",
    ""Font"": {
      ""Size"": null,
      ""Family"": null,
      ""Color"": ""#515151""
    },
    ""DateTimeFormat"": null
  },
  ""FillOpacity"": 0.2,
  ""FillColor"": null,
  ""Legend"": {
    ""BackgroundColor"": ""transparent"",
    ""BackgroundOpacity"": null,
    ""LabelBoxBorderColor"": null
  },
  ""Title"": {
    ""Font"": {
      ""Size"": 16,
      ""Family"": null,
      ""Color"": null
    },
    ""Align"": ""left""
  },
  ""Subtitle"": {
    ""Font"": {
      ""Size"": 12,
      ""Family"": null,
      ""Color"": null
    },
    ""Align"": ""left""
  }
}");
            RockMigrationHelper.AddDefinedValueAttributeValue("B45DA8E1-B9A6-46FD-9A2B-E8440D7D6AAC", "173E1A89-A84E-48EC-BFD5-0C8D65A84276", @"{
  ""Title"": {
    ""Font"": {
      ""Size"": 16,
      ""Family"": null,
      ""Color"": null
    },
    ""Align"": ""left""
  },
  ""Subtitle"": {
    ""Font"": {
      ""Size"": 12,
      ""Family"": null,
      ""Color"": null
    },
    ""Align"": ""left""
  }
}");
        }
Esempio n. 5
0
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            // Add notification option fields to Workflow Action Type Form
            AddColumn("dbo.WorkflowActionForm", "NotificationSystemEmailId", c => c.Int());
            AddColumn("dbo.WorkflowActionForm", "IncludeActionsInNotification", c => c.Boolean(nullable: false));
            CreateIndex("dbo.WorkflowActionForm", "NotificationSystemEmailId");
            AddForeignKey("dbo.WorkflowActionForm", "NotificationSystemEmailId", "dbo.SystemEmail", "Id");

            // Add/Update Defined Type for ButtonHTML
            RockMigrationHelper.AddDefinedType_pre201409101843015("Global", "Button HTML", "Contains HTML for common button styles.", "407A3A73-A3EF-4970-B856-2A33F62AC72E", @"");

            Sql(@"
    DECLARE @AttributeId int = (SELECT [Id] FROM [Attribute] WHERE [Guid] = '6FF59F53-28EA-4BFE-AFE1-A459CC588495' )

    DECLARE @FieldTypeId int = (SELECT [Id] FROM [FieldType] WHERE [Guid] = '1D0D3794-C210-48A8-8C68-3FBEC08A6BA5')
    UPDATE [Attribute] SET
         [Name] = 'Button HTML'
        ,[Key] = 'ButtonHTML'
        ,[Description] = 'The HTML to use for displaying a button.  Both  ""{{ ButtonLink }}"" and ""{{ ButtonText }}"" merge fields are available to be used in the HTML as placeholder for the text and link values that will be rendered for the button.'
        ,[FieldTypeId] = @FieldTypeId
    WHERE [Id] = @AttributeId

    DECLARE @DefinedValueId int = (SELECT [ID] FROM [DefinedValue] WHERE [Guid] = 'FDC397CD-8B4A-436E-BEA1-BCE2E6717C03')
    UPDATE [AttributeValue] SET [Value] = '<a href=""{{ ButtonLink }}"" class=""btn btn-primary"">{{ ButtonText }}</a>'
	WHERE [AttributeId] = @AttributeId AND [EntityId] = CAST( @DefinedValueId AS varchar )

    SET @DefinedValueId = (SELECT [ID] FROM [DefinedValue] WHERE [Guid] = 'FDEB8E6C-70C3-4033-B307-7D0DEE1AC29D')
    UPDATE [AttributeValue] SET [Value] = '<a href=""{{ ButtonLink }}"" class=""btn btn-danger"">{{ ButtonText }}</a>'
	WHERE [AttributeId] = @AttributeId AND [EntityId] = CAST( @DefinedValueId AS varchar )
");
            RockMigrationHelper.AddAttributeQualifier("6FF59F53-28EA-4BFE-AFE1-A459CC588495", "editorMode", "2", "203785F4-60C1-4BD4-B2F4-CC125857A360");
            RockMigrationHelper.AddAttributeQualifier("6FF59F53-28EA-4BFE-AFE1-A459CC588495", "editorTheme", "0", "AFD572CD-B751-474F-945D-97DD1A3C7EDF");
            RockMigrationHelper.AddAttributeQualifier("6FF59F53-28EA-4BFE-AFE1-A459CC588495", "editorHeight", "", "7E21A104-50F6-4C93-943B-D1EBEE3444EE");


            // Create Default System Email for workflow form notifications
            RockMigrationHelper.UpdateSystemEmail_pre201409101843015("Workflow", "Workflow Form Notification", "", "", "", "", "", "{{ Workflow.WorkflowType.Name }}: {{ Workflow.Name }}", @"
{{ GlobalAttribute.EmailHeader }}

<p>{{ Person.FirstName }},</p>
<p>The following {{ Workflow.WorkflowType.Name }} requires action:<p>
<p>{{ Workflow.WorkflowType.WorkTerm}}: <a href='{{ GlobalAttribute.InternalApplicationRoot }}WorkflowEntry/{{ Workflow.WorkflowTypeId }}/{{ Workflow.Id }}'>{{ Workflow.Name }}</a></p>

{% assign RequiredFields = false %}

<h4>Details:</h4>
<p>
{% for attribute in Action.FormAttributes %}

    <strong>{{ attribute.Name }}:</strong> {{ attribute.Value }}<br/>

    {% if attribute.IsRequired %}
        {% assign RequiredFields = true %}
    {% endif %}

{% endfor %}
</p>


{% if Action.ActionType.WorkflowForm.IncludeActionsInNotification == true %}

    {% if RequiredFields != true %}

        <p>
        {% for button in Action.ActionType.WorkflowForm.Buttons %}

            {% capture ButtonLinkSearch %}{% raw %}{{ ButtonLink }}{% endraw %}{% endcapture %}
            {% capture ButtonLinkReplace %}{{ GlobalAttribute.InternalApplicationRoot }}WorkflowEntry/{{ Workflow.WorkflowTypeId }}/{{ Workflow.Id }}?action={{ button.Name }}{% endcapture %}
            {% capture ButtonHtml %}{{ button.Html | Replace: ButtonLinkSearch, ButtonLinkReplace }}{% endcapture %}

            {% capture ButtonTextSearch %}{% raw %}{{ ButtonText }}{% endraw %}{% endcapture %}
            {% capture ButtonTextReplace %}{{ button.Name }}{% endcapture %}
            {{ ButtonHtml | Replace: ButtonTextSearch, ButtonTextReplace }}

        {% endfor %}
        </p>

    {% endif %}

{% endif %}

{{ GlobalAttribute.EmailFooter }}

", "88C7D1CC-3478-4562-A301-AE7D4D7FFF6D");

            // Add/update routes for workflow entry page
            RockMigrationHelper.AddPageRoute("0550D2AA-A705-4400-81FF-AB124FDF83D7", "WorkflowEntry/{WorkflowTypeId}/{WorkflowId}");
            RockMigrationHelper.AddPageRoute("0550D2AA-A705-4400-81FF-AB124FDF83D7", "WorkflowEntry/{WorkflowTypeId}");
        }