title: EF Core: update database error: relation "Owner" already exists
body: <p>I try to add migration:</p>
  <pre><code>dotnet ef migrations add InitialCreate
  </code></pre>
  <p>and then update the database:</p>
  <pre><code>dotnet ef database update
  </code></pre>
  <p>But, I get an error:</p>
  <pre><code>Build started...
  Build succeeded.
  [21:59:12 INF] OnConfigure finish
  Applying migration '20201029182606_InitialCreate'.
  </code></pre>
  <blockquote>
  <p>Failed executing DbCommand (7ms) [Parameters=[], CommandType='Text', CommandTimeout='30']<br />
  CREATE TABLE &quot;Owner&quot; (<br />
  &quot;Id&quot; integer NOT NULL GENERATED BY DEFAULT AS IDENTITY,<br />
  reputation integer NOT NULL,
  user_id integer NOT NULL,<br />
  user_type text NULL,<br />
  profile_image text NULL,<br />
  display_name text NULL,<br />
  link text NULL,<br />
  accept_rate integer NULL,<br />
  CONSTRAINT &quot;PK_Owner&quot; PRIMARY KEY (&quot;Id&quot;)<br />
  );</p>
  <p>Npgsql.PostgresException (0x80004005): 42P07: relation &quot;Owner&quot; already exists</p>
  <p>at Npgsql.NpgsqlConnector.&lt;&gt;c__DisplayClass160_0.&lt;g__ReadMessageLong|0&gt;d.MoveNext()<br />
  --- End of stack trace from previous location ---<br />
  at Npgsql.NpgsqlConnector.&lt;&gt;c__DisplayClass160_0.&lt;g__ReadMessageLong|0&gt;d.MoveNext()<br />
  --- End of stack trace from previous location ---<br />
  at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming)<br />
  at Npgsql.NpgsqlDataReader.NextResult()<br />
  at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)<br />
  at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)<br />
  at Npgsql.NpgsqlCommand.ExecuteNonQuery()</p>
  <p>Exception data:<br />
  Severity: ERROR<br />
  SqlState: 42P07<br />
  MessageText: relation &quot;Owner&quot; already exists<br />
  File: heap.c<br />
  Line: 1155<br />
  Routine: heap_create_with_catalog<br />
  42P07: relation &quot;Owner&quot; already exists</p>
  </blockquote>
  <p><a href="https://github.com/LightVolk/QuestionServiceWebApi/blob/master/Models/Search.cs" rel="nofollow noreferrer">Here on my github</a> i store model (and other source code of service).
  I remove 'EnsureCreate' code from ApplicationContext file.</p>
  <p>How to solve this error?
  Thank you!</p>
  <p>P.S. I remove file appsettings.json where store connetion string:</p>
  <pre><code> {
  &quot;Logging&quot;: {
   &quot;LogLevel&quot;: {
     &quot;Default&quot;: &quot;Information&quot;,
     &quot;Microsoft&quot;: &quot;Warning&quot;,
     &quot;Microsoft.Hosting.Lifetime&quot;: &quot;Information&quot;
   }
  },
   &quot;AllowedHosts&quot;: &quot;*&quot;,
   &quot;ConnectionStrings&quot;: {
    &quot;Questions&quot;: &quot;Host=localhost;Port=5432;Database=questiondb;Username=postgres;Password=password&quot;
   },
    &quot;Tags&quot;: [
     &quot;ef core&quot;,
     &quot;c#&quot;,
     &quot;asp.net core&quot;,
     &quot;asp.net core webapi&quot;
    ]
    }
  </code></pre>