
delete from /test/oo/car/camry with version
/**
onerror(continue)
noerrinfo()
**/
;

delete from /test/oo/Dimension with version
/**
onerror(continue)
noerrinfo()
**/
;

delete from /test/oo/wheel with version
/**
onerror(continue)
noerrinfo()
**/
;

delete from /test/oo/chair with version
/**
onerror(continue)
noerrinfo()
**/
;

delete from /test/oo/car with version
/**
onerror(continue)
noerrinfo()
**/
;

delete from /test/oo/light with version
/**
onerror(continue)
noerrinfo()
**/
;

delete from /test/oo with version
/**
onerror(continue)
noerrinfo()
**/
;

-- drop class if exists /test/oo/car/camry;
-- drop class if exists /test/oo/light;
-- drop class if exists /test/oo/car;
-- drop class if exists /test/oo/chair;
-- drop class if exists /test/oo/wheel;
-- drop class if exists /test/oo/Dimension;
-- drop class if exists /test/oo;

create class if not exists /test() with namespace="test"
;

create class if not exists /test/oo();

create class if not exists Dimension : /test/oo (
    llength		int,
    wwidth		int,
    
    bk2  bucket {
            "type"  :  "tsdb",
            "param" : ["iparam1","iparam2","fparam1","fparam2","sparam1","vparam1"],
            "ptype" : ["i","i","f","f","s","s"],
            "unit"  : ["%","m","ms","ns","",""],
            "precision":[0,0,3,4,0,0],
            "ttl"   :   365,
            "crc"	 :	["iparam1", "sparam1"]
        } 'full',
        
    indexes(llength, wwidth)
) with key=manu ;

create class if not exists Chair : /test/oo (
    llength		int,
    wwidth		int,
    indexes(llength, wwidth)
) with key=manu ;

create class if not exists Light : /test/oo (
    lnum		int,
    indexes(lnum)
) with key=manu ;

create class if not exists Wheel : /test/oo (
    
    dim				Dimension,
    mymorph			Morph<Chair, Light>[2],
    remark		varchar,
    
    indexes(remark)
) with key=manu ;

create class if not exists Car : /test/oo (
    
    wheel		Wheel[4..4],
    remark		varchar,
    
    indexes(remark)
) with key=manu ;	

create class if not exists Camry : Car () with key=manu ;

alter class /test/oo/car add column  bk2  bucket {
        "type"  :  "tsdb",
        "param" : ["iparam1","iparam2","fparam1","fparam2","sparam1","vparam1"],
        "ptype" : ["i","i","f","f","s","s"],
        "unit"  : ["%","m","ms","ns","",""],
        "precision":[0,0,3,4,0,0],
        "ttl"   :   365,
        "crc"	 :	["iparam1", "sparam1"]
    } 'full',
    
    wwheel Wheel[4..4] "hhh"
/**
onerror(continue)
**/
;
