From f36d68692d247c9ab5965aa62870cdd8bdef75f4 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Wed, 13 Nov 2019 17:38:26 +0800 Subject: [PATCH] Add index for mysql table --- src/DotNetCore.CAP.MySql/IStorageInitializer.MySql.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/DotNetCore.CAP.MySql/IStorageInitializer.MySql.cs b/src/DotNetCore.CAP.MySql/IStorageInitializer.MySql.cs index e5b4d72..b08441c 100644 --- a/src/DotNetCore.CAP.MySql/IStorageInitializer.MySql.cs +++ b/src/DotNetCore.CAP.MySql/IStorageInitializer.MySql.cs @@ -66,7 +66,8 @@ CREATE TABLE IF NOT EXISTS `{prefix}.received` ( `Added` datetime NOT NULL, `ExpiresAt` datetime DEFAULT NULL, `StatusName` varchar(50) NOT NULL, - PRIMARY KEY (`Id`) + PRIMARY KEY (`Id`), + INDEX `IX_ExpiresAt`(`ExpiresAt`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE IF NOT EXISTS `{prefix}.published` ( @@ -78,7 +79,8 @@ CREATE TABLE IF NOT EXISTS `{prefix}.published` ( `Added` datetime NOT NULL, `ExpiresAt` datetime DEFAULT NULL, `StatusName` varchar(40) NOT NULL, - PRIMARY KEY (`Id`) + PRIMARY KEY (`Id`), + INDEX `IX_ExpiresAt`(`ExpiresAt`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; "; return batchSql;