Lars-Jørgen Kristiansen
02/26/2019, 8:13 AMwillem
02/26/2019, 9:32 AMRicky
02/26/2019, 10:25 AMprisma export
for db A. Then I ran prisma import -d <data-from-db-a-export>
. The nodes and lists imported fine but it constantly gives me error with relations in the format of "Failure inserting into relationtable _SurveyQuestionToSurveyResponse with ids StringIdGCValue(cjrcatjb9eeaa0754rfpxi0ay) and StringIdGCValue(cjrcau0oaeryc0754msyvwl3u). Cause: duplicate key value violates unique constraint \"_SurveyQuestionToSurveyResponse_AB_unique\"\n Detail: Key (\"A\", \"B\")=(cjrcatjb9eeaa0754rfpxi0ay, cjrcau0oaeryc0754msyvwl3u) already exists."
. Given that db B is initially empty and has the same schema as db A, what could be the possible causes? Thanksrein
02/26/2019, 10:28 AMpablo
02/26/2019, 12:53 PMLotafak
02/26/2019, 2:04 PMHooks:
Seeding based on node ./database/seed.js...
or
Resetting default@default 340ms
In addition - the seed finished sucessfully, it’s that CI fails now, because this step is “never finished”.
My seed file:
const { Graphcool } = require('graphcool-binding');
const db = new Graphcool({
typeDefs: 'src/generated/prisma.graphql',
endpoint: process.env.PRISMA_ENDPOINT,
secret: process.env.PRISMA_SECRET,
debug: false,
});
const seedUsers = async () => {
await db.mutation.createUser({
...
});
};
seedUsers();
swangy
02/26/2019, 4:02 PMswangy
02/26/2019, 4:03 PM? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? MySQL
? Does your database contain existing data? No
? Enter database host localhost
? Enter database port 8889
? Enter database user root
? Enter database password root
Connecting to database !
▸ Connection terminated unexpectedly
Get in touch if you need help: <https://www.prisma.io/forum/>
To get more detailed output, run $ export DEBUG="*"
swangy
02/26/2019, 4:03 PMJoellao
02/26/2019, 6:16 PMtype User {
id: ID! @unique
email: String @unique
username: String @unique
password: String!
firstname: String
lastname: String
createdAt: DateTime!
updatedAt: DateTime!
friends: [Friendship!]!
}
type Friendship{
id: ID! @unique
createdAt: DateTime!
users: [User!]!
}
and each user has an array of Friends. So I was thinking to implement it like the users of the people that array, but kinda went and using like the relation with Friendship table since i may want to know when they became friends etc, so the output of that is something like [idUser1, idUser2] and inside the user there is an array with the Ids of this record in Friendship table where the values are saved. Maybe this isn't the best way, in pure SQL i would have done something like the friendship table and saving user1 and user2 without the other fieldsrawriclark
02/26/2019, 7:27 PMrawriclark
02/26/2019, 7:27 PMrawriclark
02/26/2019, 7:28 PMlawjolla
02/26/2019, 8:02 PMtanekim77
02/26/2019, 8:59 PMwindkomo
02/26/2019, 9:43 PMbeforeAll
using prisma-client:
let user;
beforeAll(async () => {
user = await prisma.createUser({
name: 'John'
});
});
test('stuff', () => {
const res = doStuffWithUser(user);
expect(res)...
});
good idea or not? Right now I’m creating data manually for each test and reloading database on each test runeKane
02/26/2019, 9:44 PMChiwanAhn
02/27/2019, 12:31 AMcreateUser(
data: {
accounts: {
create: [
currency: USD *enum value*
...
]
}
}
)
Cristian
02/27/2019, 1:10 AMJames Hunyar
02/27/2019, 2:41 AMconnect
multiple Item types to a List type. My client sends me an array of Item objects in the data, and I am unsure of how to handle it on the server. I do have a mutation to connect individual items to lists using connect
with the passed id
property, to the list by id
as well. I have considered that perhaps I should do an UpdateMany... type of mutation on the passed Items, linking each one to the passed List rather than perform a mutation on the List which was my initial challenge.sburke
02/27/2019, 3:25 AMtype User {
foo: String
}
and I want to rename the type
type User {
foo: Float
}
I'm getting You already have nodes for this model. This change may result in data loss.
when I run prisma deploy
sburke
02/27/2019, 3:25 AMLotafak
02/27/2019, 7:29 AMUxname
02/27/2019, 8:49 AMohorovsky
02/27/2019, 10:18 AMrem
02/27/2019, 11:44 AMrem
02/27/2019, 11:44 AMbtotharye
02/27/2019, 12:00 PMbtotharye
02/27/2019, 12:52 PMPlínio Naves
02/27/2019, 12:52 PM