Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 711ea2a00b | |||
| c27b1088ee | |||
| 807d56d071 | |||
| c77cd7d524 | |||
| 17c8e5e9ed | |||
| 9bcce06842 | |||
| 528eeb13a1 | |||
| d5f68ca520 | |||
| 8a0bf59994 | |||
| 147b589d59 | |||
| a379088a24 | |||
| 9824616323 | |||
| 8bd7423209 |
+1
-1
@@ -30,7 +30,7 @@ services:
|
|||||||
- EnableHttpsRedirect=false
|
- EnableHttpsRedirect=false
|
||||||
- TenantSettings__BaseDomain=timetracker.marc-wieland.de
|
- TenantSettings__BaseDomain=timetracker.marc-wieland.de
|
||||||
volumes:
|
volumes:
|
||||||
- dpkeys:/home/app/.aspnet/DataProtection-Keys
|
- dpkeys:/root/.aspnet/DataProtection-Keys
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
||||||
|
|||||||
@@ -227,54 +227,10 @@ using (var scope = app.Services.CreateScope())
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if column IsApproved in Tenants table is of type integer
|
|
||||||
using (var cmdCheckApproved = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
cmdCheckApproved.CommandText = @"
|
|
||||||
SELECT data_type
|
|
||||||
FROM information_schema.columns
|
|
||||||
WHERE table_name = 'Tenants' AND column_name = 'IsApproved';";
|
|
||||||
var dataType = await cmdCheckApproved.ExecuteScalarAsync() as string;
|
|
||||||
if (dataType != null && dataType.Equals("integer", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
// Alter the column type to boolean
|
|
||||||
using (var cmdAlterApproved = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
cmdAlterApproved.CommandText = @"
|
|
||||||
ALTER TABLE ""Tenants""
|
|
||||||
ALTER COLUMN ""IsApproved"" TYPE boolean
|
|
||||||
USING (""IsApproved"" <> 0);";
|
|
||||||
await cmdAlterApproved.ExecuteNonQueryAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if column CreatedAt in Tenants table is of type text or character varying
|
|
||||||
using (var cmdCheckCreatedAt = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
cmdCheckCreatedAt.CommandText = @"
|
|
||||||
SELECT data_type
|
|
||||||
FROM information_schema.columns
|
|
||||||
WHERE table_name = 'Tenants' AND column_name = 'CreatedAt';";
|
|
||||||
var dataType = await cmdCheckCreatedAt.ExecuteScalarAsync() as string;
|
|
||||||
if (dataType != null && (dataType.Equals("text", StringComparison.OrdinalIgnoreCase) || dataType.Equals("character varying", StringComparison.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
// Alter the column type to timestamp without time zone
|
|
||||||
using (var cmdAlterCreatedAt = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
cmdAlterCreatedAt.CommandText = @"
|
|
||||||
ALTER TABLE ""Tenants""
|
|
||||||
ALTER COLUMN ""CreatedAt"" TYPE timestamp without time zone
|
|
||||||
USING (""CreatedAt""::timestamp without time zone);";
|
|
||||||
await cmdAlterCreatedAt.ExecuteNonQueryAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Fehler beim Konvertieren der PostgreSQL-Spaltentypen (IsTenantAdmin/IsApproved/CreatedAt): {ex.Message}");
|
Console.WriteLine($"Fehler beim Konvertieren der IsTenantAdmin-Spalte in PostgreSQL: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user