manager-service/ManagerService/Migrations/20250305163047_InitialCreate.cs
2025-03-06 17:39:08 +01:00

175 lines
9.2 KiB
C#

using System;
using System.Collections.Generic;
using ManagerService.Data;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ManagerService.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Configurations",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Label = table.Column<string>(type: "text", nullable: false),
Title = table.Column<List<Translation>>(type: "jsonb", nullable: false),
ImageId = table.Column<string>(type: "text", nullable: true),
ImageSource = table.Column<string>(type: "text", nullable: true),
PrimaryColor = table.Column<string>(type: "text", nullable: true),
SecondaryColor = table.Column<string>(type: "text", nullable: true),
Languages = table.Column<List<string>>(type: "text[]", nullable: true),
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
IsMobile = table.Column<bool>(type: "boolean", nullable: false),
IsTablet = table.Column<bool>(type: "boolean", nullable: false),
IsOffline = table.Column<bool>(type: "boolean", nullable: false),
InstanceId = table.Column<string>(type: "text", nullable: false),
LoaderImageId = table.Column<string>(type: "text", nullable: true),
LoaderImageUrl = table.Column<string>(type: "text", nullable: true),
WeatherCity = table.Column<string>(type: "text", nullable: true),
WeatherUpdatedDate = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
WeatherResult = table.Column<string>(type: "text", nullable: true),
IsDate = table.Column<bool>(type: "boolean", nullable: false),
IsHour = table.Column<bool>(type: "boolean", nullable: false),
IsSectionImageBackground = table.Column<bool>(type: "boolean", nullable: false),
RoundedValue = table.Column<int>(type: "integer", nullable: true),
ScreenPercentageSectionsMainPage = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Configurations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Devices",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Identifier = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: true),
IpAddressWLAN = table.Column<string>(type: "text", nullable: false),
IpAddressETH = table.Column<string>(type: "text", nullable: false),
Configuration = table.Column<string>(type: "text", nullable: true),
ConfigurationId = table.Column<string>(type: "text", nullable: false),
Connected = table.Column<bool>(type: "boolean", nullable: false),
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateUpdate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
BatteryLevel = table.Column<string>(type: "text", nullable: true),
LastBatteryLevel = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
ConnectionLevel = table.Column<string>(type: "text", nullable: true),
LastConnectionLevel = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
InstanceId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Devices", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Instances",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
PinCode = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Instances", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Resources",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
Label = table.Column<string>(type: "text", nullable: false),
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
InstanceId = table.Column<string>(type: "text", nullable: false),
Url = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Resources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Sections",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Label = table.Column<string>(type: "text", nullable: false),
Title = table.Column<List<Translation>>(type: "jsonb", nullable: false),
Description = table.Column<List<Translation>>(type: "jsonb", nullable: true),
Order = table.Column<int>(type: "integer", nullable: false),
ConfigurationId = table.Column<string>(type: "text", nullable: false),
ImageId = table.Column<string>(type: "text", nullable: false),
ImageSource = table.Column<string>(type: "text", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
IsSubSection = table.Column<bool>(type: "boolean", nullable: false),
ParentId = table.Column<string>(type: "text", nullable: true),
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Data = table.Column<string>(type: "text", nullable: false),
InstanceId = table.Column<string>(type: "text", nullable: false),
IsBeacon = table.Column<bool>(type: "boolean", nullable: false),
BeaconId = table.Column<int>(type: "integer", nullable: true),
Latitude = table.Column<string>(type: "text", nullable: true),
Longitude = table.Column<string>(type: "text", nullable: true),
MeterZoneGPS = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Sections", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Email = table.Column<string>(type: "text", nullable: false),
Password = table.Column<string>(type: "text", nullable: false),
FirstName = table.Column<string>(type: "text", nullable: true),
LastName = table.Column<string>(type: "text", nullable: false),
Token = table.Column<string>(type: "text", nullable: false),
DateCreation = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
InstanceId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Configurations");
migrationBuilder.DropTable(
name: "Devices");
migrationBuilder.DropTable(
name: "Instances");
migrationBuilder.DropTable(
name: "Resources");
migrationBuilder.DropTable(
name: "Sections");
migrationBuilder.DropTable(
name: "Users");
}
}
}