Schemas switching

This commit is contained in:
Anatoliy Chakkaev 2013-03-31 16:35:26 +04:00
parent 349931780a
commit 6d1e47ceaf
4 changed files with 10 additions and 5 deletions

View File

@ -56,20 +56,22 @@ about-docs:
GITBRANCH = $(shell git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
REPO = marcusgreenwood/hatchjs
TARGET = origin
FROM = $(GITBRANCH)
TO = $(GITBRANCH)
pull:
git pull origin $(FROM)
git pull $(TARGET) $(FROM)
safe-pull:
git pull origin $(FROM) --no-commit
git pull $(TARGET) $(FROM) --no-commit
push: test
git push origin $(TO)
git push $(TARGET) $(TO)
feature:
git checkout -b feature-$(filter-out $@,$(MAKECMDGOALS))
git push -u $(TARGET) feature-$(filter-out $@,$(MAKECMDGOALS))
%:
@:

View File

@ -19,6 +19,8 @@ jugglingdb-roadmap - The Future of JugglingDB
## MODEL CORE
* schema switching
* common transaction support
* virtual attributes
* object presentation modes
* mass-assignment protection

View File

@ -694,7 +694,7 @@ AbstractClass.prototype.isNewRecord = function () {
* @private
*/
AbstractClass.prototype._adapter = function () {
return this.constructor.schema.adapter;
return this.schema.adapter;
};
/**

View File

@ -163,11 +163,12 @@ Schema.prototype.define = function defineClass(className, properties, settings)
standartize(properties, settings);
// 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)) {
return new ModelConstructor(data);
}
AbstractClass.call(this, data);
this.schema = schema || this.constructor.schema;
};
hiddenProperty(NewClass, 'schema', schema);