1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-07 16:25:41 -04:00

Working on script to adapt changes for pg

This commit is contained in:
Ryan Voots 2020-09-01 15:29:42 -07:00
parent f1e3237782
commit 50b21447d1

18
postgresql.sql Normal file
View file

@ -0,0 +1,18 @@
BEGIN;
DROP TABLE IF EXISTS public.factoid;
CREATE TABLE public.factoid AS (SELECT * FROM sqlite.factoid);
ALTER TABLE public.factoid ALTER COLUMN original_subject TYPE text;
ALTER TABLE public.factoid ALTER COLUMN subject TYPE text;
ALTER TABLE public.factoid ALTER COLUMN copula TYPE text;
ALTER TABLE public.factoid ALTER COLUMN author TYPE text;
ALTER TABLE public.factoid ADD COLUMN namespace text;
ALTER TABLE public.factoid ADD COLUMN server text;
UPDATE public.factoid SET namespace=split_part(original_subject, E'\034', 3), server=split_part(original_subject, E'\034', 2);
UPDATE public.factoid SET namespace=NULL WHERE namespace = '';
UPDATE public.factoid SET server=NULL WHERE server = '';
UPDATE public.factoid SET original_subject=split_part(original_subject, E'\034', 4), subject=split_part(subject, E'\034', 4) WHERE namespace IS NOT NULL and server IS NOT NULL;
COMMIT;