Added database schema changes to support user group-related tables, views, and indices.
This commit is contained in:
parent
f87fe68ce3
commit
d38ca756a2
|
@ -0,0 +1,18 @@
|
|||
create table luminotes_group ( id text not null, revision timestamp with time zone not null, name text );
|
||||
create index luminotes_group_pkey on luminotes_group using btree ( id, revision );
|
||||
create view
|
||||
luminotes_group_current as
|
||||
select
|
||||
luminotes_group.id, luminotes_group.revision, luminotes_group.name
|
||||
from
|
||||
luminotes_group
|
||||
where
|
||||
( luminotes_group.revision in (
|
||||
select
|
||||
max( sub_group.revision ) as max
|
||||
from
|
||||
luminotes_group sub_group
|
||||
where
|
||||
sub_group.id = luminotes_group.id
|
||||
) );
|
||||
create table user_group ( user_id text not null, group_id text not null, admin boolean default false );
|
|
@ -59,6 +59,29 @@ CREATE TABLE invite (
|
|||
|
||||
ALTER TABLE public.invite OWNER TO luminotes;
|
||||
|
||||
--
|
||||
-- Name: luminotes_group; Type: TABLE; Schema: public; Owner: luminotes; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE luminotes_group (
|
||||
id text NOT NULL,
|
||||
revision timestamp with time zone NOT NULL,
|
||||
name text
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.luminotes_group OWNER TO luminotes;
|
||||
|
||||
--
|
||||
-- Name: luminotes_group_current; Type: VIEW; Schema: public; Owner: luminotes
|
||||
--
|
||||
|
||||
CREATE VIEW luminotes_group_current AS
|
||||
SELECT luminotes_group.id, luminotes_group.revision, luminotes_group.name FROM luminotes_group WHERE (luminotes_group.revision IN (SELECT max(sub_group.revision) AS max FROM luminotes_group sub_group WHERE (sub_group.id = luminotes_group.id)));
|
||||
|
||||
|
||||
ALTER TABLE public.luminotes_group_current OWNER TO luminotes;
|
||||
|
||||
--
|
||||
-- Name: luminotes_user; Type: TABLE; Schema: public; Owner: luminotes; Tablespace:
|
||||
--
|
||||
|
@ -157,6 +180,19 @@ CREATE TABLE password_reset (
|
|||
|
||||
ALTER TABLE public.password_reset OWNER TO luminotes;
|
||||
|
||||
--
|
||||
-- Name: user_group; Type: TABLE; Schema: public; Owner: luminotes; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE user_group (
|
||||
user_id text NOT NULL,
|
||||
group_id text NOT NULL,
|
||||
"admin" boolean DEFAULT false
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.user_group OWNER TO luminotes;
|
||||
|
||||
--
|
||||
-- Name: user_notebook; Type: TABLE; Schema: public; Owner: luminotes; Tablespace:
|
||||
--
|
||||
|
@ -242,6 +278,13 @@ CREATE INDEX file_note_id_index ON file USING btree (note_id);
|
|||
CREATE INDEX file_notebook_id_index ON file USING btree (notebook_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: luminotes_group_pkey; Type: INDEX; Schema: public; Owner: luminotes; Tablespace:
|
||||
--
|
||||
|
||||
CREATE INDEX luminotes_group_pkey ON luminotes_group USING btree (id, revision);
|
||||
|
||||
|
||||
--
|
||||
-- Name: luminotes_user_email_address_index; Type: INDEX; Schema: public; Owner: luminotes; Tablespace:
|
||||
--
|
||||
|
|
Reference in New Issue