0.2.3 • Published 10 years ago

pg-manager v0.2.3

Weekly downloads
3
License
MIT
Repository
github
Last release
10 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

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago