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

I think theres a bug when generating resources from a file. #22

Closed
devSarry opened this issue Jan 20, 2017 · 1 comment
Closed

I think theres a bug when generating resources from a file. #22

devSarry opened this issue Jan 20, 2017 · 1 comment
Labels

Comments

@devSarry
Copy link

When trying to create a resource with a relationship like

User:
  hasMany: messages
  fields:
    name:
      schema: string:50
      rules: required|min:3
      tags: fillable
    email:
      schema: string unique
      rules: required|email|unique:users,email
      tags: fillable
    password:
      schema: string
      rules: required|min:6
      tags: fillable
Message:
  belongsTo: user
  belongsToMany: channel
  fields:
    text:
      schema: text
      rules: required
      tags: fillable
  add: timestamps softDeletes 

and you run wn:resources /path/to/file.yaml

it will generate a duplicate column for the foriegn key

    public function up()
    {
        Schema::create('messages', function(Blueprint $table) {
            $table->increments('id');
            $table->text('text');
            $table->integer('user_id');
            $table->integer('user_id')->unsigned();
            $table->foreign('user_id')
                ->references('id')
                ->on('users');
            $table->timestamps();
            $table->softDeletes();
        });
    }

Also after a bit of testing and poking around I think there should be option or a flag to prevent the resource from running a migration.

@webNeat webNeat added the bug label Jan 20, 2017
@webNeat
Copy link
Owner

webNeat commented Jan 20, 2017

@dopyoman Thank you for testing and finding this bug, I fixed it and made a new release https://github.com/webNeat/lumen-generators/releases/tag/1.3.1

I have also opened a new issue Add possibility to not run migrations when using wn:resources because I am closing this one.

Fell free to reopen it if the bug seems not to be fixed.

@webNeat webNeat closed this as completed Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants