Skip to content

Commit

Permalink
feat: new database.
Browse files Browse the repository at this point in the history
  • Loading branch information
armentanoc committed Mar 3, 2024
1 parent 54ada62 commit fbbb6bb
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace URLShortener.Infra.Migrations
{
/// <inheritdoc />
public partial class CreateDatabaseInitial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Url",
columns: table => new
{
Id = table.Column<uint>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
OriginalUrl = table.Column<string>(type: "TEXT", nullable: false),
ShortenedUrl = table.Column<string>(type: "TEXT", nullable: false),
ExpirationDate = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Url", x => x.Id);
});
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Url");
}
}
}
44 changes: 44 additions & 0 deletions src/URLShortener.Infra/Migrations/AppDbContextModelSnapshot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using URLShortener.Infra.Context;

#nullable disable

namespace URLShortener.Infra.Migrations
{
[DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.2");

modelBuilder.Entity("URLShortener.Domain.Url", b =>
{
b.Property<uint>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");

b.Property<DateTime>("ExpirationDate")
.HasColumnType("TEXT");

b.Property<string>("OriginalUrl")
.IsRequired()
.HasColumnType("TEXT");

b.Property<string>("ShortenedUrl")
.IsRequired()
.HasColumnType("TEXT");

b.HasKey("Id");

b.ToTable("Url");
});
#pragma warning restore 612, 618
}
}
}
Binary file added src/URLShortener.WebAPI/URLShortenerDB.db
Binary file not shown.

0 comments on commit fbbb6bb

Please sign in to comment.