Commit graph

70 commits

Author SHA1 Message Date
Dan McGee
f9eba12312 Ensure users can be deleted when foreign keys are present
This change is necessary to prevent this:
    mysql> delete from Users where ID = 112;
    ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`aur`.`Packages`, CONSTRAINT `Packages_ibfk_2` FOREIGN KEY (`SubmitterUID`) REFERENCES `Users` (`ID`) ON DELETE NO ACTION)

As a bonus, due to foreign keys, orphaning of packages will be
automatic.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-04 10:29:14 +01:00
Dan McGee
abd41bbb51 Allow DB connection values to come from the environment
Stop hardcoding everything everywhere for those of us that don't use the
localhost/aur/aur/AUR setup. Also allow for the dummy data to be created
in the reload script if it does not exist. Finally, remove two
assumptions that the AUR database already exists.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-04 10:29:14 +01:00
Dan McGee
b9690972d0 Use a single transaction to write dummy data
This is immensely faster when using InnoDB since we don't need to sync
after each and every INSERT statement.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-03-04 10:29:13 +01:00
Lukas Fleischer
f89ba3fb6d Remove database recreation code from "support/schema/reloadtestdb.sh".
Database is being dropped and recreated in the schema, so there's no
need to do this in "reloadtestdb.sh" as well.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-28 09:45:29 +01:00
Loui Chang
c638a89314 Specify utf8 in database schema.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-28 09:38:14 +01:00
Lukas Fleischer
bc238965cb Fix some minor bugs in "support/schema/gendummydata.py".
The dummy data generation script used to create wrong package IDs for
both "PackageVotes" and "PackageDepends" tables which led to errors when
reloading the test data (constraints failed). This is fixed by no longer
creating entries with zero ("0") package IDs.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-27 19:46:30 +01:00
Lukas Fleischer
816a0cf8d7 Add "ENGINE = InnoDB" to "CREATE TABLE" statements in the SQL schema.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-27 19:46:29 +01:00
Lukas Fleischer
1e3fa38de5 Define "Packages.SubmitterUID" and "Packages.MaintainerUID" as "NULL".
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-27 19:46:19 +01:00
Lukas Fleischer
40ccf77ca0 Define "PackageComments.DelUsersID" as "NULL".
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-27 16:20:02 +01:00
Lukas Fleischer
ac632980c3 Add missing foreign keys and constraints to the DB.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-26 21:11:25 +01:00
Lukas Fleischer
5905577694 Use VARCHAR instead of CHAR in "PackageBlacklist" table.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-11 14:43:24 +01:00
Lukas Fleischer
b69f548065 Add a package name blacklist.
Can be used to blacklist package names for normal users. TUs and
developers are not affected. This is especially useful if used together
with a cron job that updates the blacklist periodically, e.g. to reject
packages which are available in the binary repos (FS#12902).

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-11 14:43:22 +01:00
Lukas Fleischer
881bfcced4 Remove unused fulltext index from "Packages" table.
Drop fulltext indexes, which prevent the use of InnoDB, from "Packages"
table. All search routines use "LIKE" patterns, so fulltext search has
actually never been used.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-10 08:17:53 +01:00
Lukas Fleischer
6d737c4684 Use VARCHAR instead of CHAR where appropriate.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-09 08:46:27 +01:00
Lukas Fleischer
34ac351e82 Drop "PackageContents" table and references.
We don't even touch source tarballs anymore - except for extracting the
PKGBUILD, so this is no longer needed.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-01 15:16:29 +01:00
Lukas Fleischer
366ea03118 Remove "FSPath" column from "Packages" table.
This field is not used anymore, so drop it from the table and remove all
references.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-01 15:01:56 +01:00
Dan McGee
7f5af61c88 Drop PackageLocations table and references
We don't need this anymore since all packages managed here are
well...managed here. Rip out all of the places we were using this field,
many of which depended on the magic value '2' anyway.

On the display side of things, we had a column that was always showing
'unsupported' that is now gone, and you can no longer sort by this column.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-01 12:41:08 +01:00
Lukas Fleischer
737268e0c2 Use "python2" shebang for "newpackage-notify" and "gendummydata.py".
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-01-24 18:12:05 +01:00
Lukas Fleischer
556de318ae Build URLs from package names (fixes FS#15308, FS#19327).
Drop the "URLPath" field from the "Packages" table, build URLs from
package names instead.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-01-24 18:08:29 +01:00
Lukas Fleischer
eda713032c Add timestamp when a package is flagged out-of-date (FS#20848).
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
- resolve conflict and omit i18n changes.
2010-11-10 14:50:35 -05:00
Denis
290c436046 Support for storing salted passwords
To upgrade existing databases:

ALTER TABLE Users ADD Salt CHAR(32) NOT NULL DEFAULT '';

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2010-04-17 16:50:24 -04:00
Loui Chang
c3ebc4d7fa aur-schema.sql: Expand LangPreference field to allow for longer lang codes.
To upgrade existing databases:

  ALTER TABLE Users MODIFY LangPreference CHAR(5) NOT NULL DEFAULT 'en';

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-11-29 06:28:15 -05:00
Evangelos Foutras
861cbf4935 Implement 'Password Reset' facility (FS#3061)
This works by adding a new field to the 'Users' table called 'ResetKey',
which is a 32 characters long, random string. When the user requests a
password reset, a new 'reset key' is generated and sent to the user's
e-mail address in the form of a link in the following format:

  http://aur.archlinux.org/passreset.php?resetkey=<reset key>

When the above link is followed, the user is presented with a form to
verify his/her e-mail address and specify the new desired password. If
the e-mail address matches the reset key in the database, the new
password is assigned to the account. If there is an error, a relevant
message is displayed and the user is prompted to re-enter the required
information. Upon successful completion of this procedure, the ResetKey
field in the database is blanked and the specific key cannot be reused.

One SQL query is needed to add the ResetKey field to the 'Users' table:

  ALTER TABLE `Users` ADD `ResetKey` CHAR(32) NOT NULL DEFAULT '';

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-11-13 16:49:55 -05:00
Dan McGee
e2b3bd1c37 Add multicolumn indexes on votes and notifications tables
To put a long story short, when we do joins on these tables in our
pkg_search_page() function, we always join on both the user ID and package
ID columns. By creating multicolumn indices, we can always get the exact row
we are looking for in the table.

The benefits of adding a unique index should also speak for themselves, as
we previously did not have this on either of these tables.

This is part one of a two-part series to address the fact that this query
was often showing up in our slow query logs.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2009-06-18 01:47:17 -04:00
Callan Barrett
04dae8d94f Remove references to AURMaintainerUID
This (should) get rid of anything to do with the unused column AURMaintainerUID
in the scripts and schema files

Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
Signed-off-by: Simo Leone <simo@archlinux.org>
2008-03-27 02:34:35 -05:00
Loui Chang
e64307d8d2 Generate valid dummy data entries
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Simo Leone <simo@archlinux.org>
2008-03-23 03:04:17 -05:00
Loui Chang
3577326b2b Make all references to AUR database consistent
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Simo Leone <simo@archlinux.org>
2008-03-23 03:04:17 -05:00
Callan Barrett
ce225727f6 Bug in uploading PKGBUILDs and aur schema
This fixes a bug where TUs and devs couldn't upload packages because
the query would have an extra column in it to mark the pkgbuild safe
automatically, guessing it got missed when the safe flags were
removed. Also fixes a screw up I made with the schema file when I
added the tables for the voting app.

Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
2008-01-20 00:21:19 -06:00
Callan Barrett
5f4afcc8cb Add support for variable length votes in voting application
Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
2008-01-20 00:21:19 -06:00
Callan Barrett
a8e574ef28 AUR Voting Application
Added support for TU voting through AUR

Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
2008-01-20 00:21:19 -06:00
eliott
c17b629a4d Fix for safe-removal. 2008-01-20 00:21:18 -06:00
eliott
a9837329d6 Hand diff of simo's patch to remove flag safe functionality.
Simo's original commit text:
 The idea of safe flagging is unclear, poorly named, misunderstood,
 and not even used. At the time this patch was created, less than
 a third of the packages in unsupported were flagged safe, and less
 than a tenth of users knew how to interpret it.

 The safe flag has been replaced by a disclaimer on the main page.
2008-01-20 00:21:18 -06:00
Dan McGee
6dbe12264a Remove dummy data from GIT
There is no need to check in dummy data if it is available by running the
script that sat right next to it in the repo. Doh!

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-20 00:20:24 -06:00
eliott
5e38e3d3d0 Added AurJSON code.
Added a JSON interface to the aur. This should make it easier for developers to integrate
command line utilities and poll against the AUR itself.
2008-01-19 23:49:35 -06:00
pjmattal
fa06bab00c committed old schema change from old version 2007-09-17 13:38:35 +00:00
dsa
723f1afde8 Added the DepCondition field to the table PackageDepends. 2007-02-01 10:15:52 +00:00
swiergot
dce2f70443 Applied license patch from dsa (closes #4085). 2006-08-22 14:18:28 +00:00
pjmattal
c15513fd77 of course, max length for Description must be 255, not 256 2006-08-10 01:18:04 +00:00
pjmattal
db4075a050 upped length on Description in Package table to 256 from 128
as per discussions with simo and dsa
2006-08-03 04:39:32 +00:00
pjmattal
70b6b2250b committed schema change for swiergot's checking patch 2005-07-29 12:29:57 +00:00
simo
6adf639a34 SQL CHANGES: New table CommentNotify with fields:
PkgID
	UserID
This implements emailing comment notifications, including a user option to
enable/disable it on the package page. It uses php's mail() function to do
it and sends to everyone on the notify list as BCC.

This needs some more testing before public consumption.
2005-06-08 01:07:55 +00:00
simo
f7a0009ed7 Added ModifiedTS to Packages database
Implemented ModifiedTS such that:
  -ModifiedTS changed ONLY when package updated
  -SubmittedTS changed ONLY when new package
Also made DummyPkg fixups in tupkgupdate
2005-05-08 02:01:15 +00:00
pjmattal
2f27045c0f changed db name from AUR to aur
moved db config for webapp into the config file
2005-04-09 20:54:55 +00:00
pjmattal
71b5b9e6b7 many changes in prep for launch
new doc page added
changed AUR to community
lower-cased unsupported
fixed half of the bug with changing categories:
  categories now can't be changed for packages in community
  however they can still be changed out from under maintainers by joe users for unsupported packages
debugged problem with package details not found when unsupported uploads were with Category 0 (changed default to 19)
2005-04-06 02:54:11 +00:00
eric
7fccb8b634 added comments/category editing, and closed #2280 2005-03-20 18:54:20 +00:00
eric
e3587ddf94 started working on pkgedit for comments 2005-03-06 21:44:56 +00:00
eric
aae43d9ad6 started working on package comments 2005-03-05 20:39:36 +00:00
eric
9641fdc735 fixed dummy-data, schema, gendummydata to use md5 passwords 2005-01-24 21:03:44 +00:00
pjmattal
294c14e7bb renumber none to one, hide none from category/location dropdowns 2004-12-15 01:47:17 +00:00
jchu
19086f4f02 removed my url path and fs path from the packages table 2004-12-15 01:35:36 +00:00