This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import liquibase.statement.core.InsertStatement | |
databaseChangeLog = { | |
changeSet(author: "Shashank Agrawal", id: "my-custom-unique-id-for-each-changeSet-11212013-1") { | |
grailsChange { | |
change { | |
def statements = [] | |
// Iterating through each row in table. | |
sql.eachRow('select * from old_table_name') { | |
def insertStatement = new InsertStatement("my_database_name", "new_table_name") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import liquibase.statement.core.* | |
import com.some.domain.Post | |
databaseChangeLog = { | |
// Auto generated change sets which adds column to the post table. | |
grailsChange { | |
change { | |
Post.list().each { postInstance -> | |
postInstance.dateCreated = new Date() | |
postInstance.lastUpdated = new Date() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
databaseChangeLog = { | |
changeSet(author: 'Shashank', id: 'post.description.051020123') { | |
comment { 'increase description to 1400 chars' } | |
modifyDataType(tableName: 'post', columnName: 'description', | |
newDataType: 'varchar(1400)') | |
// Altering the column removes the not null property (makes it nullable) if your column was non-nullable. | |
// To fix this, you can pass "NOT NULL" to newDataType attribute as given below | |
// https://stackoverflow.com/questions/35864845/liquibase-modifydatatype-tag-always-makes-the-column-nullable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
databaseChangeLog = { | |
changeSet(author: "Shashank", id: "1319193290536-6") { | |
dropColumn(columnName: "canPublish", tableName: "post") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
databaseChangeLog = { | |
changeSet(author: 'Shashank', id: '1557466397806-1') { | |
comment { 'change type to text' } | |
modifyDataType(tableName: 'partner_language', columnName: 'latest_text', newDataType: 'longtext') | |
// or | |
// modifyDataType(tableName: 'partner_language', columnName: 'latest_text', newDataType: 'text') | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
databaseChangeLog = { | |
changeSet(author: "Shashank", id: "1557466397806-1") { | |
addAutoIncrement(columnName: "id", tableName: "invite_code", columnDataType: "bigint") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
changeSet(author: "Shashank", id: "1557466397807-1") { | |
delete(tableName: "user_activity", whereClause: "id < 7") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
changeSet(author: "Shashank", id: "1557466397906-1") { | |
addUniqueConstraint(columnNames: "user_id", tableName: "user_activity") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
changeSet(author: "Shashank (generated)", id: "1557466497806-3") { | |
createIndex(indexName: "FK7268FEF5EE5762B4", tableName: "user_activity") { | |
column(name: "user_id") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias guntrack='git update-index --assume-unchanged' | |
alias gtrack='git update-index --no-assume-unchanged' | |
alias gco='git checkout' | |
alias gs='git status' | |
alias gl='git log' | |
## Git log version 1 | |
alias gl1="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --branches" | |
## Git log version 2 | |
alias gl2='git log --graph --pretty=oneline --abbrev-commit' | |
## Git log version 3 |