Skip to content

Releases: Blockzilla101/deno-sqlite-orm

1.1.1

25 Jun 14:22

Choose a tag to compare

Fix regression in previous release.

1.1.0

25 Jun 13:55

Choose a tag to compare

Implemented ATTACH database as schema syntax.

  • Use it by orm.attach("path/to/other.db").
  • To change database for a model add the database name to the arguments in @orm.model(null, 'database') (will change to an object in the future).
  • Make sure to attach the database before using it in the model to avoid issues, @orm.model() reads table structure.

Example

const orm = new SqliteOrm({
    dbPath: 'test.db',
    backupDir: './backup',
    backupMax: 5,
    backupUseGitCommit: true,
});
orm.attach('test-2.db', 'testBar');

@orm.model()
class Foo extends SqlTable {
    foo = 0;
    bar = {
        baz: 0,
        bar: new Map([['foo', 0]]),
    };
}

@orm.model(undefined, 'testBar')
class Bar extends SqlTable {
    foo = 0;
    bar = {
        baz: 0,
        bar: new Map([['foo', 0]]),
    };
}

orm.modelsLoaded();

const foo = new Foo();
const bar = new Bar();

orm.save(foo);
orm.save(bar);

console.log(orm.db.prepare('SELECT * FROM main.Foo').all());
console.log(orm.db.prepare('SELECT * FROM Bar').all());

1.0.0

24 Jun 06:42

Choose a tag to compare

Fixed typo:
registerJsonSerializabe => registerJsonSerializable