diff --git a/.gitignore b/.gitignore index b3a52364a..0ef329122 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ nbproject/ *.swp ## Build folders +Build/ build/ build_*/ install/ diff --git a/CodeCompass-fork.sln b/CodeCompass-fork.sln new file mode 100644 index 000000000..55deddb61 --- /dev/null +++ b/CodeCompass-fork.sln @@ -0,0 +1,96 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.2.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{07D57EEB-2F50-60C4-C011-FE4FA775C9A8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{DEE5DD87-39C1-BF34-B639-A387DCCF972B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "csharp", "csharp", "{FDECB3EA-C235-0ECE-9066-0767EFECF65B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service", "service", "{7D914C01-75FA-9E92-82D4-3C039136171A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src_csharp", "src_csharp", "{AF4D61C2-B71E-BE38-5950-782439CCE1D6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharpservice", "plugins\csharp\service\src_csharp\csharpservice.csproj", "{23D38B20-064C-A274-616B-A87E116A69E9}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "parser", "parser", "{F09082B5-68A8-D6A7-6A9C-0D853F4DF591}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src_csharp", "src_csharp", "{10CDF008-A431-7A23-2F79-7E7DC3CA6843}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpParser", "plugins\csharp\parser\src_csharp\CSharpParser.csproj", "{63BF2A37-8F5E-CBA4-1720-68324B8B5516}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{D2CF7D5B-42D7-6566-E13F-A0B3FA04C41C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "csharp", "csharp", "{37A8322D-A38C-0C2D-0DCC-F2B38490041F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service", "service", "{584C7E52-C9BD-1FDF-01F6-05F93628661B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src_csharp", "src_csharp", "{6E09C5FF-56B3-0BA1-5DB2-3B044FB72342}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gen-netstd", "Build\plugins\csharp\service\src_csharp\gen-netstd\gen-netstd.csproj", "{623C7EF0-7B76-A1DC-FA10-8A67D757C3AA}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "migrations", "migrations", "{4A738011-D202-4B48-9CAE-8B044943D997}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sqliteMigrations", "plugins\csharp\migrations\sqliteMigrations\sqliteMigrations.csproj", "{4709E553-FC92-44D2-85CC-A1EFE918F70B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pgsqlMigrations", "plugins\csharp\migrations\pgsqlMigrations\pgsqlMigrations.csproj", "{AB02187B-59AB-4E35-B1C8-B835F25B9692}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "db_model", "plugins\csharp\db_model\db_model.csproj", "{B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {23D38B20-064C-A274-616B-A87E116A69E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {23D38B20-064C-A274-616B-A87E116A69E9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {23D38B20-064C-A274-616B-A87E116A69E9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {23D38B20-064C-A274-616B-A87E116A69E9}.Release|Any CPU.Build.0 = Release|Any CPU + {63BF2A37-8F5E-CBA4-1720-68324B8B5516}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {63BF2A37-8F5E-CBA4-1720-68324B8B5516}.Debug|Any CPU.Build.0 = Debug|Any CPU + {63BF2A37-8F5E-CBA4-1720-68324B8B5516}.Release|Any CPU.ActiveCfg = Release|Any CPU + {63BF2A37-8F5E-CBA4-1720-68324B8B5516}.Release|Any CPU.Build.0 = Release|Any CPU + {623C7EF0-7B76-A1DC-FA10-8A67D757C3AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {623C7EF0-7B76-A1DC-FA10-8A67D757C3AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {623C7EF0-7B76-A1DC-FA10-8A67D757C3AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {623C7EF0-7B76-A1DC-FA10-8A67D757C3AA}.Release|Any CPU.Build.0 = Release|Any CPU + {4709E553-FC92-44D2-85CC-A1EFE918F70B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4709E553-FC92-44D2-85CC-A1EFE918F70B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4709E553-FC92-44D2-85CC-A1EFE918F70B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4709E553-FC92-44D2-85CC-A1EFE918F70B}.Release|Any CPU.Build.0 = Release|Any CPU + {AB02187B-59AB-4E35-B1C8-B835F25B9692}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AB02187B-59AB-4E35-B1C8-B835F25B9692}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AB02187B-59AB-4E35-B1C8-B835F25B9692}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AB02187B-59AB-4E35-B1C8-B835F25B9692}.Release|Any CPU.Build.0 = Release|Any CPU + {B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {FDECB3EA-C235-0ECE-9066-0767EFECF65B} = {07D57EEB-2F50-60C4-C011-FE4FA775C9A8} + {7D914C01-75FA-9E92-82D4-3C039136171A} = {FDECB3EA-C235-0ECE-9066-0767EFECF65B} + {AF4D61C2-B71E-BE38-5950-782439CCE1D6} = {7D914C01-75FA-9E92-82D4-3C039136171A} + {23D38B20-064C-A274-616B-A87E116A69E9} = {AF4D61C2-B71E-BE38-5950-782439CCE1D6} + {F09082B5-68A8-D6A7-6A9C-0D853F4DF591} = {FDECB3EA-C235-0ECE-9066-0767EFECF65B} + {10CDF008-A431-7A23-2F79-7E7DC3CA6843} = {F09082B5-68A8-D6A7-6A9C-0D853F4DF591} + {63BF2A37-8F5E-CBA4-1720-68324B8B5516} = {10CDF008-A431-7A23-2F79-7E7DC3CA6843} + {D2CF7D5B-42D7-6566-E13F-A0B3FA04C41C} = {DEE5DD87-39C1-BF34-B639-A387DCCF972B} + {37A8322D-A38C-0C2D-0DCC-F2B38490041F} = {D2CF7D5B-42D7-6566-E13F-A0B3FA04C41C} + {584C7E52-C9BD-1FDF-01F6-05F93628661B} = {37A8322D-A38C-0C2D-0DCC-F2B38490041F} + {6E09C5FF-56B3-0BA1-5DB2-3B044FB72342} = {584C7E52-C9BD-1FDF-01F6-05F93628661B} + {623C7EF0-7B76-A1DC-FA10-8A67D757C3AA} = {6E09C5FF-56B3-0BA1-5DB2-3B044FB72342} + {4A738011-D202-4B48-9CAE-8B044943D997} = {FDECB3EA-C235-0ECE-9066-0767EFECF65B} + {4709E553-FC92-44D2-85CC-A1EFE918F70B} = {4A738011-D202-4B48-9CAE-8B044943D997} + {AB02187B-59AB-4E35-B1C8-B835F25B9692} = {4A738011-D202-4B48-9CAE-8B044943D997} + {B9532E7A-2CB8-4DEC-A0DA-672AF7D054E6} = {FDECB3EA-C235-0ECE-9066-0767EFECF65B} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4DD4E593-045A-4D66-97E2-C34DF688864A} + EndGlobalSection +EndGlobal diff --git a/plugins/csharp/model/CsharpAstNode.cs b/plugins/csharp/db_model/CsharpAstNode.cs similarity index 92% rename from plugins/csharp/model/CsharpAstNode.cs rename to plugins/csharp/db_model/CsharpAstNode.cs index 182a2160e..5745a8543 100644 --- a/plugins/csharp/model/CsharpAstNode.cs +++ b/plugins/csharp/db_model/CsharpAstNode.cs @@ -2,9 +2,9 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; -namespace CSharpParser.model +namespace DbModel { - enum AstSymbolTypeEnum + public enum AstSymbolTypeEnum { Variable, Method, @@ -17,7 +17,7 @@ enum AstSymbolTypeEnum } - enum AstTypeEnum + public enum AstTypeEnum { Declaration, Definition, @@ -27,10 +27,10 @@ enum AstTypeEnum Expression } - class CsharpAstNode + public class CsharpAstNode { public ulong Id { get; set; } - public string AstValue { get; set; } + public string? AstValue { get; set; } public AstSymbolTypeEnum AstSymbolType { get; set; } public AstTypeEnum AstType { get; set; } public Accessibility Accessibility { get; set; } @@ -38,7 +38,7 @@ class CsharpAstNode public long Location_range_start_column { get; set; } public long Location_range_end_line { get; set; } public long Location_range_end_column { get; set; } - public string Path { get; set; } + public string? Path { get; set; } public long EntityHash { get; set; } public SyntaxKind RawKind { get; set; } //SyntaxKind Enum public void SetLocation(FileLinePositionSpan f) diff --git a/plugins/csharp/model/CsharpClass.cs b/plugins/csharp/db_model/CsharpClass.cs similarity index 50% rename from plugins/csharp/model/CsharpClass.cs rename to plugins/csharp/db_model/CsharpClass.cs index fa6642923..151a0d271 100644 --- a/plugins/csharp/model/CsharpClass.cs +++ b/plugins/csharp/db_model/CsharpClass.cs @@ -1,22 +1,22 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; -namespace CSharpParser.model +namespace DbModel { - enum ClassTypeEnum + public enum ClassTypeEnum { Class, Interface, Record } - class CsharpClass : CsharpEntity + public class CsharpClass : CsharpEntity { public ClassTypeEnum ClassType { get; set; } - public CsharpNamespace CsharpNamespace { get; set; } + public CsharpNamespace? CsharpNamespace { get; set; } } //[Table("csharp_structs")] - class CsharpStruct : CsharpEntity + public class CsharpStruct : CsharpEntity { - public CsharpNamespace CsharpNamespace { get; set; } + public CsharpNamespace? CsharpNamespace { get; set; } } } diff --git a/plugins/csharp/db_model/CsharpDbContext.cs b/plugins/csharp/db_model/CsharpDbContext.cs new file mode 100644 index 000000000..7c3ea5440 --- /dev/null +++ b/plugins/csharp/db_model/CsharpDbContext.cs @@ -0,0 +1,48 @@ +using System.Text; +using Microsoft.EntityFrameworkCore; + +namespace DbModel +{ + public class CsharpDbContext : DbContext + { + + private readonly string _dbSystem; + private readonly string _connectionString; + public CsharpDbContext(DbContextOptions options) : base(options) { } + + public CsharpDbContext(string dbSystem, string connectionString) : base() + { + _dbSystem = dbSystem; + _connectionString = connectionString; + } + + public DbSet CsharpAstNodes { get; set; } + public DbSet CsharpNamespaces { get; set; } + public DbSet CsharpClasses { get; set; } + public DbSet CsharpMethods { get; set; } + public DbSet CsharpVariables { get; set; } + public DbSet CsharpStructs { get; set; } + public DbSet CsharpEnums { get; set; } + public DbSet CsharpEnumMembers { get; set; } + public DbSet CsharpEtcEntitys { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + switch(_dbSystem) + { + case "pgsql": + optionsBuilder.UseNpgsql(_connectionString, + x => x.MigrationsAssembly("pgsqlMigrations")); + break; + case "sqlite": + optionsBuilder.UseSqlite(_connectionString, + x => x.MigrationsAssembly("sqliteMigrations")); + break; + default: + break; + } + } + + } + +} diff --git a/plugins/csharp/db_model/CsharpEntity.cs b/plugins/csharp/db_model/CsharpEntity.cs new file mode 100644 index 000000000..32e582099 --- /dev/null +++ b/plugins/csharp/db_model/CsharpEntity.cs @@ -0,0 +1,33 @@ +using System; + +namespace DbModel +{ + public class CsharpEntity + { + public long Id { get; set; } + public CsharpAstNode? AstNode { get; set; } + public CsharpAstNode? ParentNode{ get; set; } + public long EntityHash { get; set; } + public String? Name { get; set; } = " "; + public String? QualifiedName { get; set; } = " "; + public string? DocumentationCommentXML { get; set; } = " "; + } + + public class CsharpTypedEntity : CsharpEntity + { + public long TypeHash { get; set; } + public String? QualifiedType { get; set; } = " "; + } + + public enum EtcEntityTypeEnum + { + Event, + Invocation, + ForeachExpr + } + public class CsharpEtcEntity : CsharpTypedEntity + { + public EtcEntityTypeEnum EtcEntityType { get; set; } + public ulong DeclaratorNodeId { get; set; } + } +} diff --git a/plugins/csharp/model/CsharpEnum.cs b/plugins/csharp/db_model/CsharpEnum.cs similarity index 74% rename from plugins/csharp/model/CsharpEnum.cs rename to plugins/csharp/db_model/CsharpEnum.cs index 5597d05d8..72e9e8c41 100644 --- a/plugins/csharp/model/CsharpEnum.cs +++ b/plugins/csharp/db_model/CsharpEnum.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; -namespace CSharpParser.model +namespace DbModel { //[Table("csharp_enums")] - class CsharpEnum : CsharpEntity + public class CsharpEnum : CsharpEntity { - public CsharpNamespace CsharpNamespace { get; set; } + public CsharpNamespace? CsharpNamespace { get; set; } public HashSet CsharpEnumMembers { get; set; } = new HashSet(); public void AddMember(CsharpEnumMember member) diff --git a/plugins/csharp/model/CsharpEnumMember.cs b/plugins/csharp/db_model/CsharpEnumMember.cs similarity index 57% rename from plugins/csharp/model/CsharpEnumMember.cs rename to plugins/csharp/db_model/CsharpEnumMember.cs index 835147ea1..671fc64e1 100644 --- a/plugins/csharp/model/CsharpEnumMember.cs +++ b/plugins/csharp/db_model/CsharpEnumMember.cs @@ -1,10 +1,11 @@ using System.ComponentModel.DataAnnotations.Schema; -namespace CSharpParser.model +namespace DbModel { //[Table("csharp_enum_members")] - class CsharpEnumMember : CsharpEntity + public class CsharpEnumMember : CsharpEntity { public int EqualsValue { get; set; } + public long? CsharpEnumId { get; set; } } } diff --git a/plugins/csharp/model/CsharpMethod.cs b/plugins/csharp/db_model/CsharpMethod.cs similarity index 70% rename from plugins/csharp/model/CsharpMethod.cs rename to plugins/csharp/db_model/CsharpMethod.cs index 087053af3..985164b8b 100644 --- a/plugins/csharp/model/CsharpMethod.cs +++ b/plugins/csharp/db_model/CsharpMethod.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -namespace CSharpParser.model +namespace DbModel { - enum MethodTypeEnum + public enum MethodTypeEnum { Delegate, Accessor, @@ -12,7 +12,7 @@ enum MethodTypeEnum Operator } - class CsharpMethod : CsharpTypedEntity + public class CsharpMethod : CsharpTypedEntity { public MethodTypeEnum MethodType { get; set; } } diff --git a/plugins/csharp/model/CsharpNamespace.cs b/plugins/csharp/db_model/CsharpNamespace.cs similarity index 66% rename from plugins/csharp/model/CsharpNamespace.cs rename to plugins/csharp/db_model/CsharpNamespace.cs index 8b4cdc4fd..8fe4b1f9d 100644 --- a/plugins/csharp/model/CsharpNamespace.cs +++ b/plugins/csharp/db_model/CsharpNamespace.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; -namespace CSharpParser.model +namespace DbModel { //[Table("csharp_namespaces")] - class CsharpNamespace : CsharpEntity + public class CsharpNamespace : CsharpEntity { } diff --git a/plugins/csharp/model/CsharpVariable.cs b/plugins/csharp/db_model/CsharpVariable.cs similarity index 71% rename from plugins/csharp/model/CsharpVariable.cs rename to plugins/csharp/db_model/CsharpVariable.cs index 9b3a7b1e3..261c1c7d0 100644 --- a/plugins/csharp/model/CsharpVariable.cs +++ b/plugins/csharp/db_model/CsharpVariable.cs @@ -1,16 +1,16 @@ using System.ComponentModel.DataAnnotations.Schema; using Microsoft.CodeAnalysis.CSharp.Syntax; -namespace CSharpParser.model +namespace DbModel { - enum VariableTypeEnum + public enum VariableTypeEnum { Property, LINQ, Parameter, Variable } - class CsharpVariable : CsharpTypedEntity + public class CsharpVariable : CsharpTypedEntity { public VariableTypeEnum VariableType { get; set; } } diff --git a/plugins/csharp/db_model/DbModel.csproj b/plugins/csharp/db_model/DbModel.csproj new file mode 100644 index 000000000..834842cd8 --- /dev/null +++ b/plugins/csharp/db_model/DbModel.csproj @@ -0,0 +1,27 @@ + + + + net8.0 + enable + enable + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/plugins/csharp/migrations/20220518134047_Initial.Designer.cs b/plugins/csharp/migrations/20220518134047_Initial.Designer.cs deleted file mode 100644 index 0a7707b34..000000000 --- a/plugins/csharp/migrations/20220518134047_Initial.Designer.cs +++ /dev/null @@ -1,545 +0,0 @@ -// -using System; -using CSharpParser.model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace CSharpParser.Migrations -{ - [DbContext(typeof(CsharpDbContext))] - [Migration("20220518134047_Initial")] - partial class Initial - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 63) - .HasAnnotation("ProductVersion", "5.0.10") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - modelBuilder.Entity("CSharpParser.model.CsharpAstNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("numeric(20,0)"); - - b.Property("Accessibility") - .HasColumnType("integer"); - - b.Property("AstSymbolType") - .HasColumnType("integer"); - - b.Property("AstType") - .HasColumnType("integer"); - - b.Property("AstValue") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Location_range_end_column") - .HasColumnType("bigint"); - - b.Property("Location_range_end_line") - .HasColumnType("bigint"); - - b.Property("Location_range_start_column") - .HasColumnType("bigint"); - - b.Property("Location_range_start_line") - .HasColumnType("bigint"); - - b.Property("Path") - .HasColumnType("text"); - - b.Property("RawKind") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("CsharpAstNodes"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpClass", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("ClassType") - .HasColumnType("integer"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpClasses"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEnums"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpEnumId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("EqualsValue") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpEnumId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEnumMembers"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DeclaratorNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("EtcEntityType") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEtcEntitys"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("MethodType") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpMethods"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpNamespaces"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpStructs"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.Property("VariableType") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpVariables"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpClass", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpEnum", null) - .WithMany("CsharpEnumMembers") - .HasForeignKey("CsharpEnumId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.Navigation("CsharpEnumMembers"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/plugins/csharp/migrations/20220518134047_Initial.cs b/plugins/csharp/migrations/20220518134047_Initial.cs deleted file mode 100644 index e643a7a6a..000000000 --- a/plugins/csharp/migrations/20220518134047_Initial.cs +++ /dev/null @@ -1,443 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace CSharpParser.Migrations -{ - public partial class Initial : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "CsharpAstNodes", - columns: table => new - { - Id = table.Column(type: "numeric(20,0)", nullable: false), - AstValue = table.Column(type: "text", nullable: true), - AstSymbolType = table.Column(type: "integer", nullable: false), - AstType = table.Column(type: "integer", nullable: false), - Accessibility = table.Column(type: "integer", nullable: false), - Location_range_start_line = table.Column(type: "bigint", nullable: false), - Location_range_start_column = table.Column(type: "bigint", nullable: false), - Location_range_end_line = table.Column(type: "bigint", nullable: false), - Location_range_end_column = table.Column(type: "bigint", nullable: false), - Path = table.Column(type: "text", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - RawKind = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpAstNodes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "CsharpEtcEntitys", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EtcEntityType = table.Column(type: "integer", nullable: false), - DeclaratorNodeId = table.Column(type: "numeric(20,0)", nullable: false), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true), - TypeHash = table.Column(type: "bigint", nullable: false), - QualifiedType = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpEtcEntitys", x => x.Id); - table.ForeignKey( - name: "FK_CsharpEtcEntitys_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpEtcEntitys_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpMethods", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - MethodType = table.Column(type: "integer", nullable: false), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true), - TypeHash = table.Column(type: "bigint", nullable: false), - QualifiedType = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpMethods", x => x.Id); - table.ForeignKey( - name: "FK_CsharpMethods_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpMethods_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpNamespaces", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpNamespaces", x => x.Id); - table.ForeignKey( - name: "FK_CsharpNamespaces_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpNamespaces_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpVariables", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - VariableType = table.Column(type: "integer", nullable: false), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true), - TypeHash = table.Column(type: "bigint", nullable: false), - QualifiedType = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpVariables", x => x.Id); - table.ForeignKey( - name: "FK_CsharpVariables_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpVariables_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpClasses", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ClassType = table.Column(type: "integer", nullable: false), - CsharpNamespaceId = table.Column(type: "bigint", nullable: true), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpClasses", x => x.Id); - table.ForeignKey( - name: "FK_CsharpClasses_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpClasses_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpClasses_CsharpNamespaces_CsharpNamespaceId", - column: x => x.CsharpNamespaceId, - principalTable: "CsharpNamespaces", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpEnums", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - CsharpNamespaceId = table.Column(type: "bigint", nullable: true), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpEnums", x => x.Id); - table.ForeignKey( - name: "FK_CsharpEnums_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpEnums_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpEnums_CsharpNamespaces_CsharpNamespaceId", - column: x => x.CsharpNamespaceId, - principalTable: "CsharpNamespaces", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpStructs", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - CsharpNamespaceId = table.Column(type: "bigint", nullable: true), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpStructs", x => x.Id); - table.ForeignKey( - name: "FK_CsharpStructs_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpStructs_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpStructs_CsharpNamespaces_CsharpNamespaceId", - column: x => x.CsharpNamespaceId, - principalTable: "CsharpNamespaces", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "CsharpEnumMembers", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - EqualsValue = table.Column(type: "integer", nullable: false), - CsharpEnumId = table.Column(type: "bigint", nullable: true), - AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), - ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), - EntityHash = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - QualifiedName = table.Column(type: "text", nullable: true), - DocumentationCommentXML = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CsharpEnumMembers", x => x.Id); - table.ForeignKey( - name: "FK_CsharpEnumMembers_CsharpAstNodes_AstNodeId", - column: x => x.AstNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpEnumMembers_CsharpAstNodes_ParentNodeId", - column: x => x.ParentNodeId, - principalTable: "CsharpAstNodes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_CsharpEnumMembers_CsharpEnums_CsharpEnumId", - column: x => x.CsharpEnumId, - principalTable: "CsharpEnums", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_CsharpClasses_AstNodeId", - table: "CsharpClasses", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpClasses_CsharpNamespaceId", - table: "CsharpClasses", - column: "CsharpNamespaceId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpClasses_ParentNodeId", - table: "CsharpClasses", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnumMembers_AstNodeId", - table: "CsharpEnumMembers", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnumMembers_CsharpEnumId", - table: "CsharpEnumMembers", - column: "CsharpEnumId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnumMembers_ParentNodeId", - table: "CsharpEnumMembers", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnums_AstNodeId", - table: "CsharpEnums", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnums_CsharpNamespaceId", - table: "CsharpEnums", - column: "CsharpNamespaceId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEnums_ParentNodeId", - table: "CsharpEnums", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEtcEntitys_AstNodeId", - table: "CsharpEtcEntitys", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpEtcEntitys_ParentNodeId", - table: "CsharpEtcEntitys", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpMethods_AstNodeId", - table: "CsharpMethods", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpMethods_ParentNodeId", - table: "CsharpMethods", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpNamespaces_AstNodeId", - table: "CsharpNamespaces", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpNamespaces_ParentNodeId", - table: "CsharpNamespaces", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpStructs_AstNodeId", - table: "CsharpStructs", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpStructs_CsharpNamespaceId", - table: "CsharpStructs", - column: "CsharpNamespaceId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpStructs_ParentNodeId", - table: "CsharpStructs", - column: "ParentNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpVariables_AstNodeId", - table: "CsharpVariables", - column: "AstNodeId"); - - migrationBuilder.CreateIndex( - name: "IX_CsharpVariables_ParentNodeId", - table: "CsharpVariables", - column: "ParentNodeId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "CsharpClasses"); - - migrationBuilder.DropTable( - name: "CsharpEnumMembers"); - - migrationBuilder.DropTable( - name: "CsharpEtcEntitys"); - - migrationBuilder.DropTable( - name: "CsharpMethods"); - - migrationBuilder.DropTable( - name: "CsharpStructs"); - - migrationBuilder.DropTable( - name: "CsharpVariables"); - - migrationBuilder.DropTable( - name: "CsharpEnums"); - - migrationBuilder.DropTable( - name: "CsharpNamespaces"); - - migrationBuilder.DropTable( - name: "CsharpAstNodes"); - } - } -} diff --git a/plugins/csharp/migrations/CsharpDbContextModelSnapshot.cs b/plugins/csharp/migrations/CsharpDbContextModelSnapshot.cs deleted file mode 100644 index 20ebbc516..000000000 --- a/plugins/csharp/migrations/CsharpDbContextModelSnapshot.cs +++ /dev/null @@ -1,543 +0,0 @@ -// -using System; -using CSharpParser.model; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace CSharpParser.Migrations -{ - [DbContext(typeof(CsharpDbContext))] - partial class CsharpDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 63) - .HasAnnotation("ProductVersion", "5.0.10") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - modelBuilder.Entity("CSharpParser.model.CsharpAstNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("numeric(20,0)"); - - b.Property("Accessibility") - .HasColumnType("integer"); - - b.Property("AstSymbolType") - .HasColumnType("integer"); - - b.Property("AstType") - .HasColumnType("integer"); - - b.Property("AstValue") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Location_range_end_column") - .HasColumnType("bigint"); - - b.Property("Location_range_end_line") - .HasColumnType("bigint"); - - b.Property("Location_range_start_column") - .HasColumnType("bigint"); - - b.Property("Location_range_start_line") - .HasColumnType("bigint"); - - b.Property("Path") - .HasColumnType("text"); - - b.Property("RawKind") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("CsharpAstNodes"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpClass", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("ClassType") - .HasColumnType("integer"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpClasses"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEnums"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpEnumId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("EqualsValue") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpEnumId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEnumMembers"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DeclaratorNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("EtcEntityType") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpEtcEntitys"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("MethodType") - .HasColumnType("integer"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpMethods"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpNamespaces"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("CsharpNamespaceId") - .HasColumnType("bigint"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("CsharpNamespaceId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpStructs"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AstNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("DocumentationCommentXML") - .HasColumnType("text"); - - b.Property("EntityHash") - .HasColumnType("bigint"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ParentNodeId") - .HasColumnType("numeric(20,0)"); - - b.Property("QualifiedName") - .HasColumnType("text"); - - b.Property("QualifiedType") - .HasColumnType("text"); - - b.Property("TypeHash") - .HasColumnType("bigint"); - - b.Property("VariableType") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("AstNodeId"); - - b.HasIndex("ParentNodeId"); - - b.ToTable("CsharpVariables"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpClass", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpEnum", null) - .WithMany("CsharpEnumMembers") - .HasForeignKey("CsharpEnumId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") - .WithMany() - .HasForeignKey("CsharpNamespaceId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("CsharpNamespace"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => - { - b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") - .WithMany() - .HasForeignKey("AstNodeId"); - - b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") - .WithMany() - .HasForeignKey("ParentNodeId"); - - b.Navigation("AstNode"); - - b.Navigation("ParentNode"); - }); - - modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => - { - b.Navigation("CsharpEnumMembers"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/plugins/csharp/migrations/pgsqlMigrations/20220518134047_Initial.Designer.cs b/plugins/csharp/migrations/pgsqlMigrations/20220518134047_Initial.Designer.cs new file mode 100644 index 000000000..1386f64c3 --- /dev/null +++ b/plugins/csharp/migrations/pgsqlMigrations/20220518134047_Initial.Designer.cs @@ -0,0 +1,546 @@ +// +using System; +using DbModel; +// using CSharpParser.model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Migrations.PgsqlMigrations +{ + [DbContext(typeof(CsharpDbContext))] + [Migration("20220518134047_Initial")] + partial class Initial + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.10") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("CSharpParser.model.CsharpAstNode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("numeric(20,0)"); + + b.Property("Accessibility") + .HasColumnType("integer"); + + b.Property("AstSymbolType") + .HasColumnType("integer"); + + b.Property("AstType") + .HasColumnType("integer"); + + b.Property("AstValue") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Location_range_end_column") + .HasColumnType("bigint"); + + b.Property("Location_range_end_line") + .HasColumnType("bigint"); + + b.Property("Location_range_start_column") + .HasColumnType("bigint"); + + b.Property("Location_range_start_line") + .HasColumnType("bigint"); + + b.Property("Path") + .HasColumnType("text"); + + b.Property("RawKind") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("CsharpAstNodes"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpClass", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("ClassType") + .HasColumnType("integer"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpClasses"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnums"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpEnumId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("EqualsValue") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpEnumId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnumMembers"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DeclaratorNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("EtcEntityType") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEtcEntitys"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("MethodType") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpMethods"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpNamespaces"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpStructs"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.Property("VariableType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpVariables"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpClass", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpEnum", null) + .WithMany("CsharpEnumMembers") + .HasForeignKey("CsharpEnumId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.Navigation("CsharpEnumMembers"); + }); +#pragma warning restore 612, 618 + } + } +} \ No newline at end of file diff --git a/plugins/csharp/migrations/pgsqlMigrations/20220518134047_Initial.cs b/plugins/csharp/migrations/pgsqlMigrations/20220518134047_Initial.cs new file mode 100644 index 000000000..72de7b274 --- /dev/null +++ b/plugins/csharp/migrations/pgsqlMigrations/20220518134047_Initial.cs @@ -0,0 +1,443 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Migrations.PgsqlMigrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "CsharpAstNodes", + columns: table => new + { + Id = table.Column(type: "numeric(20,0)", nullable: false), + AstValue = table.Column(type: "text", nullable: true), + AstSymbolType = table.Column(type: "integer", nullable: false), + AstType = table.Column(type: "integer", nullable: false), + Accessibility = table.Column(type: "integer", nullable: false), + Location_range_start_line = table.Column(type: "bigint", nullable: false), + Location_range_start_column = table.Column(type: "bigint", nullable: false), + Location_range_end_line = table.Column(type: "bigint", nullable: false), + Location_range_end_column = table.Column(type: "bigint", nullable: false), + Path = table.Column(type: "text", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + RawKind = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpAstNodes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CsharpEtcEntitys", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + EtcEntityType = table.Column(type: "integer", nullable: false), + DeclaratorNodeId = table.Column(type: "numeric(20,0)", nullable: false), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true), + TypeHash = table.Column(type: "bigint", nullable: false), + QualifiedType = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEtcEntitys", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEtcEntitys_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpEtcEntitys_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpMethods", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MethodType = table.Column(type: "integer", nullable: false), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true), + TypeHash = table.Column(type: "bigint", nullable: false), + QualifiedType = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpMethods", x => x.Id); + table.ForeignKey( + name: "FK_CsharpMethods_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpMethods_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpNamespaces", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpNamespaces", x => x.Id); + table.ForeignKey( + name: "FK_CsharpNamespaces_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpNamespaces_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpVariables", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + VariableType = table.Column(type: "integer", nullable: false), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true), + TypeHash = table.Column(type: "bigint", nullable: false), + QualifiedType = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpVariables", x => x.Id); + table.ForeignKey( + name: "FK_CsharpVariables_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpVariables_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpClasses", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ClassType = table.Column(type: "integer", nullable: false), + CsharpNamespaceId = table.Column(type: "bigint", nullable: true), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpClasses", x => x.Id); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpEnums", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CsharpNamespaceId = table.Column(type: "bigint", nullable: true), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEnums", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpStructs", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CsharpNamespaceId = table.Column(type: "bigint", nullable: true), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpStructs", x => x.Id); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CsharpEnumMembers", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + EqualsValue = table.Column(type: "integer", nullable: false), + CsharpEnumId = table.Column(type: "bigint", nullable: true), + AstNodeId = table.Column(type: "numeric(20,0)", nullable: true), + ParentNodeId = table.Column(type: "numeric(20,0)", nullable: true), + EntityHash = table.Column(type: "bigint", nullable: false), + Name = table.Column(type: "text", nullable: true), + QualifiedName = table.Column(type: "text", nullable: true), + DocumentationCommentXML = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEnumMembers", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpEnums_CsharpEnumId", + column: x => x.CsharpEnumId, + principalTable: "CsharpEnums", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_AstNodeId", + table: "CsharpClasses", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_CsharpNamespaceId", + table: "CsharpClasses", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_ParentNodeId", + table: "CsharpClasses", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_AstNodeId", + table: "CsharpEnumMembers", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_CsharpEnumId", + table: "CsharpEnumMembers", + column: "CsharpEnumId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_ParentNodeId", + table: "CsharpEnumMembers", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_AstNodeId", + table: "CsharpEnums", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_CsharpNamespaceId", + table: "CsharpEnums", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_ParentNodeId", + table: "CsharpEnums", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEtcEntitys_AstNodeId", + table: "CsharpEtcEntitys", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEtcEntitys_ParentNodeId", + table: "CsharpEtcEntitys", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpMethods_AstNodeId", + table: "CsharpMethods", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpMethods_ParentNodeId", + table: "CsharpMethods", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpNamespaces_AstNodeId", + table: "CsharpNamespaces", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpNamespaces_ParentNodeId", + table: "CsharpNamespaces", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_AstNodeId", + table: "CsharpStructs", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_CsharpNamespaceId", + table: "CsharpStructs", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_ParentNodeId", + table: "CsharpStructs", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpVariables_AstNodeId", + table: "CsharpVariables", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpVariables_ParentNodeId", + table: "CsharpVariables", + column: "ParentNodeId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CsharpClasses"); + + migrationBuilder.DropTable( + name: "CsharpEnumMembers"); + + migrationBuilder.DropTable( + name: "CsharpEtcEntitys"); + + migrationBuilder.DropTable( + name: "CsharpMethods"); + + migrationBuilder.DropTable( + name: "CsharpStructs"); + + migrationBuilder.DropTable( + name: "CsharpVariables"); + + migrationBuilder.DropTable( + name: "CsharpEnums"); + + migrationBuilder.DropTable( + name: "CsharpNamespaces"); + + migrationBuilder.DropTable( + name: "CsharpAstNodes"); + } + } +} \ No newline at end of file diff --git a/plugins/csharp/migrations/pgsqlMigrations/CsharpDbContextModelSnapshot.cs b/plugins/csharp/migrations/pgsqlMigrations/CsharpDbContextModelSnapshot.cs new file mode 100644 index 000000000..dcb5316a0 --- /dev/null +++ b/plugins/csharp/migrations/pgsqlMigrations/CsharpDbContextModelSnapshot.cs @@ -0,0 +1,544 @@ +// +using System; +using DbModel; +// using CSharpParser.model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Migrations.PgsqlMigrations +{ + [DbContext(typeof(CsharpDbContext))] + partial class CsharpDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.10") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("CSharpParser.model.CsharpAstNode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("numeric(20,0)"); + + b.Property("Accessibility") + .HasColumnType("integer"); + + b.Property("AstSymbolType") + .HasColumnType("integer"); + + b.Property("AstType") + .HasColumnType("integer"); + + b.Property("AstValue") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Location_range_end_column") + .HasColumnType("bigint"); + + b.Property("Location_range_end_line") + .HasColumnType("bigint"); + + b.Property("Location_range_start_column") + .HasColumnType("bigint"); + + b.Property("Location_range_start_line") + .HasColumnType("bigint"); + + b.Property("Path") + .HasColumnType("text"); + + b.Property("RawKind") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("CsharpAstNodes"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpClass", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("ClassType") + .HasColumnType("integer"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpClasses"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnums"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpEnumId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("EqualsValue") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpEnumId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnumMembers"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DeclaratorNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("EtcEntityType") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEtcEntitys"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("MethodType") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpMethods"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpNamespaces"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("CsharpNamespaceId") + .HasColumnType("bigint"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpStructs"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AstNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("DocumentationCommentXML") + .HasColumnType("text"); + + b.Property("EntityHash") + .HasColumnType("bigint"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentNodeId") + .HasColumnType("numeric(20,0)"); + + b.Property("QualifiedName") + .HasColumnType("text"); + + b.Property("QualifiedType") + .HasColumnType("text"); + + b.Property("TypeHash") + .HasColumnType("bigint"); + + b.Property("VariableType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpVariables"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpClass", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpEnum", null) + .WithMany("CsharpEnumMembers") + .HasForeignKey("CsharpEnumId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.Navigation("CsharpEnumMembers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/plugins/csharp/migrations/pgsqlMigrations/PgsqlMigrations.csproj b/plugins/csharp/migrations/pgsqlMigrations/PgsqlMigrations.csproj new file mode 100644 index 000000000..68adb5839 --- /dev/null +++ b/plugins/csharp/migrations/pgsqlMigrations/PgsqlMigrations.csproj @@ -0,0 +1,21 @@ + + + + net8.0 + enable + enable + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/plugins/csharp/migrations/sqliteMigrations/20260302184000_Initial.Designer.cs b/plugins/csharp/migrations/sqliteMigrations/20260302184000_Initial.Designer.cs new file mode 100644 index 000000000..b81f4d0be --- /dev/null +++ b/plugins/csharp/migrations/sqliteMigrations/20260302184000_Initial.Designer.cs @@ -0,0 +1,537 @@ +// +using System; +using DbModel; +//using CSharpParser.model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Migrations.SqliteMigrations +{ + [DbContext(typeof(CsharpDbContext))] + [Migration("20260302184000_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.20"); + + modelBuilder.Entity("CSharpParser.model.CsharpAstNode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Accessibility") + .HasColumnType("INTEGER"); + + b.Property("AstSymbolType") + .HasColumnType("INTEGER"); + + b.Property("AstType") + .HasColumnType("INTEGER"); + + b.Property("AstValue") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Location_range_end_column") + .HasColumnType("INTEGER"); + + b.Property("Location_range_end_line") + .HasColumnType("INTEGER"); + + b.Property("Location_range_start_column") + .HasColumnType("INTEGER"); + + b.Property("Location_range_start_line") + .HasColumnType("INTEGER"); + + b.Property("Path") + .HasColumnType("TEXT"); + + b.Property("RawKind") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("CsharpAstNodes"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpClass", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("ClassType") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpClasses"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnums"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpEnumId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("EqualsValue") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpEnumId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnumMembers"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DeclaratorNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("EtcEntityType") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEtcEntitys"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("MethodType") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpMethods"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpNamespaces"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpStructs"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.Property("VariableType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpVariables"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpClass", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpEnum", null) + .WithMany("CsharpEnumMembers") + .HasForeignKey("CsharpEnumId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.Navigation("CsharpEnumMembers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/plugins/csharp/migrations/sqliteMigrations/20260302184000_Initial.cs b/plugins/csharp/migrations/sqliteMigrations/20260302184000_Initial.cs new file mode 100644 index 000000000..93c3620df --- /dev/null +++ b/plugins/csharp/migrations/sqliteMigrations/20260302184000_Initial.cs @@ -0,0 +1,428 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Migrations.SqliteMigrations +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "CsharpAstNodes", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AstValue = table.Column(type: "TEXT", nullable: true), + AstSymbolType = table.Column(type: "INTEGER", nullable: false), + AstType = table.Column(type: "INTEGER", nullable: false), + Accessibility = table.Column(type: "INTEGER", nullable: false), + Location_range_start_line = table.Column(type: "INTEGER", nullable: false), + Location_range_start_column = table.Column(type: "INTEGER", nullable: false), + Location_range_end_line = table.Column(type: "INTEGER", nullable: false), + Location_range_end_column = table.Column(type: "INTEGER", nullable: false), + Path = table.Column(type: "TEXT", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + RawKind = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpAstNodes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CsharpEtcEntitys", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + EtcEntityType = table.Column(type: "INTEGER", nullable: false), + DeclaratorNodeId = table.Column(type: "INTEGER", nullable: false), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true), + TypeHash = table.Column(type: "INTEGER", nullable: false), + QualifiedType = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEtcEntitys", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEtcEntitys_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpEtcEntitys_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpMethods", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + MethodType = table.Column(type: "INTEGER", nullable: false), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true), + TypeHash = table.Column(type: "INTEGER", nullable: false), + QualifiedType = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpMethods", x => x.Id); + table.ForeignKey( + name: "FK_CsharpMethods_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpMethods_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpNamespaces", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpNamespaces", x => x.Id); + table.ForeignKey( + name: "FK_CsharpNamespaces_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpNamespaces_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpVariables", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VariableType = table.Column(type: "INTEGER", nullable: false), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true), + TypeHash = table.Column(type: "INTEGER", nullable: false), + QualifiedType = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpVariables", x => x.Id); + table.ForeignKey( + name: "FK_CsharpVariables_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpVariables_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpClasses", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ClassType = table.Column(type: "INTEGER", nullable: false), + CsharpNamespaceId = table.Column(type: "INTEGER", nullable: true), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpClasses", x => x.Id); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpClasses_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpEnums", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CsharpNamespaceId = table.Column(type: "INTEGER", nullable: true), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEnums", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpEnums_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpStructs", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CsharpNamespaceId = table.Column(type: "INTEGER", nullable: true), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpStructs", x => x.Id); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpStructs_CsharpNamespaces_CsharpNamespaceId", + column: x => x.CsharpNamespaceId, + principalTable: "CsharpNamespaces", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "CsharpEnumMembers", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + EqualsValue = table.Column(type: "INTEGER", nullable: false), + CsharpEnumId = table.Column(type: "INTEGER", nullable: true), + AstNodeId = table.Column(type: "INTEGER", nullable: true), + ParentNodeId = table.Column(type: "INTEGER", nullable: true), + EntityHash = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + QualifiedName = table.Column(type: "TEXT", nullable: true), + DocumentationCommentXML = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CsharpEnumMembers", x => x.Id); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpAstNodes_AstNodeId", + column: x => x.AstNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpAstNodes_ParentNodeId", + column: x => x.ParentNodeId, + principalTable: "CsharpAstNodes", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CsharpEnumMembers_CsharpEnums_CsharpEnumId", + column: x => x.CsharpEnumId, + principalTable: "CsharpEnums", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_AstNodeId", + table: "CsharpClasses", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_CsharpNamespaceId", + table: "CsharpClasses", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpClasses_ParentNodeId", + table: "CsharpClasses", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_AstNodeId", + table: "CsharpEnumMembers", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_CsharpEnumId", + table: "CsharpEnumMembers", + column: "CsharpEnumId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnumMembers_ParentNodeId", + table: "CsharpEnumMembers", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_AstNodeId", + table: "CsharpEnums", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_CsharpNamespaceId", + table: "CsharpEnums", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEnums_ParentNodeId", + table: "CsharpEnums", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEtcEntitys_AstNodeId", + table: "CsharpEtcEntitys", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpEtcEntitys_ParentNodeId", + table: "CsharpEtcEntitys", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpMethods_AstNodeId", + table: "CsharpMethods", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpMethods_ParentNodeId", + table: "CsharpMethods", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpNamespaces_AstNodeId", + table: "CsharpNamespaces", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpNamespaces_ParentNodeId", + table: "CsharpNamespaces", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_AstNodeId", + table: "CsharpStructs", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_CsharpNamespaceId", + table: "CsharpStructs", + column: "CsharpNamespaceId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpStructs_ParentNodeId", + table: "CsharpStructs", + column: "ParentNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpVariables_AstNodeId", + table: "CsharpVariables", + column: "AstNodeId"); + + migrationBuilder.CreateIndex( + name: "IX_CsharpVariables_ParentNodeId", + table: "CsharpVariables", + column: "ParentNodeId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CsharpClasses"); + + migrationBuilder.DropTable( + name: "CsharpEnumMembers"); + + migrationBuilder.DropTable( + name: "CsharpEtcEntitys"); + + migrationBuilder.DropTable( + name: "CsharpMethods"); + + migrationBuilder.DropTable( + name: "CsharpStructs"); + + migrationBuilder.DropTable( + name: "CsharpVariables"); + + migrationBuilder.DropTable( + name: "CsharpEnums"); + + migrationBuilder.DropTable( + name: "CsharpNamespaces"); + + migrationBuilder.DropTable( + name: "CsharpAstNodes"); + } + } +} diff --git a/plugins/csharp/migrations/sqliteMigrations/SqliteDbContextModelSnapshot.cs b/plugins/csharp/migrations/sqliteMigrations/SqliteDbContextModelSnapshot.cs new file mode 100644 index 000000000..89a74e7ce --- /dev/null +++ b/plugins/csharp/migrations/sqliteMigrations/SqliteDbContextModelSnapshot.cs @@ -0,0 +1,534 @@ +// +using System; +using DbModel; +//using CSharpParser.model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Migrations.SqliteMigrations +{ + [DbContext(typeof(CsharpDbContext))] + partial class SqliteDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.20"); + + modelBuilder.Entity("CSharpParser.model.CsharpAstNode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Accessibility") + .HasColumnType("INTEGER"); + + b.Property("AstSymbolType") + .HasColumnType("INTEGER"); + + b.Property("AstType") + .HasColumnType("INTEGER"); + + b.Property("AstValue") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Location_range_end_column") + .HasColumnType("INTEGER"); + + b.Property("Location_range_end_line") + .HasColumnType("INTEGER"); + + b.Property("Location_range_start_column") + .HasColumnType("INTEGER"); + + b.Property("Location_range_start_line") + .HasColumnType("INTEGER"); + + b.Property("Path") + .HasColumnType("TEXT"); + + b.Property("RawKind") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("CsharpAstNodes"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpClass", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("ClassType") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpClasses"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnums"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpEnumId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("EqualsValue") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpEnumId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEnumMembers"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DeclaratorNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("EtcEntityType") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpEtcEntitys"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("MethodType") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpMethods"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpNamespaces"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("CsharpNamespaceId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("CsharpNamespaceId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpStructs"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AstNodeId") + .HasColumnType("INTEGER"); + + b.Property("DocumentationCommentXML") + .HasColumnType("TEXT"); + + b.Property("EntityHash") + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("ParentNodeId") + .HasColumnType("INTEGER"); + + b.Property("QualifiedName") + .HasColumnType("TEXT"); + + b.Property("QualifiedType") + .HasColumnType("TEXT"); + + b.Property("TypeHash") + .HasColumnType("INTEGER"); + + b.Property("VariableType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AstNodeId"); + + b.HasIndex("ParentNodeId"); + + b.ToTable("CsharpVariables"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpClass", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnumMember", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpEnum", null) + .WithMany("CsharpEnumMembers") + .HasForeignKey("CsharpEnumId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEtcEntity", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpMethod", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpNamespace", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpStruct", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpNamespace", "CsharpNamespace") + .WithMany() + .HasForeignKey("CsharpNamespaceId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("CsharpNamespace"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpVariable", b => + { + b.HasOne("CSharpParser.model.CsharpAstNode", "AstNode") + .WithMany() + .HasForeignKey("AstNodeId"); + + b.HasOne("CSharpParser.model.CsharpAstNode", "ParentNode") + .WithMany() + .HasForeignKey("ParentNodeId"); + + b.Navigation("AstNode"); + + b.Navigation("ParentNode"); + }); + + modelBuilder.Entity("CSharpParser.model.CsharpEnum", b => + { + b.Navigation("CsharpEnumMembers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/plugins/csharp/migrations/sqliteMigrations/SqliteMigrations.csproj b/plugins/csharp/migrations/sqliteMigrations/SqliteMigrations.csproj new file mode 100644 index 000000000..049d81468 --- /dev/null +++ b/plugins/csharp/migrations/sqliteMigrations/SqliteMigrations.csproj @@ -0,0 +1,21 @@ + + + + net8.0 + enable + enable + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/plugins/csharp/model/CsharpDbContext.cs b/plugins/csharp/model/CsharpDbContext.cs deleted file mode 100644 index eaef779d1..000000000 --- a/plugins/csharp/model/CsharpDbContext.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Text; -using Microsoft.EntityFrameworkCore; - -namespace CSharpParser.model -{ - class CsharpDbContext : DbContext - { - public CsharpDbContext(DbContextOptions options) : base(options) { } - - public DbSet CsharpAstNodes { get; set; } - public DbSet CsharpNamespaces { get; set; } - public DbSet CsharpClasses { get; set; } - public DbSet CsharpMethods { get; set; } - public DbSet CsharpVariables { get; set; } - public DbSet CsharpStructs { get; set; } - public DbSet CsharpEnums { get; set; } - public DbSet CsharpEnumMembers { get; set; } - public DbSet CsharpEtcEntitys { get; set; } - - - } - -} diff --git a/plugins/csharp/model/CsharpEntity.cs b/plugins/csharp/model/CsharpEntity.cs deleted file mode 100644 index c7c85b7c7..000000000 --- a/plugins/csharp/model/CsharpEntity.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; - -namespace CSharpParser.model -{ - class CsharpEntity - { - public long Id { get; set; } - public CsharpAstNode AstNode { get; set; } - public CsharpAstNode ParentNode{ get; set; } - public long EntityHash { get; set; } - public String Name { get; set; } = " "; - public String QualifiedName { get; set; } = " "; - public string DocumentationCommentXML { get; set; } = " "; - } - - class CsharpTypedEntity : CsharpEntity - { - public long TypeHash { get; set; } - public String QualifiedType { get; set; } = " "; - } - - enum EtcEntityTypeEnum - { - Event, - Invocation, - ForeachExpr - } - class CsharpEtcEntity : CsharpTypedEntity - { - public EtcEntityTypeEnum EtcEntityType { get; set; } - public ulong DeclaratorNodeId { get; set; } - } -} diff --git a/plugins/csharp/parser/src_csharp/AstVisitor.cs b/plugins/csharp/parser/src_csharp/AstVisitor.cs index 722804bf9..15b0aa1e8 100644 --- a/plugins/csharp/parser/src_csharp/AstVisitor.cs +++ b/plugins/csharp/parser/src_csharp/AstVisitor.cs @@ -4,7 +4,8 @@ using static System.Console; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; -using CSharpParser.model; +using DbModel; +// using CSharpParser.model; using Microsoft.CodeAnalysis; namespace CSharpParser diff --git a/plugins/csharp/parser/src_csharp/CSharpParser.csproj b/plugins/csharp/parser/src_csharp/CSharpParser.csproj index ee513d5b9..a9187e917 100644 --- a/plugins/csharp/parser/src_csharp/CSharpParser.csproj +++ b/plugins/csharp/parser/src_csharp/CSharpParser.csproj @@ -6,8 +6,9 @@ - - + + + @@ -16,6 +17,11 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/plugins/csharp/parser/src_csharp/Program.cs b/plugins/csharp/parser/src_csharp/Program.cs index a9b2b23a5..d7df04b79 100644 --- a/plugins/csharp/parser/src_csharp/Program.cs +++ b/plugins/csharp/parser/src_csharp/Program.cs @@ -8,283 +8,291 @@ using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; -using CSharpParser.model; +using DbModel; +// using CSharpParser.model; namespace CSharpParser { - class Program + class Program + { + //private readonly CsharpDbContext _context; + private static List _rootDir; + private static string _buildDir = ""; + private static string _buildDirBase = ""; + private static string _connectionString = ""; + private static string _dbSystem = ""; + + static int Main(string[] args) { - //private readonly CsharpDbContext _context; - private static List _rootDir; - private static string _buildDir = ""; - private static string _buildDirBase = ""; - private static string _connectionString = ""; + _rootDir = new List(); + int threadNum = 4; + + try + { + _connectionString = args[0].Replace("'", ""); + _buildDir = args[1].Replace("'", ""); + _buildDirBase = args[2].Replace("'", ""); + threadNum = int.Parse(args[3]); - static int Main(string[] args) + for (int i = 4; i < args.Length; ++i) { - _rootDir = new List(); - int threadNum = 4; + _rootDir.Add(args[i].Replace("'", "")); + } + } + catch (Exception e) + { + WriteLine("Error in parsing command!"); + return 1; + } + /*if (args.Length < 3) + { + WriteLine("Missing command-line arguments in CSharpParser!"); + return 1; + } + else if (args.Length == 3) + { + _connectionString = args[0].Replace("'", ""); + _rootDir = args[1].Replace("'", ""); + _buildDir = args[2].Replace("'", ""); + } + else if (args.Length == 4) + { + _connectionString = args[0].Replace("'", ""); + _rootDir = args[1].Replace("'", ""); + _buildDir = args[2].Replace("'", ""); + bool success = int.TryParse(args[3], out threadNum); + if (!success){ + WriteLine("Invalid threadnumber argument! Multithreaded parsing disabled!"); + } + } + else if (args.Length == 5) + { + _connectionString = args[0].Replace("'", ""); + _rootDir = args[1].Replace("'", ""); + _buildDir = args[2].Replace("'", ""); + _buildDirBase = args[3].Replace("'", ""); + bool success = int.TryParse(args[4], out threadNum); + if (!success) + { + WriteLine("Invalid threadnumber argument! Multithreaded parsing disabled!"); + } + } + else if (args.Length > 5) + { + WriteLine("Too many command-line arguments in CSharpParser!"); + return 1; + }*/ - try - { - _connectionString = args[0].Replace("'", ""); - _buildDir = args[1].Replace("'", ""); - _buildDirBase = args[2].Replace("'", ""); - threadNum = int.Parse(args[3]); + _dbSystem = _connectionString.Substring(0, _connectionString.IndexOf(':')).ToLower(); + //Converting the connectionstring into entiy framwork style connectionstring + string csharpConnectionString = transformConnectionString(); - for (int i = 4; i < args.Length; ++i) - { - _rootDir.Add(args[i].Replace("'", "")); - } - } - catch (Exception e) - { - WriteLine("Error in parsing command!"); - return 1; - } - /*if (args.Length < 3) - { - WriteLine("Missing command-line arguments in CSharpParser!"); - return 1; - } - else if (args.Length == 3) - { - _connectionString = args[0].Replace("'", ""); - _rootDir = args[1].Replace("'", ""); - _buildDir = args[2].Replace("'", ""); - } - else if (args.Length == 4) - { - _connectionString = args[0].Replace("'", ""); - _rootDir = args[1].Replace("'", ""); - _buildDir = args[2].Replace("'", ""); - bool success = int.TryParse(args[3], out threadNum); - if (!success){ - WriteLine("Invalid threadnumber argument! Multithreaded parsing disabled!"); - } - } - else if (args.Length == 5) - { - _connectionString = args[0].Replace("'", ""); - _rootDir = args[1].Replace("'", ""); - _buildDir = args[2].Replace("'", ""); - _buildDirBase = args[3].Replace("'", ""); - bool success = int.TryParse(args[4], out threadNum); - if (!success) - { - WriteLine("Invalid threadnumber argument! Multithreaded parsing disabled!"); - } - } - else if (args.Length > 5) - { - WriteLine("Too many command-line arguments in CSharpParser!"); - return 1; - }*/ + CsharpDbContext context = new CsharpDbContext(_dbSystem, csharpConnectionString); + context.Database.Migrate(); - //Converting the connectionstring into entiy framwork style connectionstring - string csharpConnectionString = transformConnectionString(); + List allFiles = new List(); + foreach (var p in _rootDir) + { + Console.WriteLine(p); + allFiles.AddRange(GetSourceFilesFromDir(p, ".cs")); + } - var options = new DbContextOptionsBuilder() - .UseNpgsql(csharpConnectionString) - .Options; + foreach (var f in allFiles) + { + WriteLine(f); + } + IEnumerable assemblies = GetSourceFilesFromDir(_buildDir, ".dll"); + IEnumerable assemblies_base = assemblies; + if (args.Length == 5) + assemblies_base = GetSourceFilesFromDir(_buildDirBase, ".dll"); - CsharpDbContext _context = new CsharpDbContext(options); - _context.Database.Migrate(); + List trees = new List(); + foreach (string file in allFiles) + { + string programText = File.ReadAllText(file); + SyntaxTree tree = CSharpSyntaxTree.ParseText(programText, null, file); + trees.Add(tree); + } + Write(trees.Count); - List allFiles = new List(); - foreach (var p in _rootDir) - { - Console.WriteLine(p); - allFiles.AddRange(GetSourceFilesFromDir(p, ".cs")); - } + CSharpCompilation compilation = CSharpCompilation.Create("CSharpCompilation") + .AddReferences(MetadataReference.CreateFromFile(typeof(object).Assembly.Location)) + .AddSyntaxTrees(trees); - foreach (var f in allFiles) - { - WriteLine(f); - } - IEnumerable assemblies = GetSourceFilesFromDir(_buildDir, ".dll"); - IEnumerable assemblies_base = assemblies; - if (args.Length == 5) - assemblies_base = GetSourceFilesFromDir(_buildDirBase, ".dll"); + foreach (string file in assemblies_base) + { + compilation = compilation.AddReferences(MetadataReference.CreateFromFile(file)); + } + foreach (string file in assemblies) + { + compilation = compilation.AddReferences(MetadataReference.CreateFromFile(file)); + } - List trees = new List(); - foreach (string file in allFiles) - { - string programText = File.ReadAllText(file); - SyntaxTree tree = CSharpSyntaxTree.ParseText(programText, null, file); - trees.Add(tree); - } - Write(trees.Count); + var runtask = ParalellRun(csharpConnectionString, threadNum, trees, compilation); + int ret = runtask.Result; - CSharpCompilation compilation = CSharpCompilation.Create("CSharpCompilation") - .AddReferences(MetadataReference.CreateFromFile(typeof(object).Assembly.Location)) - .AddSyntaxTrees(trees); - - foreach (string file in assemblies_base) - { - compilation = compilation.AddReferences(MetadataReference.CreateFromFile(file)); - } - foreach (string file in assemblies) - { - compilation = compilation.AddReferences(MetadataReference.CreateFromFile(file)); - } + return 0; + } - var runtask = ParalellRun(csharpConnectionString, threadNum, trees, compilation); - int ret = runtask.Result; - - return 0; - } + private static async Task ParalellRun(string csharpConnectionString, int threadNum, + List trees, CSharpCompilation compilation) + { + + CsharpDbContext dbContext = new CsharpDbContext(_dbSystem, csharpConnectionString); + var contextList = new List(); + contextList.Add(dbContext); + for (int i = 1; i < threadNum; i++) + { + CsharpDbContext dbContextInstance = new CsharpDbContext(_dbSystem, csharpConnectionString); + contextList.Add(dbContextInstance); + } + + var ParsingTasks = new List>(); + int maxThread = threadNum < trees.Count() ? threadNum : trees.Count(); + WriteLine(threadNum); + for (int i = 0; i < maxThread; i++) + { + ParsingTasks.Add(ParseTree(contextList[i], trees[i], compilation, i)); + } + + int nextTreeIndex = maxThread; + while (ParsingTasks.Count > 0) + { + var finshedTask = await Task.WhenAny(ParsingTasks); + int nextContextIndex = await finshedTask; - private static async Task ParalellRun(string csharpConnectionString, int threadNum, - List trees, CSharpCompilation compilation) + ParsingTasks.Remove(finshedTask); + if (nextTreeIndex < trees.Count) { - var options = new DbContextOptionsBuilder() - .UseNpgsql(csharpConnectionString) - .Options; - CsharpDbContext dbContext = new CsharpDbContext(options); + ParsingTasks.Add(ParseTree(contextList[nextContextIndex], + trees[nextTreeIndex], compilation, nextContextIndex)); + ++nextTreeIndex; + } + } - var contextList = new List(); - contextList.Add(dbContext); - for (int i = 1; i < threadNum; i++) - { - CsharpDbContext dbContextInstance = new CsharpDbContext(options); - contextList.Add(dbContextInstance); - } + foreach (var ctx in contextList) + { + ctx.SaveChanges(); + } - var ParsingTasks = new List>(); - int maxThread = threadNum < trees.Count() ? threadNum : trees.Count(); - WriteLine(threadNum); - for (int i = 0; i < maxThread; i++) - { - ParsingTasks.Add(ParseTree(contextList[i],trees[i],compilation,i)); - } + return 0; + } - int nextTreeIndex = maxThread; - while (ParsingTasks.Count > 0) - { - var finshedTask = await Task.WhenAny(ParsingTasks); - int nextContextIndex = await finshedTask; + private static async Task ParseTree(CsharpDbContext context, + SyntaxTree tree, CSharpCompilation compilation, int index) + { + var ParsingTask = Task.Run(() => + { + WriteLine("ParallelRun " + tree.FilePath); + SemanticModel model = compilation.GetSemanticModel(tree); + var visitor = new AstVisitor(context, model, tree); + visitor.Visit(tree.GetCompilationUnitRoot()); + WriteLine((visitor.FullyParsed ? "+" : "-") + tree.FilePath); + return index; + }); + return await ParsingTask; + } - ParsingTasks.Remove(finshedTask); - if (nextTreeIndex < trees.Count) - { - ParsingTasks.Add(ParseTree(contextList[nextContextIndex], - trees[nextTreeIndex],compilation,nextContextIndex)); - ++nextTreeIndex; - } - } + public static IEnumerable GetSourceFilesFromDir(string root, string extension) + { + IEnumerable allFiles = new string[] { }; + // Data structure to hold names of subfolders. + ArrayList dirs = new ArrayList(); - foreach (var ctx in contextList) - { - ctx.SaveChanges(); - } + if (!System.IO.Directory.Exists(root)) + { + throw new ArgumentException(); + } + dirs.Add(root); - return 0; + while (dirs.Count > 0) + { + string currentDir = dirs[0].ToString(); + dirs.RemoveAt(0); + string[] subDirs; + try + { + subDirs = System.IO.Directory.GetDirectories(currentDir); } - - private static async Task ParseTree(CsharpDbContext context, - SyntaxTree tree, CSharpCompilation compilation, int index) + catch (UnauthorizedAccessException e) { - var ParsingTask = Task.Run(() => - { - WriteLine("ParallelRun " + tree.FilePath); - SemanticModel model = compilation.GetSemanticModel(tree); - var visitor = new AstVisitor(context, model, tree); - visitor.Visit(tree.GetCompilationUnitRoot()); - WriteLine((visitor.FullyParsed ? "+" : "-") + tree.FilePath); - return index; - }); - return await ParsingTask; + WriteLine(e.Message); + continue; } - - public static IEnumerable GetSourceFilesFromDir(string root, string extension) + catch (System.IO.DirectoryNotFoundException e) { - IEnumerable allFiles = new string[]{}; - // Data structure to hold names of subfolders. - ArrayList dirs = new ArrayList(); - - if (!System.IO.Directory.Exists(root)) - { - throw new ArgumentException(); - } - dirs.Add(root); - - while (dirs.Count > 0) - { - string currentDir = dirs[0].ToString(); - dirs.RemoveAt(0); - string[] subDirs; - try - { - subDirs = System.IO.Directory.GetDirectories(currentDir); - } - catch (UnauthorizedAccessException e) - { - WriteLine(e.Message); - continue; - } - catch (System.IO.DirectoryNotFoundException e) - { - WriteLine(e.Message); - continue; - } - - // Add the subdirectories for traversal. - dirs.AddRange(subDirs); + WriteLine(e.Message); + continue; + } - string[] files = null; - try - { - files = System.IO.Directory.GetFiles(currentDir); - } - catch (UnauthorizedAccessException e) - { - Console.WriteLine(e.Message); - continue; - } - catch (System.IO.DirectoryNotFoundException e) - { - Console.WriteLine(e.Message); - continue; - } + // Add the subdirectories for traversal. + dirs.AddRange(subDirs); - foreach (string file in files) - { - try - { - System.IO.FileInfo fi = new System.IO.FileInfo(file); - if (fi.Extension == extension) { - allFiles = allFiles.Append(file); - } - } - catch (System.IO.FileNotFoundException e) - { - // If file was deleted by a separate application - Console.WriteLine(e.Message); - } - } - } - - return allFiles; + string[] files = null; + try + { + files = System.IO.Directory.GetFiles(currentDir); + } + catch (UnauthorizedAccessException e) + { + Console.WriteLine(e.Message); + continue; + } + catch (System.IO.DirectoryNotFoundException e) + { + Console.WriteLine(e.Message); + continue; } - private static string transformConnectionString() + foreach (string file in files) { - _connectionString = _connectionString.Substring(_connectionString.IndexOf(':')+1); - _connectionString = _connectionString.Replace("user", "username"); - string [] properties = _connectionString.Split(';'); - string csharpConnectionString = ""; - for (int i = 0; i < properties.Length; ++i) + try + { + System.IO.FileInfo fi = new System.IO.FileInfo(file); + if (fi.Extension == extension) { - csharpConnectionString += properties[i].Substring(0,1).ToUpper() - + properties[i].Substring(1); - if (i < properties.Length-1) - { - csharpConnectionString += ";"; - } + allFiles = allFiles.Append(file); } + } + catch (System.IO.FileNotFoundException e) + { + // If file was deleted by a separate application + Console.WriteLine(e.Message); + } + } + } + + return allFiles; + } + + private static string transformConnectionString() + { + string csharpConnectionString = ""; + if (_dbSystem == "pgsql") + { + _connectionString = _connectionString.Substring(_connectionString.IndexOf(':') + 1); + _connectionString = _connectionString.Replace("user", "username"); + string[] properties = _connectionString.Split(';'); - return csharpConnectionString; + for (int i = 0; i < properties.Length; ++i) + { + csharpConnectionString += properties[i].Substring(0, 1).ToUpper() + + properties[i].Substring(1); + if (i < properties.Length - 1) + { + csharpConnectionString += ";"; + } } + } + else + { + // "sqlite:database=" needs to be removed from the connection string. + _connectionString = _connectionString.Substring(_connectionString.IndexOf(':') + 10); + csharpConnectionString = "Data Source=" + _connectionString; + } + + return csharpConnectionString; } + + } } diff --git a/plugins/csharp/service/src_csharp/CSharpQueryHandler.cs b/plugins/csharp/service/src_csharp/CSharpQueryHandler.cs index a221b65b9..1d0d2ee8f 100644 --- a/plugins/csharp/service/src_csharp/CSharpQueryHandler.cs +++ b/plugins/csharp/service/src_csharp/CSharpQueryHandler.cs @@ -15,32 +15,19 @@ using System.Diagnostics; using language; using cc.service.csharp; -using CSharpParser.model; +// using CSharpParser.model; +using DbModel; public class CSharpQueryHandler : CsharpService.IAsync { private CsharpDbContext dbContext; - public CSharpQueryHandler(string connenctionString) + public CSharpQueryHandler(string connectionString) { - // Converting the connectionstring into Entity Framework style connection string - connenctionString = connenctionString.Substring(connenctionString.IndexOf(':')+1); - connenctionString = connenctionString.Replace("user", "username"); - string[] properties = connenctionString.Split(';'); - string csharpConnenctionString = ""; - for (int i = 0; i < properties.Length; ++i) - { - csharpConnenctionString += properties[i].Substring(0,1).ToUpper() - + properties[i].Substring(1); - if (i < properties.Length-1) - { - csharpConnenctionString += ";"; - } - } + string dbSystem = connectionString.Substring(0, connectionString.IndexOf(':')).ToLower(); + //Converting the connectionstring into entiy framwork style connectionstring + string csharpConnectionString = transformConnectionString(dbSystem, connectionString); - var options = new DbContextOptionsBuilder() - .UseNpgsql(csharpConnenctionString) - .Options; - dbContext = new CsharpDbContext(options); + dbContext = new CsharpDbContext(dbSystem, csharpConnectionString); } private language.AstNodeInfo createAstNodeInfo(CsharpAstNode node) @@ -104,8 +91,9 @@ private CsharpAstNode queryCsharpAstNode(string astNodeId) CsharpAstNode ret; try { + ulong NodeId = ulong.Parse(astNodeId); ret = dbContext.CsharpAstNodes - .Where(a => a.Id.ToString()==astNodeId) + .Where(a => a.Id==NodeId) .First(); } catch (InvalidOperationException e) @@ -680,5 +668,33 @@ public async Task getDiagram(string astNodeId, int diagramId, return await Task.FromResult(new List()); } + private static string transformConnectionString(string dbSystem, string connectionString) + { + string csharpConnectionString = ""; + if (dbSystem == "pgsql") + { + connectionString = connectionString.Substring(connectionString.IndexOf(':') + 1); + connectionString = connectionString.Replace("user", "username"); + string[] properties = connectionString.Split(';'); + + for (int i = 0; i < properties.Length; ++i) + { + csharpConnectionString += properties[i].Substring(0, 1).ToUpper() + + properties[i].Substring(1); + if (i < properties.Length - 1) + { + csharpConnectionString += ";"; + } + } + } + else + { + // "sqlite:database=" needs to be removed from the connection string. + connectionString = connectionString.Substring(connectionString.IndexOf(':') + 10); + csharpConnectionString = "Data Source=" + connectionString; + } + + return csharpConnectionString; + } } \ No newline at end of file diff --git a/plugins/csharp/service/src_csharp/CSharpQueryServer.cs b/plugins/csharp/service/src_csharp/CSharpQueryServer.cs index 955de23a1..308f81e4f 100644 --- a/plugins/csharp/service/src_csharp/CSharpQueryServer.cs +++ b/plugins/csharp/service/src_csharp/CSharpQueryServer.cs @@ -19,7 +19,8 @@ using System.Diagnostics; using language; using cc.service.csharp; -using CSharpParser.model; +// using CSharpParser.model; +using DbModel; namespace Server { diff --git a/plugins/csharp/service/src_csharp/csharpservice.csproj b/plugins/csharp/service/src_csharp/csharpservice.csproj index 091a93f6c..ecedd8a60 100644 --- a/plugins/csharp/service/src_csharp/csharpservice.csproj +++ b/plugins/csharp/service/src_csharp/csharpservice.csproj @@ -5,12 +5,9 @@ net8.0 - - - - + @@ -18,6 +15,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive