You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
259 lines
15 KiB
259 lines
15 KiB
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
|
|
namespace StubbedContextLib.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class MyMigrations : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Activity",
|
|
columns: table => new
|
|
{
|
|
IdActivity = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Type = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
|
Date = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
StartTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
EndTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
EffortFelt = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Variability = table.Column<float>(type: "REAL", nullable: false),
|
|
Variance = table.Column<float>(type: "REAL", nullable: false),
|
|
StandardDeviation = table.Column<float>(type: "REAL", nullable: false),
|
|
Average = table.Column<float>(type: "REAL", nullable: false),
|
|
Maximum = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Minimum = table.Column<int>(type: "INTEGER", nullable: false),
|
|
AverageTemperature = table.Column<float>(type: "REAL", nullable: false),
|
|
HasAutoPause = table.Column<bool>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Activity", x => x.IdActivity);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Athlete",
|
|
columns: table => new
|
|
{
|
|
IdAthlete = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Username = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
|
LastName = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
|
FirstName = table.Column<string>(type: "TEXT", maxLength: 150, nullable: false),
|
|
Email = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
|
Sexe = table.Column<string>(type: "TEXT", maxLength: 1, nullable: false),
|
|
Lenght = table.Column<double>(type: "REAL", nullable: false),
|
|
Weight = table.Column<float>(type: "REAL", nullable: false),
|
|
Password = table.Column<string>(type: "TEXT", nullable: false),
|
|
DateOfBirth = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
IsCoach = table.Column<bool>(type: "INTEGER", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Athlete", x => x.IdAthlete);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DataSource",
|
|
columns: table => new
|
|
{
|
|
IdSource = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Type = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
|
Modele = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
|
Precision = table.Column<float>(type: "REAL", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DataSource", x => x.IdSource);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "HeartRate",
|
|
columns: table => new
|
|
{
|
|
IdHeartRate = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Altitude = table.Column<double>(type: "REAL", nullable: false),
|
|
Time = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
Temperature = table.Column<float>(type: "REAL", nullable: false),
|
|
Bpm = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Longitude = table.Column<float>(type: "REAL", nullable: false),
|
|
Latitude = table.Column<float>(type: "REAL", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_HeartRate", x => x.IdHeartRate);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Notification",
|
|
columns: table => new
|
|
{
|
|
IdNotif = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Message = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
|
Date = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
Statut = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
Urgence = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Notification", x => x.IdNotif);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Statistic",
|
|
columns: table => new
|
|
{
|
|
IdStatistic = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Weight = table.Column<float>(type: "REAL", nullable: false),
|
|
AverageHeartRate = table.Column<double>(type: "REAL", nullable: false),
|
|
MaximumHeartRate = table.Column<double>(type: "REAL", nullable: false),
|
|
AverageCaloriesBurned = table.Column<double>(type: "REAL", nullable: false),
|
|
Date = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Statistic", x => x.IdStatistic);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Training",
|
|
columns: table => new
|
|
{
|
|
IdTraining = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Date = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
Description = table.Column<string>(type: "TEXT", maxLength: 300, nullable: true),
|
|
Latitude = table.Column<float>(type: "REAL", nullable: false),
|
|
Longitude = table.Column<float>(type: "REAL", nullable: false),
|
|
FeedBack = table.Column<string>(type: "TEXT", maxLength: 300, nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Training", x => x.IdTraining);
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Activity",
|
|
columns: new[] { "IdActivity", "Average", "AverageTemperature", "Date", "EffortFelt", "EndTime", "HasAutoPause", "Maximum", "Minimum", "StandardDeviation", "StartTime", "Type", "Variability", "Variance" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Running", 0.5f, 0.5f },
|
|
{ 2, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Cycling", 0.5f, 0.5f },
|
|
{ 3, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Swimming", 0.5f, 0.5f },
|
|
{ 4, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Walking", 0.5f, 0.5f },
|
|
{ 5, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Hiking", 0.5f, 0.5f },
|
|
{ 6, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Climbing", 0.5f, 0.5f },
|
|
{ 7, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Yoga", 0.5f, 0.5f }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Athlete",
|
|
columns: new[] { "IdAthlete", "DateOfBirth", "Email", "FirstName", "IsCoach", "LastName", "Lenght", "Password", "Sexe", "Username", "Weight" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "john.doe@example.com", "John", true, "Doe", 1.8, "password123", "M", "Doe", 75f },
|
|
{ 2, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "jane.smith@example.com", "Jane", false, "Smith", 1.6499999999999999, "secure456", "F", "Smith", 60f },
|
|
{ 3, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "paul.martin@example.com", "Paul", true, "Martin", 1.75, "super789", "M", "Martin", 68f },
|
|
{ 4, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "anna.brown@example.com", "Anna", false, "Brown", 1.7, "test000", "F", "Brown", 58f },
|
|
{ 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "bruce.lee@example.com", "Bruce", false, "Lee", 2.0, "hello321", "M", "Lee", 90f }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "DataSource",
|
|
columns: new[] { "IdSource", "Modele", "Precision", "Type" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, "Garmin", 0.5f, "Smartwatch" },
|
|
{ 2, "Polar", 0.5f, "Smartwatch" },
|
|
{ 3, "Suunto", 0.5f, "Smartwatch" },
|
|
{ 4, "Fitbit", 0.5f, "Smartwatch" },
|
|
{ 5, "Apple Watch", 0.5f, "Smartwatch" }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "HeartRate",
|
|
columns: new[] { "IdHeartRate", "Altitude", "Bpm", "Latitude", "Longitude", "Temperature", "Time" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, 0.0, 60, 66f, 35f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) },
|
|
{ 2, 10.0, 65, 67f, 35f, 20.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) },
|
|
{ 3, 11.0, 71, 66f, 36f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) },
|
|
{ 4, 12.0, 75, 67f, 36f, 20.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) },
|
|
{ 5, 13.0, 80, 66f, 37f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Notification",
|
|
columns: new[] { "IdNotif", "Date", "Message", "Statut", "Urgence" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "You have a new activity to check", true, "A" },
|
|
{ 2, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "You have a new athlete to check", false, "3" },
|
|
{ 3, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "You have a new heart rate to check", true, "2" },
|
|
{ 4, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "You have a new data source to check", false, "1" },
|
|
{ 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "You have a new notification to check", true, "3" }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Statistic",
|
|
columns: new[] { "IdStatistic", "AverageCaloriesBurned", "AverageHeartRate", "Date", "MaximumHeartRate", "Weight" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, 500.0, 120.0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 180.0, 75f },
|
|
{ 2, 600.0, 130.0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 190.0, 60f },
|
|
{ 3, 550.0, 125.0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 185.0, 68f },
|
|
{ 4, 650.0, 135.0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 195.0, 58f },
|
|
{ 5, 450.0, 110.0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 170.0, 90f }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Training",
|
|
columns: new[] { "IdTraining", "Date", "Description", "FeedBack", "Latitude", "Longitude" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Running", "Good", 48.8566f, 2.3522f },
|
|
{ 2, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Cycling", null, 48.8566f, 2.3522f },
|
|
{ 3, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Good", 48.8566f, 2.3522f },
|
|
{ 4, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Running", "Good", 48.8566f, 2.3522f },
|
|
{ 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Cycling", null, 48.8566f, 2.3522f }
|
|
});
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Activity");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Athlete");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "DataSource");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "HeartRate");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Notification");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Statistic");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Training");
|
|
}
|
|
}
|
|
}
|