danielgindi / knex-schema-builder

A schema builder module for knex.js, handles schema initialization and migration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tables not being created

samgranger opened this issue · comments

Have tried to get this to work to no avail unfortunately, not sure if this is a bug or if I'm doing something wrong. No tables are being created, except from schema_globals.

My schema.json is as follows:

{
    "schema": {
      "posts": {
        "columns": [
          {
            "name": "post",
            "type": "text",
            "nullable": true
          },
          {
            "name": "description",
            "type": "text",
            "nullable": true
          }
        ]
      }
    }
}

Hopefully you can see what's going wrong. I really like the idea behind this module.

Well it should work - it works for me with much huge and complex schemas...
Do you have a version.json file?

I have a version.json file, I even copied my schema.json and called it update.2.json - when running, it sets db_version to 2 (obviously after changing version to 2 in version.json) in schema_globals. That's the only part that is working on my side unfortunately.

It might just be me, I just copied the example code you have in the readme and then added a version.json and schema.json. Do I need to have a json with createTable inside of it? A working example would be really nice, I'm assuming that I'm doing something stupid and missed something here.

I've just tested this with your schema - and it seems fine.
Are you actually calling install?

Using this: schemaInstaller.install(db, schemaPath, function (err) { console.log(err) });

err seems to be undefined so no hints there.

Do you want to send a sample project with just the bits that don't work?

On Mon, Jun 29, 2015 at 9:30 PM, Sam Granger notifications@github.com
wrote:

Using this: 'schemaInstaller.install(db, schemaPath, function (err) {
console.log(err) });'

err seems to be undefined so no hints there.


Reply to this email directly or view it on GitHub
#1 (comment)
.

Just commited an example where it goes wrong: https://github.com/samgranger/schema_issue

Alright it's fixed! Just do an npm update and it will update

Thanks!