Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore :: v1.1.2 누락 된 if exists 재추가 #82

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
-- 복호화 view 삭제
drop view member_view;
drop view IF EXISTS member_view;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻


-- 함수 삭제
drop function member_view_delete_trigger;
drop function member_view_insert_trigger;
drop function member_view_update_trigger;
drop function IF EXISTS member_view_delete_trigger;
drop function IF EXISTS member_view_insert_trigger;
drop function IF EXISTS member_view_update_trigger;


-- member 테이블 컬럼 자료형 변경
ALTER TABLE public."member" RENAME COLUMN birthdate TO age;
ALTER TABLE public."member" ALTER COLUMN age TYPE INT;
ALTER TABLE public."member" ALTER COLUMN gender TYPE INT;
ALTER TABLE public."member" DROP COLUMN IF EXISTS birthdate;
ALTER TABLE public."member" DROP COLUMN IF EXISTS gender;
ALTER TABLE public."member" ADD COLUMN IF NOT EXISTS age int;
ALTER TABLE public."member" ADD COLUMN IF NOT EXISTS gender int;

-- 복호화 뷰 생성
CREATE
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code patch includes the following changes:

  1. The view member_view is dropped using drop view IF EXISTS member_view;. This ensures that the view is only dropped if it exists.
  2. Three functions (member_view_delete_trigger, member_view_insert_trigger, and member_view_update_trigger) are dropped using drop function IF EXISTS <function_name>;. Once again, this ensures that the functions are only dropped if they exist.
  3. The column birthdate in the table member is dropped if it exists using ALTER TABLE public."member" DROP COLUMN IF EXISTS birthdate;.
  4. The column gender in the table member is dropped if it exists using ALTER TABLE public."member" DROP COLUMN IF EXISTS gender;.
  5. The column age is added to the member table if it doesn't exist using ALTER TABLE public."member" ADD COLUMN IF NOT EXISTS age int;.
  6. The column gender is added to the member table if it doesn't exist using ALTER TABLE public."member" ADD COLUMN IF NOT EXISTS gender int;.

Overall, the code appears to handle the dropping of views, functions, and columns gracefully, using appropriate checks for their existence. However, without additional context or knowledge of the specific requirements, it is difficult to provide further improvement suggestions or identify potential bug risks.

Expand Down
Loading