add database migration support

This commit is contained in:
John Bintz 2016-01-14 07:07:24 -05:00
parent b72952b415
commit 74ab417191
4 changed files with 29 additions and 2 deletions

2
.gitignore vendored
View File

@ -14,4 +14,4 @@ pom.xml.asc
/public/out /public/out
/public/index.js /public/index.js
/images /images
/db

6
database.json Normal file
View File

@ -0,0 +1,6 @@
{
"dev": {
"driver": "sqlite3",
"filename": "db/dev.db"
}
}

View File

@ -0,0 +1,19 @@
var dbm = global.dbm || require('db-migrate');
var type = dbm.dataType;
exports.up = function(db, callback) {
db.createTable('images', {
id: {type: 'int', primaryKey: true},
path: 'string',
name: 'string',
width: 'int',
height: 'int',
type: 'string',
createdAt: 'int',
updatedAt: 'int'
}, callback);
};
exports.down = function(db, callback) {
db.dropTable('images', callback);
};

View File

@ -8,7 +8,9 @@
:source-paths ["src/server" "src/client"] :source-paths ["src/server" "src/client"]
:npm { :dependencies [[ws "0.4.30"] :npm { :dependencies [[ws "0.4.30"]
[imagemagick-native "https://github.com/elad/node-imagemagick-native.git"] [imagemagick-native "https://github.com/elad/node-imagemagick-native.git"]
[express "4.13.3"]]} [express "4.13.3"]
[sqlite3 "3.1.1"]
[db-migrate "0.9.23"]]}
:cljsbuild { :cljsbuild {
:builds [{:source-paths ["src/server"] :builds [{:source-paths ["src/server"]
:compiler { :compiler {