Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tries to update database every time app starts. #581

Closed
chopfitzroy opened this issue May 17, 2017 · 3 comments
Closed

Tries to update database every time app starts. #581

chopfitzroy opened this issue May 17, 2017 · 3 comments

Comments

@chopfitzroy
Copy link

Steps to reproduce

  1. Create new feathers project using the cli.
  2. Create database connection using Postgres and Knex.
  3. Start app and connect to database, stop app.
  4. Start app again.
  5. Get following error: Error updating users table { error: relation "users_email_unique" already exists

Can't really set up a jsbin demo as it is a server issue.

Expected behavior

Based off the following generated code:

module.exports = function (app) {
  const db = app.get('knexClient');

  db.schema.createTableIfNotExists('users', table => {
    table.increments('id');
  
    table.string('email').unique();
    table.string('password');
  
  
    table.string('facebookId');
  
  })
  .then(() => console.log('Updated users table'))
  .catch(e => console.error('Error updating users table', e));

  return db;
};

I would expect Knex to not try and create the relation as it and the table already exist.

Actual behavior

An error is thrown every time I boot the app.

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

    "feathers": "^2.1.2",
    "feathers-authentication": "^1.2.3",
    "feathers-authentication-hooks": "^0.1.3",
    "feathers-authentication-jwt": "^0.3.1",
    "feathers-authentication-local": "^0.3.4",
    "feathers-authentication-oauth2": "^0.2.4",
    "feathers-configuration": "^0.4.1",
    "feathers-errors": "^2.8.0",
    "feathers-hooks": "^2.0.1",
    "feathers-hooks-common": "^3.3.2",
    "feathers-knex": "^2.6.3",
    "feathers-rest": "^1.7.2",
    "feathers-socketio": "^2.0.0",
    "knex": "^0.13.0",

NodeJS version:
7.10

Operating System:
Docker Node (Debian Jessie)

Browser Version:
N/A

React Native Version:
N/A

Module Loader:
N/A

@daffl
Copy link
Member

daffl commented May 18, 2017

I think the related issue is knex/knex#1303 and we can probably work around it using knex/knex#1303 (comment)

@chopfitzroy
Copy link
Author

Hey @daffl sounds good to me :).

Cheers.

@lock
Copy link

lock bot commented Feb 7, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants