
--Migration_RCCP_20260303_134501.txt
EXECUTE sp_rename @objname = N'dbo.AreaMetrics', @newname = N'EntityMetrics', @objtype = N'OBJECT'
IF object_id('[PK_dbo.AreaMetrics]') IS NOT NULL BEGIN
    EXECUTE sp_rename @objname = N'[PK_dbo.AreaMetrics]', @newname = N'PK_dbo.EntityMetrics', @objtype = N'OBJECT'
END
ALTER TABLE [dbo].[EntityMetrics] ADD [EntityType] [nvarchar](max)
ALTER TABLE [dbo].[EntityMetrics] ADD [EntityId] [nvarchar](max)
DECLARE @var0 nvarchar(128)
SELECT @var0 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.EntityMetrics')
AND col_name(parent_object_id, parent_column_id) = 'AreaId';
IF @var0 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[EntityMetrics] DROP CONSTRAINT [' + @var0 + ']')
ALTER TABLE [dbo].[EntityMetrics] DROP COLUMN [AreaId]
