comnpany to cm

This commit is contained in:
ctengiz
2024-06-14 17:19:38 +03:00
parent a28576960e
commit f54c5660ea
15 changed files with 50 additions and 74 deletions

View File

@@ -13,7 +13,7 @@ create table company (
constraint uq_company unique (clid, code)
);
CREATE TRIGGER zl_company before INSERT or UPDATE ON company
CREATE TRIGGER zl_company before INSERT or UPDATE ON cm
FOR EACH ROW EXECUTE FUNCTION zllog();
create table company_usr (
@@ -22,5 +22,5 @@ create table company_usr (
usr_id dmn_usrid,
constraint uq_company_usr unique (company_id, usr_id),
constraint fk_company_usr_company foreign key (company_id)
references company(id) on update cascade on delete cascade
references cm(id) on update cascade on delete cascade
);

View File

@@ -1 +1 @@
alter table company add tmpl jsonb;
alter table cm add tmpl jsonb;

View File

@@ -0,0 +1,12 @@
alter table public.cm
rename to cm;
alter table public.cm
rename column title to name;
alter table public.company_usr
rename to cm_usr;
alter table public.cm_usr
rename column company_id to cm_id;

View File

@@ -1,13 +1,13 @@
-- << Create
insert into company ( clid
insert into cm ( clid
, code
, title
, name
, is_active
, notes
, tmpl)
values ( @clid
, @code
, @title
, @name
, @is_active
, @notes
, @tmpl)
@@ -18,20 +18,19 @@ returning id
select clid
, id
, code
, title
, name
, is_active
, notes
, tmpl
from company
from cm
where id = $1
-- Read >>
-- << Update
update company
set clid = @clid
, code = @code
, title = @title
update cm
set code = @code
, name = @name
, is_active = @is_active
, notes = @notes
, tmpl = @tmpl
@@ -41,7 +40,7 @@ where id = @id
-- << Delete
delete
from company
from cm
where id = $1
-- Delete >>
@@ -49,12 +48,12 @@ where id = $1
select clid
, id
, code
, title
, name
, is_active
, notes
, tmpl
from company {{.Where}}
from cm {{.Where}}
{{.OrderBy}}
{{.Rows}}
-- List >>