add
This commit is contained in:
@@ -57,6 +57,25 @@ BEGIN
|
|||||||
ELSE
|
ELSE
|
||||||
RAISE NOTICE 'country_code table already exists';
|
RAISE NOTICE 'country_code table already exists';
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
IF NOT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'country_flag') THEN
|
||||||
|
CREATE TABLE country_flag (
|
||||||
|
id UUID DEFAULT gen_random_uuid_v7() PRIMARY KEY NOT NULL,
|
||||||
|
country_id UUID NOT NULL,
|
||||||
|
flag VARCHAR NOT NULL,
|
||||||
|
deleted BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
CREATE TRIGGER update_flag_updated_at
|
||||||
|
BEFORE UPDATE ON "country_flag"
|
||||||
|
FOR EACH ROW
|
||||||
|
EXECUTE FUNCTION update_data_modified_column();
|
||||||
|
|
||||||
|
RAISE NOTICE 'created country_flag table and trigger';
|
||||||
|
ELSE
|
||||||
|
RAISE NOTICE 'country_flag table already exists';
|
||||||
|
END IF;
|
||||||
END $$;
|
END $$;
|
||||||
|
|
||||||
DO $$
|
DO $$
|
||||||
|
|||||||
Reference in New Issue
Block a user