@tauri-apps/plugin-sql 2.0.0-beta.7 → 2.0.0-rc.0
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 +21 -2
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
|
|
|
19
19
|
```toml
|
|
20
20
|
[dependencies.tauri-plugin-sql]
|
|
21
21
|
features = ["sqlite"] # or "postgres", or "mysql"
|
|
22
|
-
version = "2.0.0-
|
|
22
|
+
version = "2.0.0-rc"
|
|
23
23
|
# alternatively with Git
|
|
24
24
|
git = "https://github.com/tauri-apps/plugins-workspace"
|
|
25
25
|
branch = "v2"
|
|
@@ -158,7 +158,26 @@ fn main() {
|
|
|
158
158
|
|
|
159
159
|
### Applying Migrations
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
To apply the migrations when the plugin is initialized, add the connection string to the `tauri.conf.json` file:
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"plugins": {
|
|
166
|
+
"sql": {
|
|
167
|
+
"preload": ["sqlite:mydatabase.db"]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Alternatively, the client side `load()` also runs the migrations for a given connection string:
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
import Database from "@tauri-apps/plugin-sql";
|
|
177
|
+
const db = await Database.load("sqlite:mydatabase.db");
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Ensure that the migrations are defined in the correct order and are safe to run multiple times.
|
|
162
181
|
|
|
163
182
|
### Migration Management
|
|
164
183
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-sql",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.0",
|
|
4
4
|
"description": "Interface with SQL databases",
|
|
5
5
|
"license": "MIT or APACHE-2.0",
|
|
6
6
|
"authors": [
|
|
7
7
|
"Tauri Programme within The Commons Conservancy"
|
|
8
8
|
],
|
|
9
|
+
"repository": "https://github.com/tauri-apps/plugins-workspace",
|
|
9
10
|
"type": "module",
|
|
10
11
|
"types": "./dist-js/index.d.ts",
|
|
11
12
|
"main": "./dist-js/index.cjs",
|
|
@@ -15,15 +16,15 @@
|
|
|
15
16
|
"import": "./dist-js/index.js",
|
|
16
17
|
"require": "./dist-js/index.cjs"
|
|
17
18
|
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "rollup -c"
|
|
21
|
+
},
|
|
18
22
|
"files": [
|
|
19
23
|
"dist-js",
|
|
20
24
|
"README.md",
|
|
21
25
|
"LICENSE"
|
|
22
26
|
],
|
|
23
27
|
"dependencies": {
|
|
24
|
-
"@tauri-apps/api": "2.0.0-
|
|
25
|
-
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "rollup -c"
|
|
28
|
+
"@tauri-apps/api": "^2.0.0-rc.0"
|
|
28
29
|
}
|
|
29
|
-
}
|
|
30
|
+
}
|