Skip to content

Commit 7c0522a

Browse files
committed
Use ensureIndex to create path_hash_ns_idx
1 parent 53908de commit 7c0522a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/DeployCache.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ public static function createTable(): void {
2424
path VARCHAR(2083) NOT NULL,
2525
file_hash CHAR(32) NOT NULL,
2626
namespace VARCHAR(128) NOT NULL,
27-
PRIMARY KEY (id),
28-
UNIQUE KEY path_hash_ns_idx (path_hash, namespace)
27+
PRIMARY KEY (id)
2928
) $charset_collate;";
3029

3130
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
3231
dbDelta( $sql );
32+
33+
Controller::ensureIndex(
34+
$table_name,
35+
'path_hash_ns_idx',
36+
"CREATE UNIQUE INDEX path_hash_ns_idx ON $table_name (path_hash, namespace)"
37+
);
3338
}
3439

3540
public static function addFile(

0 commit comments

Comments
 (0)