Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Error when trying to use persistentIndex(true) #260

Open
danbritt opened this issue Jan 15, 2020 · 1 comment · May be fixed by #268
Open

Error when trying to use persistentIndex(true) #260

danbritt opened this issue Jan 15, 2020 · 1 comment · May be fixed by #268

Comments

@danbritt
Copy link

Version: 2.1.12

Using persistentIndex(true) causes an error when calling schemaBuilder.connect(), making it unusable since you can't get past that step.

Code to reproduce: (link to jsfiddle: https://jsfiddle.net/ouwgrdtn/3/)

/**
* Running this the first time will create the database and insert a record, 
* but there will be no data in the pk index table
*
* Running this the second time gives an error when calling connect()
*
* If you change it to persistentIndex(false), it works fine.
*/
var sb = lf.schema.create('test_db', 1);

sb.createTable('Asset')
  .addColumn('id', lf.Type.NUMBER)
  .addColumn('asset', lf.Type.STRING)
  .addPrimaryKey(['id'])
  .persistentIndex(true);
 console.log('schema builder created');

// Schema is defined, now connect to the database instance.
sb.connect().then(async function(testDb) {
  console.log('connect successful');
  let localTable = testDb.getSchema().table('Asset');
  await testDb
    .insertOrReplace()
    .into(localTable)
    .values([
    localTable.createRow({ id: Date.now(), asset: 'test' })
  ])
    .exec();
  console.log('insert successful');
});

Screenshot of console errors:
image

@philesc
Copy link

philesc commented Oct 1, 2020

I can reproduce using edge
Microsoft Edge 44.17763.831.0
Microsoft EdgeHTML 18.17763

I tried to use persistentIndex(true) because the connection is very, very slow on Edge (especially on a webview). This is 5/6sec on chrome -> 5/10minutes on edge depending of the database size.

Got this error : SCRIPT438: SCRIPT438: Object doesn't support property or method 'lb'

lb is the minified method getColumns() : https://github.com/google/lovefield/blob/master/lib/schema/table_builder.js#L613

@philesc philesc linked a pull request Oct 1, 2020 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants