diff --git a/src/db/Schema.php b/src/db/Schema.php new file mode 100644 index 0000000..d99f68a --- /dev/null +++ b/src/db/Schema.php @@ -0,0 +1,60 @@ +quoteSimpleTableName($schema); + } + + return $this->db->createCommand($sql)->queryColumn(); + } +} diff --git a/src/variables/ConnectVariable.php b/src/variables/ConnectVariable.php index f0be30f..9c5195b 100644 --- a/src/variables/ConnectVariable.php +++ b/src/variables/ConnectVariable.php @@ -12,6 +12,7 @@ use nystudio107\connect\Connect; use nystudio107\connect\db\Query; +use nystudio107\connect\db\Schema; use nystudio107\connect\models\Settings; use Craft; @@ -67,6 +68,20 @@ public function query($connection = null): Query ]); } + /** + * Returns a new generic schema. + * + * @param null|Connection $connection + * + * @return Schema + */ + public function schema($connection = null): Schema + { + return new Schema([ + 'db' => $connection, + ]); + } + // Protected Methods // =========================================================================