Skip to content

Commit

Permalink
Improved test
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Nov 28, 2023
1 parent 4c84d5d commit a839187
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/Pgvector.Tests/EntityFrameworkCoreTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
using Pgvector.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;

Expand Down Expand Up @@ -42,8 +44,10 @@ public class EntityFrameworkCoreTests
public async Task Main()
{
await using var ctx = new ItemContext();
await ctx.Database.EnsureDeletedAsync();
await ctx.Database.EnsureCreatedAsync();

ctx.Database.ExecuteSql($"DROP TABLE IF EXISTS efcore_items");
var databaseCreator = ctx.GetService<IRelationalDatabaseCreator>();
databaseCreator.CreateTables();

ctx.Items.Add(new Item { Embedding = new Vector(new float[] { 1, 1, 1 }) });
ctx.Items.Add(new Item { Embedding = new Vector(new float[] { 2, 2, 2 }) });
Expand Down

0 comments on commit a839187

Please sign in to comment.