Problem with DB Constraint

May 9, 2008 at 2:48 PM
I am having a problem with the table creation scripts - it may be an issue with the SchemaExplorer api. I am using 4.14 of CS, and 3.0 of the nuSoft Framework.

The problem is that it is not getting all of the check constraints. The following shows 2 regions, the first is SQLDMO table script for just the constraints, the second is the frameWork generation.

Anyone else notice this ?
--region Constraints
ALTER TABLE CarrierLocality ADD
CONSTRAINT CK_CarrierLocalityCarrierNotEmpty CHECK (len(Carrier) > 0),
CONSTRAINT CK_CarrierLocalityLocalityNotEmpty CHECK (len(Locality) > 0),
CONSTRAINT CK_CarrierLocalityStateNotEmpty CHECK (len(State) > 0),
CONSTRAINT CK_CarrierLocalityUpdatedByNotEmpty CHECK (len(UpdatedBy) > 0)
GO



--region Defaults
ALTER TABLE CarrierLocality ADD
CONSTRAINT DF_CarrierLocality_IsRural DEFAULT (0) FOR IsRural,
CONSTRAINT DF_CarrierLocality_LastUpdated DEFAULT (getdate()) FOR LastUpdated,
CONSTRAINT DF_CarrierLocality_UpdatedBy DEFAULT (suser_sname()) FOR UpdatedBy
GO



--endregion


--endregion

--region Non Primary Key Constraints
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECTID(N'CKCarrierLocalityCarrierNotEmpty') AND OBJECTPROPERTY(id, N'IsConstraint') = 1)
ALTER TABLE dbo.CarrierLocality ADD
CONSTRAINT CK_CarrierLocalityCarrierNotEmpty CHECK (len(Carrier) > 0)
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECTID(N'CKCarrierLocalityStateNotEmpty') AND OBJECTPROPERTY(id, N'IsConstraint') = 1)
ALTER TABLE dbo.CarrierLocality ADD
CONSTRAINT CK_CarrierLocalityStateNotEmpty CHECK (len(State) > 0)
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECTID(N'DFCarrierLocality_IsRural') AND OBJECTPROPERTY(id, N'IsConstraint') = 1)
ALTER TABLE dbo.CarrierLocality ADD
CONSTRAINT DF_CarrierLocality_IsRural DEFAULT (0) FOR IsRural
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECTID(N'CKCarrierLocalityLocalityNotEmpty') AND OBJECTPROPERTY(id, N'IsConstraint') = 1)
ALTER TABLE dbo.CarrierLocality ADD
CONSTRAINT CK_CarrierLocalityLocalityNotEmpty CHECK (len(Locality) > 0)
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECTID(N'DFCarrierLocality_LastUpdated') AND OBJECTPROPERTY(id, N'IsConstraint') = 1)
ALTER TABLE dbo.CarrierLocality ADD
CONSTRAINT DF_CarrierLocality_LastUpdated DEFAULT (getdate()) FOR LastUpdated
GO
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECTID(N'DFCarrierLocality_UpdatedBy') AND OBJECTPROPERTY(id, N'IsConstraint') = 1)
ALTER TABLE dbo.CarrierLocality ADD
CONSTRAINT DF_CarrierLocality_UpdatedBy DEFAULT (suser_sname()) FOR UpdatedBy
GO

--endregion