Skip to content

Commit

Permalink
Schemas switching
Browse files Browse the repository at this point in the history
  • Loading branch information
1602 committed Mar 31, 2013
1 parent 3499317 commit 6d1e47c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions Makefile
Expand Up @@ -56,20 +56,22 @@ about-docs:
GITBRANCH = $(shell git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') GITBRANCH = $(shell git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')


REPO = marcusgreenwood/hatchjs REPO = marcusgreenwood/hatchjs
TARGET = origin
FROM = $(GITBRANCH) FROM = $(GITBRANCH)
TO = $(GITBRANCH) TO = $(GITBRANCH)


pull: pull:
git pull origin $(FROM) git pull $(TARGET) $(FROM)


safe-pull: safe-pull:
git pull origin $(FROM) --no-commit git pull $(TARGET) $(FROM) --no-commit


push: test push: test
git push origin $(TO) git push $(TARGET) $(TO)


feature: feature:
git checkout -b feature-$(filter-out $@,$(MAKECMDGOALS)) git checkout -b feature-$(filter-out $@,$(MAKECMDGOALS))
git push -u $(TARGET) feature-$(filter-out $@,$(MAKECMDGOALS))
%: %:
@: @:


Expand Down
2 changes: 2 additions & 0 deletions docs/roadmap.md
Expand Up @@ -19,6 +19,8 @@ jugglingdb-roadmap - The Future of JugglingDB


## MODEL CORE ## MODEL CORE


* schema switching
* common transaction support
* virtual attributes * virtual attributes
* object presentation modes * object presentation modes
* mass-assignment protection * mass-assignment protection
Expand Down
2 changes: 1 addition & 1 deletion lib/model.js
Expand Up @@ -694,7 +694,7 @@ AbstractClass.prototype.isNewRecord = function () {
* @private * @private
*/ */
AbstractClass.prototype._adapter = function () { AbstractClass.prototype._adapter = function () {
return this.constructor.schema.adapter; return this.schema.adapter;
}; };


/** /**
Expand Down
3 changes: 2 additions & 1 deletion lib/schema.js
Expand Up @@ -163,11 +163,12 @@ Schema.prototype.define = function defineClass(className, properties, settings)
standartize(properties, settings); standartize(properties, settings);


// every class can receive hash of data as optional param // every class can receive hash of data as optional param
var NewClass = function ModelConstructor(data) { var NewClass = function ModelConstructor(data, schema) {
if (!(this instanceof ModelConstructor)) { if (!(this instanceof ModelConstructor)) {
return new ModelConstructor(data); return new ModelConstructor(data);
} }
AbstractClass.call(this, data); AbstractClass.call(this, data);
this.schema = schema || this.constructor.schema;
}; };


hiddenProperty(NewClass, 'schema', schema); hiddenProperty(NewClass, 'schema', schema);
Expand Down

0 comments on commit 6d1e47c

Please sign in to comment.