Schemas switching
This commit is contained in:
parent
349931780a
commit
6d1e47ceaf
8
Makefile
8
Makefile
|
@ -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))
|
||||
%:
|
||||
@:
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -694,7 +694,7 @@ AbstractClass.prototype.isNewRecord = function () {
|
|||
* @private
|
||||
*/
|
||||
AbstractClass.prototype._adapter = function () {
|
||||
return this.constructor.schema.adapter;
|
||||
return this.schema.adapter;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue