Compare commits
34 Commits
081c814036
...
a902d9eb81
Author | SHA1 | Date | |
---|---|---|---|
a902d9eb81 | |||
827cdaf9f9 | |||
d2ba2d982c | |||
79118c5283 | |||
8cd8277c22 | |||
ae46823685 | |||
7aa37618e0 | |||
04b6687181 | |||
7a741d7783 | |||
f17ee43805 | |||
b67f0a82ed | |||
815c860dc0 | |||
f0544ff42e | |||
c9c6a99fe9 | |||
aa1e1000fa | |||
a353b4c3f8 | |||
b81fe6d8c1 | |||
8a103831eb | |||
62ccf94222 | |||
271df127a6 | |||
7c79f7d840 | |||
b8728cd490 | |||
7db4dc2c86 | |||
348b78b84e | |||
4c93ed282d | |||
1bdf40f31f | |||
31c36443e1 | |||
43b6ab7934 | |||
f79c7c7db9 | |||
53a0439edb | |||
78a242f4c3 | |||
0a9c98cbf9 | |||
164d575d98 | |||
bf3a9d4b36 |
@ -2,17 +2,19 @@ name: .NET Test Pipeline
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master, 'release/*']
|
||||
push:
|
||||
branches:
|
||||
[master, 'release/*']
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up .NET Core
|
||||
uses: actions/setup-dotnet@v3
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Mirea.Api.DataAccess.Application.Common.Mappings;
|
||||
|
||||
public class AssemblyMappingProfile : Profile
|
||||
{
|
||||
public AssemblyMappingProfile(Assembly assembly) =>
|
||||
ApplyMappingsFromAssembly(assembly);
|
||||
|
||||
private void ApplyMappingsFromAssembly(Assembly assembly)
|
||||
{
|
||||
var types = assembly.GetExportedTypes()
|
||||
.Where(type => type.GetInterfaces()
|
||||
.Any(i => i.IsGenericType &&
|
||||
i.GetGenericTypeDefinition() == typeof(IMapWith<>)))
|
||||
.ToList();
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
var instance = Activator.CreateInstance(type);
|
||||
var methodInfo = type.GetMethod("Mapping");
|
||||
methodInfo?.Invoke(instance, new[] { this });
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
using AutoMapper;
|
||||
|
||||
namespace Mirea.Api.DataAccess.Application.Common.Mappings;
|
||||
|
||||
public interface IMapWith<T>
|
||||
{
|
||||
void Mapping(Profile profile) =>
|
||||
profile.CreateMap(typeof(T), GetType());
|
||||
}
|
78
Backend.sln
78
Backend.sln
@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34330.188
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain", "Domain\Domain.csproj", "{C27FB5CD-6A70-4FB2-847A-847B34806902}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Endpoint", "Endpoint\Endpoint.csproj", "{F3A1D12E-F5B2-4339-9966-DBF869E78357}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elements of the solution", "Elements of the solution", "{3E087889-A4A0-4A55-A07D-7D149A5BC928}"
|
||||
@ -19,13 +17,34 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elements of the solution",
|
||||
.gitea\workflows\test.yaml = .gitea\workflows\test.yaml
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Application", "Application\Application.csproj", "{E7F0A4D4-B032-4BB9-9526-1AF688F341A4}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Persistence", "Persistence\Persistence.csproj", "{4C1E558F-633F-438E-AC3A-61CDDED917C5}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiDto", "ApiDto\ApiDto.csproj", "{0335FA36-E137-453F-853B-916674C168FE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Security", "Security\Security.csproj", "{47A3C065-4E1D-4B1E-AAB4-2BB8F40E56B4}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Security", "Security\Security.csproj", "{47A3C065-4E1D-4B1E-AAB4-2BB8F40E56B4}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SqlData", "SqlData", "{7E7A63CD-547B-4FB4-A383-EB75298020A1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain", "SqlData\Domain\Domain.csproj", "{3BFD6180-7CA7-4E85-A379-225B872439A1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Application", "SqlData\Application\Application.csproj", "{0B1F3656-E5B3-440C-961F-A7D004FBE9A8}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Persistence", "SqlData\Persistence\Persistence.csproj", "{48C9998C-ECE2-407F-835F-1A7255A5C99E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Migrations", "Migrations", "{79639CD4-7A16-4AB4-BBE8-672B9ACCB3F5}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqliteMigrations", "SqlData\Migrations\SqliteMigrations\SqliteMigrations.csproj", "{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{48C9998C-ECE2-407F-835F-1A7255A5C99E} = {48C9998C-ECE2-407F-835F-1A7255A5C99E}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MysqlMigrations", "SqlData\Migrations\MysqlMigrations\MysqlMigrations.csproj", "{5861915B-9574-4D5D-872F-D54A09651697}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{48C9998C-ECE2-407F-835F-1A7255A5C99E} = {48C9998C-ECE2-407F-835F-1A7255A5C99E}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PsqlMigrations", "SqlData\Migrations\PsqlMigrations\PsqlMigrations.csproj", "{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{48C9998C-ECE2-407F-835F-1A7255A5C99E} = {48C9998C-ECE2-407F-835F-1A7255A5C99E}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -33,22 +52,10 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C27FB5CD-6A70-4FB2-847A-847B34806902}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C27FB5CD-6A70-4FB2-847A-847B34806902}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C27FB5CD-6A70-4FB2-847A-847B34806902}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C27FB5CD-6A70-4FB2-847A-847B34806902}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F3A1D12E-F5B2-4339-9966-DBF869E78357}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F3A1D12E-F5B2-4339-9966-DBF869E78357}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F3A1D12E-F5B2-4339-9966-DBF869E78357}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F3A1D12E-F5B2-4339-9966-DBF869E78357}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E7F0A4D4-B032-4BB9-9526-1AF688F341A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E7F0A4D4-B032-4BB9-9526-1AF688F341A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E7F0A4D4-B032-4BB9-9526-1AF688F341A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E7F0A4D4-B032-4BB9-9526-1AF688F341A4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4C1E558F-633F-438E-AC3A-61CDDED917C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4C1E558F-633F-438E-AC3A-61CDDED917C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4C1E558F-633F-438E-AC3A-61CDDED917C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4C1E558F-633F-438E-AC3A-61CDDED917C5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0335FA36-E137-453F-853B-916674C168FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0335FA36-E137-453F-853B-916674C168FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0335FA36-E137-453F-853B-916674C168FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@ -57,10 +64,43 @@ Global
|
||||
{47A3C065-4E1D-4B1E-AAB4-2BB8F40E56B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{47A3C065-4E1D-4B1E-AAB4-2BB8F40E56B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{47A3C065-4E1D-4B1E-AAB4-2BB8F40E56B4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3BFD6180-7CA7-4E85-A379-225B872439A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3BFD6180-7CA7-4E85-A379-225B872439A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3BFD6180-7CA7-4E85-A379-225B872439A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3BFD6180-7CA7-4E85-A379-225B872439A1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0B1F3656-E5B3-440C-961F-A7D004FBE9A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0B1F3656-E5B3-440C-961F-A7D004FBE9A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0B1F3656-E5B3-440C-961F-A7D004FBE9A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0B1F3656-E5B3-440C-961F-A7D004FBE9A8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{48C9998C-ECE2-407F-835F-1A7255A5C99E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{48C9998C-ECE2-407F-835F-1A7255A5C99E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{48C9998C-ECE2-407F-835F-1A7255A5C99E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{48C9998C-ECE2-407F-835F-1A7255A5C99E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5861915B-9574-4D5D-872F-D54A09651697}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5861915B-9574-4D5D-872F-D54A09651697}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5861915B-9574-4D5D-872F-D54A09651697}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5861915B-9574-4D5D-872F-D54A09651697}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{3BFD6180-7CA7-4E85-A379-225B872439A1} = {7E7A63CD-547B-4FB4-A383-EB75298020A1}
|
||||
{0B1F3656-E5B3-440C-961F-A7D004FBE9A8} = {7E7A63CD-547B-4FB4-A383-EB75298020A1}
|
||||
{48C9998C-ECE2-407F-835F-1A7255A5C99E} = {7E7A63CD-547B-4FB4-A383-EB75298020A1}
|
||||
{79639CD4-7A16-4AB4-BBE8-672B9ACCB3F5} = {7E7A63CD-547B-4FB4-A383-EB75298020A1}
|
||||
{EF5530BD-4BF4-4DD8-80BB-04C6B6623DA7} = {79639CD4-7A16-4AB4-BBE8-672B9ACCB3F5}
|
||||
{5861915B-9574-4D5D-872F-D54A09651697} = {79639CD4-7A16-4AB4-BBE8-672B9ACCB3F5}
|
||||
{E9E238CD-6DD8-4B29-8C36-C61F1168FCCD} = {79639CD4-7A16-4AB4-BBE8-672B9ACCB3F5}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {E80A1224-87F5-4FEB-82AE-89006BE98B12}
|
||||
EndGlobalSection
|
||||
|
@ -1,4 +1,6 @@
|
||||
using Mirea.Api.Endpoint.Configuration.General.Attributes;
|
||||
using System;
|
||||
using Mirea.Api.DataAccess.Persistence.Common;
|
||||
using Mirea.Api.Endpoint.Configuration.General.Attributes;
|
||||
using Mirea.Api.Endpoint.Configuration.General.Interfaces;
|
||||
|
||||
namespace Mirea.Api.Endpoint.Configuration.General.Settings;
|
||||
@ -15,8 +17,15 @@ public class DbSettings : IIsConfigured
|
||||
public DatabaseEnum TypeDatabase { get; set; }
|
||||
public required string ConnectionStringSql { get; set; }
|
||||
|
||||
public bool IsConfigured()
|
||||
{
|
||||
return !string.IsNullOrEmpty(ConnectionStringSql);
|
||||
}
|
||||
public DatabaseProvider DatabaseProvider =>
|
||||
TypeDatabase switch
|
||||
{
|
||||
DatabaseEnum.PostgresSql => DatabaseProvider.Postgresql,
|
||||
DatabaseEnum.Mysql => DatabaseProvider.Mysql,
|
||||
DatabaseEnum.Sqlite => DatabaseProvider.Sqlite,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
|
||||
public bool IsConfigured() =>
|
||||
!string.IsNullOrEmpty(ConnectionStringSql);
|
||||
}
|
@ -31,9 +31,12 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ApiDto\ApiDto.csproj" />
|
||||
<ProjectReference Include="..\Domain\Domain.csproj" />
|
||||
<ProjectReference Include="..\Persistence\Persistence.csproj" />
|
||||
<ProjectReference Include="..\SqlData\Domain\Domain.csproj" />
|
||||
<ProjectReference Include="..\SqlData\Persistence\Persistence.csproj" />
|
||||
<ProjectReference Include="..\Security\Security.csproj" />
|
||||
<ProjectReference Include="..\SqlData\Migrations\PsqlMigrations\PsqlMigrations.csproj" />
|
||||
<ProjectReference Include="..\SqlData\Migrations\SqliteMigrations\SqliteMigrations.csproj" />
|
||||
<ProjectReference Include="..\SqlData\Migrations\MysqlMigrations\MysqlMigrations.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -10,11 +10,13 @@ using Microsoft.Extensions.Options;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Mirea.Api.DataAccess.Application;
|
||||
using Mirea.Api.DataAccess.Persistence;
|
||||
using Mirea.Api.DataAccess.Persistence.Common;
|
||||
using Mirea.Api.Endpoint.Common.Interfaces;
|
||||
using Mirea.Api.Endpoint.Common.Services;
|
||||
using Mirea.Api.Endpoint.Common.Services.Security;
|
||||
using Mirea.Api.Endpoint.Configuration;
|
||||
using Mirea.Api.Endpoint.Configuration.General;
|
||||
using Mirea.Api.Endpoint.Configuration.General.Settings;
|
||||
using Mirea.Api.Endpoint.Configuration.General.Validators;
|
||||
using Mirea.Api.Endpoint.Configuration.Swagger;
|
||||
using Mirea.Api.Endpoint.Middleware;
|
||||
@ -114,8 +116,9 @@ public class Program
|
||||
builder.Configuration.AddJsonFile(PathBuilder.Combine(GeneralConfig.FilePath), optional: true, reloadOnChange: true);
|
||||
builder.Services.Configure<GeneralConfig>(builder.Configuration);
|
||||
|
||||
var generalConfig = builder.Configuration.Get<GeneralConfig>();
|
||||
builder.Services.AddApplication();
|
||||
builder.Services.AddPersistence(builder.Configuration.Get<GeneralConfig>()?.DbSettings?.ConnectionStringSql ?? string.Empty);
|
||||
builder.Services.AddPersistence(generalConfig?.DbSettings?.DatabaseProvider ?? DatabaseProvider.Sqlite, generalConfig?.DbSettings?.ConnectionStringSql ?? string.Empty);
|
||||
builder.Services.AddControllers();
|
||||
|
||||
builder.Services.AddSingleton<IMaintenanceModeNotConfigureService, MaintenanceModeNotConfigureService>();
|
||||
|
@ -1,40 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||
using Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||
|
||||
namespace Mirea.Api.DataAccess.Persistence;
|
||||
|
||||
public static class DependencyInjection
|
||||
{
|
||||
public static IServiceCollection AddPersistence(this IServiceCollection services, string connection)
|
||||
{
|
||||
services.AddDbContext<CampusDbContext>(DbConfig);
|
||||
services.AddDbContext<DisciplineDbContext>(DbConfig);
|
||||
services.AddDbContext<FacultyDbContext>(DbConfig);
|
||||
services.AddDbContext<GroupDbContext>(DbConfig);
|
||||
services.AddDbContext<LectureHallDbContext>(DbConfig);
|
||||
services.AddDbContext<LessonAssociationDbContext>(DbConfig);
|
||||
services.AddDbContext<ProfessorDbContext>(DbConfig);
|
||||
services.AddDbContext<LessonDbContext>(DbConfig);
|
||||
services.AddDbContext<TypeOfOccupationDbContext>(DbConfig);
|
||||
services.AddDbContext<SpecificWeekDbContext>(DbConfig);
|
||||
|
||||
services.AddDbContext<UberDbContext>(DbConfig);
|
||||
|
||||
services.AddScoped<ICampusDbContext>(provider => provider.GetService<CampusDbContext>()!);
|
||||
services.AddScoped<IDisciplineDbContext>(provider => provider.GetService<DisciplineDbContext>()!);
|
||||
services.AddScoped<IFacultyDbContext>(provider => provider.GetService<FacultyDbContext>()!);
|
||||
services.AddScoped<IGroupDbContext>(provider => provider.GetService<GroupDbContext>()!);
|
||||
services.AddScoped<ILectureHallDbContext>(provider => provider.GetService<LectureHallDbContext>()!);
|
||||
services.AddScoped<ILessonAssociationDbContext>(provider => provider.GetService<LessonAssociationDbContext>()!);
|
||||
services.AddScoped<IProfessorDbContext>(provider => provider.GetService<ProfessorDbContext>()!);
|
||||
services.AddScoped<ILessonDbContext>(provider => provider.GetService<LessonDbContext>()!);
|
||||
services.AddScoped<ITypeOfOccupationDbContext>(provider => provider.GetService<TypeOfOccupationDbContext>()!);
|
||||
services.AddScoped<ISpecificWeekDbContext>(provider => provider.GetService<SpecificWeekDbContext>()!);
|
||||
|
||||
return services;
|
||||
|
||||
void DbConfig(DbContextOptionsBuilder options) => options.UseSqlite(connection);
|
||||
}
|
||||
}
|
@ -13,15 +13,14 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="12.0.1" />
|
||||
<PackageReference Include="FluentValidation" Version="11.9.0" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.0" />
|
||||
<PackageReference Include="MediatR" Version="12.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.9.1" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.1" />
|
||||
<PackageReference Include="MediatR" Version="12.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Domain\Domain.csproj" />
|
||||
<ProjectReference Include="..\Domain\Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
442
SqlData/Migrations/MysqlMigrations/Migrations/20240601023106_InitialMigration.Designer.cs
generated
Normal file
442
SqlData/Migrations/MysqlMigrations/Migrations/20240601023106_InitialMigration.Designer.cs
generated
Normal file
@ -0,0 +1,442 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Mirea.Api.DataAccess.Persistence;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MysqlMigrations.Migrations
|
||||
{
|
||||
[DbContext(typeof(UberDbContext))]
|
||||
[Migration("20240601023106_InitialMigration")]
|
||||
partial class InitialMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("CodeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Campus", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Discipline", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Faculty", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("FacultyId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FacultyId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Group", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("LectureHall", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DayOfWeek")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DisciplineId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GroupId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsEven")
|
||||
.HasColumnType("BIT(1)");
|
||||
|
||||
b.Property<bool?>("IsExcludedWeeks")
|
||||
.HasColumnType("BIT(1)");
|
||||
|
||||
b.Property<int>("PairNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DisciplineId");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Lesson", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("LectureHallId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("LinkToMeet")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("ProfessorId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("TypeOfOccupationId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LectureHallId");
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.HasIndex("ProfessorId");
|
||||
|
||||
b.HasIndex("TypeOfOccupationId");
|
||||
|
||||
b.ToTable("LessonAssociation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AltName")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Professor", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("WeekNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.ToTable("SpecificWeek", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("TypeOfOccupation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("Faculties")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
|
||||
.WithMany("Groups")
|
||||
.HasForeignKey("FacultyId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Faculty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("LectureHalls")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("DisciplineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Discipline");
|
||||
|
||||
b.Navigation("Group");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LectureHallId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("ProfessorId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("TypeOfOccupationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("LectureHall");
|
||||
|
||||
b.Navigation("Lesson");
|
||||
|
||||
b.Navigation("Professor");
|
||||
|
||||
b.Navigation("TypeOfOccupation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("SpecificWeeks")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Lesson");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Navigation("Faculties");
|
||||
|
||||
b.Navigation("LectureHalls");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Navigation("Groups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
|
||||
b.Navigation("SpecificWeeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,389 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MysqlMigrations.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Campus",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CodeName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FullName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Address = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Campus", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Discipline",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Discipline", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Professor",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
AltName = table.Column<string>(type: "TEXT", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Professor", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TypeOfOccupation",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ShortName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TypeOfOccupation", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Faculty",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CampusId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Faculty", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Faculty_Campus_CampusId",
|
||||
column: x => x.CampusId,
|
||||
principalTable: "Campus",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LectureHall",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CampusId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LectureHall", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_LectureHall_Campus_CampusId",
|
||||
column: x => x.CampusId,
|
||||
principalTable: "Campus",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Group",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FacultyId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Group", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Group_Faculty_FacultyId",
|
||||
column: x => x.FacultyId,
|
||||
principalTable: "Faculty",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Lesson",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
IsEven = table.Column<bool>(type: "BIT(1)", nullable: false),
|
||||
DayOfWeek = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
PairNumber = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
IsExcludedWeeks = table.Column<bool>(type: "BIT(1)", nullable: true),
|
||||
GroupId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
DisciplineId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Lesson", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Lesson_Discipline_DisciplineId",
|
||||
column: x => x.DisciplineId,
|
||||
principalTable: "Discipline",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Lesson_Group_GroupId",
|
||||
column: x => x.GroupId,
|
||||
principalTable: "Group",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LessonAssociation",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
LinkToMeet = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
TypeOfOccupationId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
LessonId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
ProfessorId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
LectureHallId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LessonAssociation", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_LectureHall_LectureHallId",
|
||||
column: x => x.LectureHallId,
|
||||
principalTable: "LectureHall",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_Lesson_LessonId",
|
||||
column: x => x.LessonId,
|
||||
principalTable: "Lesson",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_Professor_ProfessorId",
|
||||
column: x => x.ProfessorId,
|
||||
principalTable: "Professor",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_TypeOfOccupation_TypeOfOccupationId",
|
||||
column: x => x.TypeOfOccupationId,
|
||||
principalTable: "TypeOfOccupation",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SpecificWeek",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
WeekNumber = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
LessonId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SpecificWeek", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SpecificWeek_Lesson_LessonId",
|
||||
column: x => x.LessonId,
|
||||
principalTable: "Lesson",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Campus_Id",
|
||||
table: "Campus",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Discipline_Id",
|
||||
table: "Discipline",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Faculty_CampusId",
|
||||
table: "Faculty",
|
||||
column: "CampusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Faculty_Id",
|
||||
table: "Faculty",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Group_FacultyId",
|
||||
table: "Group",
|
||||
column: "FacultyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Group_Id",
|
||||
table: "Group",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LectureHall_CampusId",
|
||||
table: "LectureHall",
|
||||
column: "CampusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LectureHall_Id",
|
||||
table: "LectureHall",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lesson_DisciplineId",
|
||||
table: "Lesson",
|
||||
column: "DisciplineId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lesson_GroupId",
|
||||
table: "Lesson",
|
||||
column: "GroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lesson_Id",
|
||||
table: "Lesson",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_Id",
|
||||
table: "LessonAssociation",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_LectureHallId",
|
||||
table: "LessonAssociation",
|
||||
column: "LectureHallId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_LessonId",
|
||||
table: "LessonAssociation",
|
||||
column: "LessonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_ProfessorId",
|
||||
table: "LessonAssociation",
|
||||
column: "ProfessorId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_TypeOfOccupationId",
|
||||
table: "LessonAssociation",
|
||||
column: "TypeOfOccupationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Professor_Id",
|
||||
table: "Professor",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SpecificWeek_Id",
|
||||
table: "SpecificWeek",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SpecificWeek_LessonId",
|
||||
table: "SpecificWeek",
|
||||
column: "LessonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TypeOfOccupation_Id",
|
||||
table: "TypeOfOccupation",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "LessonAssociation");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SpecificWeek");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LectureHall");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Professor");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TypeOfOccupation");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Lesson");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Discipline");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Group");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Faculty");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Campus");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,439 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Mirea.Api.DataAccess.Persistence;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MysqlMigrations.Migrations
|
||||
{
|
||||
[DbContext(typeof(UberDbContext))]
|
||||
partial class UberDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("CodeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Campus", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Discipline", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Faculty", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("FacultyId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FacultyId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Group", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("LectureHall", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DayOfWeek")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DisciplineId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GroupId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsEven")
|
||||
.HasColumnType("BIT(1)");
|
||||
|
||||
b.Property<bool?>("IsExcludedWeeks")
|
||||
.HasColumnType("BIT(1)");
|
||||
|
||||
b.Property<int>("PairNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DisciplineId");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Lesson", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("LectureHallId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("LinkToMeet")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("ProfessorId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("TypeOfOccupationId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LectureHallId");
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.HasIndex("ProfessorId");
|
||||
|
||||
b.HasIndex("TypeOfOccupationId");
|
||||
|
||||
b.ToTable("LessonAssociation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AltName")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Professor", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("WeekNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.ToTable("SpecificWeek", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("TypeOfOccupation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("Faculties")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
|
||||
.WithMany("Groups")
|
||||
.HasForeignKey("FacultyId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Faculty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("LectureHalls")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("DisciplineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Discipline");
|
||||
|
||||
b.Navigation("Group");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LectureHallId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("ProfessorId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("TypeOfOccupationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("LectureHall");
|
||||
|
||||
b.Navigation("Lesson");
|
||||
|
||||
b.Navigation("Professor");
|
||||
|
||||
b.Navigation("TypeOfOccupation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("SpecificWeeks")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Lesson");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Navigation("Faculties");
|
||||
|
||||
b.Navigation("LectureHalls");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Navigation("Groups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
|
||||
b.Navigation("SpecificWeeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
12
SqlData/Migrations/MysqlMigrations/MysqlMigrations.csproj
Normal file
12
SqlData/Migrations/MysqlMigrations/MysqlMigrations.csproj
Normal file
@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<BaseOutputPath>..\..\Persistence\bin\</BaseOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Persistence\Persistence.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
442
SqlData/Migrations/PsqlMigrations/Migrations/20240601021702_InitialMigration.Designer.cs
generated
Normal file
442
SqlData/Migrations/PsqlMigrations/Migrations/20240601021702_InitialMigration.Designer.cs
generated
Normal file
@ -0,0 +1,442 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Mirea.Api.DataAccess.Persistence;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PsqlMigrations.Migrations
|
||||
{
|
||||
[DbContext(typeof(UberDbContext))]
|
||||
[Migration("20240601021702_InitialMigration")]
|
||||
partial class InitialMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("CodeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Campus", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Discipline", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Faculty", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("FacultyId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FacultyId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Group", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("LectureHall", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DayOfWeek")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DisciplineId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GroupId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsEven")
|
||||
.HasColumnType("BOOLEAN");
|
||||
|
||||
b.Property<bool?>("IsExcludedWeeks")
|
||||
.HasColumnType("BOOLEAN");
|
||||
|
||||
b.Property<int>("PairNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DisciplineId");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Lesson", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("LectureHallId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("LinkToMeet")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("ProfessorId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("TypeOfOccupationId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LectureHallId");
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.HasIndex("ProfessorId");
|
||||
|
||||
b.HasIndex("TypeOfOccupationId");
|
||||
|
||||
b.ToTable("LessonAssociation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AltName")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Professor", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("WeekNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.ToTable("SpecificWeek", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("TypeOfOccupation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("Faculties")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
|
||||
.WithMany("Groups")
|
||||
.HasForeignKey("FacultyId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Faculty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("LectureHalls")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("DisciplineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Discipline");
|
||||
|
||||
b.Navigation("Group");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LectureHallId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("ProfessorId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("TypeOfOccupationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("LectureHall");
|
||||
|
||||
b.Navigation("Lesson");
|
||||
|
||||
b.Navigation("Professor");
|
||||
|
||||
b.Navigation("TypeOfOccupation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("SpecificWeeks")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Lesson");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Navigation("Faculties");
|
||||
|
||||
b.Navigation("LectureHalls");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Navigation("Groups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
|
||||
b.Navigation("SpecificWeeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,365 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PsqlMigrations.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Campus",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
CodeName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false),
|
||||
FullName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
|
||||
Address = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Campus", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Discipline",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Discipline", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Professor",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
AltName = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Professor", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TypeOfOccupation",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ShortName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TypeOfOccupation", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Faculty",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
|
||||
CampusId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Faculty", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Faculty_Campus_CampusId",
|
||||
column: x => x.CampusId,
|
||||
principalTable: "Campus",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LectureHall",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
|
||||
CampusId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LectureHall", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_LectureHall_Campus_CampusId",
|
||||
column: x => x.CampusId,
|
||||
principalTable: "Campus",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Group",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
|
||||
FacultyId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Group", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Group_Faculty_FacultyId",
|
||||
column: x => x.FacultyId,
|
||||
principalTable: "Faculty",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Lesson",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
IsEven = table.Column<bool>(type: "BOOLEAN", nullable: false),
|
||||
DayOfWeek = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
PairNumber = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
IsExcludedWeeks = table.Column<bool>(type: "BOOLEAN", nullable: true),
|
||||
GroupId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
DisciplineId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Lesson", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Lesson_Discipline_DisciplineId",
|
||||
column: x => x.DisciplineId,
|
||||
principalTable: "Discipline",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Lesson_Group_GroupId",
|
||||
column: x => x.GroupId,
|
||||
principalTable: "Group",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LessonAssociation",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
LinkToMeet = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true),
|
||||
TypeOfOccupationId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
LessonId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
ProfessorId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
LectureHallId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LessonAssociation", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_LectureHall_LectureHallId",
|
||||
column: x => x.LectureHallId,
|
||||
principalTable: "LectureHall",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_Lesson_LessonId",
|
||||
column: x => x.LessonId,
|
||||
principalTable: "Lesson",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_Professor_ProfessorId",
|
||||
column: x => x.ProfessorId,
|
||||
principalTable: "Professor",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_TypeOfOccupation_TypeOfOccupationId",
|
||||
column: x => x.TypeOfOccupationId,
|
||||
principalTable: "TypeOfOccupation",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SpecificWeek",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
WeekNumber = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
LessonId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SpecificWeek", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SpecificWeek_Lesson_LessonId",
|
||||
column: x => x.LessonId,
|
||||
principalTable: "Lesson",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Campus_Id",
|
||||
table: "Campus",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Discipline_Id",
|
||||
table: "Discipline",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Faculty_CampusId",
|
||||
table: "Faculty",
|
||||
column: "CampusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Faculty_Id",
|
||||
table: "Faculty",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Group_FacultyId",
|
||||
table: "Group",
|
||||
column: "FacultyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Group_Id",
|
||||
table: "Group",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LectureHall_CampusId",
|
||||
table: "LectureHall",
|
||||
column: "CampusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LectureHall_Id",
|
||||
table: "LectureHall",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lesson_DisciplineId",
|
||||
table: "Lesson",
|
||||
column: "DisciplineId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lesson_GroupId",
|
||||
table: "Lesson",
|
||||
column: "GroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lesson_Id",
|
||||
table: "Lesson",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_Id",
|
||||
table: "LessonAssociation",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_LectureHallId",
|
||||
table: "LessonAssociation",
|
||||
column: "LectureHallId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_LessonId",
|
||||
table: "LessonAssociation",
|
||||
column: "LessonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_ProfessorId",
|
||||
table: "LessonAssociation",
|
||||
column: "ProfessorId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_TypeOfOccupationId",
|
||||
table: "LessonAssociation",
|
||||
column: "TypeOfOccupationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Professor_Id",
|
||||
table: "Professor",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SpecificWeek_Id",
|
||||
table: "SpecificWeek",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SpecificWeek_LessonId",
|
||||
table: "SpecificWeek",
|
||||
column: "LessonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TypeOfOccupation_Id",
|
||||
table: "TypeOfOccupation",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "LessonAssociation");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SpecificWeek");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LectureHall");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Professor");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TypeOfOccupation");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Lesson");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Discipline");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Group");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Faculty");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Campus");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,439 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Mirea.Api.DataAccess.Persistence;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PsqlMigrations.Migrations
|
||||
{
|
||||
[DbContext(typeof(UberDbContext))]
|
||||
partial class UberDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("CodeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Campus", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Discipline", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Faculty", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("FacultyId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FacultyId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Group", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("LectureHall", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DayOfWeek")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DisciplineId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GroupId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsEven")
|
||||
.HasColumnType("BOOLEAN");
|
||||
|
||||
b.Property<bool?>("IsExcludedWeeks")
|
||||
.HasColumnType("BOOLEAN");
|
||||
|
||||
b.Property<int>("PairNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DisciplineId");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Lesson", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("LectureHallId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("LinkToMeet")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("ProfessorId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("TypeOfOccupationId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LectureHallId");
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.HasIndex("ProfessorId");
|
||||
|
||||
b.HasIndex("TypeOfOccupationId");
|
||||
|
||||
b.ToTable("LessonAssociation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AltName")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Professor", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("WeekNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.ToTable("SpecificWeek", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("TypeOfOccupation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("Faculties")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
|
||||
.WithMany("Groups")
|
||||
.HasForeignKey("FacultyId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Faculty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("LectureHalls")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("DisciplineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Discipline");
|
||||
|
||||
b.Navigation("Group");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LectureHallId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("ProfessorId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("TypeOfOccupationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("LectureHall");
|
||||
|
||||
b.Navigation("Lesson");
|
||||
|
||||
b.Navigation("Professor");
|
||||
|
||||
b.Navigation("TypeOfOccupation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("SpecificWeeks")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Lesson");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Navigation("Faculties");
|
||||
|
||||
b.Navigation("LectureHalls");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Navigation("Groups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
|
||||
b.Navigation("SpecificWeeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
12
SqlData/Migrations/PsqlMigrations/PsqlMigrations.csproj
Normal file
12
SqlData/Migrations/PsqlMigrations/PsqlMigrations.csproj
Normal file
@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<BaseOutputPath>..\..\Persistence\bin\</BaseOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Persistence\Persistence.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
417
SqlData/Migrations/SqliteMigrations/Migrations/20240601015714_InitialMigration.Designer.cs
generated
Normal file
417
SqlData/Migrations/SqliteMigrations/Migrations/20240601015714_InitialMigration.Designer.cs
generated
Normal file
@ -0,0 +1,417 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Mirea.Api.DataAccess.Persistence;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SqliteMigrations.Migrations
|
||||
{
|
||||
[DbContext(typeof(UberDbContext))]
|
||||
[Migration("20240601015714_InitialMigration")]
|
||||
partial class InitialMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("CodeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Campus", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Discipline", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Faculty", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("FacultyId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FacultyId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Group", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("LectureHall", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DayOfWeek")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DisciplineId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GroupId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsEven")
|
||||
.HasColumnType("BOOLEAN");
|
||||
|
||||
b.Property<bool?>("IsExcludedWeeks")
|
||||
.HasColumnType("BOOLEAN");
|
||||
|
||||
b.Property<int>("PairNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DisciplineId");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Lesson", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("LectureHallId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("LinkToMeet")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("ProfessorId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("TypeOfOccupationId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LectureHallId");
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.HasIndex("ProfessorId");
|
||||
|
||||
b.HasIndex("TypeOfOccupationId");
|
||||
|
||||
b.ToTable("LessonAssociation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AltName")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Professor", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("WeekNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.ToTable("SpecificWeek", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("TypeOfOccupation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("Faculties")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
|
||||
.WithMany("Groups")
|
||||
.HasForeignKey("FacultyId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Faculty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("LectureHalls")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("DisciplineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Discipline");
|
||||
|
||||
b.Navigation("Group");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LectureHallId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("ProfessorId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("TypeOfOccupationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("LectureHall");
|
||||
|
||||
b.Navigation("Lesson");
|
||||
|
||||
b.Navigation("Professor");
|
||||
|
||||
b.Navigation("TypeOfOccupation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("SpecificWeeks")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Lesson");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Navigation("Faculties");
|
||||
|
||||
b.Navigation("LectureHalls");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Navigation("Groups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
|
||||
b.Navigation("SpecificWeeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,364 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SqliteMigrations.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Campus",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
CodeName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false),
|
||||
FullName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
|
||||
Address = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Campus", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Discipline",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Discipline", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Professor",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
AltName = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Professor", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TypeOfOccupation",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
ShortName = table.Column<string>(type: "TEXT", maxLength: 16, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TypeOfOccupation", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Faculty",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
|
||||
CampusId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Faculty", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Faculty_Campus_CampusId",
|
||||
column: x => x.CampusId,
|
||||
principalTable: "Campus",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LectureHall",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
|
||||
CampusId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LectureHall", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_LectureHall_Campus_CampusId",
|
||||
column: x => x.CampusId,
|
||||
principalTable: "Campus",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Group",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
|
||||
FacultyId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Group", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Group_Faculty_FacultyId",
|
||||
column: x => x.FacultyId,
|
||||
principalTable: "Faculty",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Lesson",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
IsEven = table.Column<bool>(type: "BOOLEAN", nullable: false),
|
||||
DayOfWeek = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
PairNumber = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
IsExcludedWeeks = table.Column<bool>(type: "BOOLEAN", nullable: true),
|
||||
GroupId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
DisciplineId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Lesson", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Lesson_Discipline_DisciplineId",
|
||||
column: x => x.DisciplineId,
|
||||
principalTable: "Discipline",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Lesson_Group_GroupId",
|
||||
column: x => x.GroupId,
|
||||
principalTable: "Group",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LessonAssociation",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
LinkToMeet = table.Column<string>(type: "TEXT", maxLength: 512, nullable: true),
|
||||
TypeOfOccupationId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
LessonId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
ProfessorId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
LectureHallId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LessonAssociation", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_LectureHall_LectureHallId",
|
||||
column: x => x.LectureHallId,
|
||||
principalTable: "LectureHall",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_Lesson_LessonId",
|
||||
column: x => x.LessonId,
|
||||
principalTable: "Lesson",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_Professor_ProfessorId",
|
||||
column: x => x.ProfessorId,
|
||||
principalTable: "Professor",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "FK_LessonAssociation_TypeOfOccupation_TypeOfOccupationId",
|
||||
column: x => x.TypeOfOccupationId,
|
||||
principalTable: "TypeOfOccupation",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SpecificWeek",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
WeekNumber = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
LessonId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SpecificWeek", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SpecificWeek_Lesson_LessonId",
|
||||
column: x => x.LessonId,
|
||||
principalTable: "Lesson",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Campus_Id",
|
||||
table: "Campus",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Discipline_Id",
|
||||
table: "Discipline",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Faculty_CampusId",
|
||||
table: "Faculty",
|
||||
column: "CampusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Faculty_Id",
|
||||
table: "Faculty",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Group_FacultyId",
|
||||
table: "Group",
|
||||
column: "FacultyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Group_Id",
|
||||
table: "Group",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LectureHall_CampusId",
|
||||
table: "LectureHall",
|
||||
column: "CampusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LectureHall_Id",
|
||||
table: "LectureHall",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lesson_DisciplineId",
|
||||
table: "Lesson",
|
||||
column: "DisciplineId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lesson_GroupId",
|
||||
table: "Lesson",
|
||||
column: "GroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lesson_Id",
|
||||
table: "Lesson",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_Id",
|
||||
table: "LessonAssociation",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_LectureHallId",
|
||||
table: "LessonAssociation",
|
||||
column: "LectureHallId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_LessonId",
|
||||
table: "LessonAssociation",
|
||||
column: "LessonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_ProfessorId",
|
||||
table: "LessonAssociation",
|
||||
column: "ProfessorId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LessonAssociation_TypeOfOccupationId",
|
||||
table: "LessonAssociation",
|
||||
column: "TypeOfOccupationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Professor_Id",
|
||||
table: "Professor",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SpecificWeek_Id",
|
||||
table: "SpecificWeek",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SpecificWeek_LessonId",
|
||||
table: "SpecificWeek",
|
||||
column: "LessonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TypeOfOccupation_Id",
|
||||
table: "TypeOfOccupation",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "LessonAssociation");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SpecificWeek");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LectureHall");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Professor");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TypeOfOccupation");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Lesson");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Discipline");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Group");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Faculty");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Campus");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,414 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Mirea.Api.DataAccess.Persistence;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SqliteMigrations.Migrations
|
||||
{
|
||||
[DbContext(typeof(UberDbContext))]
|
||||
partial class UberDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("CodeName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Campus", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Discipline", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Faculty", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("FacultyId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("FacultyId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Group", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CampusId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CampusId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("LectureHall", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DayOfWeek")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DisciplineId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("GroupId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsEven")
|
||||
.HasColumnType("BOOLEAN");
|
||||
|
||||
b.Property<bool?>("IsExcludedWeeks")
|
||||
.HasColumnType("BOOLEAN");
|
||||
|
||||
b.Property<int>("PairNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DisciplineId");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Lesson", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("LectureHallId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("LinkToMeet")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("ProfessorId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("TypeOfOccupationId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LectureHallId");
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.HasIndex("ProfessorId");
|
||||
|
||||
b.HasIndex("TypeOfOccupationId");
|
||||
|
||||
b.ToTable("LessonAssociation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AltName")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Professor", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("WeekNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.ToTable("SpecificWeek", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("TypeOfOccupation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("Faculties")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Faculty", "Faculty")
|
||||
.WithMany("Groups")
|
||||
.HasForeignKey("FacultyId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Faculty");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Campus", "Campus")
|
||||
.WithMany("LectureHalls")
|
||||
.HasForeignKey("CampusId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Campus");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Discipline", "Discipline")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("DisciplineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Group", "Group")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("GroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Discipline");
|
||||
|
||||
b.Navigation("Group");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LessonAssociation", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", "LectureHall")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LectureHallId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Professor", "Professor")
|
||||
.WithMany("LessonAssociations")
|
||||
.HasForeignKey("ProfessorId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", "TypeOfOccupation")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("TypeOfOccupationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("LectureHall");
|
||||
|
||||
b.Navigation("Lesson");
|
||||
|
||||
b.Navigation("Professor");
|
||||
|
||||
b.Navigation("TypeOfOccupation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.SpecificWeek", b =>
|
||||
{
|
||||
b.HasOne("Mirea.Api.DataAccess.Domain.Schedule.Lesson", "Lesson")
|
||||
.WithMany("SpecificWeeks")
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Lesson");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Campus", b =>
|
||||
{
|
||||
b.Navigation("Faculties");
|
||||
|
||||
b.Navigation("LectureHalls");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Discipline", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Faculty", b =>
|
||||
{
|
||||
b.Navigation("Groups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Group", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.LectureHall", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Lesson", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
|
||||
b.Navigation("SpecificWeeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.Professor", b =>
|
||||
{
|
||||
b.Navigation("LessonAssociations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Mirea.Api.DataAccess.Domain.Schedule.TypeOfOccupation", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
12
SqlData/Migrations/SqliteMigrations/SqliteMigrations.csproj
Normal file
12
SqlData/Migrations/SqliteMigrations/SqliteMigrations.csproj
Normal file
@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<BaseOutputPath>..\..\Persistence\bin\</BaseOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Persistence\Persistence.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
9
SqlData/Persistence/Common/BaseDbContext.cs
Normal file
9
SqlData/Persistence/Common/BaseDbContext.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Mirea.Api.DataAccess.Persistence.Common;
|
||||
|
||||
public abstract class BaseDbContext<TContext>(DbContextOptions<TContext> options) : DbContext(options) where TContext : DbContext
|
||||
{
|
||||
public void ApplyConfigurations(ModelBuilder modelBuilder) =>
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
23
SqlData/Persistence/Common/ConfigurationResolver.cs
Normal file
23
SqlData/Persistence/Common/ConfigurationResolver.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Mirea.Api.DataAccess.Persistence.Common;
|
||||
|
||||
public static class ConfigurationResolver
|
||||
{
|
||||
public static Type GetConfigurationType<TEntity>(DatabaseProvider provider)
|
||||
where TEntity : class
|
||||
{
|
||||
var entityType = typeof(TEntity);
|
||||
var providerNamespace = typeof(Mark).Namespace + "." + Enum.GetName(provider);
|
||||
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var configurationType = assembly.GetTypes()
|
||||
.FirstOrDefault(t => t.Namespace != null && t.Namespace.StartsWith(providerNamespace) && t.Name == $"{entityType.Name}Configuration");
|
||||
|
||||
return configurationType ??
|
||||
throw new InvalidOperationException($"Configuration type not found for entity {entityType.Name} and provider {provider}.");
|
||||
}
|
||||
}
|
8
SqlData/Persistence/Common/DatabaseProvider.cs
Normal file
8
SqlData/Persistence/Common/DatabaseProvider.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace Mirea.Api.DataAccess.Persistence.Common;
|
||||
|
||||
public enum DatabaseProvider
|
||||
{
|
||||
Mysql,
|
||||
Sqlite,
|
||||
Postgresql
|
||||
}
|
22
SqlData/Persistence/Common/DbContextFactory.cs
Normal file
22
SqlData/Persistence/Common/DbContextFactory.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
|
||||
namespace Mirea.Api.DataAccess.Persistence.Common;
|
||||
|
||||
public static class DbContextFactory
|
||||
{
|
||||
public static DbContextOptionsBuilder CreateDbContext<TDbContext, TEntity>(this DbContextOptionsBuilder options, DatabaseProvider provider)
|
||||
where TDbContext : BaseDbContext<TDbContext>
|
||||
where TEntity : class
|
||||
{
|
||||
var dbContext = (TDbContext)Activator.CreateInstance(typeof(TDbContext), (DbContextOptions<TDbContext>)options.Options)!;
|
||||
var configurationType = ConfigurationResolver.GetConfigurationType<TEntity>(provider);
|
||||
var configurationInstance = (IEntityTypeConfiguration<TEntity>)Activator.CreateInstance(configurationType)!;
|
||||
|
||||
var modelBuilder = new ModelBuilder();
|
||||
modelBuilder.ApplyConfiguration(configurationInstance);
|
||||
dbContext.ApplyConfigurations(modelBuilder);
|
||||
|
||||
return options;
|
||||
}
|
||||
}
|
22
SqlData/Persistence/Common/ModelBuilderExtensions.cs
Normal file
22
SqlData/Persistence/Common/ModelBuilderExtensions.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
|
||||
namespace Mirea.Api.DataAccess.Persistence.Common;
|
||||
|
||||
public static class ModelBuilderExtensions
|
||||
{
|
||||
public static void ApplyConfiguration(this ModelBuilder modelBuilder, object configuration)
|
||||
{
|
||||
var applyGenericMethod = typeof(ModelBuilder)
|
||||
.GetMethods()
|
||||
.First(m => m.Name == "ApplyConfiguration" &&
|
||||
m.GetParameters().Any(p => p.ParameterType.GetGenericTypeDefinition() == typeof(IEntityTypeConfiguration<>)));
|
||||
|
||||
var entityType = configuration.GetType().GetInterfaces()
|
||||
.First(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IEntityTypeConfiguration<>))
|
||||
.GetGenericArguments()[0];
|
||||
|
||||
var applyConcreteMethod = applyGenericMethod.MakeGenericMethod(entityType);
|
||||
applyConcreteMethod.Invoke(modelBuilder, [configuration]);
|
||||
}
|
||||
}
|
@ -1,17 +1,18 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||
using Mirea.Api.DataAccess.Persistence.Common;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||
|
||||
public class CampusDbContext(DbContextOptions<CampusDbContext> options) : DbContext(options), ICampusDbContext
|
||||
public class CampusDbContext(DbContextOptions<CampusDbContext> options) : BaseDbContext<CampusDbContext>(options), ICampusDbContext
|
||||
{
|
||||
public DbSet<Campus> Campuses { get; set; } = null!;
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.ApplyConfiguration(new CampusConfiguration());
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
@ -1,17 +1,18 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||
using Mirea.Api.DataAccess.Persistence.Common;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||
|
||||
public class DisciplineDbContext(DbContextOptions<DisciplineDbContext> options) : DbContext(options), IDisciplineDbContext
|
||||
public sealed class DisciplineDbContext(DbContextOptions<DisciplineDbContext> options) : BaseDbContext<DisciplineDbContext>(options), IDisciplineDbContext
|
||||
{
|
||||
public DbSet<Discipline> Disciplines { get; set; } = null!;
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.ApplyConfiguration(new DisciplineConfiguration());
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
@ -1,17 +1,18 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
||||
using Mirea.Api.DataAccess.Domain.Schedule;
|
||||
using Mirea.Api.DataAccess.Persistence.EntityTypeConfigurations.Schedule;
|
||||
using Mirea.Api.DataAccess.Persistence.Common;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Mirea.Api.DataAccess.Persistence.Contexts.Schedule;
|
||||
|
||||
public class FacultyDbContext(DbContextOptions<FacultyDbContext> options) : DbContext(options), IFacultyDbContext
|
||||
public sealed class FacultyDbContext(DbContextOptions<FacultyDbContext> options) : BaseDbContext<FacultyDbContext>(options), IFacultyDbContext
|
||||
{
|
||||
public DbSet<Faculty> Faculties { get; set; } = null!;
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.ApplyConfiguration(new FacultyConfiguration());
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user