@strapi/database 4.0.0 → 4.0.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.
- package/jest.config.js +10 -0
- package/lib/dialects/index.js +1 -1
- package/lib/dialects/mysql/schema-inspector.js +1 -1
- package/lib/dialects/sqlite/index.js +0 -1
- package/lib/metadata/relations.js +1 -1
- package/lib/schema/diff.js +1 -3
- package/lib/schema/schema.js +3 -11
- package/package.json +4 -4
- package/examples/data.sqlite +0 -0
package/jest.config.js
ADDED
package/lib/dialects/index.js
CHANGED
|
@@ -390,7 +390,7 @@ const createJoinTable = (metadata, { attributeName, attribute, meta }) => {
|
|
|
390
390
|
const targetMeta = metadata.get(attribute.target);
|
|
391
391
|
|
|
392
392
|
if (!targetMeta) {
|
|
393
|
-
throw new Error(`
|
|
393
|
+
throw new Error(`Unknown target ${attribute.target}`);
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
const joinTableName = _.snakeCase(`${meta.tableName}_${attributeName}_links`);
|
package/lib/schema/diff.js
CHANGED
|
@@ -137,9 +137,7 @@ module.exports = db => {
|
|
|
137
137
|
const diffColumns = (oldColumn, column) => {
|
|
138
138
|
const changes = [];
|
|
139
139
|
|
|
140
|
-
const isIgnoredType = ['increments'
|
|
141
|
-
|
|
142
|
-
// NOTE: enum aren't updated, they need to be dropped & recreated. Knex doesn't handle it
|
|
140
|
+
const isIgnoredType = ['increments'].includes(column.type);
|
|
143
141
|
const oldType = oldColumn.type;
|
|
144
142
|
const type = db.dialect.getSqlType(column.type);
|
|
145
143
|
|
package/lib/schema/schema.js
CHANGED
|
@@ -113,7 +113,8 @@ const getColumnType = attribute => {
|
|
|
113
113
|
// We might want to convert email/password to string types before going into the orm with specific validators & transformers
|
|
114
114
|
case 'password':
|
|
115
115
|
case 'email':
|
|
116
|
-
case 'string':
|
|
116
|
+
case 'string':
|
|
117
|
+
case 'enumeration': {
|
|
117
118
|
return { type: 'string' };
|
|
118
119
|
}
|
|
119
120
|
case 'uid': {
|
|
@@ -132,15 +133,6 @@ const getColumnType = attribute => {
|
|
|
132
133
|
case 'json': {
|
|
133
134
|
return { type: 'jsonb' };
|
|
134
135
|
}
|
|
135
|
-
case 'enumeration': {
|
|
136
|
-
return {
|
|
137
|
-
type: 'enum',
|
|
138
|
-
args: [
|
|
139
|
-
attribute.enum,
|
|
140
|
-
/*,{ useNative: true, existingType: true, enumName: 'foo_type', schemaName: 'public' }*/
|
|
141
|
-
],
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
136
|
case 'integer': {
|
|
145
137
|
return { type: 'integer' };
|
|
146
138
|
}
|
|
@@ -185,7 +177,7 @@ const getColumnType = attribute => {
|
|
|
185
177
|
return { type: 'boolean' };
|
|
186
178
|
}
|
|
187
179
|
default: {
|
|
188
|
-
throw new Error(`
|
|
180
|
+
throw new Error(`Unknown type ${attribute.type}`);
|
|
189
181
|
}
|
|
190
182
|
}
|
|
191
183
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/database",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "Strapi's database layer",
|
|
5
5
|
"homepage": "https://strapi.io",
|
|
6
6
|
"bugs": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"lib": "./lib"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
|
-
"test": "
|
|
31
|
+
"test:unit": "jest --verbose"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"date-fns": "2.22.1",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"umzug": "2.3.0"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
|
-
"node": ">=12.
|
|
42
|
+
"node": ">=12.22.0 <=16.x.x",
|
|
43
43
|
"npm": ">=6.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "d81919ac2272948b3f5d3b25a4cf8cc7b6994460"
|
|
46
46
|
}
|
package/examples/data.sqlite
DELETED
|
Binary file
|