--up
drop table ecs_scalers;

--down
create table ecs_scalers (
  id integer primary key generated always as identity,
  name text not null unique,
  cluster_arn text not null,
  service_arn text not null,
  min_workers integer not null,
  max_workers integer not null,
  cooldown_seconds integer not null,
  last_scale_time timestamp without time zone,
  unique (cluster_arn, service_arn),
  check (min_workers >= 0 AND min_workers <= max_workers AND cooldown_seconds >= 0)
);
