Version 1
[yaffs-website] / web / modules / contrib / redirect / src / RedirectStorageSchema.php
diff --git a/web/modules/contrib/redirect/src/RedirectStorageSchema.php b/web/modules/contrib/redirect/src/RedirectStorageSchema.php
new file mode 100644 (file)
index 0000000..e034362
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+namespace Drupal\redirect;
+
+use Drupal\Core\Entity\ContentEntityTypeInterface;
+use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
+
+/**
+ * Defines the redirect schema.
+ */
+class RedirectStorageSchema extends SqlContentEntityStorageSchema {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
+    $schema = parent::getEntitySchema($entity_type, $reset);
+
+    // Add indexes.
+    $schema['redirect']['unique keys'] += [
+      'hash' => ['hash'],
+    ];
+    $schema['redirect']['indexes'] += [
+      // Limit length to 191.
+      'source_language' => [['redirect_source__path', 191], 'language'],
+    ];
+
+    return $schema;
+  }
+
+}