From 614a0776461d94ad682b4b0b72c54fccbefc0229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sun, 11 Dec 2016 00:19:31 +0300 Subject: [PATCH] Created initial migration for abpdesk app. --- .../EntityFrameworkCore/AbpDeskDbContext.cs | 7 ++-- ...161210211733_Initial_Migration.Designer.cs | 35 +++++++++++++++++++ .../20161210211733_Initial_Migration.cs | 33 +++++++++++++++++ .../AbpDeskDbContextModelSnapshot.cs | 34 ++++++++++++++++++ 4 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161210211733_Initial_Migration.Designer.cs create mode 100644 src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161210211733_Initial_Migration.cs create mode 100644 src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/AbpDeskDbContextModelSnapshot.cs diff --git a/src/AbpDesk/AbpDesk.EntityFrameworkCore/AbpDesk/EntityFrameworkCore/AbpDeskDbContext.cs b/src/AbpDesk/AbpDesk.EntityFrameworkCore/AbpDesk/EntityFrameworkCore/AbpDeskDbContext.cs index 48ad9e9b1c..1a67bab778 100644 --- a/src/AbpDesk/AbpDesk.EntityFrameworkCore/AbpDesk/EntityFrameworkCore/AbpDeskDbContext.cs +++ b/src/AbpDesk/AbpDesk.EntityFrameworkCore/AbpDesk/EntityFrameworkCore/AbpDeskDbContext.cs @@ -5,10 +5,13 @@ namespace AbpDesk.EntityFrameworkCore { public class AbpDeskDbContext : DbContext { - protected override void OnModelCreating(ModelBuilder modelBuilder) + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - base.OnModelCreating(modelBuilder); + optionsBuilder.UseSqlServer("Server=localhost;Database=AbpDesk;Trusted_Connection=True;"); + } + protected override void OnModelCreating(ModelBuilder modelBuilder) + { modelBuilder.Entity(builder => { builder.ToTable("DskTickets"); diff --git a/src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161210211733_Initial_Migration.Designer.cs b/src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161210211733_Initial_Migration.Designer.cs new file mode 100644 index 0000000000..59290a099e --- /dev/null +++ b/src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161210211733_Initial_Migration.Designer.cs @@ -0,0 +1,35 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using AbpDesk.EntityFrameworkCore; + +namespace AbpDesk.EntityFrameworkCore.Migrations +{ + [DbContext(typeof(AbpDeskDbContext))] + [Migration("20161210211733_Initial_Migration")] + partial class Initial_Migration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { + modelBuilder + .HasAnnotation("ProductVersion", "1.1.0-rtm-22752") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("AbpDesk.Tickets.Ticket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Body"); + + b.Property("Title"); + + b.HasKey("Id"); + + b.ToTable("DskTickets"); + }); + } + } +} diff --git a/src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161210211733_Initial_Migration.cs b/src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161210211733_Initial_Migration.cs new file mode 100644 index 0000000000..a59a3df5b9 --- /dev/null +++ b/src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/20161210211733_Initial_Migration.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Metadata; + +namespace AbpDesk.EntityFrameworkCore.Migrations +{ + public partial class Initial_Migration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "DskTickets", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), + Body = table.Column(nullable: true), + Title = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_DskTickets", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "DskTickets"); + } + } +} diff --git a/src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/AbpDeskDbContextModelSnapshot.cs b/src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/AbpDeskDbContextModelSnapshot.cs new file mode 100644 index 0000000000..a8740f9595 --- /dev/null +++ b/src/AbpDesk/AbpDesk.EntityFrameworkCore/Migrations/AbpDeskDbContextModelSnapshot.cs @@ -0,0 +1,34 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using AbpDesk.EntityFrameworkCore; + +namespace AbpDesk.EntityFrameworkCore.Migrations +{ + [DbContext(typeof(AbpDeskDbContext))] + partial class AbpDeskDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { + modelBuilder + .HasAnnotation("ProductVersion", "1.1.0-rtm-22752") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("AbpDesk.Tickets.Ticket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Body"); + + b.Property("Title"); + + b.HasKey("Id"); + + b.ToTable("DskTickets"); + }); + } + } +}