mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-29 03:14:38 +00:00
Update initial SQL to create usr_emails table.
I much prefer running patches to update the schema, but ah well.
This commit is contained in:
parent
6f1a20e1a2
commit
1977e9f283
@ -14,8 +14,10 @@ INSERT INTO principal_type (principal_type_id, principal_type_desc) VALUES( 2, '
|
||||
INSERT INTO principal_type (principal_type_id, principal_type_desc) VALUES( 3, 'Group' );
|
||||
|
||||
-- Create the administrator record.
|
||||
INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullname, email )
|
||||
VALUES ( 1, TRUE, current_date, current_date, 'admin', '**nimda', 'DAViCal Administrator', 'calendars@example.net' );
|
||||
INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullname )
|
||||
VALUES ( 1, TRUE, current_date, current_date, 'admin', '**nimda', 'DAViCal Administrator' );
|
||||
INSERT INTO usr_emails ( user_no, email )
|
||||
VALUES ( 1, 'calendars@example.net' );
|
||||
INSERT INTO principal ( principal_id, type_id, user_no, displayname, default_privileges )
|
||||
VALUES ( 1, 1, 1, 'DAViCal Administrator', 0::BIT(24) );
|
||||
|
||||
|
||||
@ -439,6 +439,22 @@ CREATE TABLE calendar_attendee (
|
||||
PRIMARY KEY ( dav_id, attendee )
|
||||
);
|
||||
|
||||
CREATE TABLE usr_emails (
|
||||
user_no INTEGER NOT NULL REFERENCES usr(user_no) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
email VARCHAR,
|
||||
main boolean DEFAULT true,
|
||||
UNIQUE (email)
|
||||
);
|
||||
|
||||
-- Ensure that a principal only has one primary email address.
|
||||
CREATE UNIQUE INDEX usr_emails_primary
|
||||
ON usr_emails
|
||||
USING btree
|
||||
(user_no)
|
||||
WHERE main = true;
|
||||
|
||||
ALTER TABLE usr
|
||||
DROP COLUMN email CASCADE;
|
||||
|
||||
CREATE or REPLACE FUNCTION real_path_exists( TEXT ) RETURNS BOOLEAN AS $$
|
||||
DECLARE
|
||||
@ -489,4 +505,4 @@ CREATE SEQUENCE metrics_count_delticket;
|
||||
CREATE SEQUENCE metrics_count_bind;
|
||||
CREATE SEQUENCE metrics_count_unknown;
|
||||
|
||||
SELECT new_db_revision(1,3,3, 'Marzec' );
|
||||
SELECT new_db_revision(1,3,4, 'Kwiecie<C5><84>' );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user