diff --git a/SmartAquaViewer/DataAnalisys/AppDbContext.cs b/SmartAquaViewer/DataAnalisys/AppDbContext.cs
index 6ad3331..52c178d 100644
--- a/SmartAquaViewer/DataAnalisys/AppDbContext.cs
+++ b/SmartAquaViewer/DataAnalisys/AppDbContext.cs
@@ -2,16 +2,19 @@
using System.Collections.Generic;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
+
namespace SmartAquaViewer.DataAnalisys
{
public class AppDbContext : DbContext
{
- //dotnet ef migrations add InitialCreate
- //dotnet ef database update
- //dotnet ef migrations add AddMultipleTables
- //dotnet ef database update
+ //dotnet tool install --global dotnet-ef
+ //dotnet ef migrations add InitialCreate --project SmartAquaViewer
+ //dotnet ef database update --project SmartAquaViewer
+
+ //dotnet ef migrations add AddMultipleTables --project SmartAquaViewer
+ //dotnet ef database update --project SmartAquaViewer
@@ -19,9 +22,14 @@ namespace SmartAquaViewer.DataAnalisys
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
- // SQL Server 예시 (필요에 맞게 변경)
- optionsBuilder.UseSqlServer(
- "Server=localhost;Database=SmartAquaDB;Trusted_Connection=True;TrustServerCertificate=True;");
+ // MySQL 연결 문자열 (일반적인 형태)
+ var connectionString = "Server=192.168.10.143;Port=3306;Database=smart_aqua;User=root;Password=znqk123!;";
+
+ // MySQL Server Version 설정 (버전에 맞춰 변경)
+ var serverVersion = new MySqlServerVersion(new Version(8, 0, 36));
+
+ optionsBuilder.UseMySql(connectionString, serverVersion);
}
+
}
}
diff --git a/SmartAquaViewer/Migrations/20250811050443_InitialCreate.Designer.cs b/SmartAquaViewer/Migrations/20250811050443_InitialCreate.Designer.cs
new file mode 100644
index 0000000..2faa9b3
--- /dev/null
+++ b/SmartAquaViewer/Migrations/20250811050443_InitialCreate.Designer.cs
@@ -0,0 +1,80 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using SmartAquaViewer.DataAnalisys;
+
+#nullable disable
+
+namespace SmartAquaViewer.Migrations
+{
+ [DbContext(typeof(AppDbContext))]
+ [Migration("20250811050443_InitialCreate")]
+ partial class InitialCreate
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.1")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("SmartAquaViewer.DataAnalisys.WaterQualityVO", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("DO")
+ .HasColumnType("double");
+
+ b.Property("ElectricalConductivity")
+ .HasColumnType("double");
+
+ b.Property("FlowRate")
+ .HasColumnType("double");
+
+ b.Property("ORP")
+ .HasColumnType("double");
+
+ b.Property("PH")
+ .HasColumnType("double");
+
+ b.Property("Salinity")
+ .HasColumnType("double");
+
+ b.Property("TSS")
+ .HasColumnType("double");
+
+ b.Property("Temperature")
+ .HasColumnType("double");
+
+ b.Property("Timestamp")
+ .HasColumnType("datetime(6)");
+
+ b.Property("TotalNitrogen")
+ .HasColumnType("double");
+
+ b.Property("TotalPhosphorus")
+ .HasColumnType("double");
+
+ b.Property("Turbidity")
+ .HasColumnType("double");
+
+ b.Property("WaterLevel")
+ .HasColumnType("double");
+
+ b.Property("WaterTankNum")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("WaterQuality");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/SmartAquaViewer/Migrations/20250811050443_InitialCreate.cs b/SmartAquaViewer/Migrations/20250811050443_InitialCreate.cs
new file mode 100644
index 0000000..c1b4a46
--- /dev/null
+++ b/SmartAquaViewer/Migrations/20250811050443_InitialCreate.cs
@@ -0,0 +1,53 @@
+using System;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace SmartAquaViewer.Migrations
+{
+ ///
+ public partial class InitialCreate : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterDatabase()
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "WaterQuality",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ WaterTankNum = table.Column(type: "int", nullable: false),
+ DO = table.Column(type: "double", nullable: false),
+ PH = table.Column(type: "double", nullable: false),
+ Temperature = table.Column(type: "double", nullable: false),
+ WaterLevel = table.Column(type: "double", nullable: false),
+ FlowRate = table.Column(type: "double", nullable: false),
+ ElectricalConductivity = table.Column(type: "double", nullable: false),
+ Turbidity = table.Column(type: "double", nullable: false),
+ Salinity = table.Column(type: "double", nullable: false),
+ ORP = table.Column(type: "double", nullable: false),
+ TSS = table.Column(type: "double", nullable: false),
+ TotalNitrogen = table.Column(type: "double", nullable: false),
+ TotalPhosphorus = table.Column(type: "double", nullable: false),
+ Timestamp = table.Column(type: "datetime(6)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_WaterQuality", x => x.Id);
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "WaterQuality");
+ }
+ }
+}
diff --git a/SmartAquaViewer/Migrations/AppDbContextModelSnapshot.cs b/SmartAquaViewer/Migrations/AppDbContextModelSnapshot.cs
new file mode 100644
index 0000000..ad78d1d
--- /dev/null
+++ b/SmartAquaViewer/Migrations/AppDbContextModelSnapshot.cs
@@ -0,0 +1,77 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using SmartAquaViewer.DataAnalisys;
+
+#nullable disable
+
+namespace SmartAquaViewer.Migrations
+{
+ [DbContext(typeof(AppDbContext))]
+ partial class AppDbContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.1")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("SmartAquaViewer.DataAnalisys.WaterQualityVO", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("DO")
+ .HasColumnType("double");
+
+ b.Property("ElectricalConductivity")
+ .HasColumnType("double");
+
+ b.Property("FlowRate")
+ .HasColumnType("double");
+
+ b.Property("ORP")
+ .HasColumnType("double");
+
+ b.Property("PH")
+ .HasColumnType("double");
+
+ b.Property("Salinity")
+ .HasColumnType("double");
+
+ b.Property("TSS")
+ .HasColumnType("double");
+
+ b.Property("Temperature")
+ .HasColumnType("double");
+
+ b.Property("Timestamp")
+ .HasColumnType("datetime(6)");
+
+ b.Property("TotalNitrogen")
+ .HasColumnType("double");
+
+ b.Property("TotalPhosphorus")
+ .HasColumnType("double");
+
+ b.Property("Turbidity")
+ .HasColumnType("double");
+
+ b.Property("WaterLevel")
+ .HasColumnType("double");
+
+ b.Property("WaterTankNum")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("WaterQuality");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/SmartAquaViewer/SmartAquaViewer.csproj b/SmartAquaViewer/SmartAquaViewer.csproj
index 4f73c26..542ad02 100644
--- a/SmartAquaViewer/SmartAquaViewer.csproj
+++ b/SmartAquaViewer/SmartAquaViewer.csproj
@@ -10,12 +10,17 @@
-
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+