-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* If no DefaultConnection-ConnectionString is defined, will use InMemory-database instead * Remove unused imports * Create initial migrations Issue #1
- Loading branch information
Showing
15 changed files
with
257 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"dotnet-ef": { | ||
"version": "5.0.3", | ||
"commands": [ | ||
"dotnet-ef" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; | ||
|
||
namespace SpeiderappAPI.Migrations | ||
{ | ||
public partial class InitialCreate : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "BadgeList", | ||
columns: table => new | ||
{ | ||
Id = table.Column<long>(type: "bigint", nullable: false) | ||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||
Name = table.Column<string>(type: "text", nullable: false), | ||
Image = table.Column<string>(type: "text", nullable: false), | ||
Type = table.Column<string>(type: "text", nullable: false), | ||
Description = table.Column<string>(type: "text", nullable: false), | ||
Author = table.Column<string>(type: "text", nullable: false), | ||
RootNode = table.Column<int>(type: "integer", nullable: false), | ||
CreatedAt = table.Column<string>(type: "text", nullable: false), | ||
IsComplete = table.Column<bool>(type: "boolean", nullable: false), | ||
Secret = table.Column<string>(type: "text", nullable: false) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_BadgeList", x => x.Id); | ||
}); | ||
} | ||
|
||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "BadgeList"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// <auto-generated /> | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; | ||
using SpeiderappAPI.Models; | ||
|
||
namespace SpeiderappAPI.Migrations | ||
{ | ||
[DbContext(typeof(DBContext))] | ||
partial class BadgeContextModelSnapshot : ModelSnapshot | ||
{ | ||
protected override void BuildModel(ModelBuilder modelBuilder) | ||
{ | ||
#pragma warning disable 612, 618 | ||
modelBuilder | ||
.HasAnnotation("Relational:MaxIdentifierLength", 63) | ||
.HasAnnotation("ProductVersion", "5.0.3") | ||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||
|
||
modelBuilder.Entity("SpeiderappAPI.Models.Badge", b => | ||
{ | ||
b.Property<long>("Id") | ||
.ValueGeneratedOnAdd() | ||
.HasColumnType("bigint") | ||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||
|
||
b.Property<string>("Author") | ||
.IsRequired() | ||
.HasColumnType("text"); | ||
|
||
b.Property<string>("CreatedAt") | ||
.IsRequired() | ||
.HasColumnType("text"); | ||
|
||
b.Property<string>("Description") | ||
.IsRequired() | ||
.HasColumnType("text"); | ||
|
||
b.Property<string>("Image") | ||
.IsRequired() | ||
.HasColumnType("text"); | ||
|
||
b.Property<bool>("IsComplete") | ||
.HasColumnType("boolean"); | ||
|
||
b.Property<string>("Name") | ||
.IsRequired() | ||
.HasColumnType("text"); | ||
|
||
b.Property<int>("RootNode") | ||
.HasColumnType("integer"); | ||
|
||
b.Property<string>("Secret") | ||
.IsRequired() | ||
.HasColumnType("text"); | ||
|
||
b.Property<string>("Type") | ||
.IsRequired() | ||
.HasColumnType("text"); | ||
|
||
b.HasKey("Id"); | ||
|
||
b.ToTable("BadgeList"); | ||
}); | ||
#pragma warning restore 612, 618 | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace SpeiderappAPI.Models | ||
{ | ||
public class DBContext : DbContext | ||
{ | ||
public DbSet<Badge> BadgeList => Set<Badge>(); | ||
private IConfiguration Configuration { get; } | ||
|
||
public DBContext(DbContextOptions options, IConfiguration configuration) : base(options) | ||
=> Configuration = configuration; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"ConnectionStrings": { | ||
"DefaultConnection": "host=SERVER_NAME_HERE;port=PORT_NUMBER;database=DATABASE_NAME;username=USERNAME_HERE;password=PASSWORD_HERE" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters