Added Relations and changed name of Database

This commit is contained in:
s459315 2022-07-23 23:57:12 +02:00
parent 0957963cad
commit db546557fa
6 changed files with 15 additions and 5 deletions

View File

@ -63,4 +63,11 @@
<Property Name="ParentElementType" Value="SqlTable" />
<Property Name="NewName" Value="CreatedDate" />
</Operation>
<Operation Name="Rename Refactor" Key="d8e011e8-994f-4d92-98b6-9baf8c544dfb" ChangeDateTime="07/23/2022 21:02:02">
<Property Name="ElementName" Value="[dbo].[FK_Sale_ToTable]" />
<Property Name="ElementType" Value="SqlForeignKeyConstraint" />
<Property Name="ParentElementName" Value="[dbo].[Sale]" />
<Property Name="ParentElementType" Value="SqlTable" />
<Property Name="NewName" Value="[FK_Sale_ToUser]" />
</Operation>
</Operations>

View File

@ -5,4 +5,5 @@
[Quantity] INT NOT NULL DEFAULT 1,
[PurchasePrice] MONEY NOT NULL,
[PurchaseDate] DATETIME2 NOT NULL DEFAULT getutcdate(),
CONSTRAINT [FK_Inventory_ToProduct] FOREIGN KEY (ProductId) REFERENCES Product(Id)
)

View File

@ -5,5 +5,6 @@
[SaleDate] DATETIME2 NOT NULL,
[SubTotal] MONEY NOT NULL,
[Tax] MONEY NOT NULL,
[Total] MONEY NOT NULL
[Total] MONEY NOT NULL,
CONSTRAINT [FK_Sale_ToUser] FOREIGN KEY (CashierId) REFERENCES [User](Id)
)

View File

@ -6,5 +6,6 @@
[Quantity] INT NOT NULL DEFAULT 1,
[PurchasePrice] MONEY NOT NULL,
[Tax] MONEY NOT NULL DEFAULT 0,
CONSTRAINT [FK_SaleDetail_ToSale] FOREIGN KEY (SaleId) REFERENCES Sale(Id),
CONSTRAINT [FK_SaleDetail_ToProduct] FOREIGN KEY (ProductId) REFERENCES Product(Id)
)

View File

@ -21,7 +21,7 @@ namespace RMDataManager.Models
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
: base("EFData", throwIfV1Schema: false)
{
}

View File

@ -9,7 +9,7 @@
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-RMDataManager-20220630092827.mdf;Initial Catalog=aspnet-RMDataManager-20220630092827;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="EFData" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\EFData.mdf;Initial Catalog=EFData;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="RMData" connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=RMData;Integrated Security=True;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" />
</connectionStrings>
<appSettings>