-
Notifications
You must be signed in to change notification settings - Fork 308
Closed
Labels
Description
Actions
-
rename table in supabase admin panel
-
create get migration from remote
> supabase db pull
Connecting to remote database...
Setting up initial schema....
Applying migration 20231129030618_remote_schema.sql...
Applying migration 20231129093821_remote_schema.sql...
Applying migration 20231129114012_user_management_starter.sql...
Schema written to supabase/migrations/20231207142347_remote_schema.sql
Update remote migration history table? [Y/n] n
Finished supabase db pull.
Result
auto-generated migration SQL code:
alter table "public"."town" drop constraint "town_country_id_fkey";
alter table "public"."country" drop constraint "country_pkey";
drop index if exists "public"."country_pkey";
drop table "public"."country";
create table "public"."countries" (
"id" bigint generated by default as identity not null,
"name" text,
"created_at" timestamp with time zone not null default now(),
"updated_at" timestamp with time zone default now(),
"found_year" bigint,
"next_rename_year" bigint
);
CREATE UNIQUE INDEX country_pkey ON public.countries USING btree (id);
alter table "public"."countries" add constraint "country_pkey" PRIMARY KEY using index "country_pkey";
alter table "public"."town" add constraint "town_country_id_fkey" FOREIGN KEY (country_id) REFERENCES countries(id) ON UPDATE CASCADE not valid;
alter table "public"."town" validate constraint "town_country_id_fkey";
Such migration will result in all information stored in table to be lost.
Why rename table https://www.geeksforgeeks.org/postgresql-rename-table/ statement was not used?!
Version
> supabase --version
1.113.3