--- company-details

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

  inn                   VARCHAR(1024),
  kpp                   VARCHAR(1024),
  resident              BOOLEAN     NOT NULL,
  phone                 VARCHAR(1024),
  short_name            VARCHAR(1024),
  international_name    VARCHAR(1024),
  ogrn                  VARCHAR(1024),
  ogrn_date             VARCHAR(1024),
  international_address VARCHAR(1024),

  created_at            TIMESTAMPTZ NOT NULL,
  updated_at            TIMESTAMPTZ NOT NULL
);

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