Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.

Commit 2364503

Browse files
authored
Merge pull request #118 from ASAP-Lettering/ASAP-407
ASAP-407 space에 is_main 컬럼 추가(w/ trigger)
2 parents 7ae29cb + 8bef085 commit 2364503

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- add is_main column to space table
2+
alter table space
3+
add column is_main boolean not null default false;
4+
5+
-- set is_main to true for space with space_index = 0
6+
update space
7+
set is_main = true
8+
where space_index = 0;
9+
10+
-- create trigger to update is_main column
11+
create trigger update_space_is_main
12+
before update
13+
on space
14+
for each row
15+
begin
16+
if new.space_index = 0 then
17+
set new.is_main = true;
18+
else
19+
set new.is_main = false;
20+
end if;
21+
end;

0 commit comments

Comments
 (0)