Should the development environment disable foreign keys?

Thus, although we use foreign keys in our current project, I still heard an argument that allows us to check the foreign key in the development environment, it simply poses an obstacle - the code should not rely on foreign keys that are in place.

I was wondering what people thought about this idea - when developing, do you support foreign keys in your development environment or disable them?

+5
source share
13 answers

I ALWAYS support them. You want your code not going to do something that violates FK rules. If you delete them, nothing prevents the code from posting bad data. In addition, we will use tools such as CodeSmith to help with some of our automation parts, and with the help of CodeSmith, it can automatically generate request procedures for us if we have FK.

In general, I am firmly convinced that the development environment should be a very close cue to the production environment. If you do not have them, it is very possible to have code that will not work, because it violates the FK restriction, and it will work very well in the test.

+24
source

. ; ; , , .

+9

FK . , FK, - , .

, , , , , .

+6

, . , , . , ETL, .

+4

. , , , , .

+4

-, , . - , - .

+4

, " , ", . .

, .

+2

, . . , . , # , .

, .., , FK, .

+1

FK, , , , , , , , , , , , , dev-dev, , env!

+1

, , , . , , , . , .

+1

, , .

, , INSERT/UPDATE/DELETE . , , ( ) . , .

+1

, .

FKs!

, .

.:)

, - , , , SCRUB , .

0

, , , , , , . SQL Server "".

, . cookie cookie, .

-2

All Articles