Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
grunt-liquibase-mysql
Advanced tools
Simple integration of liquibase with grunt - specifically for postgresql
Simple integration of liquibase with grunt - specifically for postgresql (the postgresql jdbc driver is bundled as part of the module - if you want to add more support then feel free to fork)
This plugin requires Grunt ~0.4.2
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-liquibase --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-liquibase');
In your project's Gruntfile, add a section named liquibase
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
liquibase : {
options: {
username : 'DB_USERNAME',
password : 'DB_PASSWORD',
url : 'jdbc:postgresql://DB_HOST:DB_PORT/DB_NAME'
},
update: {
command: 'update'
},
dropAll: {
command: 'dropAll'
},
version : {
command: 'version'
}
},
});
If running grunt with the --no-write
CLI flag, then no liquibase commands will be excuted. This is useful for performing a dry run to verify that the liquibase commands are being formed as you expect.
grunt liquibase:update --no-write --verbose
Produces:
...
Will excecute:update
Command: java -jar /Users/grunt-liquibase/lib/liquibase.jar --classpath /Users/grunt-liquibase/lib/postgresql-9.3-1100.jdbc41.jar --driver org.postgresql.Driver --logLevel info --username test_username --password test_password --url jdbc:postgresql://DB_HOST:DB_PORT/DB_NAME --changeLogFile changelog.xml update
>> no-write specified, not running command
Type: String
Default value: NONE - required
Database user - passed into the --username
argument to liquibase.
Type: String
Default value: NONE - required
Database password - passed into the --password
argument to liquibase.
Type: String
Default value: NONE - required
JDBC url - passed into the --url
argument to liquibase.
Type: String
Default value: changelog.xml
Path to the changelog file for liquibase.
Type: String
Default value: postgresql-9.3-1100.jdbc41.jar
Path to the jar file containing the jdbc driver. The module contains this jar file so you don't need it if you are talking to a postgresql database. Passed into the --classpath
argument to liquibase.
Type: String
Default value: org.postgresql.Driver
JDBC driver class. Passed into the --driver
argument to liquibase.
Type: String
Default value: null
Default schema name
Type: String
Default value: null
Liquibase properties file path
Type: String
Default value: info
Liquibase logLevel
Runs all changesets in the changeLogFile
Drops all database objects owned by the user. Note that functions, procedures and packages are not dropped
Rollback changesets in the changeLogFile to a specific tag. Must also supply the target tag as the commandAttr.
Rollback to version 0.0.1
grunt.initConfig({
liquibase: {
options: {
username : 'dbuser',
password : 'passwd',
url : 'jdbc:postgresql://localhost:5432/test_db'
},
rollback: {
command: 'rollback',
commandAttr: 'v0.0.1'
}
},
});
Rollback up to N changesets in the changeLogFile. Must also supply the number of changesets to rollback in the commandAttr.
Rollback the last 3 changesets
grunt.initConfig({
liquibase: {
options: {
username : 'dbuser',
password : 'passwd',
url : 'jdbc:postgresql://localhost:5432/test_db'
},
rollback: {
command: 'rollbackCount',
commandAttr: '3'
}
},
});
"Tags" the current database state for future rollback. Must also supply the desired tag name in the commadAttr.
Tag the current DB with v0.1.2
.
grunt.initConfig({
liquibase: {
options: {
username : 'dbuser',
password : 'passwd',
url : 'jdbc:postgresql://localhost:5432/test_db'
},
tag: {
command: 'tag',
commandAttr: 'v0.1.2'
}
},
});
In this example, the default options are used to update a postgresql database called test_db running on localhost at port 5432 using the user dbuser with password passwd with the contents of changelog.xml
grunt.initConfig({
liquibase: {
options: {
username : 'dbuser',
password : 'passwd',
url : 'jdbc:postgresql://localhost:5432/test_db'
},
command: 'update'
},
});
In this example, the location of the changelog file is modified.
grunt.initConfig({
liquibase: {
options: {
username : 'dbuser',
password : 'passwd',
url : 'jdbc:postgresql://localhost:5432/test_db',
changelog : 'src/database/dbchangelog.xml'
},
command: 'update'
},
});
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
FAQs
Simple integration of liquibase with grunt - specifically for postgresql
We found that grunt-liquibase-mysql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.