numerus/deploy/company.sql

37 lines
873 B
PL/PgSQL

-- Deploy numerus:company to pg
-- requires: schema_numerus
-- requires: extension_vat
-- requires: email
-- requires: extension_pg_libphonenumber
-- requires: extension_uri
-- requires: currency_code
-- requires: currency
begin;
set search_path to numerus,public;
create table company (
company_id serial primary key,
slug uuid not null unique default gen_random_uuid(),
business_name text not null,
vatin vatin not null,
trade_name text not null,
phone packed_phone_number not null,
email email not null,
web uri not null,
address text not null,
city text not null,
province text not null,
postal_code text not null,
country text not null,
currency_code currency_code not null references currency,
created_at timestamptz not null default current_timestamp
);
grant select on table company to invoicer;
grant select on table company to admin;
commit;