Added some indexes

pull/2/head
kay.one 14 years ago
parent bc0b1e8ae4
commit 3e61afab03

@ -43,6 +43,18 @@ namespace NzbDrone.Core.Datastore.Migrations
new Column("GrabDate", DbType.DateTime, ColumnProperty.Null) new Column("GrabDate", DbType.DateTime, ColumnProperty.Null)
}); });
var indexName = MigrationsHelper.GetIndexName("Episodes", "SeriesId");
Database.AddIndex(indexName, "Episodes", "SeriesId");
indexName = MigrationsHelper.GetIndexName("Episodes", "EpisodeFileId");
Database.AddIndex(indexName, "Episodes", "EpisodeFileId");
indexName = MigrationsHelper.GetIndexName("Episodes", "AirDate");
Database.AddIndex(indexName, "Episodes", "AirDate");
indexName = MigrationsHelper.GetIndexName("Episodes", "TvDbEpisodeId");
Database.AddIndex(indexName, "Episodes", "TvDbEpisodeId");
Database.AddTable("EpisodeFiles", new[] Database.AddTable("EpisodeFiles", new[]
{ {
@ -57,6 +69,9 @@ namespace NzbDrone.Core.Datastore.Migrations
new Column("SeasonNumber", DbType.Int32, ColumnProperty.NotNull) new Column("SeasonNumber", DbType.Int32, ColumnProperty.NotNull)
}); });
indexName = MigrationsHelper.GetIndexName("EpisodeFiles", "SeriesId");
Database.AddIndex(indexName, "Episodes", "SeriesId");
Database.AddTable("Config", new[] Database.AddTable("Config", new[]
{ {
@ -83,6 +98,12 @@ namespace NzbDrone.Core.Datastore.Migrations
new Column("Indexer", DbType.String, ColumnProperty.NotNull) new Column("Indexer", DbType.String, ColumnProperty.NotNull)
}); });
indexName = MigrationsHelper.GetIndexName("History", "EpisodeId");
Database.AddIndex(indexName, "History", "EpisodeId");
indexName = MigrationsHelper.GetIndexName("History", "SeriesId");
Database.AddIndex(indexName, "History", "SeriesId");
Database.AddTable("RootDirs", new[] Database.AddTable("RootDirs", new[]
{ {
new Column("Id", DbType.Int32, ColumnProperty.PrimaryKeyWithIdentity), new Column("Id", DbType.Int32, ColumnProperty.PrimaryKeyWithIdentity),

@ -59,6 +59,11 @@ namespace NzbDrone.Core.Datastore
engine.CreateDatabase(); engine.CreateDatabase();
} }
} }
public static string GetIndexName(string tableName, params string[] columns)
{
return String.Format("IX_{0}_{1}", tableName, String.Join("_", columns));
}
} }

Loading…
Cancel
Save