Esempio n. 1
0
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            // Add Field Type: Data Entry Requirement Level
            RockMigrationHelper.UpdateFieldType("Data Entry Requirement Level", "Indicates the availability and necessity of a data entry item.", "Rock", "Rock.Field.Types.DataEntryRequirementLevelFieldType", SystemGuid.FieldType.DATA_ENTRY_REQUIREMENT_LEVEL);


            // Add Attributes for Defined Type "Country".
            RockMigrationHelper.AddDefinedTypeAttribute(SystemGuid.DefinedType.LOCATION_COUNTRIES, SystemGuid.FieldType.TEXT, "Locality Label", SystemKey.CountryAttributeKey.AddressLocalityLabel, "The label to use for the Locality field, which describes a subdivision of a state or region.", 2, true, "County", false, false, SystemGuid.Attribute.COUNTRY_LOCALITY_LABEL);

            RockMigrationHelper.AddDefinedTypeAttribute(SystemGuid.DefinedType.LOCATION_COUNTRIES, SystemGuid.FieldType.DATA_ENTRY_REQUIREMENT_LEVEL, "Address Line 1 Requirement", SystemKey.CountryAttributeKey.AddressLine1Requirement, "Sets the requirement for the Address Line 1 component of a postal address in this Country.", 6, true, DataEntryRequirementLevelSpecifier.Required.ConvertToInt().ToString(), false, false, SystemGuid.Attribute.COUNTRY_ADDRESS_LINE_1_REQUIREMENT);
            RockMigrationHelper.AddDefinedTypeAttribute(SystemGuid.DefinedType.LOCATION_COUNTRIES, SystemGuid.FieldType.DATA_ENTRY_REQUIREMENT_LEVEL, "Address Line 2 Requirement", SystemKey.CountryAttributeKey.AddressLine2Requirement, "Sets the requirement for the Address Line 2 component of a postal address in this Country.", 7, true, DataEntryRequirementLevelSpecifier.Optional.ConvertToInt().ToString(), false, false, SystemGuid.Attribute.COUNTRY_ADDRESS_LINE_2_REQUIREMENT);
            RockMigrationHelper.AddDefinedTypeAttribute(SystemGuid.DefinedType.LOCATION_COUNTRIES, SystemGuid.FieldType.DATA_ENTRY_REQUIREMENT_LEVEL, "City Requirement", SystemKey.CountryAttributeKey.AddressCityRequirement, "Sets the requirement for the City component of a postal address in this Country.", 8, true, DataEntryRequirementLevelSpecifier.Required.ConvertToInt().ToString(), false, false, SystemGuid.Attribute.COUNTRY_ADDRESS_CITY_REQUIREMENT);
            RockMigrationHelper.AddDefinedTypeAttribute(SystemGuid.DefinedType.LOCATION_COUNTRIES, SystemGuid.FieldType.DATA_ENTRY_REQUIREMENT_LEVEL, "Locality Requirement", SystemKey.CountryAttributeKey.AddressLocalityRequirement, "Sets the requirement for the Locality component of a postal address in this Country.", 9, true, DataEntryRequirementLevelSpecifier.Optional.ConvertToInt().ToString(), false, false, SystemGuid.Attribute.COUNTRY_ADDRESS_LOCALITY_REQUIREMENT);
            RockMigrationHelper.AddDefinedTypeAttribute(SystemGuid.DefinedType.LOCATION_COUNTRIES, SystemGuid.FieldType.DATA_ENTRY_REQUIREMENT_LEVEL, "State Requirement", SystemKey.CountryAttributeKey.AddressStateRequirement, "Sets the requirement for the State component of a postal address in this Country.", 10, true, DataEntryRequirementLevelSpecifier.Required.ConvertToInt().ToString(), false, false, SystemGuid.Attribute.COUNTRY_ADDRESS_STATE_REQUIREMENT);
            RockMigrationHelper.AddDefinedTypeAttribute(SystemGuid.DefinedType.LOCATION_COUNTRIES, SystemGuid.FieldType.DATA_ENTRY_REQUIREMENT_LEVEL, "Postal Code Requirement", SystemKey.CountryAttributeKey.AddressPostalCodeRequirement, "Sets the requirement for the Postal Code component of a postal address in this Country.", 11, true, DataEntryRequirementLevelSpecifier.Optional.ConvertToInt().ToString(), false, false, SystemGuid.Attribute.COUNTRY_ADDRESS_POSTCODE_REQUIREMENT);

            // Set Attribute Values for Country Defined Type "United States".
            RockMigrationHelper.AddDefinedValueAttributeValueByValue(SystemGuid.DefinedType.LOCATION_COUNTRIES, "US", SystemKey.CountryAttributeKey.AddressLocalityLabel, "County");
            RockMigrationHelper.AddDefinedValueAttributeValueByValue(SystemGuid.DefinedType.LOCATION_COUNTRIES, "US", SystemKey.CountryAttributeKey.AddressLine1Requirement, DataEntryRequirementLevelSpecifier.Required.ConvertToInt().ToString());
            RockMigrationHelper.AddDefinedValueAttributeValueByValue(SystemGuid.DefinedType.LOCATION_COUNTRIES, "US", SystemKey.CountryAttributeKey.AddressLine2Requirement, DataEntryRequirementLevelSpecifier.Optional.ConvertToInt().ToString());
            RockMigrationHelper.AddDefinedValueAttributeValueByValue(SystemGuid.DefinedType.LOCATION_COUNTRIES, "US", SystemKey.CountryAttributeKey.AddressCityRequirement, DataEntryRequirementLevelSpecifier.Required.ConvertToInt().ToString());
            RockMigrationHelper.AddDefinedValueAttributeValueByValue(SystemGuid.DefinedType.LOCATION_COUNTRIES, "US", SystemKey.CountryAttributeKey.AddressLocalityRequirement, DataEntryRequirementLevelSpecifier.Optional.ConvertToInt().ToString());
            RockMigrationHelper.AddDefinedValueAttributeValueByValue(SystemGuid.DefinedType.LOCATION_COUNTRIES, "US", SystemKey.CountryAttributeKey.AddressStateRequirement, DataEntryRequirementLevelSpecifier.Required.ConvertToInt().ToString());
            RockMigrationHelper.AddDefinedValueAttributeValueByValue(SystemGuid.DefinedType.LOCATION_COUNTRIES, "US", SystemKey.CountryAttributeKey.AddressPostalCodeRequirement, DataEntryRequirementLevelSpecifier.Optional.ConvertToInt().ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            AddColumn("dbo.Attendance", "SearchValue", c => c.String());
            AddColumn("dbo.Attendance", "SearchResultGroupId", c => c.Int());
            AddColumn("dbo.RegistrationInstance", "RegistrationWorkflowTypeId", c => c.Int());
            AddColumn("dbo.RegistrationTemplate", "RegistrationWorkflowTypeId", c => c.Int());
            CreateIndex("dbo.Attendance", "SearchResultGroupId");
            CreateIndex("dbo.RegistrationInstance", "RegistrationWorkflowTypeId");
            CreateIndex("dbo.RegistrationTemplate", "RegistrationWorkflowTypeId");
            AddForeignKey("dbo.RegistrationTemplate", "RegistrationWorkflowTypeId", "dbo.WorkflowType", "Id");
            AddForeignKey("dbo.RegistrationInstance", "RegistrationWorkflowTypeId", "dbo.WorkflowType", "Id");
            AddForeignKey("dbo.Attendance", "SearchResultGroupId", "dbo.Group", "Id");

            // MP: Address/Country Hide Address Line 2
            RockMigrationHelper.AddDefinedTypeAttribute("D7979EA1-44E9-46E2-BF37-DDAF7F741378", Rock.SystemGuid.FieldType.BOOLEAN, "Show Address Line 2", "ShowAddressLine2", "Show Address Line 2 when editing an address", 4, "True", "360F05E4-E55B-4313-BB9F-9DCE96833571");
            RockMigrationHelper.AddDefinedValueAttributeValueByValue("D7979EA1-44E9-46E2-BF37-DDAF7F741378", "US", "ShowAddressLine2", @"False");   // United States ShowAddressLine2 (False), all other countries will default to true

            // DT: V5 hotfix: 002_CheckinGradeRequired & 004_FixGradeRequiredAttribute
            Sql(@"
    IF NOT EXISTS (
        SELECT [Id]
        FROM [Attribute]
        WHERE [Guid] = 'A4899874-9EDF-4549-B054-4F593F4C4362' )
    BEGIN

        DECLARE @EntityTypeId int = (SELECT [Id] FROM [EntityType] WHERE [Name] = 'Rock.Model.GroupType')
        DECLARE @FieldTypeId int = (SELECT [Id] FROM [FieldType] WHERE [Guid] = '1EDAFDED-DFE6-4334-B019-6EECBA89E05A')
        DECLARE @CheckInTemplatePurposeId int = ( SELECT TOP 1 [Id] FROM [DefinedValue] WHERE [Guid] = '4A406CB0-495B-4795-B788-52BDFDE00B01' )

        INSERT INTO [Attribute] (
            [IsSystem],[FieldTypeId],[EntityTypeId],[EntityTypeQualifierColumn],[EntityTypeQualifierValue],
            [Key],[Name],[Description],
            [Order],[IsGridColumn],[DefaultValue],[IsMultiValue],[IsRequired],
            [Guid])
        VALUES(
            1, @FieldTypeId, @EntityTypeid,'GroupTypePurposeValueId', CAST( @CheckInTemplatePurposeId AS varchar),
            'core_checkin_GradeRequired','Grade Required','',
            0,0,'False',0,0,
            'A4899874-9EDF-4549-B054-4F593F4C4362')

    END");
            RockMigrationHelper.UpdateAttributeQualifier("A4899874-9EDF-4549-B054-4F593F4C4362", "falsetext", "No", "B61ED891-C631-4172-A05D-D86265CA2A1D");
            RockMigrationHelper.UpdateAttributeQualifier("A4899874-9EDF-4549-B054-4F593F4C4362", "truetext", "Yes", "D4C52849-6ED4-414A-95D7-2F7F805CF9A3");

            // DT: Add back some defined value foreign key indexes (so defined value delete can use them)
            Sql(MigrationSQL._201606231511599_RegistrationWorkflow_Indexes);
        }