--- company-details

CREATE TABLE company_details (
  company_id            NUMBER(19) PRIMARY KEY REFERENCES companies (id),

  inn                   VARCHAR2(1024 CHAR),
  kpp                   VARCHAR2(1024 CHAR),
  resident              NUMBER(1)                NOT NULL,
  phone                 VARCHAR2(1024 CHAR),
  short_name            VARCHAR2(1024 CHAR),
  international_name    VARCHAR2(1024 CHAR),
  ogrn                  VARCHAR2(1024 CHAR),
  ogrn_date             VARCHAR2(1024 CHAR),
  international_address VARCHAR2(1024 CHAR),

  created_at            TIMESTAMP WITH TIME ZONE NOT NULL,
  updated_at            TIMESTAMP WITH TIME ZONE NOT NULL
);

INSERT INTO company_details (company_id, resident, created_at, updated_at) (
  SELECT
    c.id,
    1,
    SYSTIMESTAMP,
    SYSTIMESTAMP
  FROM companies c
);
