Commit 1b4b81b
Lots of fixes around MySQL (#53)
Big thing is that insert behavior is deferred to the Grammar so that MySQL can do it custom. By default, MySQL now runs two queries, one to insert and one to pull the recent item. `insertAll()` also is now separate, consecutive queries in MySQL. The user can opt out of this (single query for insert and insertAll) by passing `returnItems: false` to `QueryBuilder.insert`.
This also...
Adds
- `ON DELETE` and `ON UPDATE` to migration builders
- bigInt type and `UNSIGNED` modifier to migration builders
- Revamped column constraint building to add most constraints separately, at the end of a `CREATE TABLE` statement since the shortcuts I was using weren't all compatible across Postgres and MySQL
Fixes
- Issue with SQL columns not being populated if `.select` wasn't called in query builder (Postgres accepted it with no *, MySQL did not. That's why it didn't get caught)
- Adds some missing date time types for parsing from MySQL
- Fix constraint issues that were borked on MySQL.
Tested all the Quickstart endpoints on Postgres/MySQL to confirm nothing else is missing.
Also updated the quickstart migrations to use `.unsigned` and `.bigInt` for some columns by default, since even tho it works fine with Postgres without, MySQL requires them.
Co-authored-by: Chris Anderson <hi@chrisanderson.io>1 parent ab9fdfb commit 1b4b81b
File tree
13 files changed
+327
-121
lines changed- Quickstarts
- Backend/Sources/Backend/Migrations
- Fullstack/Backend/Sources/Backend/Migrations
- Sources/Alchemy/SQL
- Database/MySQL
- Migrations/Builders
- QueryBuilder
- Types
- Tests/AlchemyTests/SQL/Migrations
13 files changed
+327
-121
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
52 | 79 | | |
53 | 80 | | |
54 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | 6 | | |
11 | 7 | | |
12 | 8 | | |
| |||
20 | 16 | | |
21 | 17 | | |
22 | 18 | | |
23 | | - | |
| 19 | + | |
24 | 20 | | |
25 | 21 | | |
| 22 | + | |
| 23 | + | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
| |||
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | | - | |
| 34 | + | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
44 | 67 | | |
Lines changed: 72 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
7 | 42 | | |
8 | 43 | | |
9 | 44 | | |
| |||
19 | 54 | | |
20 | 55 | | |
21 | 56 | | |
22 | | - | |
| 57 | + | |
23 | 58 | | |
24 | 59 | | |
25 | 60 | | |
| |||
29 | 64 | | |
30 | 65 | | |
31 | 66 | | |
32 | | - | |
| 67 | + | |
33 | 68 | | |
34 | 69 | | |
35 | 70 | | |
36 | | - | |
| 71 | + | |
37 | 72 | | |
38 | 73 | | |
39 | 74 | | |
| |||
42 | 77 | | |
43 | 78 | | |
44 | 79 | | |
45 | | - | |
| 80 | + | |
46 | 81 | | |
47 | 82 | | |
48 | 83 | | |
49 | 84 | | |
50 | 85 | | |
51 | 86 | | |
52 | 87 | | |
53 | | - | |
| 88 | + | |
54 | 89 | | |
55 | 90 | | |
56 | | - | |
| 91 | + | |
57 | 92 | | |
58 | 93 | | |
59 | | - | |
| 94 | + | |
60 | 95 | | |
61 | 96 | | |
62 | 97 | | |
63 | 98 | | |
64 | 99 | | |
65 | 100 | | |
66 | | - | |
| 101 | + | |
67 | 102 | | |
68 | 103 | | |
69 | 104 | | |
| |||
72 | 107 | | |
73 | 108 | | |
74 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
75 | 114 | | |
76 | | - | |
77 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
78 | 122 | | |
79 | 123 | | |
80 | 124 | | |
81 | 125 | | |
82 | 126 | | |
83 | 127 | | |
84 | | - | |
| 128 | + | |
85 | 129 | | |
86 | 130 | | |
87 | 131 | | |
88 | 132 | | |
89 | 133 | | |
90 | 134 | | |
91 | | - | |
| 135 | + | |
92 | 136 | | |
93 | 137 | | |
94 | 138 | | |
95 | 139 | | |
96 | 140 | | |
97 | 141 | | |
98 | | - | |
99 | | - | |
| 142 | + | |
| 143 | + | |
100 | 144 | | |
101 | 145 | | |
102 | 146 | | |
103 | 147 | | |
104 | 148 | | |
105 | 149 | | |
106 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
107 | 162 | | |
108 | 163 | | |
109 | 164 | | |
| |||
115 | 170 | | |
116 | 171 | | |
117 | 172 | | |
118 | | - | |
| 173 | + | |
119 | 174 | | |
120 | 175 | | |
121 | 176 | | |
| |||
135 | 190 | | |
136 | 191 | | |
137 | 192 | | |
138 | | - | |
| 193 | + | |
139 | 194 | | |
140 | 195 | | |
141 | 196 | | |
| |||
Lines changed: 9 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
| |||
172 | 180 | | |
173 | 181 | | |
174 | 182 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 183 | + | |
188 | 184 | | |
0 commit comments