SP_10062024_ColumnTypeChange
This commit is contained in:
parent
c6725c0c01
commit
477245a731
@ -6,17 +6,17 @@ using Volo.Abp.Application.Dtos;
|
||||
|
||||
namespace Acme.BookStore.BookIssued
|
||||
{
|
||||
public class BookIssueDto : EntityDto<int>
|
||||
public class BookIssueDto : EntityDto<Guid>
|
||||
{
|
||||
[Required]
|
||||
public Guid bookId { get; set; }
|
||||
[Required]
|
||||
public int customerId { get; set; }
|
||||
public Guid customerId { get; set; }
|
||||
}
|
||||
|
||||
public class BookIssueListDto
|
||||
{
|
||||
public int bookIssueId { get; set; }
|
||||
public Guid bookIssueId { get; set; }
|
||||
public string bookName { get; set; }
|
||||
public string customerName { get; set; }
|
||||
public DateTime issueDate { get; set; }
|
||||
|
@ -9,14 +9,14 @@ namespace Acme.BookStore.BookIssued
|
||||
{
|
||||
public interface IBookIssueAppService : IApplicationService
|
||||
{
|
||||
Task<BookIssueDto> GetAsync(int id);
|
||||
Task<BookIssueDto> GetAsync(Guid id);
|
||||
|
||||
Task<PagedResultDto<BookIssueListDto>> GetListAsync();
|
||||
|
||||
Task<BookIssueDto> CreateAsync(BookIssueDto input);
|
||||
|
||||
Task UpdateAsync(int id, BookIssueDto input);
|
||||
Task UpdateAsync(Guid id, BookIssueDto input);
|
||||
|
||||
Task DeleteAsync(int id);
|
||||
Task DeleteAsync(Guid id);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using Volo.Abp.Application.Dtos;
|
||||
|
||||
namespace Acme.BookStore.Customers
|
||||
{
|
||||
public class CustomerDto : EntityDto<int>
|
||||
public class CustomerDto : EntityDto<Guid>
|
||||
{
|
||||
[Required]
|
||||
public string firstName { get; set; }
|
||||
|
@ -10,15 +10,15 @@ namespace Acme.BookStore.Customers
|
||||
{
|
||||
public interface ICustomerAppService : IApplicationService
|
||||
{
|
||||
Task<CustomerDto> GetAsync(int id);
|
||||
Task<CustomerDto> GetAsync(Guid id);
|
||||
|
||||
Task<PagedResultDto<CustomerDto>> GetListAsync();
|
||||
|
||||
Task<CustomerDto> CreateAsync(CustomerDto input);
|
||||
|
||||
Task UpdateAsync(int id, CustomerDto input);
|
||||
Task UpdateAsync(Guid id, CustomerDto input);
|
||||
|
||||
Task DeleteAsync(int id);
|
||||
Task DeleteAsync(Guid id);
|
||||
Task<List<CustomerDto>> GetcustomerDropDown();
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace Acme.BookStore.BookIssued
|
||||
_bookIssueManager = bookIssueManager;
|
||||
}
|
||||
|
||||
public async Task<BookIssueDto> GetAsync(int id)
|
||||
public async Task<BookIssueDto> GetAsync(Guid id)
|
||||
{
|
||||
var cus = await _bookIssueRepository.GetAsync(id);
|
||||
return ObjectMapper.Map<BookIssue, BookIssueDto>(cus);
|
||||
@ -55,7 +55,7 @@ namespace Acme.BookStore.BookIssued
|
||||
}
|
||||
|
||||
[Authorize(BookStorePermissions.BookIssued.Edit)]
|
||||
public async Task UpdateAsync(int id, BookIssueDto input)
|
||||
public async Task UpdateAsync(Guid id, BookIssueDto input)
|
||||
{
|
||||
var cus = await _bookIssueRepository.GetAsync(id);
|
||||
|
||||
@ -64,7 +64,7 @@ namespace Acme.BookStore.BookIssued
|
||||
|
||||
|
||||
[Authorize(BookStorePermissions.BookIssued.Delete)]
|
||||
public async Task DeleteAsync(int id)
|
||||
public async Task DeleteAsync(Guid id)
|
||||
{
|
||||
await _bookIssueRepository.DeleteAsync(id);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace Acme.BookStore.Customers
|
||||
_customerManager = customerManager;
|
||||
}
|
||||
|
||||
public async Task<CustomerDto> GetAsync(int id)
|
||||
public async Task<CustomerDto> GetAsync(Guid id)
|
||||
{
|
||||
var cus = await _customerRepository.GetAsync(id);
|
||||
return ObjectMapper.Map<Customer, CustomerDto>(cus);
|
||||
@ -63,7 +63,7 @@ namespace Acme.BookStore.Customers
|
||||
|
||||
[Authorize(BookStorePermissions.Customers.Edit)]
|
||||
|
||||
public async Task UpdateAsync(int id, CustomerDto input)
|
||||
public async Task UpdateAsync(Guid id, CustomerDto input)
|
||||
{
|
||||
var cus = await _customerRepository.GetAsync(id);
|
||||
|
||||
@ -78,7 +78,7 @@ namespace Acme.BookStore.Customers
|
||||
|
||||
[Authorize(BookStorePermissions.Customers.Delete)]
|
||||
|
||||
public async Task DeleteAsync(int id)
|
||||
public async Task DeleteAsync(Guid id)
|
||||
{
|
||||
await _customerRepository.DeleteAsync(id);
|
||||
}
|
||||
|
@ -7,15 +7,15 @@ using Volo.Abp.Domain.Entities.Auditing;
|
||||
|
||||
namespace Acme.BookStore.BookIssued
|
||||
{
|
||||
public class BookIssue : FullAuditedAggregateRoot<int>
|
||||
public class BookIssue : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
public Guid bookId { get; set; }
|
||||
public int customerId { get; set; }
|
||||
public Guid customerId { get; set; }
|
||||
private BookIssue()
|
||||
{
|
||||
/* This constructor is for deserialization / ORM purpose */
|
||||
}
|
||||
internal BookIssue(int id, Guid bookId, int customerId) : base(id)
|
||||
internal BookIssue(Guid id, Guid bookId, Guid customerId) : base(id)
|
||||
{
|
||||
this.bookId = bookId;
|
||||
this.customerId = customerId;
|
||||
@ -24,7 +24,7 @@ namespace Acme.BookStore.BookIssued
|
||||
|
||||
public class BookIssueList
|
||||
{
|
||||
public int bookIssueId { get; set; }
|
||||
public Guid bookIssueId { get; set; }
|
||||
public string bookName { get; set; }
|
||||
public string customerName { get; set; }
|
||||
public DateTime issueDate { get; set; }
|
||||
|
@ -26,7 +26,7 @@ namespace Acme.BookStore.BookIssued
|
||||
throw new BookIssueErrorException(existingBookIssue.customerName, existingBookIssue.bookName);
|
||||
}
|
||||
return new BookIssue(
|
||||
await _bookIssueRepository.NewBookIssueId(),
|
||||
GuidGenerator.Create(),
|
||||
bookissue.bookId,
|
||||
bookissue.customerId
|
||||
);
|
||||
|
@ -8,10 +8,10 @@ using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace Acme.BookStore.BookIssued
|
||||
{
|
||||
public interface IBookIssueRepository : IRepository<BookIssue, int>
|
||||
public interface IBookIssueRepository : IRepository<BookIssue, Guid>
|
||||
{
|
||||
Task<BookIssueList> FindBookIssueCustomer(int customerId, Guid bookId);
|
||||
Task<int> NewBookIssueId();
|
||||
Task<BookIssueList> FindBookIssueCustomer(Guid customerId, Guid bookId);
|
||||
//Task<int> NewBookIssueId();
|
||||
Task<List<BookIssueList>> BookIssueList();
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace Acme.BookStore
|
||||
|
||||
if (await _customerRepository.GetCountAsync() <= 0)
|
||||
{
|
||||
Customer customer = new Customer(1, "soumen", "pal", "9091184026", "haripal");
|
||||
Customer customer = new Customer(new Guid(), "soumen", "pal", "9091184026", "haripal");
|
||||
|
||||
await _customerRepository.InsertAsync(
|
||||
await _customerManager.CreateAsync(customer)
|
||||
|
@ -8,7 +8,7 @@ using Volo.Abp.Domain.Entities.Auditing;
|
||||
|
||||
namespace Acme.BookStore.Customers
|
||||
{
|
||||
public class Customer : FullAuditedAggregateRoot<int>
|
||||
public class Customer : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
public string firstName { get; set; }
|
||||
public string lastName { get; set; }
|
||||
@ -18,7 +18,7 @@ namespace Acme.BookStore.Customers
|
||||
{
|
||||
/* This constructor is for deserialization / ORM purpose */
|
||||
}
|
||||
internal Customer(int id, string firstName, string lastName, string phone, string address) : base(id)
|
||||
internal Customer(Guid id, string firstName, string lastName, string phone, string address) : base(id)
|
||||
{
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
|
@ -31,7 +31,7 @@ namespace Acme.BookStore.Customers
|
||||
throw new CustomerErrorException(customer.phone);
|
||||
}
|
||||
return new Customer(
|
||||
await _customerRepository.NewCustomerId(),
|
||||
GuidGenerator.Create(),
|
||||
customer.firstName,
|
||||
customer.lastName,
|
||||
customer.phone,
|
||||
|
@ -8,9 +8,9 @@ using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace Acme.BookStore.Customers
|
||||
{
|
||||
public interface ICustomerRepository : IRepository<Customer, int>
|
||||
public interface ICustomerRepository : IRepository<Customer, Guid>
|
||||
{
|
||||
Task<Customer> FindByPhoneAsync(string phone);
|
||||
Task<int> NewCustomerId();
|
||||
//Task<int> NewCustomerId();
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
|
||||
namespace Acme.BookStore.BookIssued
|
||||
{
|
||||
public class EfCoreBookIssueRepository : EfCoreRepository<BookStoreDbContext, BookIssue, int>,
|
||||
public class EfCoreBookIssueRepository : EfCoreRepository<BookStoreDbContext, BookIssue, Guid>,
|
||||
IBookIssueRepository
|
||||
{
|
||||
private readonly IDataFilter _dataFilter;
|
||||
@ -28,7 +28,7 @@ namespace Acme.BookStore.BookIssued
|
||||
_dataFilter = dataFilter;
|
||||
|
||||
}
|
||||
public async Task<BookIssueList> FindBookIssueCustomer(int customerId, Guid bookId)
|
||||
public async Task<BookIssueList> FindBookIssueCustomer(Guid customerId, Guid bookId)
|
||||
{
|
||||
//var dbSet = await GetDbSetAsync();
|
||||
|
||||
@ -51,17 +51,17 @@ namespace Acme.BookStore.BookIssued
|
||||
|
||||
}
|
||||
|
||||
public async Task<int> NewBookIssueId()
|
||||
{
|
||||
using (_dataFilter.Disable<ISoftDelete>())
|
||||
{
|
||||
var dbSet = await GetDbSetAsync();
|
||||
var values = await dbSet.MaxAsync(u => (int?)u.Id);
|
||||
return values == null ? 0 + 1 : (int)values + 1;
|
||||
//public async Task<int> NewBookIssueId()
|
||||
//{
|
||||
// using (_dataFilter.Disable<ISoftDelete>())
|
||||
// {
|
||||
// var dbSet = await GetDbSetAsync();
|
||||
// var values = await dbSet.MaxAsync(u => (Guid?)u.Id);
|
||||
// return values == null ? 0 + 1 : (int)values + 1;
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
public async Task<List<BookIssueList>> BookIssueList()
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ using Volo.Abp.EntityFrameworkCore;
|
||||
|
||||
namespace Acme.BookStore.Customers
|
||||
{
|
||||
public class EfCoreCustomerRepository : EfCoreRepository<BookStoreDbContext, Customer, int>,
|
||||
public class EfCoreCustomerRepository : EfCoreRepository<BookStoreDbContext, Customer, Guid>,
|
||||
ICustomerRepository
|
||||
{
|
||||
public EfCoreCustomerRepository(
|
||||
@ -27,14 +27,14 @@ namespace Acme.BookStore.Customers
|
||||
|
||||
}
|
||||
|
||||
public async Task<int> NewCustomerId()
|
||||
{
|
||||
var dbSet = await GetDbSetAsync();
|
||||
var values = await dbSet.MaxAsync(u => (int?)u.Id);
|
||||
return values == null ? 0 +1: (int)values + 1;
|
||||
//public async Task<int> NewCustomerId()
|
||||
//{
|
||||
// var dbSet = await GetDbSetAsync();
|
||||
// var values = await dbSet.MaxAsync(u => (Guid?)u.Id);
|
||||
// return values == null ? 0 +1: (Guid)values + 1;
|
||||
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public class BookStoreDbContext :
|
||||
builder.Entity<BookIssue>(b =>
|
||||
{
|
||||
b.ToTable(BookStoreConsts.DbTablePrefix + "BookIssued",
|
||||
"BKN");
|
||||
BookStoreConsts.DbSchema);
|
||||
|
||||
b.ConfigureByConvention();
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Acme.BookStore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Created_Book_Entity : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppBooks",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
|
||||
Type = table.Column<int>(type: "int", nullable: false),
|
||||
PublishDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
Price = table.Column<float>(type: "real", nullable: false),
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppBooks", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppBooks");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,50 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Acme.BookStore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_Authors : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppAuthors",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
||||
BirthDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ShortBio = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppAuthors", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAuthors_Name",
|
||||
table: "AppAuthors",
|
||||
column: "Name");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppAuthors");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Acme.BookStore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_Customers : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppCustomers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
firstName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||
lastName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||
phone = table.Column<string>(type: "nvarchar(14)", maxLength: 14, nullable: false),
|
||||
address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppCustomers", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppCustomers");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Acme.BookStore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_BookIssued : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "BKN");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppBookIssued",
|
||||
schema: "BKN",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
bookId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
customerId = table.Column<int>(type: "int", nullable: false),
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppBookIssued", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppBookIssued",
|
||||
schema: "BKN");
|
||||
}
|
||||
}
|
||||
}
|
@ -13,8 +13,8 @@ using Volo.Abp.EntityFrameworkCore;
|
||||
namespace Acme.BookStore.Migrations
|
||||
{
|
||||
[DbContext(typeof(BookStoreDbContext))]
|
||||
[Migration("20240606100414_Added_BookIssued")]
|
||||
partial class Added_BookIssued
|
||||
[Migration("20240610170422_Change_Table_ColumnType")]
|
||||
partial class Change_Table_ColumnType
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -95,11 +95,8 @@ namespace Acme.BookStore.Migrations
|
||||
|
||||
modelBuilder.Entity("Acme.BookStore.BookIssued.BookIssue", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
@ -146,12 +143,12 @@ namespace Acme.BookStore.Migrations
|
||||
b.Property<Guid>("bookId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("customerId")
|
||||
.HasColumnType("int");
|
||||
b.Property<Guid>("customerId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AppBookIssued", "BKN");
|
||||
b.ToTable("AppBookIssued", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Acme.BookStore.Books.Book", b =>
|
||||
@ -208,11 +205,8 @@ namespace Acme.BookStore.Migrations
|
||||
|
||||
modelBuilder.Entity("Acme.BookStore.Customers.Customer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Acme.BookStore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Change_Table_ColumnType : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppAuthors",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
||||
BirthDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ShortBio = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppAuthors", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppBookIssued",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
bookId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
customerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppBookIssued", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppBooks",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
|
||||
Type = table.Column<int>(type: "int", nullable: false),
|
||||
PublishDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
Price = table.Column<float>(type: "real", nullable: false),
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppBooks", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppCustomers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
firstName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||
lastName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
||||
phone = table.Column<string>(type: "nvarchar(14)", maxLength: 14, nullable: false),
|
||||
address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: false),
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppCustomers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAuthors_Name",
|
||||
table: "AppAuthors",
|
||||
column: "Name");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppAuthors");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppBookIssued");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppBooks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppCustomers");
|
||||
}
|
||||
}
|
||||
}
|
@ -92,11 +92,8 @@ namespace Acme.BookStore.Migrations
|
||||
|
||||
modelBuilder.Entity("Acme.BookStore.BookIssued.BookIssue", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
@ -143,12 +140,12 @@ namespace Acme.BookStore.Migrations
|
||||
b.Property<Guid>("bookId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("customerId")
|
||||
.HasColumnType("int");
|
||||
b.Property<Guid>("customerId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AppBookIssued", "BKN");
|
||||
b.ToTable("AppBookIssued", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Acme.BookStore.Books.Book", b =>
|
||||
@ -205,11 +202,8 @@ namespace Acme.BookStore.Migrations
|
||||
|
||||
modelBuilder.Entity("Acme.BookStore.Customers.Customer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
|
Loading…
x
Reference in New Issue
Block a user