Exemplo n.º 1
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            //
            // Create the Facet table.
            //
            migrationBuilder.CreateEntityTable(
                name: typeof(Facet).GetTableNameForEntity(),
                columns: table => new
            {
                EntityTypeId = table.Column <long>(nullable: false),
                Name         = table.Column <string>(nullable: false, maxLength: 100),
                Key          = table.Column <string>(nullable: false, maxLength: 50),
                Description  = table.Column <string>(nullable: true),
                Qualifiers   = table.Column <string>(nullable: true),
                DefaultValue = table.Column <string>(nullable: false)
            },
                schema: typeof(Facet).GetSchemaNameForEntity(),
                constraints: table =>
            {
                table.ForeignKey(
                    name: $"FK_{typeof( Facet ).GetTableNameForEntity()}_{nameof( Facet.EntityTypeId )}",
                    column: a => a.EntityTypeId,
                    principalTable: typeof(EntityType).GetTableNameForEntity(),
                    principalColumn: nameof(EntityType.Id),
                    principalSchema: typeof(EntityType).GetSchemaNameForEntity(),
                    onDelete: ReferentialAction.Cascade);
            });

            //
            // Create the FacetValue table.
            //
            migrationBuilder.CreateEntityTable(
                name: typeof(FacetValue).GetTableNameForEntity(),
                columns: table => new
            {
                FacetId  = table.Column <long>(nullable: false),
                EntityId = table.Column <long>(nullable: false),
                Value    = table.Column <string>(nullable: true)
            },
                schema: typeof(FacetValue).GetSchemaNameForEntity(),
                constraints: table =>
            {
                table.ForeignKey(
                    name: $"FK_{typeof( FacetValue ).GetTableNameForEntity()}_{nameof( FacetValue.FacetId )}",
                    column: a => a.FacetId,
                    principalTable: typeof(Facet).GetTableNameForEntity(),
                    principalColumn: nameof(Facet.Id),
                    principalSchema: typeof(Facet).GetSchemaNameForEntity(),
                    onDelete: ReferentialAction.Cascade);
            });
        }
Exemplo n.º 2
0
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.CreateEntityTable("com_blueboxmoon_TestPlugin",
                                        table => new
     {
         Value = table.Column <string>()
     });
 }
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.CreateEntityTable("People",
                                        table => new
     {
         FirstName = table.Column <string>(nullable: false, maxLength: 100),
         LastName  = table.Column <string>(nullable: false, maxLength: 100)
     }, "testSchema");
 }
Exemplo n.º 4
0
 protected override void Up(MigrationBuilder migrationBuilder)
 {
     migrationBuilder.CreateEntityTable("EntityTypes",
                                        table => new
     {
         Name          = table.Column <string>(nullable: false, maxLength: 100),
         QualifiedName = table.Column <string>(nullable: false, maxLength: 250)
     },
                                        EntityTypesPlugin.Schema,
                                        table =>
     {
         table.UniqueConstraint("IX_EntityTypes_Name", a => a.Name);
         table.UniqueConstraint("IX_EntityTypes_QualifiedName", a => a.QualifiedName);
     });
 }