BalestraPatrick / HomeKitty

A Vapor 3 website to easily browse HomeKit accessories.
https://homekitty.world
MIT License
74 stars 9 forks source link

Failing add data into local db on fresh install #114

Closed kimdv closed 6 years ago

kimdv commented 6 years ago

I tried to run a fresh install of HomeKitty, and when i use

static func prepare(on connection: PostgreSQLConnection) -> Future<Void> {
        return Database.create(self, on: connection, closure: { builder in
            builder.field(for: \Category.id, type: .int, .primaryKey())
            builder.field(for: \Category.name)
            builder.field(for: \Category.image)
            builder.field(for: \Category.accessoriesCount)
        })
    }

I get an error. The primary key is not auto incrementing.

But when i do this:

static func prepare(on connection: PostgreSQLConnection) -> Future<Void> {
        return Database.create(self, on: connection, closure: { builder in
            builder.field(for: \Category.id, isIdentifier: true)
            builder.field(for: \Category.name)
            builder.field(for: \Category.image)
            builder.field(for: \Category.accessoriesCount)
        })
    }

It works fine

The only diffrent is that Category.id changed from int to bigint

kimdv commented 6 years ago

It seems that it works on the website. Please delete my contribution.

But I still think we should solve this, so it is easier for other people to contribute to the project 😄

BalestraPatrick commented 6 years ago

Should be fixed with my latest changes to the seed.sh 👍