masterrecord 1.0.6 → 1.0.8

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.
Files changed (59) hide show
  1. package/.claude/settings.local.json +4 -1
  2. package/Migrations/migrationMySQLQuery.js +8 -1
  3. package/Migrations/migrationPostgresQuery.js +5 -2
  4. package/Migrations/migrationSQLiteQuery.js +6 -5
  5. package/Migrations/schema.js +14 -4
  6. package/QueryLanguage/queryMethods.js +8 -0
  7. package/QueryLanguage/queryScript.js +18 -8
  8. package/SQLLiteEngine.js +17 -7
  9. package/context.js +34 -7
  10. package/mySQLEngine.js +23 -7
  11. package/package.json +1 -1
  12. package/postgresEngine.js +155 -35
  13. package/test/count-no-from-audit.test.js +1 -1
  14. package/test/ctx-dollar-placeholder.test.js +142 -0
  15. package/test/drop-column-idempotent.test.js +181 -0
  16. package/test/postgres-camelcase-quoting.test.js +249 -0
  17. package/test/query-builder-parity.test.js +2 -2
  18. package/test/fixtures/broad-audit/config/environments/env.audit.json +0 -1
  19. package/test/fixtures/broad-audit/db/auditctx.sqlite +0 -0
  20. package/test/fixtures/count-chained-where/config/environments/env.countchained.json +0 -1
  21. package/test/fixtures/count-chained-where/db/countctx.sqlite +0 -0
  22. package/test/fixtures/count-no-from/config/environments/env.countfrom.json +0 -1
  23. package/test/fixtures/count-no-from/db/countfromctx.sqlite +0 -0
  24. package/test/fixtures/edge-cases-audit/config/environments/env.edgeaudit.json +0 -1
  25. package/test/fixtures/edge-cases-audit/db/edgectx.sqlite +0 -0
  26. package/test/fixtures/multi-migration-N4bUYy/app/models/db/migrations/1700000001000_CreateAuthor_migration.js +0 -14
  27. package/test/fixtures/multi-migration-N4bUYy/app/models/db/migrations/1700000002000_CreateBook_migration.js +0 -14
  28. package/test/fixtures/multi-migration-N4bUYy/app/models/db/migrations/1700000003000_CreateReview_migration.js +0 -14
  29. package/test/fixtures/multi-migration-N4bUYy/app/models/db/migrations/multimigctx_contextSnapShot.json +0 -96
  30. package/test/fixtures/multi-migration-N4bUYy/app/models/multimigctx.js +0 -26
  31. package/test/fixtures/multi-migration-N4bUYy/config/environments/env.multimig.json +0 -1
  32. package/test/fixtures/multi-migration-N4bUYy/db/multimigctx.sqlite +0 -0
  33. package/test/fixtures/multi-migration-N4bUYy/package.json +0 -1
  34. package/test/fixtures/multi-migration-Qu42ZE/app/models/db/migrations/1700000001000_CreateAuthor_migration.js +0 -14
  35. package/test/fixtures/multi-migration-Qu42ZE/app/models/db/migrations/1700000002000_CreateBook_migration.js +0 -14
  36. package/test/fixtures/multi-migration-Qu42ZE/app/models/db/migrations/1700000003000_CreateReview_migration.js +0 -14
  37. package/test/fixtures/multi-migration-Qu42ZE/app/models/db/migrations/multimigctx_contextSnapShot.json +0 -96
  38. package/test/fixtures/multi-migration-Qu42ZE/app/models/multimigctx.js +0 -26
  39. package/test/fixtures/multi-migration-Qu42ZE/config/environments/env.multimig.json +0 -1
  40. package/test/fixtures/multi-migration-Qu42ZE/db/multimigctx.sqlite +0 -0
  41. package/test/fixtures/multi-migration-Qu42ZE/package.json +0 -1
  42. package/test/fixtures/multi-migration-xDfXbJ/app/models/db/migrations/1700000001000_CreateAuthor_migration.js +0 -14
  43. package/test/fixtures/multi-migration-xDfXbJ/app/models/db/migrations/1700000002000_CreateBook_migration.js +0 -14
  44. package/test/fixtures/multi-migration-xDfXbJ/app/models/db/migrations/1700000003000_CreateReview_migration.js +0 -14
  45. package/test/fixtures/multi-migration-xDfXbJ/app/models/db/migrations/multimigctx_contextSnapShot.json +0 -104
  46. package/test/fixtures/multi-migration-xDfXbJ/app/models/multimigctx.js +0 -26
  47. package/test/fixtures/multi-migration-xDfXbJ/config/environments/env.multimig.json +0 -1
  48. package/test/fixtures/multi-migration-xDfXbJ/db/multimigctx.sqlite +0 -0
  49. package/test/fixtures/multi-migration-xDfXbJ/package.json +0 -1
  50. package/test/fixtures/new-setter-large-string/config/environments/env.newsetter.json +0 -1
  51. package/test/fixtures/new-setter-large-string/db/newsettercontext.sqlite +0 -0
  52. package/test/fixtures/query-builder-parity/config/environments/env.parity.json +0 -1
  53. package/test/fixtures/query-builder-parity/db/parityctx.sqlite +0 -0
  54. package/test/fixtures/setter-and-update-drop/config/environments/env.setterdrop.json +0 -1
  55. package/test/fixtures/setter-and-update-drop/db/setdropctx.sqlite +0 -0
  56. package/test/fixtures/sqlite-lifecycle/config/environments/env.test.json +0 -1
  57. package/test/fixtures/sqlite-lifecycle/db/lifecyclecontext.sqlite +0 -0
  58. package/test/fixtures/text-types/config/environments/env.texttypes.json +0 -1
  59. package/test/fixtures/text-types/db/textctx.sqlite +0 -0
@@ -1,14 +0,0 @@
1
-
2
- import masterrecord from "file:///Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/MasterRecord.js";
3
- class CreateBook extends masterrecord.schema {
4
- constructor(context){ super(context); }
5
- async up(table){
6
- await this.init(table);
7
- await this.createTable(table.Book);
8
- }
9
- async down(table){
10
- await this.init(table);
11
- await this.dropTable(table.Book);
12
- }
13
- }
14
- export default CreateBook;
@@ -1,14 +0,0 @@
1
-
2
- import masterrecord from "file:///Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/MasterRecord.js";
3
- class CreateReview extends masterrecord.schema {
4
- constructor(context){ super(context); }
5
- async up(table){
6
- await this.init(table);
7
- await this.createTable(table.Review);
8
- }
9
- async down(table){
10
- await this.init(table);
11
- await this.dropTable(table.Review);
12
- }
13
- }
14
- export default CreateReview;
@@ -1,96 +0,0 @@
1
- {
2
- "contextLocation": "../../multimigctx.js",
3
- "migrationFolder": ".",
4
- "snapShotLocation": "multimigctx_contextSnapShot.json",
5
- "schema": [
6
- {
7
- "id": {
8
- "name": "id",
9
- "type": "integer",
10
- "primary": true,
11
- "nullable": false,
12
- "unique": true,
13
- "auto": true,
14
- "cascadeOnDelete": true,
15
- "lazyLoading": true,
16
- "isNavigational": false,
17
- "skipGetFunction": false,
18
- "valueConversion": true
19
- },
20
- "name": {
21
- "name": "name",
22
- "type": "string",
23
- "nullable": true,
24
- "unique": false,
25
- "auto": false,
26
- "cascadeOnDelete": true,
27
- "lazyLoading": true,
28
- "isNavigational": false,
29
- "skipGetFunction": false,
30
- "valueConversion": true
31
- },
32
- "__compositeIndexes": [],
33
- "__name": "Author"
34
- },
35
- {
36
- "id": {
37
- "name": "id",
38
- "type": "integer",
39
- "primary": true,
40
- "nullable": false,
41
- "unique": true,
42
- "auto": true,
43
- "cascadeOnDelete": true,
44
- "lazyLoading": true,
45
- "isNavigational": false,
46
- "skipGetFunction": false,
47
- "valueConversion": true
48
- },
49
- "title": {
50
- "name": "title",
51
- "type": "string",
52
- "nullable": true,
53
- "unique": false,
54
- "auto": false,
55
- "cascadeOnDelete": true,
56
- "lazyLoading": true,
57
- "isNavigational": false,
58
- "skipGetFunction": false,
59
- "valueConversion": true
60
- },
61
- "__compositeIndexes": [],
62
- "__name": "Book"
63
- },
64
- {
65
- "id": {
66
- "name": "id",
67
- "type": "integer",
68
- "primary": true,
69
- "nullable": false,
70
- "unique": true,
71
- "auto": true,
72
- "cascadeOnDelete": true,
73
- "lazyLoading": true,
74
- "isNavigational": false,
75
- "skipGetFunction": false,
76
- "valueConversion": true
77
- },
78
- "body": {
79
- "name": "body",
80
- "type": "string",
81
- "nullable": true,
82
- "unique": false,
83
- "auto": false,
84
- "cascadeOnDelete": true,
85
- "lazyLoading": true,
86
- "isNavigational": false,
87
- "skipGetFunction": false,
88
- "valueConversion": true
89
- },
90
- "__compositeIndexes": [],
91
- "__name": "Review"
92
- }
93
- ],
94
- "seedData": {},
95
- "seedConfig": {}
96
- }
@@ -1,26 +0,0 @@
1
-
2
- import context from "file:///Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/context.js";
3
-
4
- class Author {
5
- id(db) { db.integer().primary().auto(); }
6
- name(db) { db.string(); }
7
- }
8
- class Book {
9
- id(db) { db.integer().primary().auto(); }
10
- title(db) { db.string(); }
11
- }
12
- class Review {
13
- id(db) { db.integer().primary().auto(); }
14
- body(db) { db.string(); }
15
- }
16
-
17
- class multimigctx extends context {
18
- constructor() {
19
- super();
20
- this.env("/Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/test/fixtures/multi-migration-Qu42ZE/config/environments");
21
- this.dbset(Author);
22
- this.dbset(Book);
23
- this.dbset(Review);
24
- }
25
- }
26
- export default multimigctx;
@@ -1 +0,0 @@
1
- {"multimigctx":{"type":"better-sqlite3","connection":"/Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/test/fixtures/multi-migration-Qu42ZE/db/"}}
@@ -1 +0,0 @@
1
- {"name":"multi-migration-fixture","type":"module"}
@@ -1,14 +0,0 @@
1
-
2
- import masterrecord from "file:///Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/MasterRecord.js";
3
- class CreateAuthor extends masterrecord.schema {
4
- constructor(context){ super(context); }
5
- async up(table){
6
- await this.init(table);
7
- await this.createTable(table.Author);
8
- }
9
- async down(table){
10
- await this.init(table);
11
- await this.dropTable(table.Author);
12
- }
13
- }
14
- export default CreateAuthor;
@@ -1,14 +0,0 @@
1
-
2
- import masterrecord from "file:///Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/MasterRecord.js";
3
- class CreateBook extends masterrecord.schema {
4
- constructor(context){ super(context); }
5
- async up(table){
6
- await this.init(table);
7
- await this.createTable(table.Book);
8
- }
9
- async down(table){
10
- await this.init(table);
11
- await this.dropTable(table.Book);
12
- }
13
- }
14
- export default CreateBook;
@@ -1,14 +0,0 @@
1
-
2
- import masterrecord from "file:///Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/MasterRecord.js";
3
- class CreateReview extends masterrecord.schema {
4
- constructor(context){ super(context); }
5
- async up(table){
6
- await this.init(table);
7
- await this.createTable(table.Review);
8
- }
9
- async down(table){
10
- await this.init(table);
11
- await this.dropTable(table.Review);
12
- }
13
- }
14
- export default CreateReview;
@@ -1,104 +0,0 @@
1
- {
2
- "contextLocation": "../../multimigctx.js",
3
- "migrationFolder": ".",
4
- "snapShotLocation": "multimigctx_contextSnapShot.json",
5
- "schema": [
6
- {
7
- "id": {
8
- "name": "id",
9
- "type": "integer",
10
- "primary": true,
11
- "nullable": false,
12
- "unique": true,
13
- "auto": true,
14
- "cascadeOnDelete": true,
15
- "lazyLoading": true,
16
- "isNavigational": false,
17
- "skipGetFunction": false,
18
- "valueConversion": true
19
- },
20
- "name": {
21
- "name": "name",
22
- "type": "string",
23
- "nullable": true,
24
- "unique": false,
25
- "auto": false,
26
- "cascadeOnDelete": true,
27
- "lazyLoading": true,
28
- "isNavigational": false,
29
- "skipGetFunction": false,
30
- "valueConversion": true
31
- },
32
- "__compositeIndexes": [],
33
- "__name": "Author"
34
- },
35
- {
36
- "id": {
37
- "name": "id",
38
- "type": "integer",
39
- "primary": true,
40
- "nullable": false,
41
- "unique": true,
42
- "auto": true,
43
- "cascadeOnDelete": true,
44
- "lazyLoading": true,
45
- "isNavigational": false,
46
- "skipGetFunction": false,
47
- "valueConversion": true
48
- },
49
- "title": {
50
- "name": "title",
51
- "type": "string",
52
- "nullable": true,
53
- "unique": false,
54
- "auto": false,
55
- "cascadeOnDelete": true,
56
- "lazyLoading": true,
57
- "isNavigational": false,
58
- "skipGetFunction": false,
59
- "valueConversion": true
60
- },
61
- "__compositeIndexes": [],
62
- "__name": "Book"
63
- },
64
- {
65
- "id": {
66
- "name": "id",
67
- "type": "integer",
68
- "primary": true,
69
- "nullable": false,
70
- "unique": true,
71
- "auto": true,
72
- "cascadeOnDelete": true,
73
- "lazyLoading": true,
74
- "isNavigational": false,
75
- "skipGetFunction": false,
76
- "valueConversion": true
77
- },
78
- "body": {
79
- "name": "body",
80
- "type": "string",
81
- "nullable": true,
82
- "unique": false,
83
- "auto": false,
84
- "cascadeOnDelete": true,
85
- "lazyLoading": true,
86
- "isNavigational": false,
87
- "skipGetFunction": false,
88
- "valueConversion": true
89
- },
90
- "__compositeIndexes": [],
91
- "__name": "Review"
92
- }
93
- ],
94
- "seedData": {},
95
- "seedConfig": {
96
- "generateDownMigrations": false,
97
- "downStrategy": "delete",
98
- "deleteByPrimaryKey": true,
99
- "onRollbackError": "warn",
100
- "detectCircularDependencies": true,
101
- "circularStrategy": "warn",
102
- "defaultStrategy": "insert"
103
- }
104
- }
@@ -1,26 +0,0 @@
1
-
2
- import context from "file:///Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/context.js";
3
-
4
- class Author {
5
- id(db) { db.integer().primary().auto(); }
6
- name(db) { db.string(); }
7
- }
8
- class Book {
9
- id(db) { db.integer().primary().auto(); }
10
- title(db) { db.string(); }
11
- }
12
- class Review {
13
- id(db) { db.integer().primary().auto(); }
14
- body(db) { db.string(); }
15
- }
16
-
17
- class multimigctx extends context {
18
- constructor() {
19
- super();
20
- this.env("/Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/test/fixtures/multi-migration-xDfXbJ/config/environments");
21
- this.dbset(Author);
22
- this.dbset(Book);
23
- this.dbset(Review);
24
- }
25
- }
26
- export default multimigctx;
@@ -1 +0,0 @@
1
- {"multimigctx":{"type":"better-sqlite3","connection":"/Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/test/fixtures/multi-migration-xDfXbJ/db/"}}
@@ -1 +0,0 @@
1
- {"name":"multi-migration-fixture","type":"module"}
@@ -1 +0,0 @@
1
- {"NewSetterContext":{"type":"better-sqlite3","connection":"/Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/test/fixtures/new-setter-large-string/db/"}}
@@ -1 +0,0 @@
1
- {"ParityCtx":{"type":"better-sqlite3","connection":"/Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/test/fixtures/query-builder-parity/db/"}}
@@ -1 +0,0 @@
1
- {"SetDropCtx":{"type":"better-sqlite3","connection":"/Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/test/fixtures/setter-and-update-drop/db/"}}
@@ -1 +0,0 @@
1
- {"LifecycleContext":{"type":"better-sqlite3","connection":"/Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/test/fixtures/sqlite-lifecycle/db/"}}
@@ -1 +0,0 @@
1
- {"TextCtx":{"type":"better-sqlite3","connection":"/Users/alexanderrich/Documents/development/opensourceHQ/MasterRecord/test/fixtures/text-types/db/"}}
File without changes