tableName() public static method

public static tableName ( )
 public function down()
 {
     $this->dropColumn(Project::tableName(), 'post_release');
     $this->renameColumn(Project::tableName(), 'pre_release', 'post_release');
     echo "m151014_115546_add_pre_release_task be reverted.\n";
     return true;
 }
 public function down()
 {
     $this->dropColumn(Project::tableName(), 'keep_version_num');
     $this->dropColumn(Task::tableName(), 'enable_rollback');
     echo "m151027_063246_keep_version_num was reverted.\n";
     return true;
 }
Example #3
0
 /**
  * 提交任务
  *
  * @param $projectId 没有projectId则显示列表
  * @return string
  */
 public function actionSubmit($projectId = null)
 {
     // 为了方便用户更改表名,避免表名直接定死
     $projectTable = Project::tableName();
     $groupTable = Group::tableName();
     if (!$projectId) {
         // 显示所有项目列表
         $projects = Project::find()->leftJoin(Group::tableName(), "`{$groupTable}`.`project_id` = `{$projectTable}`.`id`")->where(["`{$projectTable}`.status" => Project::STATUS_VALID, "`{$groupTable}`.`user_id`" => $this->uid])->asArray()->all();
         return $this->render('select-project', ['projects' => $projects]);
     }
     $task = new Task();
     $conf = Project::getConf($projectId);
     if (!$conf) {
         throw new \Exception(yii::t('task', 'unknown project'));
     }
     if (\Yii::$app->request->getIsPost()) {
         $group = Group::find()->where(['user_id' => $this->uid, 'project_id' => $projectId])->count();
         if (!$group) {
             throw new \Exception(yii::t('task', 'you are not the member of project'));
         }
         if ($task->load(\Yii::$app->request->post())) {
             // 是否需要审核
             $status = $conf->audit == Project::AUDIT_YES ? Task::STATUS_SUBMIT : Task::STATUS_PASS;
             $task->user_id = $this->uid;
             $task->project_id = $projectId;
             $task->status = $status;
             if ($task->save()) {
                 return $this->redirect('@web/task/');
             }
         }
     }
     $tpl = $conf->repo_type == Project::REPO_GIT ? 'submit-git' : 'submit-svn';
     return $this->render($tpl, ['task' => $task, 'conf' => $conf]);
 }
 public function up()
 {
     $this->alterColumn(Project::tableName(), 'excludes', Schema::TYPE_TEXT . ' COMMENT "要排除的文件"');
     $this->alterColumn(Project::tableName(), 'hosts', Schema::TYPE_TEXT . ' COMMENT "目标机器列表"');
     $this->alterColumn(Project::tableName(), 'pre_deploy', Schema::TYPE_TEXT . ' COMMENT "部署前置任务"');
     $this->alterColumn(Project::tableName(), 'post_deploy', Schema::TYPE_TEXT . ' COMMENT "同步之前任务"');
     $this->alterColumn(Project::tableName(), 'post_release', Schema::TYPE_TEXT . ' COMMENT "同步之后任务"');
 }
 public function actionProject()
 {
     $projectNames = ['GeekBand-I150001', 'GeekBand-I150002', 'GeekBand-I150003', 'GeekBand-I150004', 'GeekBand-I150005', 'GeekBand-I150006', 'GeekBand-I150007', 'GeekBand-I150008', 'GeekBand-I150009', 'GeekBand-I150010', 'GeekBand-I150011', 'GeekBand-I150012', 'GeekBand-I150013', 'GeekBand-I150014', 'GeekBand-I150015', 'GeekBand-I150016', 'GeekBand-I150017', 'GeekBand-I150018', 'GeekBand-I150019', 'GeekBand-I150020', 'GeekBand-I150021', 'GeekBand-I150022', 'GeekBand-I150023', 'GeekBand-I150024', 'GeekBand-I150025', 'GeekBand-I150026', 'GeekBand-I150027', 'GeekBand-I150028', 'GeekBand-I150029', 'GeekBand-I150030', 'GeekBand-I150031', 'GeekBand-I150032', 'GeekBand-I150033', 'GeekBand-I150034', 'GeekBand-I150035', 'GeekBand-I150036', 'GeekBand-I150037', 'GeekBand-I150038', 'GeekBand-I150039', 'GeekBand-I150040', 'GeekBand-A150001', 'GeekBand-A150002', 'GeekBand-A150003', 'GeekBand-A150004', 'GeekBand-A150005', 'GeekBand-A150006', 'GeekBand-A150007', 'GeekBand-A150008', 'GeekBand-A150009', 'GeekBand-A150010', 'GeekBand-A150011', 'GeekBand-A150012', 'GeekBand-A150013', 'GeekBand-A150014', 'GeekBand-A150015', 'GeekBand-A150016', 'GeekBand-A150017', 'GeekBand-A150018', 'GeekBand-A150019', 'GeekBand-A150020', 'GeekBand-A150021', 'GeekBand-A150022', 'GeekBand-A150023', 'GeekBand-A150024', 'GeekBand-A150025', 'GeekBand-A150026', 'GeekBand-A150027', 'GeekBand-A150028', 'GeekBand-A150029', 'GeekBand-A150030', 'GeekBand-A150031', 'GeekBand-A150032', 'GeekBand-A150033', 'GeekBand-A150034', 'GeekBand-A150035', 'GeekBand-A150036', 'GeekBand-A150037', 'GeekBand-A150038', 'GeekBand-A150039', 'GeekBand-A150040', 'G2015010001', 'G2015010002', 'G2015010003', 'G2015010004', 'G2015010005', 'G2015010006', 'G2015010007', 'G2015010008', 'G2015010009', 'G2015010010', 'G2015010011', 'G2015010012', 'G2015010013', 'G2015010014', 'G2015010015', 'G2015010016', 'G2015010017', 'G2015010018', 'G2015010019', 'G2015010020', 'G2015010021', 'G2015010022', 'G2015010023', 'G2015010024', 'G2015010025', 'G2015010026', 'G2015010027', 'G2015010028', 'G2015010029', 'G2015010030', 'G2015010031', 'G2015010032', 'G2015010033', 'G2015010034', 'G2015010035', 'G2015010036', 'G2015010037', 'G2015010038', 'G2015010039', 'G2015010040', 'G2015010041', 'G2015010042', 'G2015010043', 'G2015010044', 'G2015010045', 'G2015010046', 'G2015010047', 'G2015010048', 'G2015010049', 'G2015010050', 'G2015010051', 'G2015010052', 'G2015010053', 'G2015010054', 'G2015010055', 'G2015010056', 'G2015010057', 'G2015010058', 'G2015010059', 'G2015010060', 'G2015010061', 'G2015010062', 'G2015010063', 'G2015010064', 'G2015010065', 'G2015010066', 'G2015010067', 'G2015010068', 'G2015010069', 'G2015010070', 'G2015010071', 'G2015010072', 'G2015010073', 'G2015010074', 'G2015010075', 'G2015010076', 'G2015010077', 'G2015010078', 'G2015010079', 'G2015010080', 'G2015010081', 'G2015010082', 'G2015010083', 'G2015010084', 'G2015010085', 'G2015010086', 'G2015010087', 'G2015010088', 'G2015010089', 'G2015010090', 'G2015010091', 'G2015010092', 'G2015010093', 'G2015010094', 'G2015010095', 'G2015010096', 'G2015010097', 'G2015010098', 'G2015010099', 'G2015010100', 'G2015010101', 'G2015010102', 'G2015010103', 'G2015010104', 'G2015010105', 'G2015010106', 'G2015010107', 'G2015010108', 'G2015010109', 'G2015010110', 'G2015010111', 'G2015010112', 'G2015010113', 'G2015010114', 'G2015010115', 'G2015010116', 'G2015010117', 'G2015010118', 'G2015010119', 'G2015010120', 'G2015010121', 'G2015010122', 'G2015010123', 'G2015010124', 'G2015010125', 'G2015010126', 'G2015010127', 'G2015010128', 'G2015010129', 'G2015010130', 'G2015010131', 'G2015010132', 'G2015010133', 'G2015010134', 'G2015010135', 'G2015010136', 'G2015010137', 'G2015010138', 'G2015010139', 'G2015010140', 'G2015010141', 'G2015010142', 'G2015010143', 'G2015010144', 'G2015010145', 'G2015010146', 'G2015010147', 'G2015010148', 'G2015010149', 'G2015010150', 'G2015010151', 'G2015010152', 'G2015010153', 'G2015010154', 'G2015010155', 'G2015010156', 'G2015010157', 'G2015010158', 'G2015010159', 'G2015010160', 'G2015010161', 'G2015010162', 'G2015010163', 'G2015010164', 'G2015010165', 'G2015010166', 'G2015010167', 'G2015010168', 'G2015010169', 'G2015010170', 'G2015010171', 'G2015010172', 'G2015010173', 'G2015010174', 'G2015010175', 'G2015010176', 'G2015010177', 'G2015010178', 'G2015010179', 'G2015010180', 'G2015010181', 'G2015010182', 'G2015010183', 'G2015010184', 'G2015010185', 'G2015010186', 'G2015010187', 'G2015010188', 'G2015010189', 'G2015010190', 'G2015010191', 'G2015010192', 'G2015010193', 'G2015010194', 'G2015010195', 'G2015010196', 'G2015010197', 'G2015010198', 'G2015010199', 'G2015010200', 'G2015010201', 'G2015010202', 'G2015010203', 'G2015010204', 'G2015010205', 'G2015010206', 'G2015010207', 'G2015010208', 'G2015010209', 'G2015010210', 'G2015010211', 'G2015010212', 'G2015010213', 'G2015010214', 'G2015010215', 'G2015010216', 'G2015010217', 'G2015010218', 'G2015010219', 'G2015010220', 'G2015010221', 'G2015010222', 'G2015010223', 'G2015010224', 'G2015010225', 'G2015010226', 'G2015010227', 'G2015010228', 'G2015010229', 'G2015010230', 'G2015010231', 'G2015010232', 'G2015010233', 'G2015010234', 'G2015010235', 'G2015010236', 'G2015010237', 'G2015010238', 'G2015010239', 'G2015010240', 'G2015010241', 'G2015010242', 'G2015010243', 'G2015010244', 'G2015010245', 'G2015010246', 'G2015010247', 'G2015010248', 'G2015010249', 'G2015010250', 'G2015010251', 'G2015010252', 'G2015010253', 'G2015010254', 'G2015010255', 'G2015010256', 'G2015010257', 'G2015010258', 'G2015010259', 'G2015010260', 'G2015010261', 'G2015010262', 'G2015010263', 'G2015010264', 'G2015010265', 'G2015010266', 'G2015010267', 'G2015010268', 'G2015010269', 'G2015010270', 'G2015010271', 'G2015010272', 'G2015010273', 'G2015010274', 'G2015010275', 'G2015010276', 'G2015010277', 'G2015010278', 'G2015010279', 'G2015010280', 'G2015010281', 'G2015010282', 'G2015010283', 'G2015010284', 'G2015010285', 'G2015010286', 'G2015010287', 'G2015010288', 'G2015010289', 'G2015010290', 'G2015010291', 'G2015010292', 'G2015010293', 'G2015010294', 'G2015010295', 'G2015010296', 'G2015010297', 'G2015010298', 'G2015010299', 'G2015010300', 'G2015010301', 'G2015010302', 'G2015010303', 'G2015010304', 'G2015010305', 'G2015010306', 'G2015010307', 'G2015010308', 'G2015010309', 'G2015010310', 'G2015010311', 'G2015010312', 'G2015010313', 'G2015010314', 'G2015010315', 'G2015010316', 'G2015010317', 'G2015010318', 'G2015010319', 'G2015010320', 'G2015010321', 'G2015010322', 'G2015010323', 'G2015010324', 'G2015010325', 'G2015010326', 'G2015010327', 'G2015010328', 'G2015010329', 'G2015010330', 'G2015010331', 'G2015010332', 'G2015010333', 'G2015010334', 'G2015010335', 'G2015010336', 'G2015010337', 'G2015010338', 'G2015010339', 'G2015010340', 'G2015010341', 'G2015010342', 'G2015010343', 'G2015010344', 'G2015010345', 'G2015010346', 'G2015010347', 'G2015010348', 'G2015010349', 'G2015010350', 'G2015010351', 'G2015010352', 'G2015010353', 'G2015010354', 'G2015010355', 'G2015010356', 'G2015010357', 'G2015010358', 'G2015010359', 'G2015010360', 'G2015010361', 'G2015010362', 'G2015010363', 'G2015010364', 'G2015010365', 'G2015010366', 'G2015010367', 'G2015010368', 'G2015010369', 'G2015010370', 'G2015010371', 'G2015010372', 'G2015010373', 'G2015010374', 'G2015010375', 'G2015010376', 'G2015010377', 'G2015010378', 'G2015010379', 'G2015010380', 'G2015010381', 'G2015010382', 'G2015010383', 'G2015010384', 'G2015010385', 'G2015010386', 'G2015010387', 'G2015010388', 'G2015010389', 'G2015010390', 'G2015010391', 'G2015010392', 'G2015010393', 'G2015010394', 'G2015010395', 'G2015010396', 'G2015010397', 'G2015010398', 'G2015010399', 'G2015010400', 'G2015010401', 'G2015010402', 'G2015010403', 'G2015010404', 'G2015010405', 'G2015010406', 'G2015010407', 'G2015010408', 'G2015010409', 'G2015010410', 'G2015010411', 'G2015010412', 'G2015010413', 'G2015010414', 'G2015010415', 'G2015010416', 'G2015010417', 'G2015010418', 'G2015010419', 'G2015010420', 'G2015010421', 'G2015010422', 'G2015010423', 'G2015010424', 'G2015010425', 'G2015010426', 'G2015010427', 'G2015010428', 'G2015010429', 'G2015010430', 'G2015010431', 'G2015010432', 'G2015010433', 'G2015010434', 'G2015010435', 'G2015010436', 'G2015010437', 'G2015010438', 'G2015010439', 'G2015010440', 'G2015010441', 'G2015010442', 'G2015010443', 'G2015010444', 'G2015010445', 'G2015010446', 'G2015010447', 'G2015010448', 'G2015010449', 'G2015010450', 'G2015010451', 'G2015010452', 'G2015010453', 'G2015010454', 'G2015010455', 'G2015010456', 'G2015010457', 'G2015010458', 'G2015010459', 'G2015010460', 'G2015010461', 'G2015010462', 'G2015010463', 'G2015010464', 'G2015010465', 'G2015010466', 'G2015010467', 'G2015010468', 'G2015010469', 'G2015010470', 'G2015010471', 'G2015010472', 'G2015010473', 'G2015010474', 'G2015010475', 'G2015010476', 'G2015010477', 'G2015010478', 'G2015010479', 'G2015010480', 'G2015010481', 'G2015010482', 'G2015010483', 'G2015010484', 'G2015010485', 'G2015010486', 'G2015010487', 'G2015010488', 'G2015010489', 'G2015010490', 'G2015010491', 'G2015010492', 'G2015010493', 'G2015010494', 'G2015010495', 'G2015010496', 'G2015010497', 'G2015010498', 'G2015010499', 'G2015010500', 'G2015010501', 'G2015010502', 'G2015010503', 'G2015010504', 'G2015010505', 'G2015010506', 'G2015010507', 'G2015010508', 'G2015010509', 'G2015010510', 'G2015010511', 'G2015010512', 'G2015010513', 'G2015010514', 'G2015010515', 'G2015010516', 'G2015010517', 'G2015010518', 'G2015010519', 'G2015010520', 'G2015010521', 'G2015010522', 'G2015010523', 'G2015010524', 'G2015010525', 'G2015010526', 'G2015010527', 'G2015010528', 'G2015010529', 'G2015010530', 'G2015010531', 'G2015010532', 'G2015010533', 'G2015010534', 'G2015010535', 'G2015010536', 'G2015010537', 'G2015010538', 'G2015010539', 'G2015010540', 'G2015010541', 'G2015010542', 'G2015010543', 'G2015010544', 'G2015010545', 'G2015010546', 'G2015010547', 'G2015010548', 'G2015010549', 'G2015010550', 'G2015010551', 'G2015010552', 'G2015010553', 'G2015010554', 'G2015010555', 'G2015010556', 'G2015010557', 'G2015010558', 'G2015010559', 'G2015010560', 'G2015010561', 'G2015010562', 'G2015010563', 'G2015010564', 'G2015010565', 'G2015010566', 'G2015010567', 'G2015010568', 'G2015010569', 'G2015010570', 'G2015010571', 'G2015010572', 'G2015010573', 'G2015010574', 'G2015010575', 'G2015010576', 'G2015010577', 'G2015010578', 'G2015010579', 'G2015010580', 'G2015010581', 'G2015010582', 'G2015010583', 'G2015010584', 'G2015010585', 'G2015010586', 'G2015010587', 'G2015010588', 'G2015010589', 'G2015010590', 'G2015010591', 'G2015010592', 'G2015010593', 'G2015010594', 'G2015010595', 'G2015010596', 'G2015010597', 'G2015010598', 'G2015010599', 'G2015010600', 'G2015010601', 'G2015010602', 'G2015010603', 'G2015010604', 'G2015010605', 'G2015010606', 'G2015010607', 'G2015010608', 'G2015010609', 'G2015010610', 'G2015010611', 'G2015010612', 'G2015010613', 'G2015010614', 'G2015010615', 'G2015010616', 'G2015010617', 'G2015010618', 'G2015010619', 'G2015010620', 'G2015010621', 'G2015010622', 'G2015010623', 'G2015010624', 'G2015010625', 'G2015010626', 'G2015010627', 'G2015010628', 'G2015010629', 'G2015010630', 'G2015010631', 'G2015010632', 'G2015010633', 'G2015010634', 'G2015010635', 'G2015010636', 'G2015010637', 'G2015010638', 'G2015010639', 'G2015010640', 'G2015010641', 'G2015010642', 'G2015010643', 'G2015010644', 'G2015010645', 'G2015010646', 'G2015010647', 'G2015010648', 'G2015010649', 'G2015010650', 'G2015010651', 'G2015010652', 'G2015010653', 'G2015010654', 'G2015010655', 'G2015010656', 'G2015010657', 'G2015010658', 'G2015010659', 'G2015010660', 'G2015010661', 'G2015010662', 'G2015010663', 'G2015010664', 'G2015010665', 'G2015010666', 'G2015010667', 'G2015010668', 'G2015010669', 'G2015010670', 'G2015010671', 'G2015010672', 'G2015010673', 'G2015010674', 'G2015010675', 'G2015010676', 'G2015010677', 'G2015010678', 'G2015010679', 'G2015010680', 'G2015010681', 'G2015010682', 'G2015010683', 'G2015010684', 'G2015010685', 'G2015010686', 'G2015010687', 'G2015010688', 'G2015010689', 'G2015010690', 'G2015010691', 'G2015010692', 'G2015010693', 'G2015010694', 'G2015010695', 'G2015010696', 'G2015010697', 'G2015010698', 'G2015010699', 'G2015010700'];
     $bulkInsertArray = array();
     foreach ($projectNames as $name) {
         $bulkInsertArray[] = ['name' => $name];
     }
     Yii::$app->db->createCommand()->batchInsert(Project::tableName(), ['name'], $bulkInsertArray)->execute();
 }
 public function down()
 {
     $this->dropColumn(Project::tableName(), 'repo_username');
     $this->dropColumn(Project::tableName(), 'repo_password');
     $this->renameColumn(Project::tableName(), 'repo_url', 'git_url');
     $this->renameColumn(Project::tableName(), 'repo_mode', 'git_type');
     $this->dropColumn(Project::tableName(), 'repo_type');
     $this->dropColumn(Task::tableName(), 'file_list');
     echo "m151018_032238_support_svn be reverted.\n";
     return true;
 }
Example #7
0
 /**
  * 配置项目列表
  *
  */
 public function actionIndex()
 {
     // 为了方便用户更改表名,避免表名直接定死
     $groupTable = Group::tableName();
     $projectTable = Project::tableName();
     // 显示该用户为管理员的所有项目
     $project = Project::find()->leftJoin(Group::tableName(), "`{$groupTable}`.`project_id`=`{$projectTable}`.`id`")->where(["`{$groupTable}`.`user_id`" => $this->uid, "`{$groupTable}`.`type`" => Group::TYPE_ADMIN]);
     $kw = \Yii::$app->request->post('kw');
     if ($kw) {
         $project->andWhere(['like', "name", $kw]);
     }
     $project = $project->asArray()->all();
     return $this->render('index', ['list' => $project]);
 }
 public function up()
 {
     $this->dropColumn(Project::tableName(), 'conf');
     $this->addColumn(Project::tableName(), 'git_url', Schema::TYPE_STRING . '(200) DEFAULT "" COMMENT "git地址"');
     $this->addColumn(Project::tableName(), 'deploy_from', Schema::TYPE_STRING . '(200) NOT NULL COMMENT "宿主机存放clone出来的文件"');
     $this->addColumn(Project::tableName(), 'excludes', Schema::TYPE_STRING . '(500) DEFAULT "" COMMENT "要排除的文件"');
     $this->addColumn(Project::tableName(), 'release_user', Schema::TYPE_STRING . '(50) NOT NULL COMMENT "目标机器用户"');
     $this->addColumn(Project::tableName(), 'release_to', Schema::TYPE_STRING . '(200) NOT NULL COMMENT "目标机器的目录,相当于nginx的root,可直接web访问"');
     $this->addColumn(Project::tableName(), 'release_library', Schema::TYPE_STRING . '(200) NOT NULL COMMENT "目标机器版本发布库"');
     $this->addColumn(Project::tableName(), 'hosts', Schema::TYPE_STRING . '(500) NOT NULL COMMENT "目标机器列表"');
     $this->addColumn(Project::tableName(), 'pre_deploy', Schema::TYPE_STRING . '(500) DEFAULT "" COMMENT "部署前置任务"');
     $this->addColumn(Project::tableName(), 'post_deploy', Schema::TYPE_STRING . '(500) DEFAULT "" COMMENT "同步之前任务"');
     $this->addColumn(Project::tableName(), 'post_release', Schema::TYPE_STRING . '(500) DEFAULT "" COMMENT "同步之后任务"');
     $this->addColumn(Project::tableName(), 'git_type', Schema::TYPE_STRING . '(50) DEFAULT "branch" COMMENT "两种上线方式,分支、tag"');
     $this->addColumn(Project::tableName(), 'audit', Schema::TYPE_SMALLINT . '(1) DEFAULT 0 COMMENT "是否需要审核任务0不需要,1需要"');
     $this->dropColumn(Project::tableName(), 'created_at');
     $this->addColumn(Project::tableName(), 'created_at', Schema::TYPE_DATETIME . ' COMMENT "创建时间" after audit');
     $this->addColumn(Project::tableName(), 'updated_at', Schema::TYPE_DATETIME . ' COMMENT "修改时间"');
     $this->dropColumn(Task::tableName(), 'created_at');
     $this->addColumn(Task::tableName(), 'created_at', Schema::TYPE_DATETIME . ' COMMENT "创建时间"');
     $this->addColumn(Task::tableName(), 'updated_at', Schema::TYPE_DATETIME . ' COMMENT "修改时间"');
 }
Example #9
0
 /**
  * @param int $state
  * @return $this
  */
 public function status($state = 1)
 {
     $this->andWhere(Project::tableName() . '.status = ' . $state);
     return $this;
 }
 public function up()
 {
     $this->addColumn(\app\models\Task::tableName(), 'branch', \yii\db\Schema::TYPE_STRING . '(100) DEFAULT "master" comment "选择上线的分支"');
     $this->alterColumn(\app\models\Project::tableName(), 'name', \yii\db\Schema::TYPE_STRING . '(100) DEFAULT "master" comment "项目名字"');
 }
 public function down()
 {
     $this->dropColumn(Project::tableName(), 'ansible');
     echo "m160307_082032_ansible was reverted.\n";
     return true;
 }
 public function down()
 {
     $this->dropColumn(Project::tableName(), 'web_root_domain');
     echo "m160127_132028_project_web_domain was reverted.\n";
     return false;
 }
 public function down()
 {
     $this->dropColumn(Project::tableName(), 'post_release_delay');
     echo "m160402_173643_add_post_release_delay was reverted.\n";
     return true;
 }