You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// As you may have noticed, we have two tools to generate code, instead of having just one. What is the reason? The reason is that each tool starts from a different input. devon4node CLI receives user input, while cobigen receives code already exists and generates the rest accordingly. So, in order to increase the productivity, we can combine the use of both.
30
-
31
27
== Nest CLI and Devon4node schematics
32
28
33
29
We are going to use the Nest CLI to generate code of our application, you can know more about NodeJs CLI in the official link:https://docs.nestjs.com/cli/overview:[documentation].
@@ -36,11 +32,12 @@ We are going to use the Nest CLI to generate code of our application, you can kn
36
32
37
33
First of all, you need to install Nest CLI
38
34
39
-
Execute the command `yarn global add @nestjs/cli`
35
+
Execute the command `yarn global add @nestjs/cli`.
36
+
You can also use npm: `npm install -g @nestjs/cli`
40
37
41
38
And then Devon4node schematics globally with the following command:
42
39
43
-
`yarn global add @devon4node/schematics`
40
+
`yarn global add @devon4node/schematics` or `npm install -g @devon4node/schematics`
44
41
45
42
[NOTE]
46
43
====
@@ -127,13 +124,14 @@ Execute `nest g -c @devon4node/schematics security`
127
124
=== Generate database migrations
128
125
129
126
. Generate database migrations
130
-
.. In order to create migration scripts with typeorm, you need to install ts-node: `yarn global add ts-node`
127
+
.. In order to create migration scripts with typeorm, you need to install ts-node: `yarn global add ts-node` or `npm i -g ts-node`
131
128
.. Generate the tables creation migration: `yarn run typeorm migration:generate -n CreateTables`
132
129
+
130
+
image::images/insert-data.PNG[]
133
131
It will connect to the database, read all entities and then it will generate a migration file with all sql queries need to transform the current status of the database to the status defined by the entities. If the database is empty, it will generate all sql queries need to create all tables defined in the entities. You can find a example in the todo example
134
132
135
133
As typeorm is the tool used for DB. You can check official documentation for more information.
136
-
See link::[typeorm CLI documentation].
134
+
See link::https://typeorm.io/#/using-cli[typeorm CLI documentation].
0 commit comments