aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Migration/Attributes/CreateTable.php
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2024-07-17 10:49:11 -0100
committerMaxence Lange <maxence@artificial-owl.com>2024-07-29 12:44:52 -0100
commit88cfab4f329c7ee1f360be1ad7d90cf767da3720 (patch)
treead460429a5d58ef5ac67450cabc24e54bb9b1d9e /lib/public/Migration/Attributes/CreateTable.php
parent10821643645f1e9ab5d6d768bd52b37468722d3f (diff)
downloadnextcloud-server-88cfab4f329c7ee1f360be1ad7d90cf767da3720.tar.gz
nextcloud-server-88cfab4f329c7ee1f360be1ad7d90cf767da3720.zip
feat(upgrade): migration attributes
Signed-off-by: Maxence Lange <maxence@artificial-owl.com> d Signed-off-by: Maxence Lange <maxence@artificial-owl.com> f Signed-off-by: Maxence Lange <maxence@artificial-owl.com> d Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/public/Migration/Attributes/CreateTable.php')
-rw-r--r--lib/public/Migration/Attributes/CreateTable.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/public/Migration/Attributes/CreateTable.php b/lib/public/Migration/Attributes/CreateTable.php
new file mode 100644
index 00000000000..600d9bf4b9f
--- /dev/null
+++ b/lib/public/Migration/Attributes/CreateTable.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Migration\Attributes;
+
+use Attribute;
+
+#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_CLASS)]
+class CreateTable extends TableMigrationAttribute {
+ public function definition(): string {
+ $definition = empty($this->getTable()) ? 'Creation of a new table' : 'Creation of new table \'' . $this->getTable() . '\'';
+ $definition .= empty($this->getColumns()) ? '' : ' with columns ' . implode(', ', $this->getColumns());
+ return $definition;
+ }
+}