using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ASC.Migrations.MySql.Migrations { public partial class MessagesContextMigrate : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "audit_events", columns: table => new { id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), initiator = table.Column(type: "varchar(200)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), target = table.Column(type: "text", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), ip = table.Column(type: "varchar(50)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), browser = table.Column(type: "varchar(200)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), platform = table.Column(type: "varchar(200)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), date = table.Column(type: "datetime", nullable: false), tenant_id = table.Column(type: "int", nullable: false), user_id = table.Column(type: "char(38)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), page = table.Column(type: "varchar(300)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), action = table.Column(type: "int", nullable: true), description = table.Column(type: "varchar(20000)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8") }, constraints: table => { table.PrimaryKey("PK_audit_events", x => x.id); }) .Annotation("MySql:CharSet", "utf8"); migrationBuilder.CreateTable( name: "core_user", columns: table => new { id = table.Column(type: "varchar(38)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), tenant = table.Column(type: "int", nullable: false), username = table.Column(type: "varchar(255)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), firstname = table.Column(type: "varchar(64)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), lastname = table.Column(type: "varchar(64)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), sex = table.Column(type: "tinyint(1)", nullable: true), bithdate = table.Column(type: "datetime", nullable: true), status = table.Column(type: "int", nullable: false, defaultValueSql: "'1'"), activation_status = table.Column(type: "int", nullable: false, defaultValueSql: "'0'"), email = table.Column(type: "varchar(255)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), workfromdate = table.Column(type: "datetime", nullable: true), terminateddate = table.Column(type: "datetime", nullable: true), title = table.Column(type: "varchar(64)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), culture = table.Column(type: "varchar(20)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), contacts = table.Column(type: "varchar(1024)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), phone = table.Column(type: "varchar(255)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), phone_activation = table.Column(type: "int", nullable: false, defaultValueSql: "'0'"), location = table.Column(type: "varchar(255)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), notes = table.Column(type: "varchar(512)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), sid = table.Column(type: "varchar(512)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), sso_name_id = table.Column(type: "varchar(512)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), sso_session_id = table.Column(type: "varchar(512)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), removed = table.Column(type: "tinyint(1)", nullable: false, defaultValueSql: "'0'"), create_on = table.Column(type: "timestamp", nullable: false), last_modified = table.Column(type: "datetime", nullable: false) }, constraints: table => { table.PrimaryKey("PRIMARY", x => x.id); }) .Annotation("MySql:CharSet", "utf8"); migrationBuilder.CreateTable( name: "login_events", columns: table => new { id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), login = table.Column(type: "varchar(200)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), active = table.Column(type: "tinyint(1)", nullable: false), ip = table.Column(type: "varchar(50)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), browser = table.Column(type: "varchar(200)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), platform = table.Column(type: "varchar(200)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), date = table.Column(type: "datetime", nullable: false), tenant_id = table.Column(type: "int", nullable: false), user_id = table.Column(type: "char(38)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), page = table.Column(type: "varchar(300)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), action = table.Column(type: "int", nullable: true), description = table.Column(type: "varchar(500)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8") }, constraints: table => { table.PrimaryKey("PK_login_events", x => x.id); }) .Annotation("MySql:CharSet", "utf8"); migrationBuilder.CreateTable( name: "tenants_tenants", columns: table => new { id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), name = table.Column(type: "varchar(255)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), alias = table.Column(type: "varchar(100)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), mappeddomain = table.Column(type: "varchar(100)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), version = table.Column(type: "int", nullable: false, defaultValueSql: "'2'"), version_changed = table.Column(type: "datetime", nullable: true), language = table.Column(type: "char(10)", nullable: false, defaultValueSql: "'en-US'", collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), timezone = table.Column(type: "varchar(50)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), trusteddomains = table.Column(type: "varchar(1024)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), trusteddomainsenabled = table.Column(type: "int", nullable: false, defaultValueSql: "'1'"), status = table.Column(type: "int", nullable: false, defaultValueSql: "'0'"), statuschanged = table.Column(type: "datetime", nullable: true), creationdatetime = table.Column(type: "datetime", nullable: false), owner_id = table.Column(type: "varchar(38)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), payment_id = table.Column(type: "varchar(38)", nullable: true, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), industry = table.Column(type: "int", nullable: false, defaultValueSql: "'0'"), last_modified = table.Column(type: "timestamp", nullable: false), spam = table.Column(type: "tinyint(1)", nullable: false, defaultValueSql: "'1'"), calls = table.Column(type: "tinyint(1)", nullable: false, defaultValueSql: "'1'") }, constraints: table => { table.PrimaryKey("PK_tenants_tenants", x => x.id); }) .Annotation("MySql:CharSet", "utf8"); migrationBuilder.CreateTable( name: "webstudio_settings", columns: table => new { TenantID = table.Column(type: "int", nullable: false), ID = table.Column(type: "varchar(64)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), UserID = table.Column(type: "varchar(64)", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8"), Data = table.Column(type: "mediumtext", nullable: false, collation: "utf8_general_ci") .Annotation("MySql:CharSet", "utf8") }, constraints: table => { table.PrimaryKey("PRIMARY", x => new { x.TenantID, x.ID, x.UserID }); }) .Annotation("MySql:CharSet", "utf8"); migrationBuilder.InsertData( table: "core_user", columns: new[] { "id", "bithdate", "contacts", "create_on", "culture", "email", "firstname", "last_modified", "lastname", "location", "phone", "notes", "sex", "sid", "sso_name_id", "sso_session_id", "status", "tenant", "terminateddate", "title", "username", "workfromdate" }, values: new object[] { "66faa6e4-f133-11ea-b126-00ffeec8b4ef", null, null, new DateTime(2022, 7, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "", "Administrator", new DateTime(2021, 3, 9, 9, 52, 55, 765, DateTimeKind.Utc).AddTicks(1420), "", null, null, null, null, null, null, null, 1, 1, null, null, "administrator", new DateTime(2021, 3, 9, 9, 52, 55, 764, DateTimeKind.Utc).AddTicks(9157) }); migrationBuilder.InsertData( table: "tenants_tenants", columns: new[] { "id", "alias", "creationdatetime", "last_modified", "mappeddomain", "name", "owner_id", "payment_id", "statuschanged", "timezone", "trusteddomains", "version_changed" }, values: new object[] { 1, "localhost", new DateTime(2021, 3, 9, 17, 46, 59, 97, DateTimeKind.Utc).AddTicks(4317), new DateTime(2022, 7, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Web Office", "66faa6e4-f133-11ea-b126-00ffeec8b4ef", null, null, null, null, null }); migrationBuilder.InsertData( table: "webstudio_settings", columns: new[] { "ID", "TenantID", "UserID", "Data" }, values: new object[] { "9a925891-1f92-4ed7-b277-d6f649739f06", 1, "00000000-0000-0000-0000-000000000000", "{\"Completed\":false}" }); migrationBuilder.CreateIndex( name: "date", table: "audit_events", columns: new[] { "tenant_id", "date" }); migrationBuilder.CreateIndex( name: "email", table: "core_user", column: "email"); migrationBuilder.CreateIndex( name: "last_modified", table: "core_user", column: "last_modified"); migrationBuilder.CreateIndex( name: "username", table: "core_user", columns: new[] { "tenant", "username" }); migrationBuilder.CreateIndex( name: "date", table: "login_events", column: "date"); migrationBuilder.CreateIndex( name: "tenant_id", table: "login_events", columns: new[] { "tenant_id", "user_id" }); migrationBuilder.CreateIndex( name: "alias", table: "tenants_tenants", column: "alias", unique: true); migrationBuilder.CreateIndex( name: "last_modified", table: "tenants_tenants", column: "last_modified"); migrationBuilder.CreateIndex( name: "mappeddomain", table: "tenants_tenants", column: "mappeddomain"); migrationBuilder.CreateIndex( name: "version", table: "tenants_tenants", column: "version"); migrationBuilder.CreateIndex( name: "ID", table: "webstudio_settings", column: "ID"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "audit_events"); migrationBuilder.DropTable( name: "core_user"); migrationBuilder.DropTable( name: "login_events"); migrationBuilder.DropTable( name: "tenants_tenants"); migrationBuilder.DropTable( name: "webstudio_settings"); } } }