hanako
07/18/2022, 7:49 PMNeedle
07/18/2022, 7:49 PMOlyno
07/18/2022, 7:52 PMhanako
07/18/2022, 7:52 PMhanako
07/18/2022, 7:53 PMOlyno
07/18/2022, 7:53 PMOlyno
07/18/2022, 7:54 PMhanako
07/18/2022, 7:57 PMhanako
07/18/2022, 8:03 PMFailed to run sql query: function "handle_new_user" already exists with same argument typesOlyno
07/18/2022, 8:03 PMhanako
07/18/2022, 8:06 PMhanako
07/18/2022, 8:14 PMhanako
07/18/2022, 8:14 PMNanoBit
07/19/2022, 9:01 AMpsql -f to be able to reference the auth schema.hanako
07/19/2022, 1:05 PMNanoBit
07/19/2022, 1:09 PMjson
"prisma:setup": "psql -f path/to/file.sql $DATABASE_URL ",
Then I run that, AFTER I run my migrate command. You can run it separately or
json
"prisma:migrate": "yarn prisma migrate dev && yarn run prisma:setup",
Note: This is still a workflow testing in progress. At the end, I will post my results to the discussions https://github.com/supabase/supabase/discussions/7659 where I can hopefully explain how I combine Prisma and Supabasehanako
07/19/2022, 1:11 PMNanoBit
07/19/2022, 1:11 PMhanako
07/21/2022, 3:14 PMnpm run prisma:setup but got this -
Password for user asus:
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user
"asus"hanako
07/21/2022, 3:15 PMasus it came out of nowhere. I don't know its password and hence this errorhanako
07/21/2022, 3:16 PMNanoBit
07/21/2022, 3:16 PMhanako
07/21/2022, 3:17 PM"prisma:setup": "psql -f path/to/file.sql $DATABASE_URL ", in package.jsonNanoBit
07/21/2022, 3:17 PM$DATABASE_URL points to your DB url (which you can get from Supabase dashboard)?NanoBit
07/21/2022, 3:17 PMpath/to/file.sql is pointing to an actual file?hanako
07/21/2022, 3:18 PMhanako
07/21/2022, 3:19 PMNanoBit
07/21/2022, 3:19 PMNanoBit
07/21/2022, 3:19 PMhanako
07/21/2022, 3:20 PMhanako
07/21/2022, 3:20 PMhanako
07/21/2022, 3:20 PMNanoBit
07/21/2022, 3:21 PMNanoBit
07/21/2022, 3:21 PMpsql)hanako
07/21/2022, 3:22 PMhanako
07/21/2022, 3:22 PMfile.sql in the project directory?hanako
07/21/2022, 3:23 PMNanoBit
07/21/2022, 3:23 PM.env points me to https://stackoverflow.com/a/60701796NanoBit
07/21/2022, 3:23 PMprisma directory. But it's up to youNanoBit
07/21/2022, 3:24 PMpath/to/file.sql with the path of the fileNanoBit
07/21/2022, 3:24 PMpath/to/file format in the past.hanako
07/21/2022, 3:25 PM/prisma then it'll be prisma/file.sql?NanoBit
07/21/2022, 3:25 PMfile.sql. It is also up to you how you want to name ithanako
07/21/2022, 3:25 PMhanako
07/21/2022, 3:26 PMNanoBit
07/21/2022, 3:28 PMNanoBit
07/21/2022, 3:28 PMhanako
07/21/2022, 7:55 PM"prisma:setup": "psql -f prisma/file.sql DATABASE_URL",
"prisma:migrate": "npx prisma migrate dev && npm run prisma:setup"hanako
07/21/2022, 7:56 PMError: db error: ERROR: database "prisma_migrate_shadow_db_ccead842-6b6e-4416-a568-486137389446" is being accessed by other users
DETAIL: There is 1 other session using the database.
0: sql_migration_connector::validate_migrations
at migration-engine\connectors\sql-migration-connector\src\lib.rs:272
1: migration_core::state::DevDiagnostic
at migration-engine\core\src\state.rs:250hanako
07/21/2022, 7:57 PMhanako
07/21/2022, 7:58 PMNanoBit
07/22/2022, 4:04 AMNanoBit
07/22/2022, 4:05 AMhanako
07/22/2022, 7:58 AMhanako
07/22/2022, 7:58 AMNanoBit
07/22/2022, 8:37 AMNanoBit
07/22/2022, 8:37 AMNanoBit
07/22/2022, 8:37 AMNanoBit
07/22/2022, 8:37 AMNanoBit
07/22/2022, 9:07 AMhanako
07/22/2022, 10:11 AMhanako
07/22/2022, 10:30 AMhanako
07/22/2022, 12:04 PMasus in my case, which is my pc's name)hanako
07/22/2022, 12:04 PMhanako
07/22/2022, 12:05 PM"prisma:setup": "psql -U postgres prisma/file.sql DATABASE_URL",
"prisma:push": "npx prisma db push && npm run prisma:setup"hanako
07/22/2022, 12:09 PMhanako
07/22/2022, 12:09 PMpsql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: database "prisma/file.sql" does not existhanako
07/22/2022, 12:10 PMprisma/file.sql then it still says the same but now "DATABASE_URL" does not existhanako
07/22/2022, 12:11 PMNanoBit
07/22/2022, 12:51 PMfile.sql exist in prisma folder?hanako
07/22/2022, 1:00 PMNanoBit
07/22/2022, 1:02 PMDATABASE_URL a placeholder for your real URL?NanoBit
07/22/2022, 1:05 PMSettings>Database>Connection String . Then choose psql. You can even try running that command solo to see if you connect successfullyhanako
07/22/2022, 4:32 PMDATABASE_URL = supabase connection string in .envhanako
07/22/2022, 4:34 PMhanako
07/22/2022, 4:36 PMNanoBit
07/22/2022, 5:23 PMNanoBit
07/22/2022, 5:24 PMhanako
07/22/2022, 5:25 PMNanoBit
07/22/2022, 5:26 PMhanako
07/22/2022, 5:28 PMhanako
07/22/2022, 5:29 PMhanako
07/22/2022, 5:30 PMNanoBit
07/22/2022, 6:11 PMfile.sql for the psql command. (adapted to your needs ofc)hanako
07/22/2022, 6:18 PMNeedle
07/24/2022, 12:58 PM