Skip to content

Instantly share code, notes, and snippets.

@jasonlucas907
Last active April 24, 2018 16:14
Show Gist options
  • Save jasonlucas907/f52c7ffd5f6e61352748c585f2be8860 to your computer and use it in GitHub Desktop.
Save jasonlucas907/f52c7ffd5f6e61352748c585f2be8860 to your computer and use it in GitHub Desktop.

Create a feature flag for Mars app on Mac

Install DBeaver and setup connection to the TP Dev database

Building the feature flag script

  • Create a branch on the TPCore repository

  • In TPCore go to TPCore/Database/UpdateScripts/Ultrafit

  • Open the release date folder that your new feature flag scripts will be released on. If the folder does not exist then create it.(example: 2018-01-04)

  • Inside the release date folder you should see two folders:

    • 1PreScripts
    • 2PostScripts
  • Open the 1PreScripts folder

  • Inside the 1PreScripts folder create the .sql file for your feature flag script.(example: addCoachDeskFeatureFlag.sql) You can also cut and paste a previous existing script file for reference.

  • Inside of your new sql file you need to create the script for your feature flag. -Example:

    ```
    IF NOT EXISTS (SELECT * FROM FeatureFlag WHERE Name = 'coachDesk')
    BEGIN
      PRINT 'Creating coachDesk feature flag';
      INSERT INTO FeatureFlag (Name, Enabled) VALUES ('coachDesk', 0);
    END
    ```
    
  • Replace coachDesk with the name for your feature flag. The 0 following coachDesk in the INSERT INTO script represents a bool. In this case 0 = false for disabled.

  • Inside the 1PreScripts folder you should aslo have an update.txt file. Inside of the update.txt file add the name of your new feature flag file.(example: addCoachDeskFeatureFlag.sql)

  • Now in DBeaver run your script and you should see the PRINT message from your script.

  • Now in DBeaver check the list of all feature flags and your new feature flag should be listed.

Enable feature flag on Dev

  • In DBeaver access the dev database devdb04.dev.trainingpeaks.com
  • Run the command to enable the feature flag. Be sure to include WHERE so that you only enable your flag.
     * UPDATE featureflag SST ENABLE=1 WHERE NAME = 'coachDesk'
     
     
    
       
       
       
       
       
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment