0.2.3 • Published 9 years ago

pg-manager v0.2.3

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

pg-manager

The database schema is stored as a series of changes in a folder 'schema_updates' at the root of your project.

1.sql
2.sql
...etc

When this tool is ran, it will check a table called "schema_changes" (it will be created if needed) and run the required sql files necessary to bring the database up to date. You can not 'downgrade' a database once it is updated.

##Grunt

// Gruntfile.js

var PGManager = require('pg-manager');
var pgManager = new PGManager({
	host: 'localhost',
	port: 5432,
	database: 'my-database',
	user: 'my-db-user',
	password: 'my-db-password'
});
module.exports = function(grunt) {
	grunt.registerTask('db-hard-reset', function () {
		var done = this.async();
		pgManager.hardReset()
		.then(function () {
			done();
		})
		.catch(function (err){
			grunt.log.error("Error: " + err);
			done(false);
		});
	});
	grunt.registerTask('db-update', function () {
		var done = this.async();
		pgManager.updateSchema()
		.then(function () {
			done();
		})
		.catch(function (err){
			grunt.log.error("Error: " + err);
			done(false);
		});
	});
};
0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago