tspace-mysql 1.5.0 → 1.5.2
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 +1856 -701
- package/build/cli/dump/db.js +3 -2
- package/build/cli/generate/make.js +17 -15
- package/build/cli/generate/modelDecorator.d.ts +1 -1
- package/build/cli/generate/modelDecorator.js +2 -3
- package/build/cli/index.js +45 -27
- package/build/cli/migrate/make.d.ts +1 -1
- package/build/cli/migrate/make.js +2 -2
- package/build/cli/migrations/make-db.d.ts +4 -0
- package/build/cli/migrations/make-db.js +58 -0
- package/build/cli/migrations/make.d.ts +2 -0
- package/build/cli/migrations/make.js +201 -0
- package/build/lib/Interface.d.ts +24 -5
- package/build/lib/connection/index.d.ts +5 -1
- package/build/lib/connection/index.js +65 -8
- package/build/lib/connection/options.js +2 -2
- package/build/lib/constants/index.js +13 -3
- package/build/lib/{tspace → core}/Abstracts/AbstractBuilder.d.ts +1 -1
- package/build/lib/{tspace → core}/Abstracts/AbstractModel.d.ts +15 -13
- package/build/lib/{tspace → core}/Blueprint.d.ts +14 -3
- package/build/lib/{tspace → core}/Blueprint.js +30 -4
- package/build/lib/{tspace → core}/Builder.d.ts +140 -44
- package/build/lib/{tspace → core}/Builder.js +772 -459
- package/build/lib/{tspace → core}/DB.d.ts +20 -4
- package/build/lib/{tspace → core}/DB.js +73 -39
- package/build/lib/{tspace → core}/Decorator.js +2 -2
- package/build/lib/{tspace → core/Handlers}/Logger.d.ts +3 -3
- package/build/lib/{tspace → core/Handlers}/Logger.js +4 -4
- package/build/lib/{tspace → core}/Handlers/Proxy.js +2 -2
- package/build/lib/{tspace → core}/Handlers/Relation.d.ts +2 -4
- package/build/lib/{tspace → core}/Handlers/Relation.js +69 -48
- package/build/lib/{tspace → core}/Handlers/State.d.ts +1 -1
- package/build/lib/{tspace → core}/Handlers/State.js +3 -3
- package/build/lib/{tspace → core}/Model.d.ts +358 -133
- package/build/lib/{tspace → core}/Model.js +1316 -558
- package/build/lib/core/Schema.d.ts +137 -0
- package/build/lib/{tspace → core}/Schema.js +147 -52
- package/build/lib/core/Type.d.ts +6 -0
- package/build/lib/core/Type.js +2 -0
- package/build/lib/{tspace → core}/index.d.ts +2 -1
- package/build/lib/{tspace → core}/index.js +3 -2
- package/build/lib/index.d.ts +2 -2
- package/build/lib/index.js +2 -2
- package/build/lib/utils/index.d.ts +1 -0
- package/build/lib/utils/index.js +17 -7
- package/package.json +6 -4
- package/build/lib/tspace/Schema.d.ts +0 -70
- /package/build/lib/{tspace → core}/Abstracts/AbstractBuilder.js +0 -0
- /package/build/lib/{tspace → core}/Abstracts/AbstractDB.d.ts +0 -0
- /package/build/lib/{tspace → core}/Abstracts/AbstractDB.js +0 -0
- /package/build/lib/{tspace → core}/Abstracts/AbstractModel.js +0 -0
- /package/build/lib/{tspace → core}/Decorator.d.ts +0 -0
- /package/build/lib/{tspace → core}/Handlers/Proxy.d.ts +0 -0
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Builder } from "./Builder";
|
|
2
|
-
declare class Schema extends Builder {
|
|
3
|
-
table: (table: string, schemas: Record<string, any>) => Promise<void>;
|
|
4
|
-
createTable: (table: string, schemas: Record<string, any>) => string;
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* The 'Sync' method is used to check for create or update table or columns with your schema in your model.
|
|
8
|
-
*
|
|
9
|
-
* The schema can define with method 'useSchema'
|
|
10
|
-
* @param {string} pathFolders directory to models
|
|
11
|
-
* @property {boolean} options.force - forec always check all columns if not exists will be created
|
|
12
|
-
* @property {boolean} options.log - show log execution with sql statements
|
|
13
|
-
* @property {boolean} options.delay - wait for execution
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* - node_modules
|
|
17
|
-
* - app
|
|
18
|
-
* - Models
|
|
19
|
-
* - User.ts
|
|
20
|
-
* - Post.ts
|
|
21
|
-
*
|
|
22
|
-
* // file User.ts
|
|
23
|
-
* class User extends Model {
|
|
24
|
-
* constructor(){
|
|
25
|
-
* super()
|
|
26
|
-
* this.hasMany({ name : 'posts' , model : Post })
|
|
27
|
-
* this.useSchema ({
|
|
28
|
-
* id : new Blueprint().int().notNull().primary().autoIncrement(),
|
|
29
|
-
* uuid : new Blueprint().varchar(50).null(),
|
|
30
|
-
* email : new Blueprint().int().notNull().unique(),
|
|
31
|
-
* name : new Blueprint().varchar(255).null(),
|
|
32
|
-
* created_at : new Blueprint().timestamp().null(),
|
|
33
|
-
* updated_at : new Blueprint().timestamp().null(),
|
|
34
|
-
* deleted_at : new Blueprint().timestamp().null()
|
|
35
|
-
* })
|
|
36
|
-
* }
|
|
37
|
-
* }
|
|
38
|
-
*
|
|
39
|
-
* // file Post.ts
|
|
40
|
-
* class Post extends Model {
|
|
41
|
-
* constructor(){
|
|
42
|
-
* super()
|
|
43
|
-
* this.hasMany({ name : 'comments' , model : Comment })
|
|
44
|
-
* this.belongsTo({ name : 'user' , model : User })
|
|
45
|
-
* this.useSchema ({
|
|
46
|
-
* id : new Blueprint().int().notNull().primary().autoIncrement(),
|
|
47
|
-
* uuid : new Blueprint().varchar(50).null(),
|
|
48
|
-
* user_id : new Blueprint().int().notNull().foreign({ references : 'id' , on : User , onDelete : 'CASCADE' , onUpdate : 'CASCADE' }),,
|
|
49
|
-
* title : new Blueprint().varchar(255).null(),
|
|
50
|
-
* created_at : new Blueprint().timestamp().null(),
|
|
51
|
-
* updated_at : new Blueprint().timestamp().null(),
|
|
52
|
-
* deleted_at : new Blueprint().timestamp().null()
|
|
53
|
-
* })
|
|
54
|
-
* }
|
|
55
|
-
* }
|
|
56
|
-
*
|
|
57
|
-
* await Schema.sync(`app/Models` , { force : true })
|
|
58
|
-
*/
|
|
59
|
-
static sync(pathFolders: string, { force, log, foreign, delay }?: {
|
|
60
|
-
force?: boolean | undefined;
|
|
61
|
-
log?: boolean | undefined;
|
|
62
|
-
foreign?: boolean | undefined;
|
|
63
|
-
delay?: number | undefined;
|
|
64
|
-
}): Promise<void>;
|
|
65
|
-
private static _import;
|
|
66
|
-
private static _syncExecute;
|
|
67
|
-
private static _syncForeignKey;
|
|
68
|
-
}
|
|
69
|
-
export { Schema };
|
|
70
|
-
export default Schema;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|