-- Tables

-- Alters

ALTER TABLE [AKUZ].[T_PREGNANT_ANTI_RHESUS_IG_HISTORY] DROP CONSTRAINT [FK_T_LPU_MAIN_T_PREGNANT_ANTI_RHESUS_IG_HISTORY_LPU_MAIN]
GO

ALTER TABLE [AKUZ].[T_PREGNANT_ANTI_RHESUS_IG_HISTORY] DROP COLUMN [LPU_MAIN]
GO

ALTER TABLE [AKUZ].[T_PREGNANT_ANTI_RHESUS_IG_HISTORY] ADD [Users] uniqueidentifier NULL
GO

ALTER TABLE [AKUZ].[T_PREGNANT_ANTI_RHESUS_IG_HISTORY] ADD [Drug] varchar(255) NULL
GO
UPDATE [AKUZ].[T_PREGNANT_ANTI_RHESUS_IG_HISTORY] SET [Drug] = ''
GO
ALTER TABLE [AKUZ].[T_PREGNANT_ANTI_RHESUS_IG_HISTORY] ALTER COLUMN [Drug] varchar(255) NOT NULL
GO

ALTER TABLE [AKUZ].[T_PREGNANT_ANTI_RHESUS_IG_HISTORY] ADD CONSTRAINT [FK_T_USERS_T_PREGNANT_ANTI_RHESUS_IG_HISTORY_Users]
FOREIGN KEY([Users]) REFERENCES [AKUZ].[T_USERS] ([UserID])
GO


ALTER TABLE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] DROP COLUMN [NewbornInformation]
GO
UPDATE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] SET [PregnancyType] = 0 WHERE [PregnancyType] IS NULL
GO
ALTER TABLE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] ALTER COLUMN [PregnancyType] int NOT NULL
GO
UPDATE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] SET [Outcome] = 0 WHERE [Outcome] IS NULL
GO
ALTER TABLE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] ALTER COLUMN [Outcome] int NOT NULL
GO

ALTER TABLE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] ADD [PrematureBirth] bit NULL
GO
UPDATE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] SET [PrematureBirth] = 0
GO
ALTER TABLE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] ALTER COLUMN [PrematureBirth] bit NOT NULL
GO

ALTER TABLE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] ADD [Operations] uniqueidentifier NULL
GO

ALTER TABLE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] ADD [VRTType] int NULL
GO

ALTER TABLE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] ADD [Year] int NULL
GO
UPDATE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] SET [Year] = 0
GO
ALTER TABLE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] ALTER COLUMN [Year] int NOT NULL
GO

ALTER TABLE [AKUZ].[T_PREVIOUS_PREGNANCIES_INFORMATION] ADD CONSTRAINT [FK_T_MEDICAL_SERVICE_T_PREVIOUS_PREGNANCIES_INFORMATION_Operations]
FOREIGN KEY([Operations]) REFERENCES [AKUZ].[T_MEDICAL_SERVICE] ([MedicalServiceID])
GO


ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ADD [CruelTreatment] bit NULL
GO
UPDATE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] SET [CruelTreatment] = 0
GO
ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ALTER COLUMN [CruelTreatment] bit NOT NULL
GO

ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ADD [Migrants] bit NULL
GO
UPDATE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] SET [Migrants] = 0
GO
ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ALTER COLUMN [Migrants] bit NOT NULL
GO

ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ADD [ParentalRightsDeprivation] bit NULL
GO
UPDATE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] SET [ParentalRightsDeprivation] = 0
GO
ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ALTER COLUMN [ParentalRightsDeprivation] bit NOT NULL
GO

ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ADD [SuicidalAttempts] bit NULL
GO
UPDATE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] SET [SuicidalAttempts] = 0
GO
ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ALTER COLUMN [SuicidalAttempts] bit NOT NULL
GO

ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ADD [MarginalLifestyle] bit NULL
GO
UPDATE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] SET [MarginalLifestyle] = 0
GO
ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ALTER COLUMN [MarginalLifestyle] bit NOT NULL
GO

ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ADD [Poor] bit NULL
GO
UPDATE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] SET [Poor] = 0
GO
ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ALTER COLUMN [Poor] bit NOT NULL
GO

ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ADD [Disabled] bit NULL
GO
UPDATE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] SET [Disabled] = 0
GO
ALTER TABLE [AKUZ].[T_SOCIOBIOLOGICAL_RISK_FACTORS] ALTER COLUMN [Disabled] bit NOT NULL
GO

ALTER TABLE [AKUZ].[T_OBSTETRICS_RISKS_ANKETA] ADD [SociobiologicalRisk] bit NULL
GO
UPDATE [AKUZ].[T_OBSTETRICS_RISKS_ANKETA] SET [SociobiologicalRisk] = 0
GO
ALTER TABLE [AKUZ].[T_OBSTETRICS_RISKS_ANKETA] ALTER COLUMN [SociobiologicalRisk] bit NOT NULL
GO
