Drop the public from table references as we won't be in the public schema
This commit is contained in:
parent
9806a970da
commit
b35c79761f
@ -1,16 +1,16 @@
|
||||
-- Create a new join table to associate time_entries with tags
|
||||
CREATE TABLE public.time_entry_tags (
|
||||
time_entry_id bigint not null references public.time_entries(id) on delete cascade,
|
||||
tag_id bigint not null references public.tags(id) on delete cascade,
|
||||
CREATE TABLE time_entry_tags (
|
||||
time_entry_id bigint not null references time_entries(id) on delete cascade,
|
||||
tag_id bigint not null references tags(id) on delete cascade,
|
||||
primary key (time_entry_id, tag_id)
|
||||
);
|
||||
|
||||
-- Insert data into the new join table based on the existing time_entries and tags data
|
||||
INSERT INTO public.time_entry_tags (time_entry_id, tag_id)
|
||||
INSERT INTO time_entry_tags (time_entry_id, tag_id)
|
||||
SELECT time_entries.id, UNNEST(time_entries.tag_ids) AS tag_id
|
||||
FROM public.time_entries
|
||||
FROM time_entries
|
||||
WHERE time_entries.tag_ids IS NOT NULL;
|
||||
|
||||
-- Remove the tag_ids array column from the time_entries table
|
||||
ALTER TABLE public.time_entries
|
||||
ALTER TABLE time_entries
|
||||
DROP COLUMN tag_ids;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user