Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding db migrations to fix column lengths for package tables
- Loading branch information
Showing
9 changed files
with
180 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Website/Migrations/201208222206329_ColumnLengthOfPackageTable.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
68 changes: 68 additions & 0 deletions
68
Website/Migrations/201208222206329_ColumnLengthOfPackageTable.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
namespace NuGetGallery.Migrations | ||
{ | ||
using System.Data.Entity.Migrations; | ||
|
||
public partial class ColumnLengthOfPackageTable : DbMigration | ||
{ | ||
public override void Up() | ||
{ | ||
// There's an existing index that prevents altering these columns. We'll drop the index and recreate it. | ||
DropIndex(table: "Packages", name: "IX_Packages_PackageRegistrationKey"); | ||
|
||
AlterColumn("PackageRegistrations", "Id", c => c.String(nullable: false, maxLength: 128)); | ||
AlterColumn("Packages", "HashAlgorithm", c => c.String(maxLength: 10)); | ||
AlterColumn("Packages", "Hash", c => c.String(nullable: false, maxLength: 256)); | ||
AlterColumn("Packages", "Title", c => c.String(maxLength: 256)); | ||
AlterColumn("Packages", "Version", c => c.String(nullable: false, maxLength: 64)); | ||
AlterColumn("PackageDependencies", "Id", c => c.String(maxLength: 128)); | ||
AlterColumn("PackageDependencies", "VersionSpec", c => c.String(maxLength: 256)); | ||
AlterColumn("PackageDependencies", "TargetFramework", c => c.String(maxLength: 256)); | ||
AlterColumn("PackageFrameworks", "TargetFramework", c => c.String(maxLength: 256)); | ||
|
||
// CreateIndex does not support INCLUDE | ||
Sql(@"CREATE NONCLUSTERED INDEX [IX_Packages_PackageRegistrationKey] ON [dbo].[Packages] | ||
( | ||
[PackageRegistrationKey] ASC | ||
) | ||
INCLUDE ( [Key], | ||
[Copyright], | ||
[Created], | ||
[Description], | ||
[DownloadCount], | ||
[ExternalPackageUrl], | ||
[HashAlgorithm], | ||
[Hash], | ||
[IconUrl], | ||
[IsLatest], | ||
[LastUpdated], | ||
[LicenseUrl], | ||
[Published], | ||
[PackageFileSize], | ||
[ProjectUrl], | ||
[RequiresLicenseAcceptance], | ||
[Summary], | ||
[Tags], | ||
[Title], | ||
[Version], | ||
[FlattenedAuthors], | ||
[FlattenedDependencies], | ||
[IsLatestStable], | ||
[Listed], | ||
[IsPrerelease], | ||
[ReleaseNotes])"); | ||
} | ||
|
||
public override void Down() | ||
{ | ||
AlterColumn("PackageFrameworks", "TargetFramework", c => c.String()); | ||
AlterColumn("PackageDependencies", "TargetFramework", c => c.String()); | ||
AlterColumn("PackageDependencies", "VersionSpec", c => c.String()); | ||
AlterColumn("PackageDependencies", "Id", c => c.String()); | ||
AlterColumn("Packages", "Version", c => c.String()); | ||
AlterColumn("Packages", "Title", c => c.String()); | ||
AlterColumn("Packages", "Hash", c => c.String()); | ||
AlterColumn("Packages", "HashAlgorithm", c => c.String()); | ||
AlterColumn("PackageRegistrations", "Id", c => c.String()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters