What are the challenges you face when working across database platforms? Take the survey
Options

Adding a migration after a manual change to production

Hello,

Could someone please advise on how to correctly sync the database project after a stored procedure was created manually in production? The project is currently configured to generate scripts for database objects such as stored procedures.

Thanks.
Tagged:

Answers

  • Options
    Hi,

    Are you using a SQL Source Control or a SQL Change Automation project?

    Kind Regards,
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Options
    asadcasadc Posts: 6 Bronze 1
    It's a SQL Change Automation project.
  • Options
    Assuming that you are using the default option of using Programmable Objects, then it's just a case of adding the Stored Procedure to your development database and importing it.
    This will generate a Programmable Objects script that will be deployed in Production and will drop the existing Stored Procedure and recreate it.
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Options
    asadcasadc Posts: 6 Bronze 1
    We're not using programmable objects, so the script that's generated will be a CREATE. I ended up manually modifying the generated script by adding a DROP, I'm not sure if there's a better way. =
  • Options
    We would advise using the same approach used in Programmable Objects, drop the the object if exists and then script the CREATE:

    For example:

    IF OBJECT_ID('[HumanResources].[uspUpdateEmployeeHireInfo]') IS NOT NULL
    DROP PROCEDURE [HumanResources].[uspUpdateEmployeeHireInfo];

    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
Sign In or Register to comment.