add inheritance support for db.tuples
parent
f47ee3ef18
commit
8f06c94ee8
|
@ -414,6 +414,25 @@ TUPLE: does-not-persist ;
|
||||||
[ class \ not-persistent = ] must-fail-with
|
[ class \ not-persistent = ] must-fail-with
|
||||||
] test-postgresql
|
] test-postgresql
|
||||||
|
|
||||||
|
|
||||||
|
TUPLE: suparclass a ;
|
||||||
|
|
||||||
|
suparclass f {
|
||||||
|
{ "id" "ID" +db-assigned-id+ }
|
||||||
|
{ "a" "A" INTEGER }
|
||||||
|
} define-persistent
|
||||||
|
|
||||||
|
TUPLE: subbclass < suparclass b ;
|
||||||
|
|
||||||
|
subbclass "SUBCLASS" {
|
||||||
|
{ "b" "B" TEXT }
|
||||||
|
} define-persistent
|
||||||
|
|
||||||
|
: test-db-inheritance ( -- )
|
||||||
|
[ ] [ subbclass ensure-table ] unit-test ;
|
||||||
|
|
||||||
|
[ test-db-inheritance ] test-sqlite
|
||||||
|
|
||||||
! Don't comment these out. These words must infer
|
! Don't comment these out. These words must infer
|
||||||
\ bind-tuple must-infer
|
\ bind-tuple must-infer
|
||||||
\ insert-tuple must-infer
|
\ insert-tuple must-infer
|
||||||
|
|
|
@ -19,7 +19,7 @@ ERROR: not-persistent ;
|
||||||
"db-table" word-prop [ not-persistent ] unless* ;
|
"db-table" word-prop [ not-persistent ] unless* ;
|
||||||
|
|
||||||
: db-columns ( class -- obj )
|
: db-columns ( class -- obj )
|
||||||
"db-columns" word-prop ;
|
superclasses [ "db-columns" word-prop ] map concat ;
|
||||||
|
|
||||||
: db-relations ( class -- obj )
|
: db-relations ( class -- obj )
|
||||||
"db-relations" word-prop ;
|
"db-relations" word-prop ;
|
||||||
|
|
Loading…
Reference in New Issue