@capacitor-community/sqlite 4.1.0-1 → 4.1.0-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -179
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,187 +28,11 @@
|
|
|
28
28
|
|
|
29
29
|
## CAPACITOR 4 (Master)
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
For more info on releases:
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
Developers can now install it as normal
|
|
33
|
+
- [info_releases](https://github.com/capacitor-community/sqlite/blob/master/info_releases.md)
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
npm install @capacitor-community/sqlite@latest
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
🚨 Release 4.0.1 <<- 🚨
|
|
41
|
-
|
|
42
|
-
🚨 Release 4.0.0-1 all platforms ->> 🚨
|
|
43
|
-
This is a tentative of implementing @Capacitor/core@4.0.1 proposed by rdlabo (Masahiko Sakakibara).
|
|
44
|
-
For those who want to try it do
|
|
45
|
-
```
|
|
46
|
-
npm install @capacitor-community/sqlite@next
|
|
47
|
-
```
|
|
48
|
-
Revert quickly any issue by clearly mentionning V4 in the title of the issue.
|
|
49
|
-
|
|
50
|
-
Thanks for your help in testing
|
|
51
|
-
|
|
52
|
-
🚨 Release 4.0.0-1 <<- 🚨
|
|
53
|
-
|
|
54
|
-
## CAPACITOR 3 (v3.7.0)
|
|
55
|
-
|
|
56
|
-
🚨 Release 3.4.3-3 all platforms ->> 🚨
|
|
57
|
-
|
|
58
|
-
The main change is related to the delete table's rows when a synchronization table exists as well as a last_mofidied table's column, allowing for database synchronization of the local database with a remote server database.
|
|
59
|
-
|
|
60
|
-
- All existing triggers to YOUR_TABLE_NAME_trigger_last_modified must be modified as follows
|
|
61
|
-
```
|
|
62
|
-
CREATE TRIGGER YOUR_TABLE_NAME_trigger_last_modified
|
|
63
|
-
AFTER UPDATE ON YOUR_TABLE_NAME
|
|
64
|
-
FOR EACH ROW WHEN NEW.last_modified < OLD.last_modified
|
|
65
|
-
BEGIN
|
|
66
|
-
UPDATE YOUR_TABLE_NAME SET last_modified= (strftime('%s', 'now')) WHERE id=OLD.id;
|
|
67
|
-
END;
|
|
68
|
-
```
|
|
69
|
-
- an new column `sql_deleted` must be added to each of your tables as
|
|
70
|
-
```
|
|
71
|
-
sql_deleted BOOLEAN DEFAULT 0 CHECK (sql_deleted IN (0, 1))
|
|
72
|
-
```
|
|
73
|
-
This column will be autommatically set to 1 when you will use a `DELETE FROM ...` sql statement in the `execute`, `run` or `executeSet` methods.
|
|
74
|
-
|
|
75
|
-
- In the JSON object that you provide to `importFromJson`, all the deleted rows in your remote server database's tables must have the `sql_deleted` column set to 1. This will indicate to the import process to physically delete the corresponding rows in your local database. All the others rows must have the `sql_deleted` column set to 0.
|
|
76
|
-
|
|
77
|
-
- In the JSON object outputs by the `exportToJson`, all the deleted rows in your local database have got the `sql_deleted` column set to 1 to help in your synchronization management process with the remote server database. A system `last_exported_date` is automatically saved in the synchronization table at the start of the export process flow.
|
|
78
|
-
|
|
79
|
-
- On successful completion of your synchronization management process with the remote server database, you must
|
|
80
|
-
- Set a new synchronization date (as `(new Date()).toISOString()`) with the `setSyncDate` method.
|
|
81
|
-
- Execute the `deleteExportedRows` method which physically deletes all table's rows having 1 as value for the `sql_deleted` column prior to the `last_exported_date` in your local database.
|
|
82
|
-
|
|
83
|
-
An example of using this new feature is given in [solidjs-vite-sqlite-app](https://github.com/jepiqueau/capacitor-solid-sqlite). It has been used to test the validity of the implementation.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
🚨 Release 3.4.3-3 <<- 🚨
|
|
87
|
-
|
|
88
|
-
🚨 Release 3.4.2-4 ->> 🚨
|
|
89
|
-
!!!! DO NOT USE IT !!!!
|
|
90
|
-
🚨 Release 3.4.2-4 <<- 🚨
|
|
91
|
-
|
|
92
|
-
🚨 Since release 3.4.2-3 ->> 🚨
|
|
93
|
-
|
|
94
|
-
- **overwrite** boolean parameter has been added to the Json Object (default false)
|
|
95
|
-
- `true` : delete the physically the database whatever the version is.
|
|
96
|
-
- `false`:
|
|
97
|
-
- re-importing a database with the same `version` number will do nothing, keeping the existing database and will return `changes = 0`
|
|
98
|
-
- re-importing a database with a lower `version` number will throw an error `ImportFromJson: Cannot import a version lower than `
|
|
99
|
-
|
|
100
|
-
- During an import in `full` mode the `Foreign Key` constraint has been turn off before dropping the tables and turn back on after
|
|
101
|
-
|
|
102
|
-
🚨 Since release 3.4.2-3 <<- 🚨
|
|
103
|
-
🚨 Since release 3.4.1 ->> 🚨
|
|
104
|
-
Databases location for Electron can be set in `the config.config.ts` as followed:
|
|
105
|
-
|
|
106
|
-
- for sharing databases between users:
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
plugins: {
|
|
110
|
-
CapacitorSQLite: {
|
|
111
|
-
electronMacLocation: "/YOUR_DATABASES_PATH",
|
|
112
|
-
electronWindowsLocation: "C:\\ProgramData\\CapacitorDatabases",
|
|
113
|
-
electronLinuxLocation: "/home/CapacitorDatabases"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
- for only the user in its Home folder
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
Plugins: {
|
|
122
|
-
CapacitorSQLite: {
|
|
123
|
-
electronMacLocation: "Databases",
|
|
124
|
-
electronWindowsLocation: "Databases",
|
|
125
|
-
electronLinuxLocation: "Databases"
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
For existing databases, YOU MUST COPY old databases to the new location
|
|
131
|
-
You MUST remove the Electron folder and add it again with
|
|
132
|
-
|
|
133
|
-
```
|
|
134
|
-
npx cap add @capacitor-community/electron
|
|
135
|
-
npm run build
|
|
136
|
-
cd electron
|
|
137
|
-
npm i --save sqlite3
|
|
138
|
-
npm i --save @types:sqlite3
|
|
139
|
-
npm run rebuild
|
|
140
|
-
cd ..
|
|
141
|
-
npx cap sync @capacitor-community/electron
|
|
142
|
-
npm run build
|
|
143
|
-
npx cap copy @capacitor-community/electron
|
|
144
|
-
npx cap open @capacitor-community/electron
|
|
145
|
-
```
|
|
146
|
-
🚨 Since release 3.4.1 <<- 🚨
|
|
147
|
-
|
|
148
|
-
🚨 Since release 3.4.1-1 ->> 🚨
|
|
149
|
-
|
|
150
|
-
- add iosIsEncryption, androidIsEncryption in capacitor.config.ts
|
|
151
|
-
When your application use only `non-encrypted databases` set those parameter to false then iOS KeyChain & Android MasterKey are not defined.
|
|
152
|
-
|
|
153
|
-
🚨 Since release 3.4.1-1 <<- 🚨
|
|
154
|
-
|
|
155
|
-
🚨 Since release 3.4.0-2 ->> 🚨
|
|
156
|
-
|
|
157
|
-
- iOS & Android only
|
|
158
|
-
Adding biometric FaceID/TouchID to secure the pass phrase in the Keychain/SharedPreferences stores. see:
|
|
159
|
-
[Biometric_Authentication](https://github.com/capacitor-community/sqlite/blob/master/docs/Biometric-Authentication.md)
|
|
160
|
-
|
|
161
|
-
- iOS only
|
|
162
|
-
Fix identical pass phrase stored in the Keychain for differents applications using the plugin by adding an application prefix to the Keychain account.
|
|
163
|
-
Before the account `"CapacitorSQLitePlugin"` was used and was the same for all applications.
|
|
164
|
-
Now by adding `iosKeychainPrefix: 'YOUR_APP_NAME'`in the `capacitor.config.ts` of your application,
|
|
165
|
-
the account will be `"YOUR_APP_NAME_CapacitorSQLitePlugin"`
|
|
166
|
-
If you were having a pass phrase stored, first modify the `capacitor.config.ts` and then run the command `isSecretStored` which will manage the upgrade of the Keychain account.
|
|
167
|
-
🚨 Since release 3.4.0-2 <<- 🚨
|
|
168
|
-
|
|
169
|
-
🚨 Since release 3.3.3-2 ->> 🚨
|
|
170
|
-
|
|
171
|
-
- iOS only
|
|
172
|
-
Support for a database location not visible to iTunes and backed up to iCloud.
|
|
173
|
-
For this you must add to the `const config: CapacitorConfig` of the `capacitor.config.ts` file of your application the following:
|
|
174
|
-
```ts
|
|
175
|
-
plugins: {
|
|
176
|
-
CapacitorSQLite: {
|
|
177
|
-
"iosDatabaseLocation": "Library/CapacitorDatabase"
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
```
|
|
181
|
-
Pre-existing databases from the `Documents` folder will be moved to the new folder `Library/CapacitorDatabase` and your application will work as before.
|
|
182
|
-
If you do not modify the `capacitor.config.ts` file of your application the databases will still reside in the `Documents` folder
|
|
183
|
-
|
|
184
|
-
🚨 Since release 3.3.3-2 <<- 🚨
|
|
185
|
-
|
|
186
|
-
🚨 Since release 3.2.5-2 ->> 🚨
|
|
187
|
-
|
|
188
|
-
- support zip file in copyFromAssets method
|
|
189
|
-
- add optional `overwrite` parameter (true/false) default to true
|
|
190
|
-
|
|
191
|
-
🚨 Since release 3.2.5-2 <<- 🚨
|
|
192
|
-
|
|
193
|
-
🚨 Since release 3.2.3-1 ->> 🚨
|
|
194
|
-
|
|
195
|
-
The `initWebStore` and `saveToStore` methods have been added to the Web platform.
|
|
196
|
-
- The `initWebStore` has been added to fix the issue#172 and since then is `MANDATORY`
|
|
197
|
-
```js
|
|
198
|
-
...
|
|
199
|
-
if(platform === "web") {
|
|
200
|
-
await customElements.whenDefined('jeep-sqlite');
|
|
201
|
-
const jeepSqliteEl = document.querySelector('jeep-sqlite');
|
|
202
|
-
if(jeepSqliteEl != null) {
|
|
203
|
-
await sqliteConnection.initWebStore()
|
|
204
|
-
...
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
...
|
|
208
|
-
```
|
|
209
|
-
- the `saveToStore` allows to perform intermediate save of the database in case the browser needs to delete the cache.
|
|
210
|
-
|
|
211
|
-
🚨 Since release 3.2.3-1 <<- 🚨
|
|
35
|
+
- [changelog]https://github.com/capacitor-community/sqlite/blob/master/changelog.md
|
|
212
36
|
|
|
213
37
|
The test has been achieved on:
|
|
214
38
|
|
|
@@ -224,6 +48,7 @@ The test has been achieved on:
|
|
|
224
48
|
|
|
225
49
|
- a [Vue TypeORM app](https://github.com/jepiqueau/vue-typeorm-app)
|
|
226
50
|
|
|
51
|
+
- a [SolidJS Vite app](https://github.com/jepiqueau/capacitor-solid-sqlite)
|
|
227
52
|
|
|
228
53
|
## Browser Support
|
|
229
54
|
|
|
@@ -315,6 +140,15 @@ npx cap open ios
|
|
|
315
140
|
```
|
|
316
141
|
npx cap open android
|
|
317
142
|
```
|
|
143
|
+
In case you get the following error:
|
|
144
|
+
`x files found with path 'build-data.properties'.`
|
|
145
|
+
You can you add the following code to `app/build.gradle`:
|
|
146
|
+
```
|
|
147
|
+
packagingOptions {
|
|
148
|
+
exclude 'build-data.properties'
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
See [#301](https://github.com/capacitor-community/sqlite/issues/301) and [SO](https://stackoverflow.com/questions/63291529/how-to-fix-more-than-one-file-was-found-with-os-independent-path-build-data-pro] for more information.
|
|
318
152
|
|
|
319
153
|
### Electron
|
|
320
154
|
|