How can we help you today? How can we help you today?

Enforce Naming Conventions

Is there a way in SQL Source Control to check for object naming conventions and not allow check in if object is not named according to a standard?
kjmcsd
0

Comments

8 comments

  • David Atkinson
    Interesting idea. Can you give an example of the convention you'd like to enforce?
    David Atkinson
    0
  • kjmcsd
    Table and stored procedure names should begin with either "app" or "ssp"
    kjmcsd
    0
  • David Atkinson
    Have you thought about using SQL Server's built in policies to enforce this?
    David Atkinson
    0
  • kjmcsd
    I'm looking at that right now. :)
    kjmcsd
    0
  • AlexYates
    Nope - but you could write a tSQLt test for it and run it as part of your build/CI processes.
    AlexYates
    0
  • kjmcsd

    I'm finding out that policies only tell you if there are things not meeting standards. They do not enforce or prevent people from not complying with them. I think this would be a good feature to add to SQL Source Control. Adding this on the TFS side breaks SQL source control.

    kjmcsd
    0
  • David Atkinson
    Adding to Alex's suggestion, you might be able to write the tSQLt tests and have them run in a pre-commit hook, which could fail the commit should they not all pass? If this works, it would be a great blog post to share with the wider community.
    David Atkinson
    0
  • AlexYates
    Yes - that's a better idea.

    Do what David said.
    AlexYates
    0

Add comment

Please sign in to leave a comment.