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.
Files changed (53) hide show
  1. package/README.md +1856 -701
  2. package/build/cli/dump/db.js +3 -2
  3. package/build/cli/generate/make.js +17 -15
  4. package/build/cli/generate/modelDecorator.d.ts +1 -1
  5. package/build/cli/generate/modelDecorator.js +2 -3
  6. package/build/cli/index.js +45 -27
  7. package/build/cli/migrate/make.d.ts +1 -1
  8. package/build/cli/migrate/make.js +2 -2
  9. package/build/cli/migrations/make-db.d.ts +4 -0
  10. package/build/cli/migrations/make-db.js +58 -0
  11. package/build/cli/migrations/make.d.ts +2 -0
  12. package/build/cli/migrations/make.js +201 -0
  13. package/build/lib/Interface.d.ts +24 -5
  14. package/build/lib/connection/index.d.ts +5 -1
  15. package/build/lib/connection/index.js +65 -8
  16. package/build/lib/connection/options.js +2 -2
  17. package/build/lib/constants/index.js +13 -3
  18. package/build/lib/{tspace → core}/Abstracts/AbstractBuilder.d.ts +1 -1
  19. package/build/lib/{tspace → core}/Abstracts/AbstractModel.d.ts +15 -13
  20. package/build/lib/{tspace → core}/Blueprint.d.ts +14 -3
  21. package/build/lib/{tspace → core}/Blueprint.js +30 -4
  22. package/build/lib/{tspace → core}/Builder.d.ts +140 -44
  23. package/build/lib/{tspace → core}/Builder.js +772 -459
  24. package/build/lib/{tspace → core}/DB.d.ts +20 -4
  25. package/build/lib/{tspace → core}/DB.js +73 -39
  26. package/build/lib/{tspace → core}/Decorator.js +2 -2
  27. package/build/lib/{tspace → core/Handlers}/Logger.d.ts +3 -3
  28. package/build/lib/{tspace → core/Handlers}/Logger.js +4 -4
  29. package/build/lib/{tspace → core}/Handlers/Proxy.js +2 -2
  30. package/build/lib/{tspace → core}/Handlers/Relation.d.ts +2 -4
  31. package/build/lib/{tspace → core}/Handlers/Relation.js +69 -48
  32. package/build/lib/{tspace → core}/Handlers/State.d.ts +1 -1
  33. package/build/lib/{tspace → core}/Handlers/State.js +3 -3
  34. package/build/lib/{tspace → core}/Model.d.ts +358 -133
  35. package/build/lib/{tspace → core}/Model.js +1316 -558
  36. package/build/lib/core/Schema.d.ts +137 -0
  37. package/build/lib/{tspace → core}/Schema.js +147 -52
  38. package/build/lib/core/Type.d.ts +6 -0
  39. package/build/lib/core/Type.js +2 -0
  40. package/build/lib/{tspace → core}/index.d.ts +2 -1
  41. package/build/lib/{tspace → core}/index.js +3 -2
  42. package/build/lib/index.d.ts +2 -2
  43. package/build/lib/index.js +2 -2
  44. package/build/lib/utils/index.d.ts +1 -0
  45. package/build/lib/utils/index.js +17 -7
  46. package/package.json +6 -4
  47. package/build/lib/tspace/Schema.d.ts +0 -70
  48. /package/build/lib/{tspace → core}/Abstracts/AbstractBuilder.js +0 -0
  49. /package/build/lib/{tspace → core}/Abstracts/AbstractDB.d.ts +0 -0
  50. /package/build/lib/{tspace → core}/Abstracts/AbstractDB.js +0 -0
  51. /package/build/lib/{tspace → core}/Abstracts/AbstractModel.js +0 -0
  52. /package/build/lib/{tspace → core}/Decorator.d.ts +0 -0
  53. /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