· 7 years ago · Sep 03, 2018, 07:48 AM
1<?php
2
3/**
4 * Data object containing the SQL and PHP code to migrate the database
5 * up to version 1326293132.
6 * Generated on 2012-01-11 15:45:32 by havvg
7 */
8class PropelMigration_1326293132
9{
10
11 public function preUp($manager)
12 {
13 // add the pre-migration code here
14 }
15
16 public function postUp($manager)
17 {
18 // add the post-migration code here
19 }
20
21 public function preDown($manager)
22 {
23 // add the pre-migration code here
24 }
25
26 public function postDown($manager)
27 {
28 // add the post-migration code here
29 }
30
31 /**
32 * Get the SQL statements for the Up migration
33 *
34 * @return array list of the SQL strings to execute for the Up migration
35 * the keys being the datasources
36 */
37 public function getUpSQL()
38 {
39 return array (
40 'default' => '
41# This is a fix for InnoDB in MySQL >= 4.1.x
42# It "suspends judgement" for fkey relationships until are tables are set.
43SET FOREIGN_KEY_CHECKS = 0;
44
45CREATE TABLE `acl_classes`
46(
47 `id` INTEGER NOT NULL AUTO_INCREMENT,
48 `class_type` VARCHAR(200) NOT NULL,
49 PRIMARY KEY (`id`),
50 UNIQUE INDEX `acl_classes_U_1` (`class_type`)
51) ENGINE=InnoDB;
52
53CREATE TABLE `acl_security_identities`
54(
55 `id` INTEGER NOT NULL AUTO_INCREMENT,
56 `identifier` VARCHAR(200) NOT NULL,
57 `username` TINYINT(1) NOT NULL,
58 PRIMARY KEY (`id`),
59 UNIQUE INDEX `acl_security_identities_U_1` (`identifier`, `username`)
60) ENGINE=InnoDB;
61
62CREATE TABLE `acl_object_identities`
63(
64 `id` INTEGER NOT NULL AUTO_INCREMENT,
65 `class_id` INTEGER NOT NULL,
66 `object_identifier` VARCHAR(200) NOT NULL,
67 `parent_object_identity_id` INTEGER,
68 `entries_inheriting` TINYINT(1) DEFAULT 1 NOT NULL,
69 PRIMARY KEY (`id`),
70 UNIQUE INDEX `acl_object_identities_U_1` (`class_id`, `object_identifier`),
71 INDEX `acl_object_identities_I_1` (`parent_object_identity_id`),
72 CONSTRAINT `acl_object_identities_FK_1`
73 FOREIGN KEY (`class_id`)
74 REFERENCES `acl_classes` (`id`)
75 ON UPDATE CASCADE
76 ON DELETE RESTRICT,
77 CONSTRAINT `acl_object_identities_FK_2`
78 FOREIGN KEY (`parent_object_identity_id`)
79 REFERENCES `acl_object_identities` (`id`)
80 ON UPDATE RESTRICT
81 ON DELETE RESTRICT
82) ENGINE=InnoDB;
83
84CREATE TABLE `acl_object_identity_ancestors`
85(
86 `object_identity_id` INTEGER NOT NULL,
87 `ancestor_id` INTEGER NOT NULL,
88 PRIMARY KEY (`object_identity_id`,`ancestor_id`),
89 INDEX `acl_object_identity_ancestors_FI_2` (`ancestor_id`),
90 INDEX `acl_object_identity_ancestors_I_2` (`ancestor_id`),
91 CONSTRAINT `acl_object_identity_ancestors_FK_1`
92 FOREIGN KEY (`object_identity_id`)
93 REFERENCES `acl_object_identities` (`id`)
94 ON UPDATE CASCADE
95 ON DELETE CASCADE,
96 CONSTRAINT `acl_object_identity_ancestors_FK_2`
97 FOREIGN KEY (`ancestor_id`)
98 REFERENCES `acl_object_identities` (`id`)
99 ON UPDATE CASCADE
100 ON DELETE CASCADE
101) ENGINE=InnoDB;
102
103CREATE TABLE `acl_entries`
104(
105 `id` INTEGER NOT NULL AUTO_INCREMENT,
106 `class_id` INTEGER NOT NULL,
107 `object_identity_id` INTEGER,
108 `security_identity_id` INTEGER NOT NULL,
109 `field_name` VARCHAR(50),
110 `ace_order` INTEGER NOT NULL,
111 `mask` INTEGER NOT NULL,
112 `granting` TINYINT(1) NOT NULL,
113 `granting_strategy` VARCHAR(30) NOT NULL,
114 `audit_success` TINYINT(1) NOT NULL,
115 `audit_failure` TINYINT(1) NOT NULL,
116 PRIMARY KEY (`id`),
117 UNIQUE INDEX `acl_entries_U_1` (`class_id`, `object_identity_id`, `field_name`, `ace_order`),
118 INDEX `acl_entries_I_1` (`class_id`, `object_identity_id`, `security_identity_id`),
119 INDEX `acl_entries_I_2` (`class_id`),
120 INDEX `acl_entries_I_3` (`object_identity_id`),
121 INDEX `acl_entries_I_4` (`security_identity_id`),
122 CONSTRAINT `acl_entries_FK_1`
123 FOREIGN KEY (`class_id`)
124 REFERENCES `acl_classes` (`id`)
125 ON UPDATE CASCADE
126 ON DELETE CASCADE,
127 CONSTRAINT `acl_entries_FK_2`
128 FOREIGN KEY (`object_identity_id`)
129 REFERENCES `acl_object_identities` (`id`)
130 ON UPDATE CASCADE
131 ON DELETE CASCADE,
132 CONSTRAINT `acl_entries_FK_3`
133 FOREIGN KEY (`security_identity_id`)
134 REFERENCES `acl_security_identities` (`id`)
135 ON UPDATE CASCADE
136 ON DELETE CASCADE
137) ENGINE=InnoDB;
138
139# This restores the fkey checks, after having unset them earlier
140SET FOREIGN_KEY_CHECKS = 1;
141',
142);
143 }
144
145 /**
146 * Get the SQL statements for the Down migration
147 *
148 * @return array list of the SQL strings to execute for the Down migration
149 * the keys being the datasources
150 */
151 public function getDownSQL()
152 {
153 return array (
154 'default' => '
155# This is a fix for InnoDB in MySQL >= 4.1.x
156# It "suspends judgement" for fkey relationships until are tables are set.
157SET FOREIGN_KEY_CHECKS = 0;
158
159DROP TABLE IF EXISTS `acl_classes`;
160
161DROP TABLE IF EXISTS `acl_security_identities`;
162
163DROP TABLE IF EXISTS `acl_object_identities`;
164
165DROP TABLE IF EXISTS `acl_object_identity_ancestors`;
166
167DROP TABLE IF EXISTS `acl_entries`;
168
169# This restores the fkey checks, after having unset them earlier
170SET FOREIGN_KEY_CHECKS = 1;
171',
172);
173 }
174
175}