goldcaddy77 / warthog

GraphQL API Framework with strong conventions and auto-generated schema
https://warthog.dev/
MIT License
359 stars 38 forks source link

Create Migrations does nothing #465

Closed Keryx42 closed 3 years ago

Keryx42 commented 3 years ago

Hi first thank for creating this awesome project :) I have a question maybe it's a bug or I am doing something completely wrong. It's a fresh created project.

I tried my best formatting the informations readable ^^°

Background

env.yaml

local: &local DEBUG: '*' NODE_ENV: development WARTHOG_AUTO_OPEN_PLAYGROUND: false WARTHOG_AUTO_GENERATE_FILES: false

test: PGUSER: postgres # Otherwise tries to use system user WARTHOG_DB_LOGGING: none

local_app: &local_app WARTHOG_APP_HOST: localhost WARTHOG_APP_PORT: 4100

build_env: &build_env WARTHOG_DB_ENTITIES: dist/src//*.model.js WARTHOG_DB_SUBSCRIBERS: dist/src/*/.model.js WARTHOG_RESOLVERS_PATH: dist/src//*.resolver.js

local_db: &local_db WARTHOG_DB_DATABASE: card_api WARTHOG_DB_HOST: localhost WARTHOG_DB_LOGGING: all WARTHOG_DB_PASSWORD: 'secret' WARTHOG_DB_PORT: 5432 WARTHOG_DB_SYNCHRONIZE: false WARTHOG_DB_USERNAME: postgres

prod_db: &prod_db PGSSLMODE: require WARTHOG_DB_DATABASE: ${env:WARTHOG_STARTER_DB_DATABASE} WARTHOG_DB_HOST: ${env:WARTHOG_STARTER_DB_HOST} WARTHOG_DB_LOGGING: none WARTHOG_DB_PASSWORD: ${env:WARTHOG_STARTER_DB_PASSWORD} WARTHOG_DB_PORT: ${env:WARTHOG_STARTER_DB_PORT} WARTHOG_DB_SYNCHRONIZE: false WARTHOG_DB_USERNAME: ${env:WARTHOG_STARTER_DB_USERNAME}

development: <<: local <<: local_app <<: *local_db

development:build: <<: local <<: local_app <<: build_env <<: local_db

development:prod-like: WARTHOG_APP_PROTOCOL: http <<: local <<: local_app <<: build_env <<: prod_db

production: NODE_ENV: production WARTHOG_APP_HOST: localhost WARTHOG_APP_PORT: ${env:PORT} WARTHOG_INTROSPECTION: true WARTHOG_PLAYGROUND: true <<: prod_db <<: build_env

What I did

  1. created an empty folder
  2. yarn add yarn add warthog
  3. yarn warthog new
  4. yarn
  5. yarn warthog generate user name // the files where created successfully
  6. yarn warthog codegen// the files where generated succefully
  7. yarn warthog db:migrate:generate --name=create-user-table - no mirgrations where created command finish with. Output: ✨ Done in 6.33s.
  8. yarn warthog db:migrate - does than nothing (ofc with no migrations) Output ✨ Done in 5.75s.
  9. yarn start:dev - Generates output and than the server is not started. Output [INFO] 13:39:19 ts-node-dev ver. 1.1.6 (using ts-node ver. 9.1.1, typescript ver. 3.9.9) ✨ Done in 5.97s.

Further Information: Db connection seems to work

  1. I tried also the clean command "clean": "yarn db:drop && rm -rf ./node_modules ./generated ./dist",
  2. ran yarn again
  3. ran yarn warthog db:create - This successfully created the database again. So the db configuration seems fine for me Output Database 'card_api' created! ✨ Done in 4.51s.

Further Information: doesn't seem to be a file write access problem

Further Information: A Guess from my side I read in the documentation that the Migration commands are

proxies through TypeORM CLI So maybe there happened some change

Thanks in advance If you need more Informations I try my best to deliver them :)

Keryx42 commented 3 years ago

Update I stumbled over the warthog-starter repos issues and saw this issue https://github.com/goldcaddy77/warthog-starter/issues/71 regarding similar problems. I just downgraded my node version to 13 to test if it would make a difference and indeed now everything works. It's maybe not a final solution but at least a temporary work around^^°

goldcaddy77 commented 3 years ago

@Keryx42 I'm glad you figured it out. I have a fix for newer versions of node - will get that in this weekend.

goldcaddy77 commented 3 years ago

Node 14+ now supported: https://github.com/goldcaddy77/warthog/pull/468 . Thanks for filing the issue.