SERIAL'ler serilerin sonuna _seq ekliyor, ama kodda oldugu gibi cagirabiliyoruz
ALTER TABLE aa_authorization_parameter_no_seq RENAME TO aa_authorization_parameter_no;
ALTER TABLE aa_group_no_seq RENAME TO aa_group_no;
ALTER TABLE user_attribute_no_seq RENAME TO user_attribute_no;
ALTER TABLE user_attribute_user_no_seq RENAME TO user_no;
ALTER TABLE user_operation_no_seq RENAME TO user_operation_no;
Default Data
INSERT INTO aa_group ("no", name, description) VALUES (1, 'Signomat Base Users', 'Signomat Base Users, have basic usage rights');
INSERT INTO aa_group ("no", name, description) VALUES (2, 'SignArt Client Users', 'SignArt Client Users, have access to CSP mobile signing facilities');
INSERT INTO aa_group ("no", name, description) VALUES (3, 'Workspace Users', 'Workspace Users, have access to /workspace web pages');
INSERT INTO aa_group ("no", name, description) VALUES (4, 'Dox Users', 'Dox Users, have access to /dox web pages');
INSERT INTO aa_group ("no", name, description) VALUES (5, 'Admin Users', 'Admin Users have access to /admin web pages');
INSERT INTO aa_group ("no", name, description) VALUES (6, 'Demo Users', 'Demo Users have limited access, no access to DoX, and no timestamp facilities in signing portal');
INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 1, NULL, 1);
INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 2, NULL, 2);
INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 3, NULL, 3);
INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 4, NULL, 4);
INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 5, NULL, 5);
INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('PageAccessAuth', 6, NULL, 3);
INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('SignAuth', 3, NULL, 1);
INSERT INTO aa_group_authorization (auth_name, group_no, param_no, "rule") VALUES ('SignAuth', 6, NULL, 2);
INSERT INTO user_attribute (attribute, value, "type", priority) VALUES ('username', 'admin', '00_id', 0);
INSERT INTO user_attribute (user_no, attribute, value, "type", priority) VALUES ((select user_no from user_attribute where attribute = 'username' and value='admin'), 'citizenshipNumber', '12345', '00_id', 0);
INSERT INTO user_authentication (username, "password") VALUES ('12345', '21232f297a57a5a743894a0e4a801fc3');
INSERT INTO aa_user_group (username, group_no, "order") VALUES ((select user_no from user_attribute where attribute = 'username' and value='admin'), 1, 1);
INSERT INTO aa_user_group (username, group_no, "order") VALUES ((select user_no from user_attribute where attribute = 'username' and value='admin'), 3, 2);
INSERT INTO aa_user_group (username, group_no, "order") VALUES ((select user_no from user_attribute where attribute = 'username' and value='admin'), 4, 3);
INSERT INTO aa_user_group (username, group_no, "order") VALUES ((select user_no from user_attribute where attribute = 'username' and value='admin'), 5, 4);
Function to delete all data from all tables. Can be updated later (runAlways is set)
0 THEN CONTINUE; END IF;
table_list := table_list || quote_ident(mtable.tablename) || '', '';
END LOOP;
table_list := substring(table_list from 0 for length(table_list)-1);
EXECUTE ''TRUNCATE TABLE '' || table_list;
RETURN table_list;
END;';
]]>
to keep track of attachment size, and tell to the browser while downloading
change on delete cascade to on delete restrict of some foreign key constraints, since referencing tables does not belong to referenced tables
e.g. Msg. attachment does not belong to content, if a msg attch. exists, referenced content cannot be deleted.