Skip to content

Instantly share code, notes, and snippets.

View goyalmohit's full-sized avatar

mohit goyal goyalmohit

View GitHub Profile
{
"databaseChangeLog": [{
"changeSet": {
"id": "20190221092200",
"author": "mohitgoyal",
"changes": [{
"createTable": {
"catalogName": "AdventureWorks2017",
"columns": [{
"column": {
@goyalmohit
goyalmohit / liquibase.properties
Last active March 2, 2019 09:53
Define default values for liquibase command
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
classpath: ..\\Program Files\\Microsoft JDBC Driver 6.0 for SQL Server\\sqljdbc_6.0\\enu\\jre8\\sqljdbc42.jar
url: jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks2017;integratedSecurity=false;
changeLogFile: C:\\Source\\changelog-01.json
username: liquibase
password: liquibase@123
logLevel: info
liquibase
--driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
--classpath="C:\\Program Files\\Microsoft JDBC Driver 6.0 for SQL Server\\sqljdbc_6.0\\enu\\jre8\\sqljdbc42.jar"
--url="jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks2017;integratedSecurity=false;"
--changeLogFile="D:\Source\master.xml"
--username=liquibase
--password=liquibase@123
Update
@goyalmohit
goyalmohit / sample-changelog.sql
Created February 21, 2019 19:31
liquibase changelog sample in sql format
--liquibase formatted sql
--changeset mohitgoyal:20190221092200
CREATE TABLE [dbo].[CustomerDetails](
[CustomerTypeID] [nchar](10) NULL,
[CustomerDesc] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
@goyalmohit
goyalmohit / sample-changelog.json
Last active February 21, 2019 19:22
liquibase changelog sample in json format
{
"databaseChangeLog": [{
"changeSet": {
"id": "20190221092200",
"author": "mohitgoyal",
"changes": [{
"createTable": {
"catalogName": "AdventureWorks2017",
"columns": [{
"column": {
@goyalmohit
goyalmohit / sample-changelog.yaml
Last active February 28, 2019 03:27
liquibase changelog sample in yaml format
changeSet:
id: 20190221092200
author: mohitgoyal
changes:
- createTable:
catalogName: AdventureWorks2017
columns:
- column:
name: CustomerTypeID
type: nchar(10)
@goyalmohit
goyalmohit / sample-changelog.xml
Created February 21, 2019 04:14
liquibase changelog sample in xml format
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="mohitgoyal" id="20190221092200">
<createTable tableName="dbo.CustomerDetails">
<column name="CustomerTypeID" type="nchar(10)"/>
<column name="CustomerDesc" type="nvarchar (max) (16)"/>
</createTable>
</changeSet>
</databaseChangeLog>
@goyalmohit
goyalmohit / changeset-content-only.xml
Created February 17, 2019 22:20
Sample changeset for liquibase
<changeSet author="mohit" id="91">
<createTable tableName="Customers">
<column name="CustomerID" type="nchar(5)">
<constraints primaryKey="true" primaryKeyName="PK_Customers"/>
</column>
<column name="CompanyName" type="nvarchar(40)">
<constraints nullable="false"/>
</column>
<column name="ContactName" type="nvarchar(30)"/>
<column name="ContactTitle" type="nvarchar(30)"/>
@goyalmohit
goyalmohit / liquibase-changelog.xml
Created February 17, 2019 22:18
Empty changelog file for the liquibase
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
</databaseChangeLog>
@goyalmohit
goyalmohit / Show-NestedLoopProgress.ps1
Created February 8, 2019 22:32
Display progress of long running operations using Write-Progress Cmdlet
$outerLoopMax = 255
$innerLoopMax = 126
for ($outerCounter=1; $outerCounter -lt $outerLoopMax; $outerCounter++) {
Write-Progress -Activity "Main loop progress:" `
-PercentComplete ([int](100 * $outerCounter / $outerLoopMax)) `
-CurrentOperation ("Completed {0}%" -f ([int](100 * $outerCounter / $outerLoopMax))) `
-Status ("Outer loop working on item [{0}]" -f $outerCounter) `
-Id 1