tspace-mysql 1.0.4 → 1.0.5
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/dist/cli/migrate/make.js
CHANGED
|
@@ -33,6 +33,7 @@ exports.default = (function (_ref) {
|
|
|
33
33
|
if (!(files === null || files === void 0 ? void 0 : files.length))
|
|
34
34
|
console.log('this folder is empty');
|
|
35
35
|
var cmd = type === '.js' ? 'node' : 'ts-node';
|
|
36
|
+
var sum = 0;
|
|
36
37
|
try {
|
|
37
38
|
for (var files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
|
|
38
39
|
var _file = files_1_1.value;
|
|
@@ -45,6 +46,7 @@ exports.default = (function (_ref) {
|
|
|
45
46
|
if (err)
|
|
46
47
|
console.error(err);
|
|
47
48
|
});
|
|
49
|
+
sum++;
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -54,6 +56,8 @@ exports.default = (function (_ref) {
|
|
|
54
56
|
}
|
|
55
57
|
finally { if (e_1) throw e_1.error; }
|
|
56
58
|
}
|
|
59
|
+
if (sum === file.length)
|
|
60
|
+
process.exit(0);
|
|
57
61
|
}
|
|
58
62
|
catch (err) {
|
|
59
63
|
console.log(err.message);
|
package/dist/cli/tables/make.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var table_1 = __importDefault(require("./table"));
|
|
7
7
|
exports.default = (function (_ref) {
|
|
8
|
-
var file = _ref.file,
|
|
8
|
+
var file = _ref.file, type = _ref.type, cwd = _ref.cwd, dir = _ref.dir, fs = _ref.fs, npm = _ref.npm;
|
|
9
9
|
// if(name == null) {
|
|
10
10
|
// console.log(`use ${npm} make:migration <NAME TABLE> --dir=<DIRECTORY>`)
|
|
11
11
|
// process.exit(0);
|
|
@@ -21,11 +21,11 @@ exports.default = (function (_ref) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
var folderMigrate = dir ? "".concat(cwd, "/").concat(dir, "/create_").concat(file, "_table").concat(type) : "".concat(cwd, "/create_").concat(file, "_table").concat(type);
|
|
24
|
-
var table = (0, table_1.default)(
|
|
24
|
+
var table = (0, table_1.default)(file, npm);
|
|
25
25
|
fs.writeFile(folderMigrate, table, function (err) {
|
|
26
26
|
if (err)
|
|
27
27
|
console.log(err.message);
|
|
28
28
|
});
|
|
29
|
-
console.log("Migration : ".concat(
|
|
29
|
+
console.log("Migration : ".concat(file, " created successfully"));
|
|
30
30
|
process.exit(0);
|
|
31
31
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const Table: (
|
|
1
|
+
declare const Table: (table: string, npm: string) => string;
|
|
2
2
|
export default Table;
|
package/dist/cli/tables/table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var Table = function (
|
|
4
|
-
return "import { Schema , Blueprint , DB } from '".concat(npm, "'\n(async () => {\n await new Schema().table('").concat(
|
|
3
|
+
var Table = function (table, npm) {
|
|
4
|
+
return "import { Schema , Blueprint , DB } from '".concat(npm, "'\n(async () => {\n await new Schema().table('").concat(table, "',{ \n id : new Blueprint().int().notNull().primary().autoIncrement(),\n name : new Blueprint().varchar(120).default('my name'),\n email : new Blueprint().varchar(120).unique(),\n email_verify : new Blueprint().tinyInt(),\n password : new Blueprint().varchar(120),\n birthdate : new Blueprint().date(),\n created_at : new Blueprint().null().timestamp(),\n updated_at : new Blueprint().null().timestamp()\n })\n\n /**\n * \n * @Faker data\n * await new DB().table('").concat(table, "').faker(5)\n */\n})()\n");
|
|
5
5
|
};
|
|
6
6
|
exports.default = Table;
|