Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Support sequelize connection object (#388) #389

Closed
wants to merge 2 commits into from
Closed

Support sequelize connection object (#388) #389

wants to merge 2 commits into from

Conversation

Alfredo-Delgado
Copy link
Contributor

@Alfredo-Delgado Alfredo-Delgado commented Aug 13, 2018

  • generate app
    • npm i feathers-cli
    • npm link generator-feathers
    • npx feathers generate app
  • generate postgrs /src/sequelize.js
    • npm i feathers-cli
    • npm link generator-feathers
    • npx feathers generate connection #postgres
    • vim config/default.json # make postgres attribute an object
    • npx feathers generate service
      • curl new service 👍
    • npx feathers generate service
      • config/default.json isn't molested 👍
  • generate mysql /src/sequelize.js
    • npm link generator-feathers
    • npx feathers generate connection #mysql
      • new template in effect 👍

Resolves #388

@daffl
Copy link
Member

daffl commented Aug 15, 2018

Thank you for the PR Alfredo. The problem with moving away from the connection string for all database adapters is that we now also have to document somewhere how the connection object looks like and where it can be modified since it is not something set up automatically by the generator.

Specifically for the problem in #388 and mentioned in feathersjs-ecosystem/feathers-sequelize#229 (comment) and in a discussion in feathersjs/feathers#676 (comment) a

encodeURIComponent('my@password') // -> 'my%40password'

Would also work. I know it's not super intuitive but connection strings are URIs after all.

@Alfredo-Delgado
Copy link
Contributor Author

We can scrap this or I can look into getting the generator to ask which format to generate. I don't mind upgrading my nonexistent yeomen-fu.

@daffl
Copy link
Member

daffl commented Aug 16, 2018

A PR generally fancying up the connection setup would be great. Connection strings are definitely not super intuitive but it was the easiest (meaning me = laziest) way since it is just a single string prompt for every db.

const answers = getProps(current);
const { adapter, database } = answers;

return adapter === 'sequelize' && database !== 'mssql';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm currently leaving mssql out because I see that it has special handling where the connection string is broken out into components. Let me know if you think it makes sense to refactor that, too,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. force connection object on mssql and fold the sequelize-mssql.js template into the regular sequelize.js template.

@Alfredo-Delgado
Copy link
Contributor Author

screen shot 2018-08-20 at 2 42 58 pm

@daffl
Copy link
Member

daffl commented Sep 11, 2018

This looks great, thank you. Sorry I'm taking so long and now I even have to make another request 😑

This repo got moved to a monorepo at /~https://github.com/feathersjs/feathers. Would you mind reopening the pull request there (against /~https://github.com/feathersjs/feathers/tree/master/packages/generator-feathers)? I thought I could just import the new changes again but it does not seem to work.

@Alfredo-Delgado
Copy link
Contributor Author

No problem.

@daffl
Copy link
Member

daffl commented Sep 13, 2018

Thank you! Closing this then.

@daffl daffl closed this Sep 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants