using System; using Microsoft.EntityFrameworkCore.Migrations; namespace NadekoBot.Migrations { public partial class first : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "BotConfig", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), BufferSize = table.Column(nullable: false), CurrencyGenerationChance = table.Column(nullable: false), CurrencyGenerationCooldown = table.Column(nullable: false), CurrencyName = table.Column(nullable: true), CurrencyPluralName = table.Column(nullable: true), CurrencySign = table.Column(nullable: true), DMHelpString = table.Column(nullable: true), ForwardMessages = table.Column(nullable: false), ForwardToAllOwners = table.Column(nullable: false), HelpString = table.Column(nullable: true), MigrationVersion = table.Column(nullable: false), RemindMessageFormat = table.Column(nullable: true), RotatingStatuses = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_BotConfig", x => x.Id); }); migrationBuilder.CreateTable( name: "ClashOfClans", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), ChannelId = table.Column(nullable: false), EnemyClan = table.Column(nullable: true), GuildId = table.Column(nullable: false), Size = table.Column(nullable: false), StartedAt = table.Column(nullable: false), WarState = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_ClashOfClans", x => x.Id); }); migrationBuilder.CreateTable( name: "ConversionUnits", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), InternalTrigger = table.Column(nullable: true), Modifier = table.Column(nullable: false), UnitType = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_ConversionUnits", x => x.Id); }); migrationBuilder.CreateTable( name: "Currency", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), Amount = table.Column(nullable: false), UserId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Currency", x => x.Id); }); migrationBuilder.CreateTable( name: "CustomReactions", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), GuildId = table.Column(nullable: true), IsRegex = table.Column(nullable: false), OwnerOnly = table.Column(nullable: false), Response = table.Column(nullable: true), Trigger = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_CustomReactions", x => x.Id); }); migrationBuilder.CreateTable( name: "Donators", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), Amount = table.Column(nullable: false), Name = table.Column(nullable: true), UserId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Donators", x => x.Id); }); migrationBuilder.CreateTable( name: "LogSettings", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), ChannelCreated = table.Column(nullable: false), ChannelDestroyed = table.Column(nullable: false), ChannelId = table.Column(nullable: false), ChannelUpdated = table.Column(nullable: false), IsLogging = table.Column(nullable: false), LogUserPresence = table.Column(nullable: false), LogVoicePresence = table.Column(nullable: false), MessageDeleted = table.Column(nullable: false), MessageUpdated = table.Column(nullable: false), UserBanned = table.Column(nullable: false), UserJoined = table.Column(nullable: false), UserLeft = table.Column(nullable: false), UserPresenceChannelId = table.Column(nullable: false), UserUnbanned = table.Column(nullable: false), UserUpdated = table.Column(nullable: false), VoicePresenceChannelId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_LogSettings", x => x.Id); }); migrationBuilder.CreateTable( name: "MusicPlaylists", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), Author = table.Column(nullable: true), AuthorId = table.Column(nullable: false), Name = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_MusicPlaylists", x => x.Id); }); migrationBuilder.CreateTable( name: "Permission", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), NextId = table.Column(nullable: true), PrimaryTarget = table.Column(nullable: false), PrimaryTargetId = table.Column(nullable: false), SecondaryTarget = table.Column(nullable: false), SecondaryTargetName = table.Column(nullable: true), State = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Permission", x => x.Id); table.ForeignKey( name: "FK_Permission_Permission_NextId", column: x => x.NextId, principalTable: "Permission", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Quotes", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), AuthorId = table.Column(nullable: false), AuthorName = table.Column(nullable: false), GuildId = table.Column(nullable: false), Keyword = table.Column(nullable: false), Text = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Quotes", x => x.Id); }); migrationBuilder.CreateTable( name: "Reminders", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), ChannelId = table.Column(nullable: false), IsPrivate = table.Column(nullable: false), Message = table.Column(nullable: true), ServerId = table.Column(nullable: false), UserId = table.Column(nullable: false), When = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Reminders", x => x.Id); }); migrationBuilder.CreateTable( name: "Repeaters", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), ChannelId = table.Column(nullable: false), GuildId = table.Column(nullable: false), Interval = table.Column(nullable: false), Message = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Repeaters", x => x.Id); }); migrationBuilder.CreateTable( name: "SelfAssignableRoles", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), GuildId = table.Column(nullable: false), RoleId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_SelfAssignableRoles", x => x.Id); }); migrationBuilder.CreateTable( name: "BlacklistItem", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), BotConfigId = table.Column(nullable: true), ItemId = table.Column(nullable: false), Type = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_BlacklistItem", x => x.Id); table.ForeignKey( name: "FK_BlacklistItem_BotConfig_BotConfigId", column: x => x.BotConfigId, principalTable: "BotConfig", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "EightBallResponses", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), BotConfigId = table.Column(nullable: true), Text = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_EightBallResponses", x => x.Id); table.ForeignKey( name: "FK_EightBallResponses_BotConfig_BotConfigId", column: x => x.BotConfigId, principalTable: "BotConfig", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "ModulePrefixes", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), BotConfigId = table.Column(nullable: true), ModuleName = table.Column(nullable: true), Prefix = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_ModulePrefixes", x => x.Id); table.ForeignKey( name: "FK_ModulePrefixes_BotConfig_BotConfigId", column: x => x.BotConfigId, principalTable: "BotConfig", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "PlayingStatus", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), BotConfigId = table.Column(nullable: true), Status = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_PlayingStatus", x => x.Id); table.ForeignKey( name: "FK_PlayingStatus_BotConfig_BotConfigId", column: x => x.BotConfigId, principalTable: "BotConfig", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "RaceAnimals", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), BotConfigId = table.Column(nullable: true), Icon = table.Column(nullable: true), Name = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_RaceAnimals", x => x.Id); table.ForeignKey( name: "FK_RaceAnimals_BotConfig_BotConfigId", column: x => x.BotConfigId, principalTable: "BotConfig", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "ClashCallers", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), BaseDestroyed = table.Column(nullable: false), CallUser = table.Column(nullable: true), ClashWarId = table.Column(nullable: false), Stars = table.Column(nullable: false), TimeAdded = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_ClashCallers", x => x.Id); table.ForeignKey( name: "FK_ClashCallers_ClashOfClans_ClashWarId", column: x => x.ClashWarId, principalTable: "ClashOfClans", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "IgnoredLogChannels", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), ChannelId = table.Column(nullable: false), LogSettingId = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_IgnoredLogChannels", x => x.Id); table.ForeignKey( name: "FK_IgnoredLogChannels_LogSettings_LogSettingId", column: x => x.LogSettingId, principalTable: "LogSettings", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "IgnoredVoicePresenceCHannels", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), ChannelId = table.Column(nullable: false), LogSettingId = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_IgnoredVoicePresenceCHannels", x => x.Id); table.ForeignKey( name: "FK_IgnoredVoicePresenceCHannels_LogSettings_LogSettingId", column: x => x.LogSettingId, principalTable: "LogSettings", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "PlaylistSong", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), MusicPlaylistId = table.Column(nullable: true), Provider = table.Column(nullable: true), ProviderType = table.Column(nullable: false), Query = table.Column(nullable: true), Title = table.Column(nullable: true), Uri = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_PlaylistSong", x => x.Id); table.ForeignKey( name: "FK_PlaylistSong_MusicPlaylists_MusicPlaylistId", column: x => x.MusicPlaylistId, principalTable: "MusicPlaylists", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "GuildConfigs", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), AutoAssignRoleId = table.Column(nullable: false), AutoDeleteByeMessages = table.Column(nullable: false), AutoDeleteGreetMessages = table.Column(nullable: false), AutoDeleteGreetMessagesTimer = table.Column(nullable: false), AutoDeleteSelfAssignedRoleMessages = table.Column(nullable: false), ByeMessageChannelId = table.Column(nullable: false), ChannelByeMessageText = table.Column(nullable: true), ChannelGreetMessageText = table.Column(nullable: true), DefaultMusicVolume = table.Column(nullable: false), DeleteMessageOnCommand = table.Column(nullable: false), DmGreetMessageText = table.Column(nullable: true), ExclusiveSelfAssignedRoles = table.Column(nullable: false), FilterInvites = table.Column(nullable: false), FilterWords = table.Column(nullable: false), GreetMessageChannelId = table.Column(nullable: false), GuildId = table.Column(nullable: false), LogSettingId = table.Column(nullable: true), PermissionRole = table.Column(nullable: true), RootPermissionId = table.Column(nullable: true), SendChannelByeMessage = table.Column(nullable: false), SendChannelGreetMessage = table.Column(nullable: false), SendDmGreetMessage = table.Column(nullable: false), VerbosePermissions = table.Column(nullable: false), VoicePlusTextEnabled = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_GuildConfigs", x => x.Id); table.ForeignKey( name: "FK_GuildConfigs_LogSettings_LogSettingId", column: x => x.LogSettingId, principalTable: "LogSettings", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_GuildConfigs_Permission_RootPermissionId", column: x => x.RootPermissionId, principalTable: "Permission", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "CommandCooldown", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), CommandName = table.Column(nullable: true), GuildConfigId = table.Column(nullable: true), Seconds = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_CommandCooldown", x => x.Id); table.ForeignKey( name: "FK_CommandCooldown_GuildConfigs_GuildConfigId", column: x => x.GuildConfigId, principalTable: "GuildConfigs", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "FilterChannelId", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), ChannelId = table.Column(nullable: false), GuildConfigId = table.Column(nullable: true), GuildConfigId1 = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_FilterChannelId", x => x.Id); table.ForeignKey( name: "FK_FilterChannelId_GuildConfigs_GuildConfigId", column: x => x.GuildConfigId, principalTable: "GuildConfigs", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_FilterChannelId_GuildConfigs_GuildConfigId1", column: x => x.GuildConfigId1, principalTable: "GuildConfigs", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "FilteredWord", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), GuildConfigId = table.Column(nullable: true), Word = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_FilteredWord", x => x.Id); table.ForeignKey( name: "FK_FilteredWord_GuildConfigs_GuildConfigId", column: x => x.GuildConfigId, principalTable: "GuildConfigs", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "FollowedStream", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), ChannelId = table.Column(nullable: false), GuildConfigId = table.Column(nullable: true), GuildId = table.Column(nullable: false), Type = table.Column(nullable: false), Username = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_FollowedStream", x => x.Id); table.ForeignKey( name: "FK_FollowedStream_GuildConfigs_GuildConfigId", column: x => x.GuildConfigId, principalTable: "GuildConfigs", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "GCChannelId", columns: table => new { Id = table.Column(nullable: false) .Annotation("Autoincrement", true), ChannelId = table.Column(nullable: false), GuildConfigId = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_GCChannelId", x => x.Id); table.ForeignKey( name: "FK_GCChannelId_GuildConfigs_GuildConfigId", column: x => x.GuildConfigId, principalTable: "GuildConfigs", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_BlacklistItem_BotConfigId", table: "BlacklistItem", column: "BotConfigId"); migrationBuilder.CreateIndex( name: "IX_ClashCallers_ClashWarId", table: "ClashCallers", column: "ClashWarId"); migrationBuilder.CreateIndex( name: "IX_CommandCooldown_GuildConfigId", table: "CommandCooldown", column: "GuildConfigId"); migrationBuilder.CreateIndex( name: "IX_Currency_UserId", table: "Currency", column: "UserId", unique: true); migrationBuilder.CreateIndex( name: "IX_Donators_UserId", table: "Donators", column: "UserId", unique: true); migrationBuilder.CreateIndex( name: "IX_EightBallResponses_BotConfigId", table: "EightBallResponses", column: "BotConfigId"); migrationBuilder.CreateIndex( name: "IX_FilterChannelId_GuildConfigId", table: "FilterChannelId", column: "GuildConfigId"); migrationBuilder.CreateIndex( name: "IX_FilterChannelId_GuildConfigId1", table: "FilterChannelId", column: "GuildConfigId1"); migrationBuilder.CreateIndex( name: "IX_FilteredWord_GuildConfigId", table: "FilteredWord", column: "GuildConfigId"); migrationBuilder.CreateIndex( name: "IX_FollowedStream_GuildConfigId", table: "FollowedStream", column: "GuildConfigId"); migrationBuilder.CreateIndex( name: "IX_GCChannelId_GuildConfigId", table: "GCChannelId", column: "GuildConfigId"); migrationBuilder.CreateIndex( name: "IX_GuildConfigs_GuildId", table: "GuildConfigs", column: "GuildId", unique: true); migrationBuilder.CreateIndex( name: "IX_GuildConfigs_LogSettingId", table: "GuildConfigs", column: "LogSettingId"); migrationBuilder.CreateIndex( name: "IX_GuildConfigs_RootPermissionId", table: "GuildConfigs", column: "RootPermissionId"); migrationBuilder.CreateIndex( name: "IX_IgnoredLogChannels_LogSettingId", table: "IgnoredLogChannels", column: "LogSettingId"); migrationBuilder.CreateIndex( name: "IX_IgnoredVoicePresenceCHannels_LogSettingId", table: "IgnoredVoicePresenceCHannels", column: "LogSettingId"); migrationBuilder.CreateIndex( name: "IX_ModulePrefixes_BotConfigId", table: "ModulePrefixes", column: "BotConfigId"); migrationBuilder.CreateIndex( name: "IX_Permission_NextId", table: "Permission", column: "NextId", unique: true); migrationBuilder.CreateIndex( name: "IX_PlayingStatus_BotConfigId", table: "PlayingStatus", column: "BotConfigId"); migrationBuilder.CreateIndex( name: "IX_PlaylistSong_MusicPlaylistId", table: "PlaylistSong", column: "MusicPlaylistId"); migrationBuilder.CreateIndex( name: "IX_RaceAnimals_BotConfigId", table: "RaceAnimals", column: "BotConfigId"); migrationBuilder.CreateIndex( name: "IX_Repeaters_channelId", table: "Repeaters", column: "ChannelId", unique: true); migrationBuilder.CreateIndex( name: "IX_SelfAssignableRoles_GuildId_RoleId", table: "SelfAssignableRoles", columns: new[] { "GuildId", "RoleId" }, unique: true); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "BlacklistItem"); migrationBuilder.DropTable( name: "ClashCallers"); migrationBuilder.DropTable( name: "CommandCooldown"); migrationBuilder.DropTable( name: "ConversionUnits"); migrationBuilder.DropTable( name: "Currency"); migrationBuilder.DropTable( name: "CustomReactions"); migrationBuilder.DropTable( name: "Donators"); migrationBuilder.DropTable( name: "EightBallResponses"); migrationBuilder.DropTable( name: "FilterChannelId"); migrationBuilder.DropTable( name: "FilteredWord"); migrationBuilder.DropTable( name: "FollowedStream"); migrationBuilder.DropTable( name: "GCChannelId"); migrationBuilder.DropTable( name: "IgnoredLogChannels"); migrationBuilder.DropTable( name: "IgnoredVoicePresenceCHannels"); migrationBuilder.DropTable( name: "ModulePrefixes"); migrationBuilder.DropTable( name: "PlayingStatus"); migrationBuilder.DropTable( name: "PlaylistSong"); migrationBuilder.DropTable( name: "Quotes"); migrationBuilder.DropTable( name: "RaceAnimals"); migrationBuilder.DropTable( name: "Reminders"); migrationBuilder.DropTable( name: "Repeaters"); migrationBuilder.DropTable( name: "SelfAssignableRoles"); migrationBuilder.DropTable( name: "ClashOfClans"); migrationBuilder.DropTable( name: "GuildConfigs"); migrationBuilder.DropTable( name: "MusicPlaylists"); migrationBuilder.DropTable( name: "BotConfig"); migrationBuilder.DropTable( name: "LogSettings"); migrationBuilder.DropTable( name: "Permission"); } } }