Untitled

 avatar
user_6688396
plain_text
a year ago
527 B
6
Indexable
Never
insert into team_users(
  user_id,
  team_id,
  deleted,
  owner,
  profile,
  created_at,
  updated_at
)
select
  usu.id as user_id,
  tea.id as team_id,
  false as deleted,
  true as owner,
  1 as profile,
  current_timestamp as create_at,
  current_timestamp as updated_at
from
  teams tea
cross join (
  select
    id,
	name
  from
    users
  where email in (
    'lucas.assis@trinusco.com.br'
  )
) usu
where (usu.id, tea.id) not in (
  select
    user_id,
	team_id
  from
	team_users
)