public function process(Schema $schema) { $schema->setNamespace('scheduler'); $job = $schema->createModel('job', 'Job', array('name' => 'Name', 'status' => 'Status', array('system', 'integer', 'System command'))); $schedule = $schema->createModel('schedule', 'Schedule', array('type' => 'Type', 'month' => 'Month', 'day' => 'Day', 'hour' => 'Hour', 'minute' => 'Minute', 'dt_next' => 'Date for next running')); $job->hasOne($schedule); $command = $schema->createModel('command', 'Job Command', array('command' => 'Command', array('priority', 'integer', 'Priority'))); $command->hasOne($job); // New, Active, Complete, Fail $task = $schema->createModel('task', 'Task', array('dt_scheduled' => 'Scheduled start date', 'dt_start' => 'Fact start date', 'dt_end' => 'Fact end date', 'status' => 'Status', array('success', 'integer', 'Success'))); $task->hasOne($job); $log = $schema->createModel('log', 'Log', array('output' => 'Output', 'dt_log' => 'Log date')); $log->hasOne($task); }
public function process(Schema $schema) { $schema->setNamespace('public'); $person = $schema->createModel('person', 'Пользователь', array('login' => array('comment' => 'Имя пользователя', 'required' => true), 'salt' => 'Соль для вычисления хэша', 'hash' => 'Полученный хэш', 'status' => array('type' => 'char', 'comment' => 'Статус'))); $person->createIndex('login'); $person->addBehaviour('log'); $module = $schema->createModel('module', 'Модуль', array('name' => 'Наименование')); // favorite modules link $favorite_module = $schema->createLink(array($person, 'favorite_module' => $module)); $favorite_module->addProperty('rating', array('comment' => 'Рейтинг', 'type' => 'integer', 'max' => 100, 'min' => 0)); // module developers link $schema->createLink(array($module, 'developer' => $person)); // default user module $schema->getModel('person')->hasOne('module')->usingAlias('default_module')->referencedBy('default_user')->setStrategy('merge'); // module owner $module->hasOne('person')->usingAlias('owner')->referencedBy('own_module'); // isolate model // $exchange = $schema->createModel('exchange', 'Точка обмена', array( // 'key' => 'Ключ', // 'value' => 'Значение' // )); // $exchange->setNamespace('other'); }