thinker icon indicating copy to clipboard operation
thinker copied to clipboard

Handle tables that don't use the default primary key field name id

Open internalfx opened this issue 10 years ago • 2 comments

Handle tables that don't use the default primary key field name id, you can retrieve the primary key of the source table through r.db(sourceDb).table(table).info()('primary_key') and pass it into the tableCreate call through the primaryKey opt arg.

internalfx avatar Jan 05 '15 21:01 internalfx

@internalfx Is that fixed for the sync command? I tried to sync two dbs and that's the error I'm getting:

{ ReqlOpFailedError: Index `id` was not found on table `db.table` in:
r.db("db").table("table").orderBy({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    index: r.asc("id")
    ^^^^^^^^^^^^^^^^^^
}).map(function(var_6) {
^^^^^^^^^^^^^^^^^^^^^^^^
    return {
    ^^^^^^^^
        id: var_6("id"),
        ^^^^^^^^^^^^^^^^
        hash: r.uuid(var_6.toJSON())
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    }
    ^
})
^^

thinklinux avatar Sep 04 '16 13:09 thinklinux

@thinklinux :frowning:

I'm guessing no.....and I will have another look.

Thanks for reporting.

internalfx avatar Sep 06 '16 21:09 internalfx