Skip to content

export() resets foreign key pragma #233

Closed
@karlb

Description

@karlb

When calling export() on a database, foreign keys are turned off. I would expect PRAGMA foreign_keys to return the same value before and after an export. Generally, I would expect export not to change the state of the db at all.

Example from developer console:

> db.run('PRAGMA foreign_keys=ON');
Database {filename: "dbfile_2179398655", db: 5292304, statements: {}, changeRows: ƒ, changeRow: ƒ, …}

> db.exec('PRAGMA foreign_keys')[0].values[0];
[1]

> db.export()
Uint8Array(32768) [83, 81, 76, 105, 116, 101, 32, 102, 111, 114, 109, 97, 116, 32, 51, 0, 16, 0, 1, 1, 0, 64, 32, 32, 0, 0, 1, 43, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 43, 0, 46, 28, 176, ]

> db.exec('PRAGMA foreign_keys')[0].values[0];
[0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions