@stonyx/orm 0.2.1-beta.40 → 0.2.1-beta.41

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 CHANGED
@@ -223,6 +223,27 @@ Set the `MYSQL_HOST` environment variable to enable MySQL persistence. The ORM l
223
223
  | `stonyx db:migrate:rollback` | Rollback the most recent migration |
224
224
  | `stonyx db:migrate:status` | Show migration status |
225
225
 
226
+ ### Running MySQL Tests
227
+
228
+ The ORM includes integration tests that run against a real MySQL database. These are optional — all other tests work without MySQL.
229
+
230
+ **One-time setup:**
231
+
232
+ ```bash
233
+ # Requires local MySQL 8.0+ running
234
+ ./scripts/setup-test-db.sh
235
+ ```
236
+
237
+ This creates a `stonyx_orm_test` database with a `stonyx_test` user. Safe to re-run.
238
+
239
+ **Running tests:**
240
+
241
+ ```bash
242
+ npm test
243
+ ```
244
+
245
+ MySQL integration tests run automatically when MySQL is available. In CI (where `CI=true`), they skip gracefully.
246
+
226
247
  ## REST Server Integration
227
248
 
228
249
  The ORM can automatically register REST routes using your access classes.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "stonyx-async",
5
5
  "stonyx-module"
6
6
  ],
7
- "version": "0.2.1-beta.40",
7
+ "version": "0.2.1-beta.41",
8
8
  "description": "",
9
9
  "main": "src/main.js",
10
10
  "type": "module",
@@ -33,13 +33,13 @@
33
33
  },
34
34
  "homepage": "https://github.com/abofs/stonyx-orm#readme",
35
35
  "dependencies": {
36
- "stonyx": "0.2.3-beta.6",
36
+ "@stonyx/cron": "0.2.1-beta.15",
37
37
  "@stonyx/events": "0.1.1-beta.7",
38
- "@stonyx/cron": "0.2.1-beta.15"
38
+ "stonyx": "0.2.3-beta.6"
39
39
  },
40
40
  "peerDependencies": {
41
- "mysql2": "^3.0.0",
42
- "@stonyx/rest-server": ">=0.2.1-beta.14"
41
+ "@stonyx/rest-server": ">=0.2.1-beta.14",
42
+ "mysql2": "^3.0.0"
43
43
  },
44
44
  "peerDependenciesMeta": {
45
45
  "mysql2": {
@@ -52,6 +52,7 @@
52
52
  "devDependencies": {
53
53
  "@stonyx/rest-server": "0.2.1-beta.19",
54
54
  "@stonyx/utils": "0.2.3-beta.5",
55
+ "mysql2": "^3.20.0",
55
56
  "qunit": "^2.24.1",
56
57
  "sinon": "^21.0.0"
57
58
  },
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+ # scripts/setup-test-db.sh
3
+ # Creates the stonyx_orm_test database and stonyx_test user.
4
+ # Idempotent — safe to re-run. Requires local MySQL with root access.
5
+
6
+ set -euo pipefail
7
+
8
+ echo "Setting up stonyx-orm test database..."
9
+
10
+ mysql -u root <<SQL
11
+ CREATE DATABASE IF NOT EXISTS stonyx_orm_test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
12
+ CREATE USER IF NOT EXISTS 'stonyx_test'@'localhost' IDENTIFIED BY 'stonyx_test';
13
+ GRANT ALL PRIVILEGES ON stonyx_orm_test.* TO 'stonyx_test'@'localhost';
14
+ FLUSH PRIVILEGES;
15
+ SQL
16
+
17
+ echo ""
18
+ echo "Done! Test database 'stonyx_orm_test' is ready."
19
+ echo "User: stonyx_test / Password: stonyx_test"
20
+ echo ""
21
+ echo "Run tests with: npm test"