- MSSQL Docker OR (better option 👇)
- Azure SQL Edge
- Azure Data Studio
- install
dotnet tool install --global dotnet-ef --version 8.*
dotnet ef migrations add [MIGRATION_NAME]
followed bydotnet ef database update
dotnet ef migrations add init
dotnet ef database update
- stocks table
DECLARE @Counter INT = 1;
DECLARE @MaxRecords INT = 200;
WHILE @Counter <= @MaxRecords
BEGIN
INSERT INTO [stocks].[dbo].[Stocks] ([Symbol], [Company], [Purchase], [LastDiv], [Industry], [MarketCap])
VALUES (
CONCAT('SYM', @Counter),
CONCAT('Company ', @Counter),
ROUND(RAND() * 1000, 2),
ROUND(RAND() * 100, 2),
CASE
WHEN RAND() < 0.2 THEN 'Technology'
WHEN RAND() < 0.4 THEN 'Healthcare'
WHEN RAND() < 0.6 THEN 'Finance'
WHEN RAND() < 0.8 THEN 'Consumer Goods'
ELSE 'Utilities'
END,
CAST(RAND() * 1000000000 AS BIGINT)
);
SET @Counter = @Counter + 1;
END;
- comments table
- register users
- get user ids
- update snippet below with user ids
DECLARE @Counter INT = 1;
DECLARE @MaxRecords INT = 1000;
DECLARE @StockIdMin INT = 1;
DECLARE @StockIdMax INT = 200;
WHILE @Counter <= @MaxRecords
BEGIN
INSERT INTO [stocks].[dbo].[Comments] ([Title], [Content], [CreatedAt], [StockId])
VALUES (
CONCAT('Comment Title ', @Counter),
CONCAT('Culpa officia dolor sint dolor dolor.', @Counter, '. It provides feedback or discussion related to a stock.'),
DATEADD(MINUTE, -1 * (RAND() * 10000), SYSDATETIME()),
CAST((RAND() * (@StockIdMax - @StockIdMin) + 13) AS INT)
);
SET @Counter = @Counter + 1;
END;
- portfolios table
- register users
- manually insert records (user id & stock id)
dotnet ef migrations add Identity
dotnet ef migrations add SeedRole
dotnet ef database update