StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Database Deployment Toolkit
»
Database Deployment Toolkit (How do I?)
»
Triggers vs Check Constraints?
Triggers vs Check Constraints?
Post Reply
Like
1
Triggers vs Check Constraints?
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
William Fields
William Fields
posted 11 Years Ago
ANSWER
Topic Details
Share Topic
Group: StrataFrame Users
Posts: 80,
Visits: 239
Hello,
I'm working through updating our code to remove triggers and replace them with declarative R.I. rules.
I've also got a fair amount of trigger code that checks for empty field values (on not null fields), so I'm looking into check constraints as a replacement. But, I don't know if this is the right choice, or if the DDT supports check constraints other than default value constraints.
Here's a link describing how to set up a check constraint to prevent blank field values:
http://stackoverflow.com/questions/5489648/how-to-constraint-no-empty-strings-on-an-nvarchar-column
Can anyone chime in about pro's and con's of this approach, and where check constraints can be defined in the DDT for not allowing empty string field values?
Thanks.
Bill
Edited
11 Years Ago by
William Fields
Reply
Like
1
StrataFrame Team
S
StrataFrame Team
posted 11 Years Ago
ANSWER
Post Details
Share Post
S
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
The pro would be that since the check is at the database level, you can ensure that there will never be any junk that gets into your database if non-SF applications touch it. The con would be that you're not going to know about the constraint until you try to save the record, then it will throw an exception, so you'll also want to add a business rule to the business object to prevent saving when the field is blank. We have the RequiredFields collection that can be edited through the class component designer just for this.
As for adding the constraints, we don't support them through the UI, but you can add a post-deployment script in the DDT to add anything you want.
Reply
Like
1
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
1
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search