diff --git a/backend/Program.cs b/backend/Program.cs index 0b9b507f..562b0ddf 100644 --- a/backend/Program.cs +++ b/backend/Program.cs @@ -33,11 +33,11 @@ string connectionString; if (builder.Environment.IsDevelopment()) { - connectionString = builder.Configuration.GetConnectionString("HostConnection"); + connectionString = builder.Configuration.GetConnectionString("HostConnection") ?? throw new InvalidOperationException("HostConnection string is missing."); } else { - connectionString = builder.Configuration.GetConnectionString("ProductionConnection"); + connectionString = builder.Configuration.GetConnectionString("ProductionConnection") ?? throw new InvalidOperationException("ProductionConnection string is missing."); } builder.Services.AddMySqlDataSource(connectionString); diff --git a/backend/appsettings.json b/backend/appsettings.json index f5ff761d..79f3ab33 100644 --- a/backend/appsettings.json +++ b/backend/appsettings.json @@ -9,6 +9,6 @@ "ConnectionStrings": { "DefaultConnection": "Server=mysql;Port=3306;Database=chemistry_db;User=chemistrycafedev;Password=chemistrycafe", "HostConnection": "Server=localhost;Port=3307;Database=chemistry_db;User=chemistrycafedev;Password=chemistrycafe", - "ProductionConnection": "Server=localhost;Port=3307;Database=chemistry_db;User=chemistrycafedev;Password=chemistrycafe" + "ProductionConnection": "Server=localhost;Port=3306;Database=chemistry_db;User=chemistrycafedev;Password=chemistrycafe" } } diff --git a/init.sql b/init.sql index 246c085d..e180bfcc 100644 --- a/init.sql +++ b/init.sql @@ -1,4 +1,5 @@ -- init.sql +USE chemistry_db; -- 1. Create Tables