Skip to content

Commit 4b47967

Browse files
ZenikAdrienpierre-nicoliRiduidelhgwood
authored
Skills update (#169)
* 🗃️ Add verified column to Skill table * 🗃️ Add init scripts for referential data * 🗃️ Adding Skill / Tag relationship init * 🗃️ Adding unicity constraint on skill/tag combo * 🗃️ Add init scripts for topics + type column * 🗃️ Idempotence on Category seeding * 🗃️ Separating local_seeding from referential seeding * 🗃️ Created the skill to topic mapping * 🗃️ Update skill topics * 🗃️ Update skill topics * 🗃️🐛 Inserting data works better when the table actually exists :) * 🔒 overriding dep for underscore,upgrading sharp (#160) * 🔒 overriding dep for underscore,upgrading sharp * 🔧 upgrade node in ci * 🔧 upgrading graphql to fix peer dependency conflict * 🔧 Updating deps Co-authored-by: Hugo Wood <[email protected]> * 📦 Updating hasura engine (#165) * 📦 Hasura update (#167) * 📦 Updating hasura engine * 📦 Updating node images for CI build * 📦 Updating circleci build script * 📦 Lowering to have matching nodes alogn the build script * 🌐 Upodated localisations (#168) * 🔧 This file is weirdly needed by migration generation from Hasura Co-authored-by: Pierre Nicoli <[email protected]> Co-authored-by: Nicolas Delsaux <[email protected]> Co-authored-by: Hugo Wood <[email protected]>
1 parent 83c997c commit 4b47967

File tree

24 files changed

+1565
-333
lines changed

24 files changed

+1565
-333
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,34 @@ Start by running `docker compose up -d` to launch the postgres database and the
4141
Check that engine is running by going to `http://localhost:8080` (do not modify schemas through this URL).
4242

4343
### Run the hasura migrations
44-
45-
Run `npm run hasura migrate apply` (schemas setup) and `npm run hasura metadata apply` (graphql setup) to apply migrations and metadatas
44+
In order to initialize / update the database run :
45+
```
46+
# npm run hasura migrate apply # Sets up the schema
47+
# npm run hasura metadata apply # Sets up GraphQL
48+
# npm run hasura seed apply # Optional : seeds/cleans up the database with referential data
49+
```
4650

4751
Connect to the Hasura console by running `npm run hasura console` (it should open the console in your browser with the correct port (to keep track of schema changes in the hasura/migrations folder)).
4852

4953
Browse to the `Data` tab in the console and select the `User` table.
5054
Create your own Zenika user (its email should match your login email).
5155

56+
### Develop with hasura
57+
For hasura to generate the migration files properly the hasura console must be run apart from the "in-app" hasura engine and console.
58+
```
59+
# npm install --global hasura-cli # Installs the hasura console globally
60+
# cd ./hasura # Go into the hasura folder to reuse the config.yaml
61+
# hasura console # Runs the "other" hasura console on a different port
62+
```
63+
5264
### Launch the app
5365

5466
Run the dev server using `npm run dev`.
5567
The application should be available at the URL specified in your .env.local file under `NEXT_PUBLIC_BASE_URL`.
5668

57-
### Generate seeds
69+
### Generate local seeds
5870

5971
If you want to generate random seed data, you can use the hasura console to export the Skill table to JSON
60-
Then move it to `hasura/seeds/Skill.json`
72+
Then move it to `hasura/local_seeds/Skill.json`
6173
You can now run `npm run seeds:generate`
6274
And `npm run seeds:apply` to apply the random data to the database
Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,12 @@
55
{
66
"name": "Nantes"
77
},
8-
{
9-
"name": "Singapore"
10-
},
118
{
129
"name": "Bordeaux"
1310
},
1411
{
1512
"name": "Brest"
1613
},
17-
{
18-
"name": "Montreal"
19-
},
2014
{
2115
"name": "Grenoble"
2216
},
@@ -28,5 +22,23 @@
2822
},
2923
{
3024
"name": "Lille"
25+
},
26+
{
27+
"name": "Niort"
28+
},
29+
{
30+
"name": "Clermont-Ferrand"
31+
},
32+
{
33+
"name": "Singapore"
34+
},
35+
{
36+
"name": "Montreal"
37+
},
38+
{
39+
"name": "Toronto"
40+
},
41+
{
42+
"name": "Casablanca"
3143
}
3244
]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@
22
{
33
"index": 1,
44
"color": "yellow",
5-
"label": "languages-and-frameworks",
5+
"label": "practices",
66
"x": "left",
77
"y": "top",
88
"id": "89780de3-4a4c-40c2-bcdf-b5d15a48437a"
99
},
1010
{
1111
"index": 2,
1212
"color": "violet",
13-
"label": "platforms",
13+
"label": "activities",
1414
"x": "right",
1515
"y": "top",
1616
"id": "06420261-3e78-4a91-bc6a-1a52cad5d6a1"
1717
},
1818
{
1919
"index": 3,
2020
"color": "blue",
21-
"label": "tools",
21+
"label": "knowledge",
2222
"x": "left",
2323
"y": "bot",
2424
"id": "c3341edb-3c1f-4e3d-bf89-8e795eb13690"
2525
},
2626
{
2727
"index": 4,
2828
"color": "cyan",
29-
"label": "technics-and-methods",
29+
"label": "behaviors",
3030
"x": "right",
3131
"y": "bot",
3232
"id": "89f5e9a5-5ce6-416c-bed9-dd736546aa7f"
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type Skill = { id: string; name: string; categoryId: string };
1414

1515
const agencies: Agency[] = require("./Agency.json");
1616
const categories = require("./Category.json");
17+
const tags: Skill[] = require("./Tag.json");
1718
const skills: Skill[] = require("./Skill.json");
1819
const topics = require("./Topic.json");
1920

@@ -134,6 +135,6 @@ ${userAgenciesInsertQuery.query}
134135
${userSkillsInsertQuery.query}`;
135136

136137
(async () => {
137-
await writeFile("./hasura/seeds/seeds.sql", result);
138-
console.log("Seeds succesfully generated into hasura/seeds/seeds.sql file");
138+
await writeFile("./hasura/local_seeds/seeds.sql", result);
139+
console.log("Seeds succesfully generated into hasura/local_seeds/seeds.sql file");
139140
})();

hasura/metadata/network.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

hasura/metadata/tables.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@
136136
- table:
137137
schema: public
138138
name: SkillTag
139+
- table:
140+
schema: public
141+
name: SkillTopic
139142
- table:
140143
schema: public
141144
name: Tag

0 commit comments

Comments
 (0)