@apso/cli 0.47.3 → 0.47.4

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.
@@ -160,13 +160,24 @@ function schemaModel(input) {
160
160
  const joinTables = [];
161
161
  const inline = [];
162
162
  const foreignKeys = [];
163
- const index = (table, columns, unique = false) => model.indexes.push({
164
- key: `index:${table}(${columns.join(",")})`,
165
- name: exports.constraintName.index(table, columns),
166
- table,
167
- columns,
168
- unique,
169
- });
163
+ // The same columns can be indexed twice (a field or relationship
164
+ // "index": true plus an "indexes" entry). TypeORM names an index by its
165
+ // table and columns, so a second CREATE INDEX would fail on deploy: keep one.
166
+ const index = (table, columns, unique = false) => {
167
+ const key = `index:${table}(${columns.join(",")})`;
168
+ const seen = model.indexes.find((i) => i.key === key);
169
+ if (seen) {
170
+ seen.unique || (seen.unique = unique);
171
+ return;
172
+ }
173
+ model.indexes.push({
174
+ key,
175
+ name: exports.constraintName.index(table, columns),
176
+ table,
177
+ columns,
178
+ unique,
179
+ });
180
+ };
170
181
  const unique = (table, columns, name, list = inline) => list.push({
171
182
  key: `unique:${table}(${columns.join(",")})`,
172
183
  name,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@apso/cli",
3
- "version": "0.47.3",
3
+ "version": "0.47.4",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@apso/cli",
9
- "version": "0.47.3",
9
+ "version": "0.47.4",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@apso/schema-tools": "^0.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.47.3",
2
+ "version": "0.47.4",
3
3
  "commands": {
4
4
  "config": {
5
5
  "id": "config",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apso/cli",
3
- "version": "0.47.3",
3
+ "version": "0.47.4",
4
4
  "mcpName": "io.github.apsoai/apso",
5
5
  "description": "Apso CLI",
6
6
  "author": "Apso by Mavric - @mavric",