https://supabase.com/ logo
#help
Title
# help
b

Bicijay

06/09/2022, 3:12 PM
Hey guys, i created a project in the cloud with a lot of tables/policies/functions, now i want to create a local enviroment with the supabase cli. To manage migrations between projects im using migrations scripts with knex.js, so the first script would be a dump of my cloud project with pg_dump. The thing is, when i try to run the DDL statement on my local supabase instance i have a lot of "already exists" type errors, is there any way i could create the local instance in a "clean state" so i can import the dump without collisions?
n

Needle

06/09/2022, 3:12 PM
Hello @Bicijay! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
b

Bicijay

06/09/2022, 3:20 PM
so i added some new args to the pgdump --clean --if-exists --quote-all-identifiers but now i get this error: cannot drop schema storage because other objects depend on it
b

burggraf

06/09/2022, 4:52 PM
Maybe exclude the storage schema
-N, --exclude-schema=PATTERN do NOT dump the specified schema(s)
b

Bicijay

06/09/2022, 5:29 PM
Managed to make it work with the remote migration tool from cli, everything seems to be working alright after some tweaks
One thing that is missing is all buckets and their policies from the cloud project
is there any way i could create the buckets through a sql script, and would it create the buckets on s3 too?
b

burggraf

06/09/2022, 5:40 PM
If you followed the instructions on that page (just above, the migration part) and set your permissions to elevate postgres to superuser, then you should have been able to migrate everything related to storage
b

Bicijay

06/09/2022, 5:45 PM
i didnt run de pg_dump command because it gave me a lot of collisions, and it would take a lot of time to fix each one of them manually, so i used the cli remote migration tool to check the diff between the two databases pretty sure i ran it with postgres user as a superuser, maybe this tool does not includes the storage schema?
yeah, pretty sure it ran the diff only on things related to the public schema i mean, i dont mind to write another script to create the buckets and their policies, just checking if thats the expected behavior from the cli migration tool
n

Needle

06/09/2022, 10:46 PM
Thread was archived by @Bicijay. Anyone can send a message to unarchive it.