Presentation is loading. Please wait.

Presentation is loading. Please wait.

Presented by : Chirag Dani & Dhaval Shah

Similar presentations


Presentation on theme: "Presented by : Chirag Dani & Dhaval Shah"— Presentation transcript:

1 Presented by : Chirag Dani & Dhaval Shah
AliaSQL Presented by : Chirag Dani & Dhaval Shah

2 What is AliaSQL?

3 What is AliaSQL? AliaSQL is a command line tool for database deployments. Very popular Automated Database Change Management tool. Freeware. Open Source Code. Code Repository: Useful for Continuous Delivery / Deployment. Easy to rebuild database and rollback changes. Easy association with task or work item as Code and Database changes can go in a single check-in. Facility to create database with Test Data.

4 Why AliaSQL? TWO common mistakes exist when managing the database change management process.  Scenario 1: Developers sharing a development database.  When sharing a development database, changes to this database have to be a blocking issue.  Working on branches becomes an issue because when a database change happens, other developers end up working with a version of the code that has a problem with the new database change.  The external environmental change ends up wasting the time of other team members.

5 Why AliaSQL? Scenario 2: Developers maintaining local databases that are synced manually later. When each developer maintains isolated databases that are synced manually, the team invariably has to figure out – What are the needed database changes for a given build? Which order of database scripts to follow? When needs to be deployed to production? This process is complex and difficult for QA to test.

6 Getting started AliaSQL is a command line tool for database deployments It depends on having a database scripts folder with these 4 folders: Create Update Everytime TestData AliaSQL.exe [Action] [Database Server] [DatabaseName] [Scripts path] [Username] [Password]

7 NuGet packages

8 AliaSQL.Kickstarter NuGet package
Create an empty C# console app. Install AliaSQL.Kickstarter from the package manager console. PM> Install-Package AliaSQL.Kickstarter It is recommended to prefix scripts with numbers to ensure the run order (0001- AddTestTable.sql, 0002-AddSecondTable.sql) You can nest folders in the Create, Update and Everytime folders if you want to organize your scripts in some way.

9 AliaSQL folders description
Create and Update scripts are for tables, constraints, indexes etc which are altered via a series of transitions from one instruction to the next. Everytime scripts are for views/functions/stored procedures which are more similar to your client application code. This allows you to treat them like source code and edit them over time. You create a stored procedure in script #1 and edit that same script over time as the need arises. New or modified scripts in this folder will run every time.

10 Create command AliaSQL.exe Create .\sqlexpress Demo ./scripts
Create database and run all scripts in Create folder. Runs all new scripts and changed scripts in Everytime folder. Logs to usd_AppliedDatabaseScript table.

11 Update command AliaSQL.exe Update .\sqlexpress Demo ./scripts
Run all scripts in Create and Update folders that have not yet been ran. If target database does not already exist it will be created. Runs all scripts in Everytime folder that have not yet been ran or have been modified. Logs to usd_AppliedDatabaseScript table.

12 Rebuild command AliaSQL.exe Rebuild .\sqlexpress Demo ./scripts
Drop and recreate database then run all scripts in Create and Update folders. Runs all scripts in Everytime folder. Logs to usd_AppliedDatabaseScript table.

13 TestData command AliaSQL.exe TestData .\sqlexpress Demo ./scripts
Run all scripts in TestData folder that have not yet been ran - expects target database to already exist. Logs to usd_AppliedDatabaseTestDataScript table.

14 Baseline command AliaSQL.exe Baseline .\sqlexpress Demo ./scripts
Logs (but does not execute) all scripts in Create and Update folders that have not yet been ran - expects database to already exist. This adds the usd_AppliedDatabaseScript table and a record of all scripts to an existing database. This is useful when you have an existing database that you want to bring into change management without running all of your current scripts against it. Logs to usd_AppliedDatabaseScript table.

15 AliaSQL change management practice
Each developer using their own local database to do their development work. Each environment using its own database. i.e. Development, Testing, Staging, Production Each developer maintains his changes locally. When the database changes are ready to commit alongside the application source code, the developer follows these steps: Create a change script that wraps all of the database changes into a single transactional change script. (PowerShell script does that easily) Save the change script into a folder in your source tree call Update. Commit the change script along with the source code that corresponds to the change.

16 The continuous integration server detects changes to the source control repository than it:
It builds the application code. It executes the applications unit tests. Executes the database create task to create a new database with all of the changes that are in source control. Executes the projects integration (data access) tests. Marks the build a success when all the tests pass. Each developer runs the build script locally after receiving new schema changes scripts from the source code repository.

17 To rebuild WeeeTest database on PRORESDBDEV server using scripts:
The change management managers execute the script using the Database deployer tool (like Jenkins) to run the database scripts against the Dev, Test and staging environments when the environments receive their next update of the source code. To rebuild WeeeTest database on PRORESDBDEV server using scripts: C:\Program Files (x86)\Jenkins\jobs\WEEE\jobs\Deploy WEEE to Dev\workspace > build\Database\AliaSQL.exe Rebuild PRORESDBDEV WeeeTest build\Database weeeadmin weeeadmin With Test Data: C:\Program Files (x86)\Jenkins\jobs\WEEE\jobs\Deploy WEEE to Dev\workspace> build\Database\AliaSQL.exe TestData PRORESDBDEV WeeeTest

18 DEMO

19 Q & A

20 THANK YOU !!!


Download ppt "Presented by : Chirag Dani & Dhaval Shah"

Similar presentations


Ads by Google