--- org-options

create table org_options (
    org_id bigint primary key references orgs(id),

    max_inbox int not null,

    created_at timestamptz not null,
    updated_at timestamptz not null
);

create table project_options (
    project_id bigint primary key references projects(id),

    allow_user_file_upload boolean not null,

    created_at timestamptz not null,
    updated_at timestamptz not null
);

insert into org_options (
    org_id,
    max_inbox,
    created_at,
    updated_at
) (
    SELECT
        id,
        max_inbox,
        created_at,
        updated_at
    FROM
        orgs
);

alter table orgs drop column max_inbox;
