From c29bd8ad971029beaf5059d2e5f3b6c09d5de5b4 Mon Sep 17 00:00:00 2001 From: Zachary Rankin Date: Thu, 6 Mar 2014 21:57:25 -0800 Subject: [PATCH] Show a nice message if triggers, indexes, columns, etc are not setup on a table --- Controller/SchemaController.php | 7 +++- View/Schema/table_describe.ctp | 64 +++++++++++++++++++++++++++------ 2 files changed, 59 insertions(+), 12 deletions(-) diff --git a/Controller/SchemaController.php b/Controller/SchemaController.php index 21fc253..e751411 100644 --- a/Controller/SchemaController.php +++ b/Controller/SchemaController.php @@ -28,7 +28,12 @@ public function tableDescribe() $description = new \SQLBoss\Describe\Table($schema, $table, $table_queries); $this->set('table_name', $this->params['pass'][0]); - $this->set('description', $description); + $this->set('columns', $description->getFields()); + $this->set('indexes', $description->getIndexes()); + $this->set('foreign_keys', $description->getForeignKeys()); + $this->set('triggers', $description->getTriggers()); + $this->set('references', $description->getReferences()); + $this->set('checks', $description->getChecks()); } public function tableDefinition() diff --git a/View/Schema/table_describe.ctp b/View/Schema/table_describe.ctp index 7eaf331..f287fdc 100644 --- a/View/Schema/table_describe.ctp +++ b/View/Schema/table_describe.ctp @@ -36,16 +36,23 @@ $this->Html->css('/media/sqlboss/schema/css/tableDescribe', null, array('inline' - getFields() as $field): ?> + - -
+ + No columns + + + + + + +
-
 
+
 
- + - +

Indexes

@@ -57,7 +64,14 @@ $this->Html->css('/media/sqlboss/schema/css/tableDescribe', null, array('inline' - getIndexes() as $index): ?> + + + + No indexes + + + +
@@ -74,7 +88,14 @@ $this->Html->css('/media/sqlboss/schema/css/tableDescribe', null, array('inline' - getChecks() as $check): ?> + + + + No check constraints + + + +
@@ -91,7 +112,14 @@ $this->Html->css('/media/sqlboss/schema/css/tableDescribe', null, array('inline' - getForeignKeys() as $fk): ?> + + + + No foreign-key contraints + + + +
@@ -109,7 +137,14 @@ $this->Html->css('/media/sqlboss/schema/css/tableDescribe', null, array('inline' - getTriggers() as $trigger): ?> + + + + No triggers + + + + @@ -134,7 +169,14 @@ $this->Html->css('/media/sqlboss/schema/css/tableDescribe', null, array('inline' - getReferences() as $ref): ?> + + + + Not referenced + + + +