summaryrefslogtreecommitdiffstats
path: root/UPGRADING
blob: ceee6f5ea197601f4abe54340477f568141e362b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
Upgrading
=========

From 3.1.0 to 3.2.0
-------------------

1. Add support for package requests to the database:

----
CREATE TABLE RequestTypes (
	ID TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
	Name VARCHAR(32) NOT NULL DEFAULT '',
	PRIMARY KEY (ID)
) ENGINE = InnoDB;
INSERT INTO RequestTypes VALUES (1, 'deletion');
INSERT INTO RequestTypes VALUES (2, 'orphan');

CREATE TABLE PackageRequests (
	ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
	ReqTypeID TINYINT UNSIGNED NOT NULL,
	PackageBaseID INTEGER UNSIGNED NULL,
	PackageBaseName VARCHAR(255) NOT NULL,
	UsersID INTEGER UNSIGNED NULL DEFAULT NULL,
	Comments TEXT NOT NULL DEFAULT '',
	RequestTS BIGINT UNSIGNED NOT NULL DEFAULT 0,
	Status TINYINT UNSIGNED NOT NULL DEFAULT 0,
	PRIMARY KEY (ID),
	INDEX (UsersID),
	INDEX (PackageBaseID),
	FOREIGN KEY (ReqTypeID) REFERENCES RequestTypes(ID) ON DELETE NO ACTION,
	FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE SET NULL,
	FOREIGN KEY (PackageBaseID) REFERENCES PackageBases(ID) ON DELETE SET NULL
) ENGINE = InnoDB;
----

From 3.0.0 to 3.1.0
-------------------

1. Increase the size of all fields containing package names, license names,
group names or package versions:

----
ALTER TABLE PackageBases MODIFY Name VARCHAR(255) NOT NULL;
ALTER TABLE Packages
	MODIFY Name VARCHAR(255) NOT NULL,
	MODIFY Version VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE Licenses MODIFY Name VARCHAR(255) NOT NULL;
ALTER TABLE Groups MODIFY Name VARCHAR(255) NOT NULL;
ALTER TABLE PackageDepends MODIFY DepCondition VARCHAR(255);
ALTER TABLE PackageRelations MODIFY RelCondition VARCHAR(255);
----

From 2.3.1 to 3.0.0
-------------------

1. Drop the user ID foreign key from the "PackageComments" table:

`ALTER TABLE PackageComments DROP FOREIGN KEY PackageComments_ibfk_1;` should
work in most cases. Otherwise, check the output of `SHOW CREATE TABLE
PackageComments;` and use the foreign key name shown there.

2. Add support for anonymous comments:

----
ALTER TABLE PackageComments
	MODIFY UsersID INTEGER UNSIGNED NULL DEFAULT NULL,
	ADD FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE SET NULL;
----

3. Create the PackageBases table:

----
CREATE TABLE PackageBases (
	ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
	Name VARCHAR(64) NOT NULL,
	CategoryID TINYINT UNSIGNED NOT NULL DEFAULT 1,
	NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0,
	OutOfDateTS BIGINT UNSIGNED NULL DEFAULT NULL,
	SubmittedTS BIGINT UNSIGNED NOT NULL,
	ModifiedTS BIGINT UNSIGNED NOT NULL,
	SubmitterUID INTEGER UNSIGNED NULL DEFAULT NULL,
	MaintainerUID INTEGER UNSIGNED NULL DEFAULT NULL,
	PackagerUID INTEGER UNSIGNED NULL DEFAULT NULL,
	PRIMARY KEY (ID),
	UNIQUE (Name),
	INDEX (CategoryID),
	INDEX (NumVotes),
	INDEX (SubmitterUID),
	INDEX (MaintainerUID),
	INDEX (PackagerUID),
	FOREIGN KEY (CategoryID) REFERENCES PackageCategories(ID) ON DELETE NO ACTION,
	-- deleting a user will cause packages to be orphaned, not deleted
	FOREIGN KEY (SubmitterUID) REFERENCES Users(ID) ON DELETE SET NULL,
	FOREIGN KEY (MaintainerUID) REFERENCES Users(ID) ON DELETE SET NULL,
	FOREIGN KEY (PackagerUID) REFERENCES Users(ID) ON DELETE SET NULL
) ENGINE = InnoDB;
----

4. Migrate data from Packages to PackageBases:

----
INSERT INTO PackageBases
	SELECT ID, Name, CategoryID, NumVotes, OutOfDateTS, SubmittedTS,
	ModifiedTS, SubmitterUID, MaintainerUID, NULL FROM Packages;
----

5. Delete unneeded foreign keys from Packages:

First, drop the foreign keys on CategoryID, SubmitterUID and MaintainerUID. The
following queries should work in most cases:

----
ALTER TABLE Packages
	DROP FOREIGN KEY Packages_ibfk_1,
	DROP FOREIGN KEY Packages_ibfk_2,
	DROP FOREIGN KEY Packages_ibfk_3;
----

You can use `SHOW CREATE TABLE Packages;` to check whether you should use
different names for your setup.

6. Delete unneeded fields from Packages:

----
ALTER TABLE Packages
	DROP COLUMN CategoryID,
	DROP COLUMN NumVotes,
	DROP COLUMN OutOfDateTS,
	DROP COLUMN SubmittedTS,
	DROP COLUMN ModifiedTS,
	DROP COLUMN SubmitterUID,
	DROP COLUMN MaintainerUID;
----

7. Add package base references to the Packages table:

----
ALTER TABLE Packages ADD COLUMN PackageBaseID INTEGER UNSIGNED NULL;
UPDATE Packages SET PackageBaseID = ID;
ALTER TABLE Packages
	MODIFY PackageBaseID INTEGER UNSIGNED NOT NULL,
	ADD FOREIGN KEY (PackageBaseID) REFERENCES PackageBases(ID) ON DELETE CASCADE;
----

8. Delete foreign keys from PackageVotes, PackageComments and CommentNotify:

----
ALTER TABLE PackageVotes
	DROP FOREIGN KEY PackageVotes_ibfk_1,
	DROP FOREIGN KEY PackageVotes_ibfk_2;
ALTER TABLE PackageComments
	DROP FOREIGN KEY PackageComments_ibfk_3;
ALTER TABLE CommentNotify
	DROP FOREIGN KEY CommentNotify_ibfk_1,
	DROP FOREIGN KEY CommentNotify_ibfk_2;
----

We highly recommend to use `SHOW CREATE TABLE PackageVotes;` etc. to check
whether you should use different names for your setup.

9. Delete indexes from PackageVotes and CommentNotify:

----
ALTER TABLE PackageVotes DROP INDEX VoteUsersIDPackageID;
ALTER TABLE CommentNotify DROP INDEX NotifyUserIDPkgID;
----

10. Migrate PackageVotes, PackageComments and CommentNotify to refer to package
bases:

----
ALTER TABLE PackageVotes ADD COLUMN PackageBaseID INTEGER UNSIGNED NOT NULL;
UPDATE PackageVotes SET PackageBaseID = PackageID;
ALTER TABLE PackageVotes DROP COLUMN PackageID;
ALTER TABLE PackageComments ADD COLUMN PackageBaseID INTEGER UNSIGNED NOT NULL;
UPDATE PackageComments SET PackageBaseID = PackageID;
ALTER TABLE PackageComments DROP COLUMN PackageID;
ALTER TABLE CommentNotify ADD COLUMN PackageBaseID INTEGER UNSIGNED NOT NULL;
UPDATE CommentNotify SET PackageBaseID = PkgID;
ALTER TABLE CommentNotify DROP COLUMN PkgID;
----

11. Recreate missing foreign keys and indexes:

----
ALTER TABLE PackageVotes
	ADD FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (PackageBaseID) REFERENCES PackageBases(ID) ON DELETE CASCADE;
ALTER TABLE PackageComments
	ADD FOREIGN KEY (PackageBaseID) REFERENCES PackageBases(ID) ON DELETE CASCADE;
ALTER TABLE CommentNotify
	ADD FOREIGN KEY (PackageBaseID) REFERENCES PackageBases(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (UserID) REFERENCES Users(ID) ON DELETE CASCADE;
CREATE UNIQUE INDEX VoteUsersIDPackageID ON PackageVotes (UsersID, PackageBaseID);
CREATE UNIQUE INDEX NotifyUserIDPkgID ON CommentNotify (UserID, PackageBaseID);
----

12. Create a new table to store package dependency types:

----
CREATE TABLE DependencyTypes (
	ID TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
	Name VARCHAR(32) NOT NULL DEFAULT '',
	PRIMARY KEY (ID)
) ENGINE = InnoDB;
INSERT INTO DependencyTypes VALUES (1, 'depends');
INSERT INTO DependencyTypes VALUES (2, 'makedepends');
INSERT INTO DependencyTypes VALUES (3, 'checkdepends');
INSERT INTO DependencyTypes VALUES (4, 'optdepends');
----

13. Add a field to store the dependency type to the PackageDepends table:

----
ALTER TABLE PackageDepends ADD COLUMN DepTypeID TINYINT UNSIGNED NOT NULL;
UPDATE PackageDepends SET DepTypeID = 1;
ALTER TABLE PackageDepends
	ADD FOREIGN KEY (DepTypeID) REFERENCES DependencyTypes(ID) ON DELETE NO ACTION;
----

14. Resize the package dependency name field:

----
ALTER TABLE PackageDepends MODIFY DepName VARCHAR(255) NOT NULL;
----

15. Create a new table to store package relation types:

----
CREATE TABLE RelationTypes (
	ID TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
	Name VARCHAR(32) NOT NULL DEFAULT '',
	PRIMARY KEY (ID)
) ENGINE = InnoDB;
INSERT INTO RelationTypes VALUES (1, 'conflicts');
INSERT INTO RelationTypes VALUES (2, 'provides');
INSERT INTO RelationTypes VALUES (3, 'replaces');
----

16. Create a new table to store package relations:

----
CREATE TABLE PackageRelations (
	PackageID INTEGER UNSIGNED NOT NULL,
	RelTypeID TINYINT UNSIGNED NOT NULL,
	RelName VARCHAR(255) NOT NULL,
	RelCondition VARCHAR(20),
	INDEX (PackageID),
	INDEX (RelName),
	FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE,
	FOREIGN KEY (RelTypeID) REFERENCES RelationTypes(ID) ON DELETE NO ACTION
) ENGINE = InnoDB;
----

17. Create tables to store package groups:

----
CREATE TABLE Groups (
	ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
	Name VARCHAR(64) NOT NULL,
	PRIMARY KEY (ID),
	UNIQUE (Name)
) ENGINE = InnoDB;
CREATE TABLE PackageGroups (
	PackageID INTEGER UNSIGNED NOT NULL,
	GroupID INTEGER UNSIGNED NOT NULL,
	PRIMARY KEY (PackageID, GroupID),
	FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE,
	FOREIGN KEY (GroupID) REFERENCES Groups(ID) ON DELETE CASCADE
) ENGINE = InnoDB;
----

18. Create tables to store package licenses:

----
CREATE TABLE Licenses (
	ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
	Name VARCHAR(64) NOT NULL,
	PRIMARY KEY (ID),
	UNIQUE (Name)
) ENGINE = InnoDB;
CREATE TABLE PackageLicenses (
	PackageID INTEGER UNSIGNED NOT NULL,
	LicenseID INTEGER UNSIGNED NOT NULL,
	PRIMARY KEY (PackageID, LicenseID),
	FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE,
	FOREIGN KEY (LicenseID) REFERENCES Licenses(ID) ON DELETE CASCADE
) ENGINE = InnoDB;
----

19. Convert existing licenses to the new storage format:

----
INSERT INTO Licenses (Name) SELECT DISTINCT License FROM Packages;
INSERT INTO PackageLicenses (PackageID, LicenseID)
	SELECT Packages.ID, Licenses.ID FROM Packages
	INNER JOIN Licenses ON Licenses.Name = Packages.License;
----

20. Delete the license column from the Packages table:

----
ALTER TABLE Packages DROP COLUMN License;
----

From 2.2.0 to 2.3.0
-------------------

1. Add registration and inactivity time stamps to the "Users" table:

----
ALTER TABLE Users
	ADD COLUMN RegistrationTS TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
	ADD COLUMN InactivityTS BIGINT NOT NULL DEFAULT 0;
----

2. Add fields to store the total number of TUs and the quorum to the
   "TU_VoteInfo" table:

----
ALTER TABLE TU_VoteInfo
	ADD COLUMN ActiveTUs tinyint(3) unsigned NOT NULL default '0',
	ADD COLUMN Quorum decimal(2, 2) unsigned NOT NULL;
----

3. Add a "fonts" category:

----
INSERT INTO PackageCategories (Category) VALUES ('fonts');
----

From 2.1.0 to 2.2.0
-------------------

1. Add new "Users" table login IP address column:

----
ALTER TABLE Users
	ADD COLUMN LastLoginIPAddress INTEGER UNSIGNED NOT NULL DEFAULT 0;
----

2. Add a new "Bans" table:

----
CREATE TABLE Bans (
	IPAddress INTEGER UNSIGNED NOT NULL DEFAULT 0,
	BanTS TIMESTAMP NOT NULL,
	PRIMARY KEY (IPAddress)
) ENGINE = InnoDB;
----

From 2.0.0 to 2.1.0
-------------------

1. Update your aurblup setup to match configuration changes. See commit
6dc61e7d9e87ad6821869dab61e5f005af2e0252 for details.

From 1.9.1 to 2.0.0
-------------------

1. Add new "Users" table login date and PGP key columns:

----
ALTER TABLE Users ADD COLUMN LastLogin BIGINT NOT NULL DEFAULT 0;
ALTER TABLE Users ADD COLUMN PGPKey VARCHAR(40) NULL DEFAULT NULL;
----

2. Merge "web/lib/config.inc.php.proto" with "web/lib/config.inc.php".

3. Enable the PDO MySQL extension (pdo_mysql.so) in "php.ini".

4. Upgrade to PHP>=5.4.0 or enable "short_open_tag" in "php.ini".

5. Install translations by running `make install` in "po/".

From 1.9.0 to 1.9.1
-------------------

1. Merge "web/lib/config.inc.php.proto" with "web/lib/config.inc.php".

2. Install translations by running `make install` in "po/".

From 1.8.2 to 1.9.0
-------------------

1. Translation files are now gettext compatible and need to be compiled after
each AUR upgrade by running `make install` in the "po/" directory.

2. Remove the "NewPkgNotify" column from the "Users" table:

ALTER TABLE Users DROP COLUMN NewPkgNotify;

3. Fix up issues with depends performance on large dataset.

ALTER TABLE PackageDepends ADD INDEX (DepName);

4. Rename "web/lib/config.inc" to "web/lib/config.inc.php".

5. Merge "web/lib/config.inc.php.proto" with "web/lib/config.inc.php".

6. Run the upload directory transform script ("scripts/uploadbuckets.sh") and
rotate the converted directory structure into place.

7. In order to to provide backward compatible package URLs, enable mod_rewrite
and add the following to your Apache configuration (inside the "VirtualHost"
container or optionally create a ".htaccess" file in the upload directory):

----
RewriteEngine on
RewriteRule ^/packages/([^/]{1,2})([^/]*/(PKGBUILD|[^/]*\.tar\.gz|))$ /packages/$1/$1$2
----

The following equivalent rule can be used for lighttpd setups:

----
url.rewrite-once = ( "^/packages/([^/]{1,2})([^/]*/(PKGBUILD|[^/]*\.tar\.gz|))$" => "/packages/$1/$1$2" )
----

If you use a non-standard URL_DIR, slight modifications might be necessary.

8. Merge "scripts/aurblup/config.h.proto" with "scripts/aurblup/config.h".

From 1.8.1 to 1.8.2
-------------------

1. Update the modified package timestamp for new packages.

UPDATE Packages SET ModifiedTS = SubmittedTS WHERE ModifiedTS = 0;

2. Move to new method of storing package depends.

----
ALTER TABLE PackageDepends ADD COLUMN DepName VARCHAR(64) NOT NULL DEFAULT '' AFTER PackageID;
UPDATE PackageDepends SET DepName = (SELECT Name FROM Packages WHERE ID = DepPkgID);
ALTER TABLE PackageDepends MODIFY DepName VARCHAR(64) NOT NULL;
ALTER TABLE PackageDepends DROP FOREIGN KEY `PackageDepends_ibfk_2`;
ALTER TABLE PackageDepends DROP COLUMN DepPkgID;
DELETE FROM Packages WHERE DummyPkg = 1;
ALTER TABLE Packages DROP COLUMN DummyPkg;
----

3. The File_Find PEAR module is no longer required. You can safely uninstall it
if nothing else depends on it.

From 1.8.0 to 1.8.1
-------------------

1. Drop foreign keys from the "Sessions" table:

`ALTER TABLE Sessions DROP FOREIGN KEY Sessions_ibfk_1;` should work in most
cases. Otherwise, check the output of `SHOW CREATE TABLE Sessions;` and use the
foreign key name shown there.

2. Run the following MySQL statements:

----
ALTER TABLE Sessions
	ADD FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE;
ALTER TABLE PackageDepends
	ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (DepPkgID) REFERENCES Packages(ID) ON DELETE CASCADE;
ALTER TABLE PackageSources
	ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE;
ALTER TABLE TU_VoteInfo
	ADD FOREIGN KEY (SubmitterID) REFERENCES Users(ID) ON DELETE CASCADE;
ALTER TABLE TU_Votes
	ADD FOREIGN KEY (VoteID) REFERENCES TU_VoteInfo(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (UserID) REFERENCES Users(ID) ON DELETE CASCADE;
ALTER TABLE PackageComments
	MODIFY DelUsersID INTEGER UNSIGNED NULL DEFAULT NULL;
UPDATE PackageComments SET DelUsersID = NULL WHERE DelUsersID = 0;
ALTER TABLE Packages
	MODIFY SubmitterUID INTEGER UNSIGNED NULL DEFAULT NULL,
	MODIFY MaintainerUID INTEGER UNSIGNED NULL DEFAULT NULL;
UPDATE Packages SET SubmitterUID = NULL WHERE SubmitterUID = 0;
UPDATE Packages SET MaintainerUID = NULL WHERE MaintainerUID = 0;
----

3. (optional) If you converted your database from MyISAM to InnoDB during the
upgrade process from 1.7.0 to 1.8.0 or from 1.8.0 to 1.8.1 without completely
rebuilding the database from the MySQL schema, you should additionally run the
following MySQL statements to add missing foreign keys:

----
ALTER TABLE Users
	ADD FOREIGN KEY (AccountTypeID) REFERENCES AccountTypes(ID) ON DELETE NO ACTION;
ALTER TABLE Packages
	ADD FOREIGN KEY (CategoryID) REFERENCES PackageCategories(ID) ON DELETE NO ACTION,
	ADD FOREIGN KEY (SubmitterUID) REFERENCES Users(ID) ON DELETE NO ACTION,
	ADD FOREIGN KEY (MaintainerUID) REFERENCES Users(ID) ON DELETE NO ACTION;
ALTER TABLE PackageVotes
	ADD FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE;
ALTER TABLE PackageComments
	ADD FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (DelUsersID) REFERENCES Users(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE;
ALTER TABLE CommentNotify
	ADD FOREIGN KEY (PkgID) REFERENCES Packages(ID) ON DELETE CASCADE,
	ADD FOREIGN KEY (UserID) REFERENCES Users(ID) ON DELETE CASCADE;
----

4. Merge "web/lib/config.inc.proto" with "web/lib/config.inc".

From 1.7.0 to 1.8.0
-------------------

1. Run the following MySQL statements:

----
ALTER TABLE Packages ADD OutOfDateTS BIGINT UNSIGNED NULL DEFAULT NULL;
UPDATE Packages SET OutOfDateTS = UNIX_TIMESTAMP() WHERE OutOfDate = 1;
ALTER TABLE Packages DROP OutOfDate, DROP FSPath, DROP URLPath, DROP LocationID;
DROP TABLE PackageLocations, PackageContents;
ALTER TABLE AccountTypes MODIFY AccountType VARCHAR(32) NOT NULL DEFAULT '';
ALTER TABLE Users MODIFY Username VARCHAR(32) NOT NULL,
	MODIFY Email VARCHAR(64) NOT NULL,
	MODIFY RealName VARCHAR(64) NOT NULL DEFAULT '',
	MODIFY LangPreference VARCHAR(5) NOT NULL DEFAULT 'en',
	MODIFY IRCNick VARCHAR(32) NOT NULL DEFAULT '';
ALTER TABLE PackageCategories MODIFY Category VARCHAR(32) NOT NULL;
ALTER TABLE Packages MODIFY Name VARCHAR(64) NOT NULL,
	MODIFY Version VARCHAR(32) NOT NULL DEFAULT '',
	MODIFY Description VARCHAR(255) NOT NULL DEFAULT "An Arch Package",
	MODIFY URL VARCHAR(255) NOT NULL DEFAULT "https://www.archlinux.org",
	MODIFY License VARCHAR(40) NOT NULL DEFAULT '';
ALTER TABLE PackageSources
	MODIFY Source VARCHAR(255) NOT NULL DEFAULT "/dev/null";
ALTER TABLE TU_VoteInfo
	MODIFY User VARCHAR(32) collate latin1_general_ci NOT NULL;
CREATE TABLE PackageBlacklist (
	ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
	Name VARCHAR(64) NOT NULL,
	PRIMARY KEY (ID),
	UNIQUE (Name)
);
----

2. Drop all fulltext indexes from the "Packages" table:

Please do this with care. `ALTER TABLE Packages DROP INDEX Name;` will work in
most cases but might remove the wrong index if your indexes have been created
in a non-standard order (e.g. during some update process). You'd better run
`SHOW INDEX FROM Packages;` before to ensure that your setup doesn't use a
different naming.

3. You will need to update all packages which are stored in the incoming dir as
in 1.8.0, source tarballs are no longer extracted automatically and PKGBUILDs
are from now on located in the same subdirectories as the tarballs themselves.
The following script will do the conversion automatically when being run inside
"$INCOMING_DIR":

----
#!/bin/bash

for pkg in *; do
	if [ -d "${pkg}" -a ! -f "${pkg}/PKGBUILD" ]; then
		pkgbuild_file=$(find -P "${pkg}" -name PKGBUILD)
		[ -n "${pkgbuild_file}" ] && \
			cp "${pkgbuild_file}" "${pkg}/PKGBUILD"
	fi
done
----

4. (optional): 1.8.0 includes a helper utility called "aurblup" that can be
used to prevent users from uploading source packages with names identical to
packages in predefined binary repos, e.g. the official repositories of your
distribution. In order to build and install aurblup, enter the following
commands:

	cd scripts/aurblup/
	make config.h
	$EDITOR config.h
	make install  # as root

Add something like "0 * * * * /usr/local/bin/aurblup" to root's crontab to make
aurblup update the package blacklist every hour.

NOTE: You can run aurblup as non-privileged user as well. Make sure that the
user has read-write access to "/var/lib/aurblup/" (or whatever you defined with
"ALPM_DBPATH") tho.

5. (optional): As of 1.8.0, all MySQL tables should be InnoDB compatible. To
convert a table, you can use this statement: `ALTER TABLE $foo ENGINE=InnoDB;`.
If you want to stick with MyISAM or another storage engine that doesn't support
transactions, you will need to disable the "MYSQL_USE_TRANSACTIONS" setting in
"config.h" when setting up aurblup.

From 1.6.0 to 1.7.0
-------------------
ALTER TABLE Users ADD Salt CHAR(32) NOT NULL DEFAULT '';
ALTER TABLE Users ADD ResetKey CHAR(32) NOT NULL DEFAULT '';
ALTER TABLE Users MODIFY LangPreference CHAR(5) NOT NULL DEFAULT 'en';


From 1.5.2 to 1.5.3
-------------------
1. Ensure this appears in config.inc:
   define("DEFAULT_LANG", "en");


From 1.5.1 to 1.5.2
-------------------
1. Ensure Pear and File/Find.php are in the path. See web/README.txt.

2. Update your running copy of support/scripts/newpackage-notify.

3. Run this in web/lib:
<?php

# Run the script from within lib
include('config.inc');
include('aur.inc');

$query = "UPDATE Packages SET " .
         "FSPath = CONCAT('" . INCOMING_DIR . "', Name, '/', Name,
'.tar.gz'), " .
         "URLPath = CONCAT('" . URL_DIR . "', Name, '/', Name, '.tar.gz') " .
         "WHERE DummyPKG = 0 AND LocationID = 2;";

$dbh = db_connect();
db_query($query, $dbh);

$query = "ALTER TABLE Packages DROP COLUMN AURMaintainerUID;";
db_query($query, $dbh);


1.3.0
-----
ALTER TABLE PackageDepends ADD COLUMN DepCondition VARCHAR(20) AFTER DepPkgID;
ALTER TABLE Packages ADD License CHAR(40) NOT NULL DEFAULT '';


1.2.10
------
ALTER TABLE Packages MODIFY Description CHAR(255) NOT NULL DEFAULT "An Arch Package";


longerpkgname
-------------
ALTER TABLE Packages MODIFY Name CHAR(64) NOT NULL;