Skip to content

Commit 9d8958a

Browse files
committed
v.0.0.8
1 parent 9a53a21 commit 9d8958a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ionic-database-builder",
3-
"version": "0.0.7",
3+
"version": "0.0.8",
44
"description": "Extended library from database-builder to assist in creating and maintaining SQL commands. Allowing integrate execute commands with SQLite ('@ionic-native/sqlite'), Web Sql, etc. Through the interface injection 'DatabaseCreatorContract' returning an implementation of 'DatabaseObject'.",
55
"main": "index.js",
66
"scripts": {

src/providers/database.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import { DatabaseMigration } from "./database-migration";
2-
import { Injectable, Injector } from "@angular/core";
2+
import { Inject, Injectable, Injector } from "@angular/core";
33
import { BuildableDatabaseManager } from "../utils/buildable-database-manager";
44
import { DatabaseSettingsFactoryContract } from "..";
55
import { DatabaseFactoryContract } from "../utils/database-factory-contract";
66
import { DatabaseObject } from "database-builder";
7+
import { IS_AVAILABLE_DATABASE } from "../dependency-injection-definition";
78

89
@Injectable()
910
export class Database extends BuildableDatabaseManager {
1011

1112
private _settings: DatabaseSettingsFactoryContract;
1213

1314
constructor(
15+
@Inject(IS_AVAILABLE_DATABASE) private _isAvailable: boolean,
1416
private _injector: Injector,
1517
databaseFactory: DatabaseFactoryContract,
1618
private _databaseMigration: DatabaseMigration
@@ -23,7 +25,12 @@ export class Database extends BuildableDatabaseManager {
2325
}
2426

2527
protected migrationVersion(database: DatabaseObject, version: number): Promise<boolean> {
26-
return this._databaseMigration.version(database, version);
28+
if (this._isAvailable) {
29+
return this._databaseMigration.version(database, version);
30+
}
31+
return new Promise<boolean>((resolve, reject) => {
32+
resolve(true);
33+
});
2734
}
2835

2936
protected databaseName(): string {

0 commit comments

Comments
 (0)