@strapi/database 4.0.0 → 4.0.1

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 ADDED
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const baseConfig = require('../../../jest.base-config');
4
+ const pkg = require('./package');
5
+
6
+ module.exports = {
7
+ ...baseConfig,
8
+ displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
9
+ roots: [__dirname],
10
+ };
@@ -63,7 +63,7 @@ const toStrapiType = column => {
63
63
  return { type: 'bigInteger' };
64
64
  }
65
65
  case 'enum': {
66
- return { type: 'enum' };
66
+ return { type: 'string' };
67
67
  }
68
68
  case 'tinyint': {
69
69
  return { type: 'boolean' };
@@ -34,7 +34,6 @@ class SqliteDialect extends Dialect {
34
34
 
35
35
  getSqlType(type) {
36
36
  switch (type) {
37
- // FIXME: enum must be dealt separately
38
37
  case 'enum': {
39
38
  return 'text';
40
39
  }
@@ -137,9 +137,7 @@ module.exports = db => {
137
137
  const diffColumns = (oldColumn, column) => {
138
138
  const changes = [];
139
139
 
140
- const isIgnoredType = ['increments', 'enum'].includes(column.type);
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
 
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/database",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
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": "echo \"no tests yet\""
31
+ "test:unit": "jest --verbose"
32
32
  },
33
33
  "dependencies": {
34
34
  "date-fns": "2.22.1",
@@ -42,5 +42,5 @@
42
42
  "node": ">=12.x.x <=16.x.x",
43
43
  "npm": ">=6.0.0"
44
44
  },
45
- "gitHead": "b181702f0202b2c6d645d42b195a831f25cd0b03"
45
+ "gitHead": "e2cd01e8c6cbfeba15ad7787e38b6eebcbb92221"
46
46
  }
Binary file