216 lines
12 KiB
C#
216 lines
12 KiB
C#
// (c) Copyright Ascensio System SIA 2010-2022
|
|
//
|
|
// This program is a free software product.
|
|
// You can redistribute it and/or modify it under the terms
|
|
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
|
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
|
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
|
// any third-party rights.
|
|
//
|
|
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
|
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
|
//
|
|
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
|
//
|
|
// The interactive user interfaces in modified source and object code versions of the Program must
|
|
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
|
//
|
|
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
|
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
|
// trademark law for use of our trademarks.
|
|
//
|
|
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
|
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
|
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
|
|
|
namespace ASC.MessagingSystem.Migrations.PostgreSql.MessagesContextPostgreSql;
|
|
|
|
public partial class MessagesContextPostgreSql : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterDatabase()
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "audit_events",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
initiator = table.Column<string>(type: "varchar(200)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
target = table.Column<string>(type: "text", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
ip = table.Column<string>(type: "varchar(50)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
browser = table.Column<string>(type: "varchar(200)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
platform = table.Column<string>(type: "varchar(200)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
date = table.Column<DateTime>(type: "datetime", nullable: false),
|
|
tenant_id = table.Column<int>(type: "int", nullable: false),
|
|
user_id = table.Column<string>(type: "char(38)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
page = table.Column<string>(type: "varchar(300)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
action = table.Column<int>(type: "int", nullable: false),
|
|
description = table.Column<string>(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", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "login_events",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
login = table.Column<string>(type: "varchar(200)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
ip = table.Column<string>(type: "varchar(50)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
browser = table.Column<string>(type: "varchar(200)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
platform = table.Column<string>(type: "varchar(200)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
date = table.Column<DateTime>(type: "datetime", nullable: false),
|
|
tenant_id = table.Column<int>(type: "int", nullable: false),
|
|
user_id = table.Column<string>(type: "char(38)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
page = table.Column<string>(type: "varchar(300)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
action = table.Column<int>(type: "int", nullable: false),
|
|
description = table.Column<string>(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", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "tenants_tenants",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
name = table.Column<string>(type: "varchar(255)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
alias = table.Column<string>(type: "varchar(100)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
mappeddomain = table.Column<string>(type: "varchar(100)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
version = table.Column<int>(type: "int", nullable: false, defaultValueSql: "'2'"),
|
|
version_changed = table.Column<DateTime>(type: "datetime", nullable: true),
|
|
language = table.Column<string>(type: "char(10)", nullable: false, defaultValueSql: "'en-US'", collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
timezone = table.Column<string>(type: "varchar(50)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
trusteddomains = table.Column<string>(type: "varchar(1024)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
trusteddomainsenabled = table.Column<int>(type: "int", nullable: false, defaultValueSql: "'1'"),
|
|
status = table.Column<int>(type: "int", nullable: false),
|
|
statuschanged = table.Column<DateTime>(type: "datetime", nullable: true),
|
|
creationdatetime = table.Column<DateTime>(type: "datetime", nullable: false),
|
|
owner_id = table.Column<string>(type: "varchar(38)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
payment_id = table.Column<string>(type: "varchar(38)", nullable: true, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
industry = table.Column<int>(type: "int", nullable: true),
|
|
last_modified = table.Column<DateTime>(type: "timestamp", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
|
|
spam = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValueSql: "true"),
|
|
calls = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValueSql: "true")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_tenants_tenants", x => x.id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "webstudio_settings",
|
|
columns: table => new
|
|
{
|
|
TenantID = table.Column<int>(type: "int", nullable: false),
|
|
ID = table.Column<string>(type: "varchar(64)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
UserID = table.Column<string>(type: "varchar(64)", nullable: false, collation: "utf8_general_ci")
|
|
.Annotation("MySql:CharSet", "utf8"),
|
|
Data = table.Column<string>(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", "utf8mb4");
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "tenants_tenants",
|
|
columns: new[] { "id", "alias", "creationdatetime", "industry", "mappeddomain", "name", "owner_id", "payment_id", "status", "statuschanged", "timezone", "trusteddomains", "version_changed" },
|
|
values: new object[] { 1, "localhost", new DateTime(2021, 3, 9, 17, 46, 59, 97, DateTimeKind.Utc).AddTicks(4317), null, null, "Web Office", "66faa6e4-f133-11ea-b126-00ffeec8b4ef", null, 0, 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: "date",
|
|
table: "login_events",
|
|
column: "date");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "tenant_id",
|
|
table: "login_events",
|
|
columns: new[] { "tenant_id", "user_id" });
|
|
|
|
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: "login_events");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "tenants_tenants");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "webstudio_settings");
|
|
}
|
|
}
|