tspace-mysql 1.3.7 → 1.3.9

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/README.md CHANGED
@@ -189,7 +189,8 @@ const users = await new DB('users')
189
189
  name :'tspace6',
190
190
  email : 'tspace6@gmail.com'
191
191
  },
192
- ]).save()
192
+ ])
193
+ .save()
193
194
 
194
195
  const users = await new DB('users')
195
196
  .where('name','tspace4')
@@ -275,7 +276,8 @@ try {
275
276
  .bind(connection)
276
277
  .save()
277
278
 
278
- const posts = await new Post().createMultiple([
279
+ const posts = await new Post()
280
+ .createMultiple([
279
281
  {
280
282
  user_id : user.id,
281
283
  title : `tspace-post1`
@@ -412,13 +414,7 @@ class User extends Model {
412
414
  * this.useRegistry() // => build-in functions registry
413
415
  * this.useLoadRelationsInRegistry() // => auto generated results from relationship to results
414
416
  * this.useBuiltInRelationFunctions() // => build-in functions relationships to results
415
- * this.useValidationSchema({
416
- * id : Number,
417
- * username : String
418
- * created_at : Date,
419
- * updated_at : Date,
420
- * }) // => validate type of schema when return results
421
- * this.useCreateTableIfNotExists ({
417
+ * this.useSchema ({
422
418
  * id : new Blueprint().int().notNull().primary().autoIncrement(),
423
419
  * uuid : new Blueprint().varchar(50).null(),
424
420
  * user_id : new Blueprint().int().notNull(),
@@ -426,7 +422,9 @@ class User extends Model {
426
422
  * created_at : new Blueprint().timestamp().null(),
427
423
  * updated_at : new Blueprint().timestamp().null(),
428
424
  * deleted_at : new Blueprint().timestamp().null()
429
- * })
425
+ * }) // auto-generated table when table is not exists and auto-create column when column not exists
426
+ *
427
+ * this.useValidateSchema() // => validate type of value when return results reference to the schema in 'this.useSchema'
430
428
  */
431
429
 
432
430
 
@@ -853,23 +851,32 @@ hook((result) => ...) // callback result to function
853
851
  /**
854
852
  * registry relation in your models
855
853
  * @relationship
856
- */
857
- hasOne({ name , model , localKey , foreignKey , freezeTable , as })
858
- hasMany({ name , model , localKey , foreignKey , freezeTable , as })
859
- belongsTo({ name , model , localKey , foreignKey , freezeTable , as })
860
- belongsToMany({ name , model , localKey , foreignKey , freezeTable , as , pivot })
854
+ */
855
+ hasOne({ name, model, localKey, foreignKey, freezeTable , as })
856
+ hasMany({ name, model, localKey, foreignKey, freezeTable , as })
857
+ belongsTo({ name, model, localKey, foreignKey, freezeTable , as })
858
+ belongsToMany({ name, model, localKey, foreignKey, freezeTable, as, pivot })
861
859
  /**
862
860
  * @relation using registry in your models
863
- */
861
+ */
864
862
  relations(name1 , name2,...nameN)
863
+ /**
864
+ * @relation using registry in your models ignore soft delete
865
+ */
866
+ relationsAll(name1 , name2,...nameN)
865
867
  /**
866
868
  * @relation using registry in your models. if exists child data remove this data
867
- */
869
+ */
868
870
  relationsExists(name1 , name2,...nameN)
869
871
  /**
870
872
  * @relation call a name of relation in registry, callback query of data
871
- */
873
+ */
872
874
  relationQuery(name, (callback) )
875
+ /**
876
+ * @relation using registry in your models return only in trash (soft delete)
877
+ */
878
+ relationsTrashed(name1 , name2,...nameN)
879
+
873
880
 
874
881
  /**
875
882
  * queries statements
@@ -32,12 +32,26 @@ exports.default = (cmd) => {
32
32
  for (let i = 0; i < tables.length; i++) {
33
33
  const table = String((_a = Object.values(tables[i])) === null || _a === void 0 ? void 0 : _a.shift());
34
34
  const model = snakeCaseToPascal(pluralize_1.default.singular(table));
35
- const data = (0, model_1.default)(model, npm);
36
- fs.writeFile(`${cwd}/${dir}/${model}${type !== null && type !== void 0 ? type : '.ts'}`, data, (err) => {
37
- if (err)
38
- throw err;
35
+ new lib_1.DB().rawQuery(`SHOW COLUMNS FROM ${table}`).then(raw => {
36
+ let schema = '';
37
+ for (const r of raw) {
38
+ schema += `${r.Field} : `;
39
+ schema += `new Blueprint().${/^[^()]*$/.test(r.Type) ? `${r.Type.toLocaleLowerCase()}()` : r.Type.toLocaleLowerCase()}`;
40
+ schema += `${r.Null === 'YES' ? '.null()' : '.notNull()'}`;
41
+ schema += r.Key === 'PRI' ? '.primary()' : r.Key === 'UNI' ? '.unique()' : '';
42
+ schema += r.Default != null ? `.default('${r.Default}')` : '';
43
+ schema += `${r.Extra === 'auto_increment' ? '.autoIncrement()' : ''},
44
+ `;
45
+ }
46
+ const data = (0, model_1.default)(model, npm, `this.useSchema({
47
+ ${schema.replace(/,\s*$/, "")}
48
+ })`);
49
+ fs.writeFile(`${cwd}/${dir}/${model}${type !== null && type !== void 0 ? type : '.ts'}`, data, (err) => {
50
+ if (err)
51
+ throw err;
52
+ });
53
+ console.log(`Model : '${model}' created successfully`);
39
54
  });
40
- console.log(`Model : '${model}' created successfully`);
41
55
  }
42
56
  console.log('\nGenerate Models has completed');
43
57
  })
@@ -1,2 +1,2 @@
1
- declare const Model: (model: string, npm: string) => string;
1
+ declare const Model: (model: string, npm: string, schema: string) => string;
2
2
  export default Model;
@@ -1,26 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const Model = (model, npm) => {
4
- return `import { Model } from '${npm}'
3
+ const Model = (model, npm, schema) => {
4
+ return `import { Model , Blueprint } from '${npm}'
5
5
  class ${model} extends Model {
6
6
  constructor(){
7
7
  super()
8
- /**
9
- *
10
- * Assign setting global in your model
11
- * @useMethod
12
- * this.useUUID() // => runing a uuid (universally unique identifier) when insert new data
13
- * this.useDebug() // debug raw query
14
- * this.usePrimaryKey('id')
15
- * this.useTimestamp({ createdAt : 'created_at' , updatedAt : 'updated_at' }) // runing a timestamp when insert or update
16
- * this.useSoftDelete()
17
- * this.useTable('users')
18
- * this.useTableSingular() // 'user'
19
- * this.useTablePlural() // 'users'
20
- * this.usePattern('snake_case')
21
- * this.useUUID('uuid')
22
- * this.useRegistry()
23
- */
8
+ ${schema}
24
9
  }
25
10
  }
26
11
  export { ${model} }
@@ -1,4 +1,4 @@
1
- declare const _default: (formCommand: {
1
+ declare const _default: (commandInput: {
2
2
  [x: string]: any;
3
3
  }) => void;
4
4
  export default _default;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const child_process_1 = require("child_process");
4
- exports.default = (formCommand) => {
4
+ exports.default = (commandInput) => {
5
5
  var _a, _b, _c;
6
- const { type, dir, cwd, fs } = formCommand;
6
+ const { type, dir, cwd, fs } = commandInput;
7
7
  try {
8
8
  if (dir == null)
9
9
  throw new Error('Not found directory');
@@ -7,7 +7,7 @@ class ${model} extends Model {
7
7
  super()
8
8
  /**
9
9
  *
10
- * Assign setting global in your model
10
+ * //Assign setting global in your model
11
11
  * @useMethod
12
12
  *
13
13
  * this.useDebug()
@@ -16,19 +16,6 @@ class ${model} extends Model {
16
16
  * createdAt : 'created_at',
17
17
  * updatedAt : 'updated_at'
18
18
  * }) // runing a timestamp when insert or update
19
- * this.useSoftDelete()
20
- * this.useTable('users')
21
- * this.useTableSingular() // 'user'
22
- * this.useTablePlural() // 'users'
23
- * this.usePattern('snake_case') // by defalut snake_case
24
- * this.useUUID('uuid') // => runing a uuid (universally unique identifier) when insert new data
25
- * this.useRegistry()
26
- * this.useSchema({
27
- * id : Number,
28
- * username : String
29
- * created_at : Date,
30
- * updated_at : Date,
31
- * }) // validate type of schema when return result
32
19
  */
33
20
  }
34
21
  }
@@ -18,22 +18,23 @@ const environment = () => {
18
18
  return env;
19
19
  };
20
20
  dotenv_1.default.config({ path: environment() });
21
+ const ENV = process.env;
21
22
  const env = {
22
- HOST: process.env.DB_HOST || process.env.TSPACE_HOST,
23
- PORT: process.env.DB_PORT || process.env.TSPACE_PORT || 3306,
24
- USERNAME: process.env.DB_USERNAME || process.env.TSPACE_USERNAME,
25
- PASSWORD: process.env.DB_PASSWORD || process.env.TSPACE_PASSWORD || '',
26
- DATABASE: process.env.DB_DATABASE || process.env.TSPACE_DATABASE,
27
- CONNECTION_LIMIT: process.env.DB_CONNECTION_LIMIT || process.env.TSPACE_CONNECTION_LIMIT || 30,
28
- QUEUE_LIMIT: process.env.DB_QUEUE_LIMIT || process.env.TSPACE_QUEUE_LIMIT || 0,
29
- TIMEOUT: process.env.DB_TIMEOUT || process.env.TSPACE_TIMEOUT || 1000 * 60,
30
- CHARSET: process.env.DB_CHARSET || process.env.TSPACE_CHARSET || 'utf8mb4',
31
- CONNECTION_ERROR: process.env.DB_CONNECTION_ERROR || process.env.TSPACE_CONNECTION_ERROR || true,
32
- WAIT_FOR_CONNECTIONS: process.env.DB_WAIT_FOR_CONNECTIONS || process.env.TSPACE_WAIT_FOR_CONNECTIONS || true,
33
- DATE_STRINGS: process.env.DB_DATE_STRINGS || process.env.TSPACE_DATE_STRINGS || true,
34
- KEEP_ALIVE_DELAY: process.env.DB_KEEP_ALIVE_DELAY || process.env.TSPACE_KEEP_ALIVE_DELAY || 0,
35
- ENABLE_KEEP_ALIVE: process.env.DB_ENABLE_KEEP_ALIVE || process.env.TSPACE_ENABLE_KEEP_ALIVE || false,
36
- MULTIPLE_STATEMENTS: process.env.MULTIPLE_STATEMENTS || process.env.TSPACE_MULTIPLE_STATEMENTS || false
23
+ HOST: ENV.DB_HOST || ENV.TSPACE_HOST,
24
+ PORT: ENV.DB_PORT || ENV.TSPACE_PORT || 3306,
25
+ USERNAME: ENV.DB_USERNAME || ENV.TSPACE_USERNAME,
26
+ PASSWORD: ENV.DB_PASSWORD || ENV.TSPACE_PASSWORD || '',
27
+ DATABASE: ENV.DB_DATABASE || ENV.TSPACE_DATABASE,
28
+ CONNECTION_LIMIT: ENV.DB_CONNECTION_LIMIT || ENV.TSPACE_CONNECTION_LIMIT || 30,
29
+ QUEUE_LIMIT: ENV.DB_QUEUE_LIMIT || ENV.TSPACE_QUEUE_LIMIT || 0,
30
+ TIMEOUT: ENV.DB_TIMEOUT || ENV.TSPACE_TIMEOUT || 1000 * 60,
31
+ CHARSET: ENV.DB_CHARSET || ENV.TSPACE_CHARSET || 'utf8mb4',
32
+ CONNECTION_ERROR: ENV.DB_CONNECTION_ERROR || ENV.TSPACE_CONNECTION_ERROR || true,
33
+ WAIT_FOR_CONNECTIONS: ENV.DB_WAIT_FOR_CONNECTIONS || ENV.TSPACE_WAIT_FOR_CONNECTIONS || true,
34
+ DATE_STRINGS: ENV.DB_DATE_STRINGS || ENV.TSPACE_DATE_STRINGS || true,
35
+ KEEP_ALIVE_DELAY: ENV.DB_KEEP_ALIVE_DELAY || ENV.TSPACE_KEEP_ALIVE_DELAY || 0,
36
+ ENABLE_KEEP_ALIVE: ENV.DB_ENABLE_KEEP_ALIVE || ENV.TSPACE_ENABLE_KEEP_ALIVE || false,
37
+ MULTIPLE_STATEMENTS: ENV.MULTIPLE_STATEMENTS || ENV.TSPACE_MULTIPLE_STATEMENTS || false
37
38
  };
38
39
  for (const [key, value] of Object.entries(env)) {
39
40
  if (value == null)
@@ -11,6 +11,7 @@ const CONSTANTS = Object.freeze({
11
11
  BETWEEN: 'BETWEEN',
12
12
  NOT_BETWEEN: 'NOT BETWEEN',
13
13
  AND: 'AND',
14
+ NULL: 'NULL',
14
15
  IS_NULL: 'IS NULL',
15
16
  IS_NOT_NULL: 'IS NOT NULL',
16
17
  OR: 'OR',
@@ -66,6 +67,9 @@ const CONSTANTS = Object.freeze({
66
67
  CREATE_TABLE_NOT_EXISTS: 'CREATE TABLE IF NOT EXISTS',
67
68
  ENGINE: 'ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8',
68
69
  RAND: 'RAND()',
70
+ ALTER_TABLE: 'ALTER TABLE',
71
+ ADD: 'ADD',
72
+ AFTER: 'AFTER',
69
73
  RELATIONSHIP: {
70
74
  hasOne: 'hasOne',
71
75
  hasMany: 'hasMany',
@@ -158,9 +162,10 @@ const CONSTANTS = Object.freeze({
158
162
  CREATED_AT: 'created_at',
159
163
  UPDATED_AT: 'updated_at'
160
164
  },
161
- SCHEMA: null,
165
+ VALIDATE_SCHEMA: false,
166
+ VALIDATE_SCHEMA_DEFINED: null,
162
167
  FUNCTION_RELATION: false,
163
- CREATE_TABLE: null,
168
+ SCHEMA_TABLE: null,
164
169
  QUERIES: 0
165
170
  }
166
171
  });
@@ -34,12 +34,14 @@ declare abstract class AbstractModel extends Builder {
34
34
  abstract with(...nameRelations: string[]): this;
35
35
  abstract withQuery(nameRelations: string, callback: Function): this;
36
36
  abstract withExists(...nameRelations: string[]): this;
37
- abstract withAndTrashed(...nameRelations: string[]): this;
37
+ abstract withTrashed(...nameRelations: string[]): this;
38
+ abstract withAll(...nameRelations: string[]): this;
38
39
  abstract has(...nameRelations: string[]): this;
39
40
  abstract relations(...nameRelations: string[]): this;
40
41
  abstract relationQuery(nameRelations: string, callback: Function): this;
41
42
  abstract relationsExists(...nameRelations: string[]): this;
42
- abstract relationsAndTrashed(...nameRelations: string[]): this;
43
+ abstract relationsAll(...nameRelations: string[]): this;
44
+ abstract relationsTrashed(...nameRelations: string[]): this;
43
45
  }
44
46
  export { AbstractModel };
45
47
  export default AbstractModel;
@@ -3,10 +3,10 @@
3
3
  * @example
4
4
  * import { Schema , Blueprint } from 'tspace-mysql'
5
5
  * await new Schema().table('persos1',{
6
- * id : new Blueprint().int().notNull().primary().autoIncrement(),
7
- * name : new Blueprint().varchar(255).default('my name ...'),
8
- * email : new Blueprint().varchar(255).unique(),
9
- * verify : new Blueprint().tinyInt(1).notNull(),
6
+ * id : new Blueprint().int().notNull().primary().autoIncrement(),
7
+ * name : new Blueprint().varchar(255).default('my name ...'),
8
+ * email : new Blueprint().varchar(255).unique(),
9
+ * verify : new Blueprint().tinyInt(1).notNull(),
10
10
  * created_at : new Blueprint().timestamp().null(),
11
11
  * updated_at : new Blueprint().timestamp().null(),
12
12
  * deleted_at : new Blueprint().timestamp().null()
@@ -14,7 +14,8 @@
14
14
  */
15
15
  declare class Blueprint {
16
16
  protected type: string;
17
- protected attrbuites: Array<string>;
17
+ protected attributes: Array<string>;
18
+ protected valueType: NumberConstructor | StringConstructor | DateConstructor;
18
19
  /**
19
20
  * Assign type 'int' in table
20
21
  * @return {this} this
@@ -48,7 +49,7 @@ declare class Blueprint {
48
49
  float(length?: number, decimal?: number): this;
49
50
  /**
50
51
  * Assign type 'VARCHAR' in table
51
- * @param {number} length [length = 100] length of string
52
+ * @param {number} length [length = 191] length of string
52
53
  * @return {this} this
53
54
  */
54
55
  varchar(length?: number): this;
@@ -65,7 +66,6 @@ declare class Blueprint {
65
66
  longText(): this;
66
67
  /**
67
68
  * Assign type 'MEDIUMTEXT' in table
68
- * @param {number} length [length = 1] length of string
69
69
  * @return {this} this
70
70
  */
71
71
  mediumText(): this;
@@ -103,48 +103,48 @@ declare class Blueprint {
103
103
  */
104
104
  timestamp(): this;
105
105
  /**
106
- * Assign type 'UNSIGNED' in table
106
+ * Assign attributes 'UNSIGNED' in table
107
107
  * @return {this} this
108
108
  */
109
109
  unsigned(): this;
110
110
  /**
111
- * Assign type 'UNIQUE' in table
111
+ * Assign attributes 'UNIQUE' in table
112
112
  * @return {this} this
113
113
  */
114
114
  unique(): this;
115
115
  /**
116
- * Assign type 'NULL' in table
116
+ * Assign attributes 'NULL' in table
117
117
  * @return {this} this
118
118
  */
119
119
  null(): this;
120
120
  /**
121
- * Assign type 'NOT NULL' in table
121
+ * Assign attributes 'NOT NULL' in table
122
122
  * @return {this} this
123
123
  */
124
124
  notNull(): this;
125
125
  /**
126
- * Assign type 'PRIMARY KEY' in table
126
+ * Assign attributes 'PRIMARY KEY' in table
127
127
  * @return {this} this
128
128
  */
129
129
  primary(): this;
130
130
  /**
131
- * Assign attrbuites 'default' in table
131
+ * Assign attributes 'default' in table
132
132
  * @param {string | number} value default value
133
133
  * @return {this} this
134
134
  */
135
135
  default(value: string | number): this;
136
136
  /**
137
- * Assign attrbuites 'default currentTimestamp' in table
137
+ * Assign attributes 'default currentTimestamp' in table
138
138
  * @return {this} this
139
139
  */
140
140
  currentTimestamp(): this;
141
141
  /**
142
- * Assign attrbuites 'autoIncrement' in table
142
+ * Assign attributes 'autoIncrement' in table
143
143
  * @return {this} this
144
144
  */
145
145
  autoIncrement(): this;
146
146
  private _addAssignType;
147
- private _addAssignAttrbuite;
147
+ private _addAssignAttribute;
148
148
  }
149
149
  export { Blueprint };
150
150
  export default Blueprint;
@@ -6,10 +6,10 @@ exports.Blueprint = void 0;
6
6
  * @example
7
7
  * import { Schema , Blueprint } from 'tspace-mysql'
8
8
  * await new Schema().table('persos1',{
9
- * id : new Blueprint().int().notNull().primary().autoIncrement(),
10
- * name : new Blueprint().varchar(255).default('my name ...'),
11
- * email : new Blueprint().varchar(255).unique(),
12
- * verify : new Blueprint().tinyInt(1).notNull(),
9
+ * id : new Blueprint().int().notNull().primary().autoIncrement(),
10
+ * name : new Blueprint().varchar(255).default('my name ...'),
11
+ * email : new Blueprint().varchar(255).unique(),
12
+ * verify : new Blueprint().tinyInt(1).notNull(),
13
13
  * created_at : new Blueprint().timestamp().null(),
14
14
  * updated_at : new Blueprint().timestamp().null(),
15
15
  * deleted_at : new Blueprint().timestamp().null()
@@ -18,7 +18,8 @@ exports.Blueprint = void 0;
18
18
  class Blueprint {
19
19
  constructor() {
20
20
  this.type = '';
21
- this.attrbuites = [];
21
+ this.attributes = [];
22
+ this.valueType = String;
22
23
  }
23
24
  /**
24
25
  * Assign type 'int' in table
@@ -26,6 +27,7 @@ class Blueprint {
26
27
  */
27
28
  int() {
28
29
  this._addAssignType('INT');
30
+ this.valueType = Number;
29
31
  return this;
30
32
  }
31
33
  /**
@@ -35,6 +37,7 @@ class Blueprint {
35
37
  */
36
38
  tinyInt(number = 1) {
37
39
  this._addAssignType(`TINYINT(${number})`);
40
+ this.valueType = Number;
38
41
  return this;
39
42
  }
40
43
  /**
@@ -44,6 +47,7 @@ class Blueprint {
44
47
  */
45
48
  bigInt(number = 10) {
46
49
  this._addAssignType(`BIGINT(${number})`);
50
+ this.valueType = Number;
47
51
  return this;
48
52
  }
49
53
  /**
@@ -53,6 +57,7 @@ class Blueprint {
53
57
  * @return {this} this
54
58
  */
55
59
  double(length = 0, decimal = 0) {
60
+ this.valueType = Number;
56
61
  if (!length || !decimal) {
57
62
  this._addAssignType(`DOUBLE`);
58
63
  return this;
@@ -67,6 +72,7 @@ class Blueprint {
67
72
  * @return {this} this
68
73
  */
69
74
  float(length = 0, decimal = 0) {
75
+ this.valueType = Number;
70
76
  if (!length || !decimal) {
71
77
  this._addAssignType(`FLOAT`);
72
78
  return this;
@@ -76,10 +82,10 @@ class Blueprint {
76
82
  }
77
83
  /**
78
84
  * Assign type 'VARCHAR' in table
79
- * @param {number} length [length = 100] length of string
85
+ * @param {number} length [length = 191] length of string
80
86
  * @return {this} this
81
87
  */
82
- varchar(length = 100) {
88
+ varchar(length = 191) {
83
89
  if (length > 255)
84
90
  length = 255;
85
91
  this._addAssignType(`VARCHAR(${length})`);
@@ -104,7 +110,6 @@ class Blueprint {
104
110
  }
105
111
  /**
106
112
  * Assign type 'MEDIUMTEXT' in table
107
- * @param {number} length [length = 1] length of string
108
113
  * @return {this} this
109
114
  */
110
115
  mediumText() {
@@ -135,7 +140,7 @@ class Blueprint {
135
140
  * @return {this} this
136
141
  */
137
142
  enum(...enums) {
138
- this._addAssignType(`ENUM('${enums}')`);
143
+ this._addAssignType(`ENUM(${enums.map(e => `'${e.replace(/'/g, '')}'`)})`);
139
144
  return this;
140
145
  }
141
146
  /**
@@ -144,6 +149,7 @@ class Blueprint {
144
149
  */
145
150
  date() {
146
151
  this._addAssignType(`DATE`);
152
+ this.valueType = Date;
147
153
  return this;
148
154
  }
149
155
  /**
@@ -152,6 +158,7 @@ class Blueprint {
152
158
  */
153
159
  dateTime() {
154
160
  this._addAssignType(`DATETIME`);
161
+ this.valueType = Date;
155
162
  return this;
156
163
  }
157
164
  /**
@@ -160,71 +167,72 @@ class Blueprint {
160
167
  */
161
168
  timestamp() {
162
169
  this._addAssignType(`TIMESTAMP`);
170
+ this.valueType = Date;
163
171
  return this;
164
172
  }
165
173
  /**
166
- * Assign type 'UNSIGNED' in table
174
+ * Assign attributes 'UNSIGNED' in table
167
175
  * @return {this} this
168
176
  */
169
177
  unsigned() {
170
- this._addAssignAttrbuite(`UNSIGNED`);
178
+ this._addAssignAttribute(`UNSIGNED`);
171
179
  return this;
172
180
  }
173
181
  /**
174
- * Assign type 'UNIQUE' in table
182
+ * Assign attributes 'UNIQUE' in table
175
183
  * @return {this} this
176
184
  */
177
185
  unique() {
178
- this._addAssignAttrbuite(`UNIQUE`);
186
+ this._addAssignAttribute(`UNIQUE`);
179
187
  return this;
180
188
  }
181
189
  /**
182
- * Assign type 'NULL' in table
190
+ * Assign attributes 'NULL' in table
183
191
  * @return {this} this
184
192
  */
185
193
  null() {
186
- this._addAssignAttrbuite(`NULL`);
194
+ this._addAssignAttribute(`NULL`);
187
195
  return this;
188
196
  }
189
197
  /**
190
- * Assign type 'NOT NULL' in table
198
+ * Assign attributes 'NOT NULL' in table
191
199
  * @return {this} this
192
200
  */
193
201
  notNull() {
194
- this._addAssignAttrbuite(`NOT NULL`);
202
+ this._addAssignAttribute(`NOT NULL`);
195
203
  return this;
196
204
  }
197
205
  /**
198
- * Assign type 'PRIMARY KEY' in table
206
+ * Assign attributes 'PRIMARY KEY' in table
199
207
  * @return {this} this
200
208
  */
201
209
  primary() {
202
- this._addAssignAttrbuite(`PRIMARY KEY`);
210
+ this._addAssignAttribute(`PRIMARY KEY`);
203
211
  return this;
204
212
  }
205
213
  /**
206
- * Assign attrbuites 'default' in table
214
+ * Assign attributes 'default' in table
207
215
  * @param {string | number} value default value
208
216
  * @return {this} this
209
217
  */
210
218
  default(value) {
211
- this._addAssignAttrbuite(`DEFAULT '${value}'`);
219
+ this._addAssignAttribute(`DEFAULT '${value}'`);
212
220
  return this;
213
221
  }
214
222
  /**
215
- * Assign attrbuites 'default currentTimestamp' in table
223
+ * Assign attributes 'default currentTimestamp' in table
216
224
  * @return {this} this
217
225
  */
218
226
  currentTimestamp() {
219
- this._addAssignAttrbuite(`DEFAULT CURRENT_TIMESTAMP`);
227
+ this._addAssignAttribute(`DEFAULT CURRENT_TIMESTAMP`);
220
228
  return this;
221
229
  }
222
230
  /**
223
- * Assign attrbuites 'autoIncrement' in table
231
+ * Assign attributes 'autoIncrement' in table
224
232
  * @return {this} this
225
233
  */
226
234
  autoIncrement() {
227
- this._addAssignAttrbuite(`AUTO_INCREMENT`);
235
+ this._addAssignAttribute(`AUTO_INCREMENT`);
228
236
  return this;
229
237
  }
230
238
  _addAssignType(type) {
@@ -233,8 +241,8 @@ class Blueprint {
233
241
  this.type = type;
234
242
  return this;
235
243
  }
236
- _addAssignAttrbuite(attrbuite) {
237
- this.attrbuites = [...this.attrbuites, attrbuite];
244
+ _addAssignAttribute(Attribute) {
245
+ this.attributes = [...this.attributes, Attribute];
238
246
  return this;
239
247
  }
240
248
  }
@@ -189,6 +189,13 @@ declare class Builder extends AbstractBuilder {
189
189
  * @return {this}
190
190
  */
191
191
  whereNotBetween(column: string, array: Array<any>): this;
192
+ /**
193
+ * where not between using [value1, value2]
194
+ * @param {string} column
195
+ * @param {array} array
196
+ * @return {this}
197
+ */
198
+ orWhereNotBetween(column: string, array: Array<any>): this;
192
199
  /**
193
200
  * where null using NULL
194
201
  * @param {string} column
@@ -776,6 +783,12 @@ declare class Builder extends AbstractBuilder {
776
783
  * @return {Promise<Array>}
777
784
  */
778
785
  showSchemas(table?: string): Promise<Array<string>>;
786
+ /**
787
+ *
788
+ * get schema from table
789
+ * @return {this} this this
790
+ */
791
+ getSchema(): Promise<any>;
779
792
  /**
780
793
  *
781
794
  * show values in table