[vhffs-dev] [svn] commit: r245 - /trunk/vhffs-backend/src/pgsql/initdb.sql |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Author: gradator
Date: Sat Oct 28 22:58:04 2006
New Revision: 245
Log:
ALTER TABLE cannot handle several actions, exploded all ALTER TABLE.
Modified:
trunk/vhffs-backend/src/pgsql/initdb.sql
Modified: trunk/vhffs-backend/src/pgsql/initdb.sql
==============================================================================
--- trunk/vhffs-backend/src/pgsql/initdb.sql (original)
+++ trunk/vhffs-backend/src/pgsql/initdb.sql Sat Oct 28 22:58:04 2006
@@ -363,94 +363,75 @@
CONSTRAINT vhffs_user_info_pkey PRIMARY KEY (uid)
) WITH OIDS;
+
/****** Non primary key constraints.
Defining foreign keys here allow to create tables in any order.
*******/
-ALTER TABLE vhffs_acl
- ADD CONSTRAINT fk_vhffs_acl_vhffs_object_dst FOREIGN KEY (oid_dst) REFERENCES vhffs_object(object_id) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_acl_vhffs_object_src FOREIGN KEY (oid_src) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_groups
- ADD CONSTRAINT fk_vhffs_group_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_users
- ADD CONSTRAINT fk_vhffs_users_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object (object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_cvs
- ADD CONSTRAINT fk_vhffs_cvs_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_cvs_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_cvs_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_dns_global
- ADD CONSTRAINT fk_vhffs_dns_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_dns_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_dns_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_dns_rr
- ADD CONSTRAINT fk_vhffs_dns_rr_vhffs_dns FOREIGN KEY (zone) REFERENCES vhffs_dns_global(dns_id) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_dns_rr_chk_type CHECK (type='A' OR type='AAAA' OR type='CNAME' OR type='HINFO' OR type='MX' OR type='NS' OR type='PTR' OR type='RP' OR type='SRV' OR type='TXT');
-
-ALTER TABLE vhffs_groups_info
- ADD CONSTRAINT vhffs_groups_info_vhffs_groups FOREIGN KEY (gid) REFERENCES vhffs_groups (gid) ON DELETE CASCADE,
- ADD CONSTRAINT vhffs_groups_info_vhffs_users FOREIGN KEY (uid_mod) REFERENCES vhffs_users (uid) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_httpd
- ADD CONSTRAINT fk_vhffs_httpd_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_httpd_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_largefile
- ADD CONSTRAINT fk_vhffs_largefile_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_largefile_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_largefile_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+ALTER TABLE vhffs_acl ADD CONSTRAINT fk_vhffs_acl_vhffs_object_dst FOREIGN KEY (oid_dst) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+ALTER TABLE vhffs_acl ADD CONSTRAINT fk_vhffs_acl_vhffs_object_src FOREIGN KEY (oid_src) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_groups ADD CONSTRAINT fk_vhffs_group_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_users ADD CONSTRAINT fk_vhffs_users_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object (object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_cvs ADD CONSTRAINT fk_vhffs_cvs_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
+ALTER TABLE vhffs_cvs ADD CONSTRAINT fk_vhffs_cvs_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE;
+ALTER TABLE vhffs_cvs ADD CONSTRAINT fk_vhffs_cvs_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_dns_global ADD CONSTRAINT fk_vhffs_dns_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
+ALTER TABLE vhffs_dns_global ADD CONSTRAINT fk_vhffs_dns_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE;
+ALTER TABLE vhffs_dns_global ADD CONSTRAINT fk_vhffs_dns_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_dns_rr ADD CONSTRAINT fk_vhffs_dns_rr_vhffs_dns FOREIGN KEY (zone) REFERENCES vhffs_dns_global(dns_id) ON DELETE CASCADE;
+ALTER TABLE vhffs_dns_rr ADD CONSTRAINT fk_vhffs_dns_rr_chk_type CHECK (type='A' OR type='AAAA' OR type='CNAME' OR type='HINFO' OR type='MX' OR type='NS' OR type='PTR' OR type='RP' OR type='SRV' OR type='TXT');
+
+ALTER TABLE vhffs_groups_info ADD CONSTRAINT vhffs_groups_info_vhffs_groups FOREIGN KEY (gid) REFERENCES vhffs_groups (gid) ON DELETE CASCADE;
+ALTER TABLE vhffs_groups_info ADD CONSTRAINT vhffs_groups_info_vhffs_users FOREIGN KEY (uid_mod) REFERENCES vhffs_users (uid) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_httpd ADD CONSTRAINT fk_vhffs_httpd_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
+ALTER TABLE vhffs_httpd ADD CONSTRAINT fk_vhffs_httpd_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_largefile ADD CONSTRAINT fk_vhffs_largefile_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
+ALTER TABLE vhffs_largefile ADD CONSTRAINT fk_vhffs_largefile_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE;
+ALTER TABLE vhffs_largefile ADD CONSTRAINT fk_vhffs_largefile_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
ALTER TABLE vhffs_repository ADD CONSTRAINT fk_vhffs_vhffs_repository_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
ALTER TABLE vhffs_repository ADD CONSTRAINT fk_vhffs_vhffs_repository_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE;
ALTER TABLE vhffs_repository ADD CONSTRAINT fk_vhffs_vhffs_repository_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-ALTER TABLE vhffs_mxdomain
- ADD CONSTRAINT fk_vhffs_mxdomain_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_mxdomain_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_mxdomain_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_ml
- ADD CONSTRAINT fk_vhffs_ml_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_ml_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_ml_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_ml_subscribers
- ADD CONSTRAINT fk_vhffs_ml_subscribers_vhffs_ml FOREIGN KEY (ml_id) REFERENCES vhffs_ml(ml_id);
-
-ALTER TABLE vhffs_mysql
- ADD CONSTRAINT fk_vhffs_mysql_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_mysql_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_mysql_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_notes
- ADD CONSTRAINT fk_vhffs_notes FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_history
- ADD CONSTRAINT fk_vhffs_history_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_user_info
- ADD CONSTRAINT vhffs_user_info_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users (uid) ON UPDATE CASCADE ON DELETE CASCADE;
-
-ALTER TABLE vhffs_pgsql
- ADD CONSTRAINT fk_vhffs_pgsql_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_pgsql_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_pgsql_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_svn
- ADD CONSTRAINT fk_vhffs_svn_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_svn_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE,
- ADD CONSTRAINT fk_vhffs_svn_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
-
-ALTER TABLE vhffs_user_group
- ADD CONSTRAINT vhffs_user_group_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users (uid) ON UPDATE CASCADE ON DELETE CASCADE,
- ADD CONSTRAINT vhffs_user_group_vhffs_groups FOREIGN KEY (gid) REFERENCES vhffs_groups (gid) ON UPDATE CASCADE ON DELETE CASCADE;
-
-ALTER TABLE vhffs_panel_user_prefs
- ADD CONSTRAINT fk_vhffs_panel_user_prefs_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
+ALTER TABLE vhffs_mxdomain ADD CONSTRAINT fk_vhffs_mxdomain_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
+ALTER TABLE vhffs_mxdomain ADD CONSTRAINT fk_vhffs_mxdomain_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE;
+ALTER TABLE vhffs_mxdomain ADD CONSTRAINT fk_vhffs_mxdomain_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_ml ADD CONSTRAINT fk_vhffs_ml_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
+ALTER TABLE vhffs_ml ADD CONSTRAINT fk_vhffs_ml_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE;
+ALTER TABLE vhffs_ml ADD CONSTRAINT fk_vhffs_ml_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_ml_subscribers ADD CONSTRAINT fk_vhffs_ml_subscribers_vhffs_ml FOREIGN KEY (ml_id) REFERENCES vhffs_ml(ml_id);
+
+ALTER TABLE vhffs_mysql ADD CONSTRAINT fk_vhffs_mysql_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
+ALTER TABLE vhffs_mysql ADD CONSTRAINT fk_vhffs_mysql_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE;
+ALTER TABLE vhffs_mysql ADD CONSTRAINT fk_vhffs_mysql_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_notes ADD CONSTRAINT fk_vhffs_notes FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_history ADD CONSTRAINT fk_vhffs_history_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_user_info ADD CONSTRAINT vhffs_user_info_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users (uid) ON UPDATE CASCADE ON DELETE CASCADE;
+
+ALTER TABLE vhffs_pgsql ADD CONSTRAINT fk_vhffs_pgsql_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
+ALTER TABLE vhffs_pgsql ADD CONSTRAINT fk_vhffs_pgsql_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE;
+ALTER TABLE vhffs_pgsql ADD CONSTRAINT fk_vhffs_pgsql_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_svn ADD CONSTRAINT fk_vhffs_svn_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
+ALTER TABLE vhffs_svn ADD CONSTRAINT fk_vhffs_svn_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE;
+ALTER TABLE vhffs_svn ADD CONSTRAINT fk_vhffs_svn_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
+ALTER TABLE vhffs_user_group ADD CONSTRAINT vhffs_user_group_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users (uid) ON UPDATE CASCADE ON DELETE CASCADE;
+ALTER TABLE vhffs_user_group ADD CONSTRAINT vhffs_user_group_vhffs_groups FOREIGN KEY (gid) REFERENCES vhffs_groups (gid) ON UPDATE CASCADE ON DELETE CASCADE;
+
+ALTER TABLE vhffs_panel_user_prefs ADD CONSTRAINT fk_vhffs_panel_user_prefs_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE;
CREATE VIEW vhffs_passwd AS