Skip to content

Darchiashvili9/ShoppingCart

Repository files navigation

ShoppingCart

implementing Shopping-Cart with Microservices

run these scripts before compiling

CREATE DATABASE ShoppingCart GO

USE [ShoppingCart] GO

CREATE TABLE [dbo].[ShoppingCart]( [ID] int IDENTITY(1,1) PRIMARY KEY, [UserId] [bigint] NOT NULL, CONSTRAINT ShoppingCartUnique UNIQUE([ID], [UserID]) ) GO

CREATE INDEX ShoppingCart_UserId ON [dbo].[ShoppingCart] (UserId) GO

CREATE TABLE [dbo].[ShoppingCartItem]( [ID] int IDENTITY(1,1) PRIMARY KEY, [ShoppingCartId] [int] NOT NULL, [ProductCatalogId] [bigint] NOT NULL, [ProductName] nvarchar NOT NULL, [ProductDescription] nvarchar NULL, [Amount] [int] NOT NULL, [Currency] nvarchar NOT NULL )

GO

ALTER TABLE [dbo].[ShoppingCartItem] WITH CHECK ADD CONSTRAINT [FK_ShoppingCart] FOREIGN KEY([ShoppingCartId]) REFERENCES [dbo].[ShoppingCart] ([Id]) GO

ALTER TABLE [dbo].[ShoppingCartItem] CHECK CONSTRAINT [FK_ShoppingCart] GO

CREATE INDEX ShoppingCartItem_ShoppingCartId ON [dbo].[ShoppingCartItem] (ShoppingCartId) GO

CREATE TABLE [dbo].[EventStore]( [ID] int IDENTITY(1,1) PRIMARY KEY, [Name] nvarchar NOT NULL, [OccurredAt] [datetimeoffset] NOT NULL, [Content]nvarchar NOT NULL ) GO