Tiago Correia
12/27/2018, 12:42 PMHarshit
12/27/2018, 3:31 PMTiago Correia
12/28/2018, 1:24 PMHarshit
12/28/2018, 1:31 PMHarshit
12/28/2018, 1:31 PMTiago Correia
12/28/2018, 2:55 PMtype Country {
id: ID! @unique
code: String! @unique
name: String!
}
Tiago Correia
12/28/2018, 2:55 PMTiago Correia
12/28/2018, 2:56 PMTiago Correia
12/28/2018, 2:56 PM[
{
"code": "AF",
"name": "Afghanistan"
},
{
"code": "AX",
"name": "ร
land Islands"
}
]
Tiago Correia
12/28/2018, 2:56 PMHarshit
12/28/2018, 2:56 PMHarshit
12/28/2018, 2:57 PMTiago Correia
12/28/2018, 3:06 PMHarshit
12/28/2018, 5:17 PMimport json from '/path/to/your/json/file'
import { prisma } from './generated/prisma-client'
async function nodeDoesntHaveTopLevelAwaitYet(){
json.forEach(el => {
await prisma.createCountry({
code: el.code,
name: el.name
})
});
}
nodeDoesntHaveTopLevelAwaitYet();
Harshit
12/28/2018, 5:19 PMprisma generate
2. replace the things with corrent path
3. run this with nodeHarshit
12/28/2018, 5:19 PMTiago Correia
12/28/2018, 7:25 PM