Skip to content

edcolvin/array-sync-issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Postgres Typeorm Array Type Synchronization Issue

This repo demonstrates a problem with Typeorm synchronization of array of varchars on Postgres.

Issue description

When using Postgres, if a length is specified for an array of type varchar and synchronization is enabled, Typeorm will drop and re-add the column on startup even if there are no schema changes.

If the length property is removed, the behavior will stop occurring.

To demonstrate with this repo:

  1. Clone the repo.
  2. Configure a postgres database 'test' and schema 'test' with owner 'test' and password 'test', or update ormconfig.json as needed.
  3. npm install
  4. npm run start (calls the compiler and executes index.js twice)

Excerpt of console output for second execution of index.js:

query: ALTER TABLE "test"."user" DROP COLUMN "roles"
query: ALTER TABLE "test"."user" ADD "roles" character varying(64) array NOT NULL

About

This repo demonstrates a problem with Typeorm synchronization of array of varchars on postgres.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published