--- org-options

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

    max_inbox number not null,

    created_at timestamp with time zone not null,
    updated_at timestamp with time zone not null
);

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

    allow_user_file_upload number(1) not null,

    created_at timestamp with time zone not null,
    updated_at timestamp with time zone 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;
