Skip to content
Vasiliy Isaichkin edited this page Mar 11, 2018 · 5 revisions

Welcome to the osmium-db wiki!

(async (DB) => {
	const db = new DB('test', 'test', 'testtest');
	db.defineSchema({
		categories: {
			'#'        : {timestamps: false},
			driver     : 'string',
			enabled    : 'boolean',
			hash       : 'string',
			icon       : 'string',
			idx        : 'string',
			name       : 'string',
			subCategory: 'integer',
			url        : 'string',
			'><items'  : {
				art    : 'string',
				colors : 'jsonb',
				driver : 'string',
				enabled: 'boolean',
				hash   : 'string',
				price  : 'integer',
				idx    : 'string',
				name   : 'string',
				size   : 'string',
				text   : 'text'
			}
		}
	});

	await db.sync({force: true});
	let id = (await db.crud.create('items', {art: 'BLA'})).id;
	await db.crud.update('items', {driver: 'BLA-BLA'}, {id});
	db.close();

})(require('../osmium-db'));
Clone this wiki locally