Normally we create
three different S???L files, one for installing on UTF-8-compatible MyS???L servers, one
for installing on non-UTF-8-compatible MyS???L servers, and one uninstall file.
We normally name the S???L installation files install.extensionname.sql and
install_backward.extensionname.sql for UTF-8 and non-UTF-8 servers
respectively. We normally name the un-installation S???L file uninstall.
extensionname.sql. We do not have to use this naming convention.
This is an example of an S???L install file, which creates the table #_myextension_
foobars, which we defined in the previous chapter:
DROP TABLE IF EXISTS `#__myextension_foobars`;
CREATE TABLE `#__myextension_foobars` (
`id` INTEGER UNSIGNED NOT NULL DEFAULT NULL AUTO_INCREMENT,
`content` TEXT NOT NULL DEFAULT '',
`checked_out` INTEGER UNSIGNED NOT NULL DEFAULT 0,
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00
00:00:00',
`params` TEXT NOT NULL DEFAULT '',
`ordering` INTEGER UNSIGNED NOT NULL DEFAULT 0,
`hits` INTEGER UNSIGNED NOT NULL DEFAULT 0,
`published` INTEGER UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY(`id`)
) CHARACTER SET `utf8` COLLATE `utf8_general_ci`;
Note that before we attempt to create the table we first delete it if it
exists.
Pages:
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161