rename annonymous to anonymous
This commit is contained in:
@@ -2,7 +2,7 @@ do
|
||||
$$
|
||||
begin
|
||||
delete from citizen;
|
||||
insert into citizen (id, name, birthday, user_id, vote_annonymous, follow_annonymous)
|
||||
insert into citizen (id, name, birthday, user_id, vote_anonymous, follow_anonymous)
|
||||
select
|
||||
uuid_in(md5('citizen'||row_number() over ()::text)::cstring),
|
||||
jsonb_build_object(
|
||||
|
||||
@@ -6,7 +6,7 @@ begin
|
||||
delete from citizen_in_workgroup;
|
||||
delete from workgroup;
|
||||
|
||||
insert into workgroup (id, created_by_id, name, description, annonymous, owner_id)
|
||||
insert into workgroup (id, created_by_id, name, description, anonymous, owner_id)
|
||||
select
|
||||
uuid_in(md5('workgroup'||rn::text)::cstring),
|
||||
z.id,
|
||||
|
||||
@@ -12,7 +12,7 @@ begin
|
||||
delete from article_relations;
|
||||
delete from article;
|
||||
|
||||
insert into article (id, version_id, created_by_id, title, annonymous, content, description, tags)
|
||||
insert into article (id, version_id, created_by_id, title, anonymous, content, description, tags)
|
||||
select
|
||||
uuid_in(md5('article'||row_number() over ())::cstring),
|
||||
uuid_in(md5('article_v'||row_number() over ())::cstring),
|
||||
|
||||
@@ -7,7 +7,7 @@ begin
|
||||
delete from title;
|
||||
delete from constitution;
|
||||
|
||||
insert into constitution (id, version_id, created_by_id, title, annonymous)
|
||||
insert into constitution (id, version_id, created_by_id, title, anonymous)
|
||||
select
|
||||
uuid_in(md5('constitution'||row_number() over ())::cstring),
|
||||
uuid_in(md5('constitution_v'||row_number() over ())::cstring),
|
||||
|
||||
@@ -14,14 +14,14 @@ begin
|
||||
-- and draft = false
|
||||
;
|
||||
|
||||
insert into article (id, version_id, created_by_id, title, annonymous, content, description, tags)
|
||||
insert into article (id, version_id, created_by_id, title, anonymous, content, description, tags)
|
||||
select
|
||||
case when _id_exist then uuid_generate_v4()
|
||||
else coalesce(id, uuid_generate_v4()) end,
|
||||
coalesce(version_id, uuid_generate_v4()),
|
||||
(resource#>>'{created_by, id}')::uuid,
|
||||
title,
|
||||
annonymous,
|
||||
anonymous,
|
||||
content,
|
||||
description,
|
||||
tags
|
||||
|
||||
@@ -7,21 +7,21 @@ declare
|
||||
begin
|
||||
select insert_user(resource->'user') into inserted_user;
|
||||
|
||||
insert into citizen (id, name, birthday, user_id, vote_annonymous, follow_annonymous)
|
||||
insert into citizen (id, name, birthday, user_id, vote_anonymous, follow_anonymous)
|
||||
select
|
||||
coalesce(id, uuid_generate_v4()),
|
||||
name,
|
||||
birthday,
|
||||
(inserted_user->>'id')::uuid,
|
||||
coalesce(vote_annonymous, true),
|
||||
coalesce(follow_annonymous, true)
|
||||
coalesce(vote_anonymous, true),
|
||||
coalesce(follow_anonymous, true)
|
||||
from json_populate_record(null::citizen, resource)
|
||||
on conflict (id) do update set
|
||||
name = excluded.name,
|
||||
birthday = excluded.birthday,
|
||||
user_id = excluded.user_id,
|
||||
vote_annonymous = excluded.vote_annonymous,
|
||||
follow_annonymous = excluded.follow_annonymous
|
||||
vote_anonymous = excluded.vote_anonymous,
|
||||
follow_anonymous = excluded.follow_anonymous
|
||||
returning id into new_id;
|
||||
|
||||
select find_citizen_by_id_with_user(new_id) into resource;
|
||||
|
||||
@@ -4,21 +4,21 @@ $$
|
||||
declare
|
||||
new_id uuid;
|
||||
begin
|
||||
insert into citizen (id, name, birthday, user_id, vote_annonymous, follow_annonymous)
|
||||
insert into citizen (id, name, birthday, user_id, vote_anonymous, follow_anonymous)
|
||||
select
|
||||
coalesce(id, uuid_generate_v4()),
|
||||
name,
|
||||
birthday,
|
||||
(resource#>>'{user, id}')::uuid,
|
||||
coalesce(vote_annonymous, true),
|
||||
coalesce(follow_annonymous, true)
|
||||
coalesce(vote_anonymous, true),
|
||||
coalesce(follow_anonymous, true)
|
||||
from json_populate_record(null::citizen, resource)
|
||||
on conflict (id) do update set
|
||||
name = excluded.name,
|
||||
birthday = excluded.birthday,
|
||||
user_id = excluded.user_id,
|
||||
vote_annonymous = excluded.vote_annonymous,
|
||||
follow_annonymous = excluded.follow_annonymous
|
||||
vote_anonymous = excluded.vote_anonymous,
|
||||
follow_anonymous = excluded.follow_anonymous
|
||||
returning id into new_id;
|
||||
|
||||
select find_citizen_by_id(new_id) into resource;
|
||||
|
||||
@@ -19,14 +19,14 @@ begin
|
||||
|
||||
raise notice '%', _id_exist;
|
||||
|
||||
insert into constitution (id, version_id, created_by_id, title, annonymous)
|
||||
insert into constitution (id, version_id, created_by_id, title, anonymous)
|
||||
select
|
||||
case when _id_exist then uuid_generate_v4()
|
||||
else coalesce(id, uuid_generate_v4()) end,
|
||||
version_id,
|
||||
_citizen_id,
|
||||
title,
|
||||
annonymous
|
||||
anonymous
|
||||
from json_populate_record(null::constitution, resource)
|
||||
returning id into new_id;
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ create table citizen
|
||||
name jsonb not null check ( name ? 'first_name' and name ? 'last_name' ),
|
||||
birthday date not null,
|
||||
user_id uuid not null references "user" (id) unique,
|
||||
vote_annonymous boolean default true not null,
|
||||
follow_annonymous boolean default true not null
|
||||
vote_anonymous boolean default true not null,
|
||||
follow_anonymous boolean default true not null
|
||||
);
|
||||
|
||||
create table workgroup
|
||||
@@ -29,7 +29,7 @@ create table workgroup
|
||||
created_by_id uuid not null references citizen (id),
|
||||
name varchar(128) not null,
|
||||
description text null,
|
||||
annonymous boolean default false not null,
|
||||
anonymous boolean default false not null,
|
||||
logo text null,
|
||||
owner_id uuid not null references citizen (id)
|
||||
);
|
||||
@@ -100,7 +100,7 @@ create table article
|
||||
version_id uuid default uuid_generate_v4() not null,
|
||||
version_number int not null,
|
||||
title text not null check ( length(title) < 128 ),
|
||||
annonymous boolean default false not null,
|
||||
anonymous boolean default false not null,
|
||||
content text not null check ( content != '' ),
|
||||
description text null check ( description != '' ),
|
||||
tags varchar(32)[] default '{}' not null,
|
||||
@@ -121,7 +121,7 @@ create table constitution
|
||||
version_id uuid default uuid_generate_v4() not null,
|
||||
version_number int not null,
|
||||
title text not null check ( length(title) < 128 ),
|
||||
annonymous boolean default false not null
|
||||
anonymous boolean default false not null
|
||||
);
|
||||
|
||||
create trigger generate_version_number_trigger
|
||||
|
||||
Reference in New Issue
Block a user