title: TypeORM QueryFailedError PostgreSQL
body: <p>I'm running into an issue when running a test server after adding a new Item entity that has a ManyToOne relationship with an inventory entity. In PGAdmin4, an Item table is shown that looks correct when comparing it to my Inventory table, so I'm not entirely sure where the bug splat is located, but neither table have any data output when trying to execute get/seed shown in my <code>app.controller.ts</code>.</p>
  <p>Looking at the terminal error message and searching up the error code 42P01, I found that it's showing that it's an undefined table.</p>
  <p>Thanks in advance for all help!</p>
  <p><code>Inventory.ts</code></p>
  <pre><code>import { BaseEntity } from &quot;typeorm/repository/BaseEntity&quot;;
  import {Entity, PrimaryGeneratedColumn, Column, OneToOne, OneToMany} from &quot;typeorm&quot;;
  import {Player} from &quot;./Player&quot;;
  import {Item} from &quot;./Item&quot;;
  
  @Entity()
  export class Inventory{
  
      @PrimaryGeneratedColumn()
      id: number;
  
      @Column(&quot;varchar&quot;, { length: 200 })
      name: string;
  
      @OneToOne(type =&gt; Player, player =&gt; player.inventory)
      player: Player;
  
      @OneToMany(type =&gt; Item, item =&gt; item.inventory)
      items: Item[];
  }
  </code></pre>
  <p>Item.ts</p>
  <pre><code>import { BaseEntity } from &quot;typeorm/repository/BaseEntity&quot;;
  import {Entity, PrimaryGeneratedColumn, Column, ManyToOne} from &quot;typeorm&quot;;
  import { Inventory } from &quot;./Inventory&quot;;
  
  @Entity()
  export class Item{ 
  
      @PrimaryGeneratedColumn()
      id: number;
  
      @Column(&quot;varchar&quot;, { length: 200 })
      name: string;
  
      @ManyToOne(type =&gt; Inventory, inventory =&gt; inventory.items)
      inventory: Inventory;
  
  }
  </code></pre>
  <p>Terminal error message</p>
  <pre><code>{ QueryFailedError: relation &quot;public.item_id_seq&quot; does not exist
      at new QueryFailedError (C:\Users\JYUN3\Desktop\Projects\NativeScript\mygame\svc\src\error\QueryFailedError.ts:7:9)
      at Query.callback (C:\Users\JYUN3\Desktop\Projects\NativeScript\mygame\svc\src\driver\postgres\PostgresQueryRunner.ts:216:26)
      at Query.handleError (C:\Users\JYUN3\Desktop\Projects\NativeScript\mygame\svc\node_modules\pg\lib\query.js:143:17)
      at Connection.connectedErrorHandler (C:\Users\JYUN3\Desktop\Projects\NativeScript\mygame\svc\node_modules\pg\lib\client.js:132:26)
      at Connection.emit (events.js:160:13)
      at Socket.&lt;anonymous&gt; (C:\Users\JYUN3\Desktop\Projects\NativeScript\mygame\svc\node_modules\pg\lib\connection.js:117:12)
      at Socket.emit (events.js:160:13)
      at addChunk (_stream_readable.js:269:12)
      at readableAddChunk (_stream_readable.js:256:11)
      at Socket.Readable.push (_stream_readable.js:213:10)
    message: 'relation &quot;public.item_id_seq&quot; does not exist',
    name: 'QueryFailedError',
    length: 116,
    severity: 'ERROR',
    code: '42P01',
    detail: undefined,
    hint: undefined,
    position: undefined,
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'namespace.c',
    line: '406',
    routine: 'RangeVarGetRelidExtended',
    query: 'ALTER TABLE &quot;public&quot;.&quot;item&quot; ALTER COLUMN &quot;id&quot; SET DEFAULT nextval(\'&quot;public.item_id_seq&quot;\')',
    parameters: [] }
  </code></pre>
  <p>app.controller.ts</p>
  <pre><code>import { Get, Controller, Param } from '@nestjs/common';
  import { Spell } from './entity/Spell';
  import { Player } from './entity/Player';
  import { Inventory } from './entity/Inventory';
  import { Item } from './entity/Item';
  import { createConnection } from 'typeorm';
  
    @Get('seed')
    seed(): void {
      createConnection().then(async connection =&gt; {
      const player1 = new Player();
      player1.name = &quot;TestSubject&quot;
      player1.health = 20;
      player1.mana = 20;
      player1.currentRing = 1;
      player1.currentZone = 2;
      player1.currentRoom = 2;
  
      
      const spell1 = new Spell();
      spell1.name = &quot;Fire&quot;;
      spell1.damage = 5;
      spell1.mana = 5;
      spell1.player = player1;
      await connection.manager.save(spell1);
  
      //loading spells into player
      player1.spells = [];
      player1.spells.push(spell1);
  
      const item1 = new Item();
      item1.name = &quot;sword&quot;;
      await connection.manager.save(item1);
      
      const inventory = new Inventory();
      inventory.name = &quot;my items&quot;;
      inventory.player = player1;
      await connection.manager.save(inventory);
  
      player1.inventory.items = [];
      player1.inventory.items.push(item1);
  
      await connection.manager.save(player1);
  
      
    }).catch(error =&gt; console.log(error));
  }
  </code></pre>