mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
Redo Docker environment with Percona 8.0
This commit is contained in:
4
.docker/mysql-home/.my.cnf
Normal file
4
.docker/mysql-home/.my.cnf
Normal file
@@ -0,0 +1,4 @@
|
||||
[mysql]
|
||||
user=gazelle
|
||||
password=password
|
||||
database=gazelle
|
||||
@@ -1,6 +0,0 @@
|
||||
[mysqld]
|
||||
sql_mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE
|
||||
userstat = on
|
||||
|
||||
[client]
|
||||
default-character-set = utf8mb4
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PHP_VER=8.1
|
||||
|
||||
run_service()
|
||||
@@ -7,42 +9,35 @@ run_service()
|
||||
service "$1" start || exit 1
|
||||
}
|
||||
|
||||
# We'll need these anyway so why not kill some time while waiting on MySQL to be ready
|
||||
if [ -n "$ENV" ] && [ "$ENV" == "prod" ]; then
|
||||
su -c 'composer --version && composer install --no-progress --no-dev --optimize-autoloader --no-suggest; yarn --prod; yarn prod' gazelle
|
||||
else
|
||||
su -c 'composer --version && composer install --no-progress; yarn; yarn dev' gazelle
|
||||
[ -f /var/www/lib/override.config.php ] || bash /var/www/.docker/web/generate-config.sh
|
||||
|
||||
if [ ! -f /etc/php/${PHP_VER}/cli/conf.d/99-boris.ini ]; then
|
||||
echo "Initialize Boris..."
|
||||
grep '^disable_functions' /etc/php/${PHP_VER}/cli/php.ini \
|
||||
| sed -r 's/pcntl_(fork|signal|signal_dispatch|waitpid),//g' \
|
||||
> /etc/php/${PHP_VER}/cli/conf.d/99-boris.ini
|
||||
fi
|
||||
|
||||
# Wait for MySQL...
|
||||
counter=1
|
||||
while ! mysql -h mysql -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" -e "show databases;" > /dev/null 2>&1; do
|
||||
sleep 1
|
||||
counter=$((counter + 1))
|
||||
if [ $((counter % 20)) -eq 0 ]; then
|
||||
mysql -h mysql -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" -e "show databases;"
|
||||
>&2 echo "Still waiting for MySQL (Count: $counter)."
|
||||
fi;
|
||||
while ! nc -z mysql 3306
|
||||
do
|
||||
echo "Waiting for MySQL..."
|
||||
sleep 10
|
||||
done
|
||||
|
||||
[ -f /var/www/lib/override.config.php ] || bash /var/www/.docker/web/generate-config.sh
|
||||
|
||||
echo "Run migrations..."
|
||||
if ! FKEY_MY_DATABASE=1 LOCK_MY_DATABASE=1 /var/www/vendor/bin/phinx migrate; then
|
||||
echo "PHINX FAILED TO RUN MIGRATIONS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "\n"
|
||||
|
||||
if [ ! -f /srv/gazelle.txt ]; then
|
||||
if [ ! -f /var/www/db/seeded.txt ]; then
|
||||
echo "Run seed:run..."
|
||||
if ! /var/www/vendor/bin/phinx seed:run -s InitialUserSeeder; then
|
||||
if ! /var/www/vendor/bin/phinx seed:run; then
|
||||
echo "PHINX FAILED TO SEED"
|
||||
exit 1
|
||||
fi
|
||||
touch /srv/gazelle.txt
|
||||
echo -e "\n"
|
||||
echo "Seeds have been run, delete to rerun" > /var/www/db/seeded.txt
|
||||
chmod 400 /var/www/db/seeded.txt
|
||||
fi
|
||||
|
||||
if [ ! -d /var/lib/gazelle/torrent ]; then
|
||||
@@ -53,11 +48,10 @@ if [ ! -d /var/lib/gazelle/torrent ]; then
|
||||
chown -R gazelle /var/lib/gazelle
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/php/${PHP_VER}/cli/conf.d/99-boris.ini ]; then
|
||||
echo "Initialize Boris..."
|
||||
grep '^disable_functions' /etc/php/${PHP_VER}/cli/php.ini \
|
||||
| sed -r 's/pcntl_(fork|signal|signal_dispatch|waitpid),//g' \
|
||||
> /etc/php/${PHP_VER}/cli/conf.d/99-boris.ini
|
||||
if [ "$ENV" == "prod" ]; then
|
||||
su -c 'composer --version && composer install --no-progress --no-dev --optimize-autoloader --no-suggest; yarn --prod; npx browserslist@latest --update-db; yarn prod' gazelle
|
||||
else
|
||||
su -c 'composer --version && composer install --no-progress; yarn; npx browserslist@latest --update-db; yarn dev' gazelle
|
||||
fi
|
||||
|
||||
echo "Start services..."
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -7,7 +7,6 @@
|
||||
.cache/
|
||||
.config/
|
||||
.docker/data/
|
||||
.docker/pg/data
|
||||
.idea/
|
||||
.vscode/
|
||||
.local/
|
||||
@@ -20,6 +19,7 @@
|
||||
__MACOSX/
|
||||
|
||||
/cache
|
||||
/db/seeded.txt
|
||||
/node_modules
|
||||
/public/static/font/
|
||||
/public/static/local/
|
||||
@@ -29,6 +29,9 @@ __MACOSX/
|
||||
/mix.js.map
|
||||
/yarn-error.log
|
||||
|
||||
.docker/mysql-home/.mysql_history
|
||||
!.docker/mysql-home/.my.cnf
|
||||
|
||||
/public/static/styles/**/*.css
|
||||
/public/static/styles/**/*.css.map
|
||||
!/public/static/styles/opendyslexic/style.css
|
||||
|
||||
@@ -17,8 +17,8 @@ RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
cron \
|
||||
make \
|
||||
mariadb-client \
|
||||
nginx \
|
||||
netcat \
|
||||
php8.1 \
|
||||
php8.1-cli \
|
||||
php8.1-curl \
|
||||
|
||||
17
README.md
17
README.md
@@ -6,7 +6,7 @@ needs. Gazelle is written in PHP, Twig, JavaScript, and MySQL.
|
||||
|
||||
## Gazelle Runtime Dependencies
|
||||
* [Nginx](http://wiki.nginx.org/Main) (recommended)
|
||||
* [PHP 7.4.27+](https://www.php.net/) (required)
|
||||
* [PHP 8.1.4+](https://www.php.net/) (required)
|
||||
* [NodeJS 12+](https://nodejs.org/en/) (required)
|
||||
* [Memcached](http://memcached.org/) (required)
|
||||
* [Sphinx 2.0.6 or newer](http://sphinxsearch.com/) (required)
|
||||
@@ -80,7 +80,7 @@ page and tick everything.
|
||||
|
||||
### Ports
|
||||
The following ports are forwarded:
|
||||
* 80 -> 8080 (web)
|
||||
* 80 -> 7001 (web)
|
||||
* 3306 -> 36000 (mysql)
|
||||
* 34000 -> 34000 (ocelot)
|
||||
|
||||
@@ -107,19 +107,12 @@ Edit the resulting file and then apply it:
|
||||
|
||||
`docker exec -it $WEBCONT vendor/bin/phinx migrate`
|
||||
|
||||
To access the database, save the following in `~root/.my.cnf` of
|
||||
the database container:
|
||||
|
||||
```
|
||||
[mysql]
|
||||
user = root
|
||||
password = password
|
||||
database = gazelle
|
||||
```
|
||||
To access the database, look at `.docker/mysql-home/.my.cnf`
|
||||
The credentials should match those used in the `docker-compose.yml` file.
|
||||
|
||||
And then:
|
||||
|
||||
`docker exec -it $(docker ps|awk '$2 ~ /^mariadb/ {print $1}') mysql`
|
||||
`docker exec -it $MYSQLCONT mysql`
|
||||
|
||||
In the same vein, you can use `mysqldump` to perform a backup.
|
||||
|
||||
|
||||
@@ -30,12 +30,13 @@ DROP FUNCTION binomial_ci;");
|
||||
// database engine, you can move forward by uncommenting the following line
|
||||
// and then iterating until things work.
|
||||
// $this->down();
|
||||
//
|
||||
// Another alternative is to connect to the mysql container and run 'drop database gazelle; create database gazelle;'
|
||||
|
||||
$this->execute("ALTER DATABASE CHARACTER SET 'utf8';");
|
||||
$this->execute("ALTER DATABASE COLLATE='utf8_swedish_ci';");
|
||||
$this->execute("
|
||||
CREATE FUNCTION IF NOT EXISTS `binomial_ci`(p int, n int) RETURNS float
|
||||
DETERMINISTIC
|
||||
CREATE FUNCTION `binomial_ci`(p int, n int) RETURNS float DETERMINISTIC
|
||||
RETURN IF(n = 0,0.0,((p + 1.35336) / n - 1.6452 * SQRT((p * (n-p)) / n + 0.67668) / n) / (1 + 2.7067 / n));
|
||||
");
|
||||
|
||||
@@ -1927,7 +1928,7 @@ RETURN IF(n = 0,0.0,((p + 1.35336) / n - 1.6452 * SQRT((p * (n-p)) / n + 0.67668
|
||||
'encoding' => 'utf8',
|
||||
])
|
||||
->addColumn('StartTime', 'datetime', [
|
||||
'null' => true,
|
||||
'null' => false,
|
||||
])
|
||||
->addColumn('EndTime', 'datetime', [
|
||||
'null' => true,
|
||||
@@ -8926,11 +8927,6 @@ RETURN IF(n = 0,0.0,((p + 1.35336) / n - 1.6452 * SQRT((p * (n-p)) / n + 0.67668
|
||||
$this->table('wiki_revisions')->insert([
|
||||
['ID' => 1, 'Revision' => 1, 'Title' => 'Wiki', 'Body' => 'Welcome to your new wiki! Hope this works.', 'Date' => '2019-01-01 12:59:59', 'Author' => 1]
|
||||
])->save();
|
||||
$this->table('tags')->insert([
|
||||
['Name' => 'rock', 'TagType' => 'genre', 'Uses' => 0, 'UserID' => 1],
|
||||
['Name' => 'pop', 'TagType' => 'genre', 'Uses' => 0, 'UserID' => 1],
|
||||
['Name' => 'female.fronted.symphonic.death.metal', 'TagType' => 'genre', 'Uses' => 0, 'UserID' => 1]
|
||||
])->save();
|
||||
|
||||
$this->table('stylesheets')->insert([
|
||||
['Name' => 'Layer cake', 'Description' => 'Grey stylesheet by Emm'],
|
||||
|
||||
@@ -28,19 +28,9 @@ class RequestChecksum extends AbstractMigration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->table('requests')
|
||||
->addColumn('Checksum', 'boolean', ['default' => false])
|
||||
->update();
|
||||
$this->execute('ALTER TABLE requests MODIFY TimeFilled datetime');
|
||||
$this->execute("UPDATE requests SET TimeFilled = null WHERE TimeFilled = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->execute("UPDATE requests SET TimeFilled = '0000-00-00 00:00:00' WHERE TimeFilled IS NULL");
|
||||
$this->execute("ALTER TABLE requests MODIFY TimeFilled datetime NOT NULL DEFAULT '0000-00-00 00:00:00'");
|
||||
$this->table('requests')
|
||||
->removeColumn('Checksum')
|
||||
->update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ class DeleteTorrent extends AbstractMigration
|
||||
$this->table('torrents')
|
||||
->changeColumn('last_action', 'datetime', ['null' => true])
|
||||
->update();
|
||||
$this->execute("UPDATE torrents SET last_action = NULL WHERE last_action = '0000-00-00 00:00:00'");
|
||||
|
||||
$this->table('deleted_torrents', ['id' => false, 'primary_key' => 'ID'])
|
||||
->addColumn('ID', 'integer', ['length' => 10])
|
||||
@@ -119,7 +118,6 @@ class DeleteTorrent extends AbstractMigration
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("UPDATE torrents SET last_action = '0000-00-00 00:00:00' WHERE last_action IS NULL");
|
||||
$this->table('torrents')
|
||||
->changeColumn('last_action', 'datetime', ['null' => false])
|
||||
->update();
|
||||
|
||||
@@ -31,9 +31,15 @@ class DropDonationEmail extends AbstractMigration
|
||||
* with the Table class.
|
||||
*/
|
||||
public function up() {
|
||||
$this->execute("ALTER TABLE users_donor_ranks DROP COLUMN IF EXISTS Email");
|
||||
/*
|
||||
$this->execute("
|
||||
ALTER TABLE users_donor_ranks DROP COLUMN Email
|
||||
");
|
||||
*/
|
||||
}
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE users_donor_ranks ADD COLUMN Email varchar(255)");
|
||||
$this->execute("
|
||||
ALTER TABLE users_donor_ranks ADD COLUMN Email varchar(255)
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,14 @@ class DropSecret extends AbstractMigration
|
||||
die("Migration cannot proceed, use the source: " . __FILE__ . "\n");
|
||||
}
|
||||
$this->table('users_main')
|
||||
->removeColumn('Secret')
|
||||
// ->removeColumn('Secret')
|
||||
->changeColumn('Title', 'string', ['limit' => 255, 'default' => ''])
|
||||
->update();
|
||||
|
||||
$this->table('users_info')
|
||||
->changeColumn('Info', 'text', ['limit' => 65536, 'default' => ''])
|
||||
->changeColumn('AdminComment', 'text', ['limit' => 65536, 'default' => ''])
|
||||
->changeColumn('SiteOptions', 'text', ['limit' => 65536, 'default' => ''])
|
||||
->changeColumn('Info', 'text', ['limit' => 65536])
|
||||
->changeColumn('AdminComment', 'text', ['limit' => 65536])
|
||||
->changeColumn('SiteOptions', 'text', ['limit' => 65536])
|
||||
->changeColumn('Warned', 'timestamp', ['null' => true])
|
||||
->changeColumn('Avatar', 'string', ['limit' => 255, 'default' => ''])
|
||||
->changeColumn('SupportFor', 'string', ['limit' => 255, 'default' => ''])
|
||||
|
||||
@@ -61,7 +61,7 @@ class MigrateLeechStatTables extends AbstractMigration
|
||||
ADD COLUMN Leechers int(6) NOT NULL DEFAULT 0,
|
||||
ADD COLUMN Snatched int(10) unsigned NOT NULL DEFAULT 0,
|
||||
ADD COLUMN balance bigint(20) NOT NULL DEFAULT 0,
|
||||
ADD COLUMN last_action datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
ADD COLUMN last_action datetime NOT NULL DEFAULT NULL
|
||||
");
|
||||
$this->execute("UPDATE torrents
|
||||
INNER JOIN torrents_leech_stats tls ON (tls.TorrentID = torrents.ID) SET
|
||||
|
||||
@@ -34,7 +34,7 @@ class UserLastAccessUpdate extends AbstractMigration
|
||||
INSERT INTO user_last_access
|
||||
SELECT ID, LastAccess
|
||||
FROM users_main
|
||||
WHERE LastAccess != '0000-00-00 00:00:00'
|
||||
WHERE LastAccess IS NOT NULL
|
||||
ON DUPLICATE KEY UPDATE user_id = user_id
|
||||
");
|
||||
}
|
||||
|
||||
@@ -4,12 +4,16 @@ use Phinx\Migration\AbstractMigration;
|
||||
|
||||
class PaymentCost extends AbstractMigration {
|
||||
public function up() {
|
||||
$this->execute("ALTER TABLE payment_reminders MODIFY Expiry date NOT NULL DEFAULT current_date, ADD COLUMN AnnualRent integer NOT NULL DEFAULT 0");
|
||||
$this->execute("UPDATE payment_reminders SET Expiry = NULL WHERE Expiry = '0000-00-00'");
|
||||
$this->execute("
|
||||
ALTER TABLE payment_reminders
|
||||
MODIFY Expiry date NOT NULL DEFAULT (current_date),
|
||||
ADD COLUMN AnnualRent integer NOT NULL DEFAULT 0
|
||||
");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE payment_reminders MODIFY Expiry datetime default '0000-00-00 00:00:00', DROP COLUMN AnnualRent");
|
||||
$this->execute("UPDATE payment_reminders SET Expiry = '0000-00-00 00:00:00' WHERE Expiry is NULL");
|
||||
$this->execute("
|
||||
ALTER TABLE payment_reminders MODIFY Expiry datetime, DROP COLUMN AnnualRent
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,17 @@ use Phinx\Migration\AbstractMigration;
|
||||
|
||||
class AnnualRentFloat extends AbstractMigration {
|
||||
public function up() {
|
||||
$this->execute("ALTER TABLE payment_reminders MODIFY AnnualRent float(24,12) NOT NULL DEFAULT 0, MODIFY `cc` enum('BTC', 'EUR','USD') NOT NULL DEFAULT 'USD'");
|
||||
$this->execute("
|
||||
ALTER TABLE payment_reminders
|
||||
MODIFY AnnualRent float(24,12) NOT NULL DEFAULT 0,
|
||||
MODIFY `cc` enum('BTC', 'EUR','USD') NOT NULL DEFAULT 'USD'
|
||||
");
|
||||
}
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE payment_reminders MODIFY AnnualRent int(11) NOT NULL DEFAULT 0, MODIFY `cc` enum('EUR','USD') NOT NULL DEFAULT 'USD'");
|
||||
$this->execute("
|
||||
ALTER TABLE payment_reminders
|
||||
MODIFY AnnualRent int(11) NOT NULL DEFAULT 0,
|
||||
MODIFY `cc` enum('EUR','USD') NOT NULL DEFAULT 'USD'
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class IndexRefactor extends AbstractMigration {
|
||||
],
|
||||
[
|
||||
't' => 'collages_torrents',
|
||||
'old' => "AddedOn datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
|
||||
'old' => "AddedOn datetime NOT NULL",
|
||||
'new' => "AddedOn datetime NOT NULL DEFAULT current_timestamp()",
|
||||
],
|
||||
[
|
||||
@@ -66,7 +66,7 @@ class IndexRefactor extends AbstractMigration {
|
||||
[
|
||||
't' => 'forums',
|
||||
'old' => "CategoryID tinyint(4) DEFAULT NULL",
|
||||
'new' => "CategoryID tinyint(2) DEFAULT NULL",
|
||||
'new' => "CategoryID tinyint(2) DEFAULT NULL",
|
||||
],
|
||||
[
|
||||
't' => 'forums_polls_votes',
|
||||
@@ -85,7 +85,7 @@ class IndexRefactor extends AbstractMigration {
|
||||
],
|
||||
[
|
||||
't' => 'forums_topics',
|
||||
'old' => "CreatedTime datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
|
||||
'old' => "CreatedTime datetime NOT NULL",
|
||||
'new' => "CreatedTime datetime NOT NULL DEFAULT current_timestamp()",
|
||||
],
|
||||
[
|
||||
@@ -95,7 +95,7 @@ class IndexRefactor extends AbstractMigration {
|
||||
],
|
||||
[
|
||||
't' => 'forums_topics',
|
||||
'old' => "CreatedTime datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
|
||||
'old' => "CreatedTime datetime NOT NULL",
|
||||
'new' => "CreatedTime datetime DEFAULT current_timestamp()",
|
||||
],
|
||||
[
|
||||
@@ -175,8 +175,8 @@ class IndexRefactor extends AbstractMigration {
|
||||
],
|
||||
[
|
||||
't' => 'top10_history_torrents',
|
||||
'old' => "Rank tinyint(4) NOT NULL DEFAULT 0",
|
||||
'new' => "Rank tinyint(2) NOT NULL DEFAULT 0",
|
||||
'old' => "`Rank` tinyint(4) NOT NULL DEFAULT 0",
|
||||
'new' => "`Rank` tinyint(2) NOT NULL DEFAULT 0",
|
||||
],
|
||||
[
|
||||
't' => 'torrents',
|
||||
@@ -185,12 +185,12 @@ class IndexRefactor extends AbstractMigration {
|
||||
],
|
||||
[
|
||||
't' => 'torrents',
|
||||
'old' => "Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
|
||||
'old' => "Time datetime NOT NULL",
|
||||
'new' => "Time datetime DEFAULT NULL",
|
||||
],
|
||||
[
|
||||
't' => 'torrents',
|
||||
'old' => "LastReseedRequest datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
|
||||
'old' => "LastReseedRequest datetime NOT NULL",
|
||||
'new' => "LastReseedRequest datetime DEFAULT NULL",
|
||||
],
|
||||
[
|
||||
@@ -210,8 +210,8 @@ class IndexRefactor extends AbstractMigration {
|
||||
],
|
||||
[
|
||||
't' => 'users_donor_ranks',
|
||||
'old' => "Rank tinyint(4) NOT NULL DEFAULT 0",
|
||||
'new' => "Rank tinyint(2) NOT NULL DEFAULT 0",
|
||||
'old' => "`Rank` tinyint(4) NOT NULL DEFAULT 0",
|
||||
'new' => "`Rank` tinyint(2) NOT NULL DEFAULT 0",
|
||||
],
|
||||
[
|
||||
't' => 'users_donor_ranks',
|
||||
@@ -270,38 +270,38 @@ class IndexRefactor extends AbstractMigration {
|
||||
return [
|
||||
[
|
||||
't' => 'artists_alias',
|
||||
'old' => "DROP KEY IF EXISTS name_idx", /* if rollback */
|
||||
'new' => "ADD KEY IF NOT EXISTS name_idx (Name)", /* if migrate */
|
||||
'old' => "DROP KEY /* IF EXISTS */ name_idx", /* if rollback */
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ name_idx (Name)", /* if migrate */
|
||||
],
|
||||
[
|
||||
't' => 'artists_similar',
|
||||
'old' => "ADD KEY IF NOT EXISTS ArtistID (ArtistID, SimilarID)",
|
||||
'new' => "DROP KEY IF EXISTS ArtistID",
|
||||
'old' => "ADD KEY /* IF NOT EXISTS */ ArtistID (ArtistID, SimilarID)",
|
||||
'new' => "DROP KEY /* IF EXISTS */ ArtistID",
|
||||
],
|
||||
[
|
||||
't' => 'artists_similar',
|
||||
'old' => "DROP KEY IF EXISTS as_similarid_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS as_similarid_idx (SimilarID)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ as_similarid_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ as_similarid_idx (SimilarID)",
|
||||
],
|
||||
[
|
||||
't' => 'collages_torrents',
|
||||
'old' => "DROP KEY IF EXISTS group_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS group_idx (GroupID)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ group_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ group_idx (GroupID)",
|
||||
],
|
||||
[
|
||||
't' => 'contest',
|
||||
'old' => "DROP KEY IF EXISTS dateend_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS dateend_idx (DateEnd)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ dateend_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ dateend_idx (DateEnd)",
|
||||
],
|
||||
[
|
||||
't' => 'do_not_upload',
|
||||
'old' => "DROP KEY IF EXISTS sequence_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS sequence_idx (Sequence)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ sequence_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ sequence_idx (Sequence)",
|
||||
],
|
||||
[
|
||||
't' => 'donations',
|
||||
'old' => "ADD COLUMN IF NOT EXISTS Email varchar(255) NOT NULL",
|
||||
'new' => "DROP COLUMN IF EXISTS Email",
|
||||
'old' => "ADD COLUMN /* IF NOT EXISTS */ Email varchar(255) NOT NULL",
|
||||
'new' => "DROP COLUMN /* IF EXISTS */ Email",
|
||||
],
|
||||
[
|
||||
't' => 'featured_albums',
|
||||
@@ -315,74 +315,74 @@ class IndexRefactor extends AbstractMigration {
|
||||
],
|
||||
[
|
||||
't' => 'login_attempts',
|
||||
'old' => "DROP KEY IF EXISTS attempts_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS attempts_idx (Attempts)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ attempts_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ attempts_idx (Attempts)",
|
||||
],
|
||||
[
|
||||
't' => 'permissions',
|
||||
'old' => "DROP KEY IF EXISTS secondary_name_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS secondary_name_idx (Secondary, Name)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ secondary_name_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ secondary_name_idx (Secondary, Name)",
|
||||
],
|
||||
[
|
||||
't' => 'pm_conversations_users',
|
||||
'old' => "DROP KEY IF EXISTS pcu_userid_unread_ininbox",
|
||||
'new' => "ADD KEY IF NOT EXISTS pcu_userid_unread_ininbox (UserID, UnRead, InInbox)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ pcu_userid_unread_ininbox",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ pcu_userid_unread_ininbox (UserID, UnRead, InInbox)",
|
||||
],
|
||||
[
|
||||
't' => 'referral_users',
|
||||
'old' => "DROP KEY IF EXISTS ru_invitekey_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS ru_invitekey_idx (InviteKey)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ ru_invitekey_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ ru_invitekey_idx (InviteKey)",
|
||||
],
|
||||
|
||||
[
|
||||
't' => 'reportsv2',
|
||||
'old' => "ADD KEY IF NOT EXISTS ResolverID (ResolverID)",
|
||||
'new' => "DROP KEY IF EXISTS ResolverID",
|
||||
'old' => "ADD KEY /* IF NOT EXISTS */ ResolverID (ResolverID)",
|
||||
'new' => "DROP KEY /* IF EXISTS */ ResolverID",
|
||||
],
|
||||
[
|
||||
't' => 'reportsv2',
|
||||
'old' => "DROP KEY IF EXISTS resolver_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS resolver_idx (ResolverID)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ resolver_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ resolver_idx (ResolverID)",
|
||||
],
|
||||
[
|
||||
't' => 'reportsv2',
|
||||
'old' => "DROP KEY IF EXISTS r2_torrentid_status",
|
||||
'new' => "ADD KEY IF NOT EXISTS r2_torrentid_status (TorrentID, Status)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ r2_torrentid_status",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ r2_torrentid_status (TorrentID, Status)",
|
||||
],
|
||||
[
|
||||
't' => 'reportsv2',
|
||||
'old' => "DROP KEY IF EXISTS r2_lastchange_resolver_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS r2_lastchange_resolver_idx (LastChangeTime, ResolverID)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ r2_lastchange_resolver_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ r2_lastchange_resolver_idx (LastChangeTime, ResolverID)",
|
||||
],
|
||||
[
|
||||
't' => 'requests_artists',
|
||||
'old' => "DROP KEY IF EXISTS artistid_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS artistid_idx (ArtistID)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ artistid_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ artistid_idx (ArtistID)",
|
||||
],
|
||||
[
|
||||
't' => 'requests_artists',
|
||||
'old' => "DROP KEY IF EXISTS aliasid_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS aliasid_idx (AliasID)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ aliasid_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ aliasid_idx (AliasID)",
|
||||
],
|
||||
[
|
||||
't' => 'staff_blog_visits',
|
||||
'old' => "ADD UNIQUE KEY IF NOT EXISTS UserID (UserID)",
|
||||
'new' => "DROP KEY IF EXISTS UserID",
|
||||
'old' => "ADD UNIQUE KEY /* IF NOT EXISTS */ UserID (UserID)",
|
||||
'new' => "DROP KEY /* IF EXISTS */ UserID",
|
||||
],
|
||||
[
|
||||
't' => 'staff_pm_conversations',
|
||||
'old' => "DROP KEY IF EXISTS spc_user_unr_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS spc_user_unr_idx (UserID, Unread)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ spc_user_unr_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ spc_user_unr_idx (UserID, Unread)",
|
||||
],
|
||||
[
|
||||
't' => 'staff_pm_messages',
|
||||
'old' => "DROP KEY IF EXISTS convid_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS convid_idx (ConvID)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ convid_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ convid_idx (ConvID)",
|
||||
],
|
||||
[
|
||||
't' => 'stylesheets',
|
||||
'old' => "DROP KEY IF EXISTS default_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS default_idx (`Default`)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ default_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ default_idx (`Default`)",
|
||||
],
|
||||
[
|
||||
't' => 'torrents_bad_files',
|
||||
@@ -426,38 +426,38 @@ class IndexRefactor extends AbstractMigration {
|
||||
],
|
||||
[
|
||||
't' => 'users_info',
|
||||
'old' => "DROP KEY IF EXISTS ui_bandate_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS ui_bandate_idx (BanDate)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ ui_bandate_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ ui_bandate_idx (BanDate)",
|
||||
],
|
||||
[
|
||||
't' => 'users_main',
|
||||
'old' => "ADD KEY IF NOT EXISTS PassHash (PassHash)",
|
||||
'new' => "DROP KEY IF EXISTS PassHash",
|
||||
'old' => "ADD KEY /* IF NOT EXISTS */ PassHash (PassHash)",
|
||||
'new' => "DROP KEY /* IF EXISTS */ PassHash",
|
||||
],
|
||||
[
|
||||
't' => 'users_notify_quoted',
|
||||
'old' => "DROP KEY IF EXISTS page_pageid_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS page_pageid_idx (Page,PageID)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ page_pageid_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ page_pageid_idx (Page,PageID)",
|
||||
],
|
||||
[
|
||||
't' => 'users_subscriptions',
|
||||
'old' => "DROP KEY IF EXISTS us_topicid_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS us_topicid_idx (TopicID)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ us_topicid_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ us_topicid_idx (TopicID)",
|
||||
],
|
||||
[
|
||||
't' => 'users_subscriptions_comments',
|
||||
'old' => "DROP KEY IF EXISTS usc_pageid_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS usc_pageid_idx (PageID)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ usc_pageid_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ usc_pageid_idx (PageID)",
|
||||
],
|
||||
[
|
||||
't' => 'wiki_aliases',
|
||||
'old' => "DROP KEY IF EXISTS article_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS article_idx (ArticleID)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ article_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ article_idx (ArticleID)",
|
||||
],
|
||||
[
|
||||
't' => 'xbt_files_history',
|
||||
'old' => "DROP KEY IF EXISTS xfh_uid_fid_idx",
|
||||
'new' => "ADD UNIQUE KEY IF NOT EXISTS xfh_uid_fid_idx (uid,fid)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ xfh_uid_fid_idx",
|
||||
'new' => "ADD UNIQUE KEY /* IF NOT EXISTS */ xfh_uid_fid_idx (uid,fid)",
|
||||
],
|
||||
[
|
||||
't' => 'xbt_files_users',
|
||||
@@ -466,13 +466,13 @@ class IndexRefactor extends AbstractMigration {
|
||||
],
|
||||
[
|
||||
't' => 'xbt_files_users',
|
||||
'old' => "ADD KEY IF NOT EXISTS remaining_idx (remaining), ADD KEY IF NOT EXISTS uid_active (uid, active)",
|
||||
'new' => "DROP KEY IF EXISTS remaining_idx, DROP KEY IF EXISTS uid_active",
|
||||
'old' => "ADD KEY /* IF NOT EXISTS */ remaining_idx (remaining), ADD KEY /* IF NOT EXISTS */ uid_active (uid, active)",
|
||||
'new' => "DROP KEY /* IF EXISTS */ remaining_idx, DROP KEY /* IF EXISTS */ uid_active",
|
||||
],
|
||||
[
|
||||
't' => 'xbt_files_users',
|
||||
'old' => "DROP KEY IF EXISTS uid_active_remain_mtime_idx, DROP KEY IF EXISTS remain_mtime_idx",
|
||||
'new' => "ADD KEY IF NOT EXISTS uid_active_remain_mtime_idx (uid, active, remaining, mtime), ADD KEY IF NOT EXISTS remain_mtime_idx (remaining, mtime)",
|
||||
'old' => "DROP KEY /* IF EXISTS */ uid_active_remain_mtime_idx, DROP KEY /* IF EXISTS */ remain_mtime_idx",
|
||||
'new' => "ADD KEY /* IF NOT EXISTS */ uid_active_remain_mtime_idx (uid, active, remaining, mtime), ADD KEY /* IF NOT EXISTS */ remain_mtime_idx (remaining, mtime)",
|
||||
],
|
||||
[
|
||||
't' => 'contest',
|
||||
|
||||
@@ -23,101 +23,101 @@ class DropUnusedIndexes extends AbstractMigration {
|
||||
if (!getenv('LOCK_MY_DATABASE')) {
|
||||
die("Migration cannot proceed, use the source: " . __FILE__ . "\n");
|
||||
}
|
||||
$this->execute("ALTER TABLE comments_edits DROP KEY IF EXISTS EditUser");
|
||||
$this->execute("ALTER TABLE collages_artists DROP KEY IF EXISTS Sort");
|
||||
$this->execute("ALTER TABLE collages_torrents DROP KEY IF EXISTS Sort");
|
||||
$this->execute("ALTER TABLE donations DROP KEY IF EXISTS Amount");
|
||||
$this->execute("ALTER TABLE forums DROP KEY IF EXISTS MinClassRead, DROP KEY IF EXISTS Sort");
|
||||
$this->execute("ALTER TABLE forums_categories DROP KEY IF EXISTS Sort");
|
||||
$this->execute("ALTER TABLE forums_topics DROP KEY IF EXISTS Title");
|
||||
$this->execute("ALTER TABLE forums_topic_notes DROP KEY IF EXISTS AuthorID");
|
||||
$this->execute("ALTER TABLE friends DROP KEY IF EXISTS UserID");
|
||||
$this->execute("ALTER TABLE group_log DROP KEY IF EXISTS UserID");
|
||||
$this->execute("ALTER TABLE invite_tree DROP KEY IF EXISTS InviterID");
|
||||
$this->execute("ALTER TABLE ip_bans DROP KEY IF EXISTS ToIP");
|
||||
$this->execute("ALTER TABLE irc_channels DROP KEY IF EXISTS Name");
|
||||
$this->execute("ALTER TABLE login_attempts DROP KEY IF EXISTS UserID");
|
||||
$this->execute("ALTER TABLE news DROP KEY IF EXISTS UserID");
|
||||
$this->execute("ALTER TABLE pm_conversations_users DROP KEY IF EXISTS ForwardedTo, DROP KEY IF EXISTS InSentbox, DROP KEY IF EXISTS ReceivedDate, DROP KEY IF EXISTS SentDate, DROP KEY IF EXISTS Sticky");
|
||||
$this->execute("ALTER TABLE reports DROP KEY IF EXISTS ResolvedTime, DROP KEY IF EXISTS Type");
|
||||
$this->execute("ALTER TABLE requests DROP KEY IF EXISTS LastVote, DROP KEY IF EXISTS Name, DROP KEY IF EXISTS TimeFilled, DROP KEY IF EXISTS Year");
|
||||
$this->execute("ALTER TABLE sphinx_a DROP KEY IF EXISTS gid");
|
||||
$this->execute("ALTER TABLE sphinx_requests DROP KEY IF EXISTS Filled, DROP KEY IF EXISTS FillerID, DROP KEY IF EXISTS LastVote, DROP KEY IF EXISTS Name, DROP KEY IF EXISTS TimeAdded, DROP KEY IF EXISTS TimeFilled, DROP KEY IF EXISTS Userid, DROP KEY IF EXISTS Year");
|
||||
$this->execute("ALTER TABLE sphinx_requests_delta DROP KEY IF EXISTS Filled, DROP KEY IF EXISTS FillerID, DROP KEY IF EXISTS LastVote, DROP KEY IF EXISTS Name, DROP KEY IF EXISTS TimeFilled, DROP KEY IF EXISTS Year");
|
||||
$this->execute("ALTER TABLE sphinx_t DROP KEY IF EXISTS format");
|
||||
$this->execute("ALTER TABLE staff_blog DROP KEY IF EXISTS UserID");
|
||||
$this->execute("ALTER TABLE tags DROP KEY IF EXISTS UserID");
|
||||
$this->execute("ALTER TABLE torrents DROP KEY IF EXISTS FileCount, DROP KEY IF EXISTS Size, DROP KEY IF EXISTS Year");
|
||||
$this->execute("ALTER TABLE torrents_cassette_approved DROP KEY IF EXISTS TimeAdded");
|
||||
$this->execute("ALTER TABLE torrents_group DROP KEY IF EXISTS RevisionID, DROP KEY IF EXISTS Time");
|
||||
$this->execute("ALTER TABLE torrents_leech_stats DROP KEY IF EXISTS tls_leechers_idx");
|
||||
$this->execute("ALTER TABLE torrents_lossymaster_approved DROP KEY IF EXISTS TimeAdded");
|
||||
$this->execute("ALTER TABLE torrents_lossyweb_approved DROP KEY IF EXISTS TimeAdded");
|
||||
$this->execute("ALTER TABLE torrents_peerlists DROP KEY IF EXISTS GroupID");
|
||||
$this->execute("ALTER TABLE torrents_peerlists_compare DROP KEY IF EXISTS GroupID, DROP KEY IF EXISTS Stats");
|
||||
$this->execute("ALTER TABLE torrents_tags DROP KEY IF EXISTS PositiveVotes, DROP KEY IF EXISTS UserID");
|
||||
$this->execute("ALTER TABLE users_freeleeches DROP KEY IF EXISTS Time");
|
||||
$this->execute("ALTER TABLE users_info DROP KEY IF EXISTS AuthKey, DROP KEY IF EXISTS BitcoinAddress, DROP KEY IF EXISTS DisableInvites, DROP KEY IF EXISTS RatioWatchDownload");
|
||||
$this->execute("ALTER TABLE users_history_ips DROP KEY IF EXISTS StartTime");
|
||||
$this->execute("ALTER TABLE users_leech_stats DROP KEY IF EXISTS uls_uploaded_idx");
|
||||
$this->execute("ALTER TABLE users_main DROP KEY IF EXISTS Invites, DROP KEY IF EXISTS IP");
|
||||
$this->execute("ALTER TABLE users_notify_filters DROP KEY IF EXISTS ToYear");
|
||||
$this->execute("ALTER TABLE users_sessions DROP KEY IF EXISTS LastUpdate");
|
||||
$this->execute("ALTER TABLE users_torrent_history DROP KEY IF EXISTS Date, DROP KEY IF EXISTS Finished");
|
||||
$this->execute("ALTER TABLE users_votes DROP KEY IF EXISTS Time, DROP KEY IF EXISTS Type");
|
||||
$this->execute("ALTER TABLE wiki_artists DROP KEY IF EXISTS Time, DROP KEY IF EXISTS UserID");
|
||||
$this->execute("ALTER TABLE wiki_torrents DROP KEY IF EXISTS Time, DROP KEY IF EXISTS UserID");
|
||||
$this->execute("ALTER TABLE xbt_snatched DROP KEY IF EXISTS tstamp");
|
||||
$this->execute("ALTER TABLE comments_edits DROP KEY /* IF EXISTS */ EditUser");
|
||||
$this->execute("ALTER TABLE collages_artists DROP KEY /* IF EXISTS */ Sort");
|
||||
$this->execute("ALTER TABLE collages_torrents DROP KEY /* IF EXISTS */ Sort");
|
||||
$this->execute("ALTER TABLE donations DROP KEY /* IF EXISTS */ Amount");
|
||||
$this->execute("ALTER TABLE forums DROP KEY /* IF EXISTS */ MinClassRead, DROP KEY /* IF EXISTS */ Sort");
|
||||
$this->execute("ALTER TABLE forums_categories DROP KEY /* IF EXISTS */ Sort");
|
||||
$this->execute("ALTER TABLE forums_topics DROP KEY /* IF EXISTS */ Title");
|
||||
$this->execute("ALTER TABLE forums_topic_notes DROP KEY /* IF EXISTS */ AuthorID");
|
||||
$this->execute("ALTER TABLE friends DROP KEY /* IF EXISTS */ UserID");
|
||||
$this->execute("ALTER TABLE group_log DROP KEY /* IF EXISTS */ UserID");
|
||||
$this->execute("ALTER TABLE invite_tree DROP KEY /* IF EXISTS */ InviterID");
|
||||
$this->execute("ALTER TABLE ip_bans DROP KEY /* IF EXISTS */ ToIP");
|
||||
$this->execute("ALTER TABLE irc_channels DROP KEY /* IF EXISTS */ Name");
|
||||
$this->execute("ALTER TABLE login_attempts DROP KEY /* IF EXISTS */ UserID");
|
||||
$this->execute("ALTER TABLE news DROP KEY /* IF EXISTS */ UserID");
|
||||
$this->execute("ALTER TABLE pm_conversations_users DROP KEY /* IF EXISTS */ ForwardedTo, DROP KEY /* IF EXISTS */ InSentbox, DROP KEY /* IF EXISTS */ ReceivedDate, DROP KEY /* IF EXISTS */ SentDate, DROP KEY /* IF EXISTS */ Sticky");
|
||||
$this->execute("ALTER TABLE reports DROP KEY /* IF EXISTS */ ResolvedTime, DROP KEY /* IF EXISTS */ Type");
|
||||
$this->execute("ALTER TABLE requests DROP KEY /* IF EXISTS */ LastVote, DROP KEY /* IF EXISTS */ Name, DROP KEY /* IF EXISTS */ TimeFilled, DROP KEY /* IF EXISTS */ Year");
|
||||
$this->execute("ALTER TABLE sphinx_a DROP KEY /* IF EXISTS */ gid");
|
||||
$this->execute("ALTER TABLE sphinx_requests DROP KEY /* IF EXISTS */ Filled, DROP KEY /* IF EXISTS */ FillerID, DROP KEY /* IF EXISTS */ LastVote, DROP KEY /* IF EXISTS */ Name, DROP KEY /* IF EXISTS */ TimeAdded, DROP KEY /* IF EXISTS */ TimeFilled, DROP KEY /* IF EXISTS */ Userid, DROP KEY /* IF EXISTS */ Year");
|
||||
$this->execute("ALTER TABLE sphinx_requests_delta DROP KEY /* IF EXISTS */ Filled, DROP KEY /* IF EXISTS */ FillerID, DROP KEY /* IF EXISTS */ LastVote, DROP KEY /* IF EXISTS */ Name, DROP KEY /* IF EXISTS */ TimeFilled, DROP KEY /* IF EXISTS */ Year");
|
||||
$this->execute("ALTER TABLE sphinx_t DROP KEY /* IF EXISTS */ format");
|
||||
$this->execute("ALTER TABLE staff_blog DROP KEY /* IF EXISTS */ UserID");
|
||||
$this->execute("ALTER TABLE tags DROP KEY /* IF EXISTS */ UserID");
|
||||
$this->execute("ALTER TABLE torrents DROP KEY /* IF EXISTS */ FileCount, DROP KEY /* IF EXISTS */ Size, DROP KEY /* IF EXISTS */ Year");
|
||||
$this->execute("ALTER TABLE torrents_cassette_approved DROP KEY /* IF EXISTS */ TimeAdded");
|
||||
$this->execute("ALTER TABLE torrents_group DROP KEY /* IF EXISTS */ RevisionID, DROP KEY /* IF EXISTS */ Time");
|
||||
$this->execute("ALTER TABLE torrents_leech_stats DROP KEY /* IF EXISTS */ tls_leechers_idx");
|
||||
$this->execute("ALTER TABLE torrents_lossymaster_approved DROP KEY /* IF EXISTS */ TimeAdded");
|
||||
$this->execute("ALTER TABLE torrents_lossyweb_approved DROP KEY /* IF EXISTS */ TimeAdded");
|
||||
$this->execute("ALTER TABLE torrents_peerlists DROP KEY /* IF EXISTS */ GroupID");
|
||||
$this->execute("ALTER TABLE torrents_peerlists_compare DROP KEY /* IF EXISTS */ GroupID, DROP KEY /* IF EXISTS */ Stats");
|
||||
$this->execute("ALTER TABLE torrents_tags DROP KEY /* IF EXISTS */ PositiveVotes, DROP KEY /* IF EXISTS */ UserID");
|
||||
$this->execute("ALTER TABLE users_freeleeches DROP KEY /* IF EXISTS */ Time");
|
||||
$this->execute("ALTER TABLE users_info DROP KEY /* IF EXISTS */ AuthKey, DROP KEY /* IF EXISTS */ BitcoinAddress, DROP KEY /* IF EXISTS */ DisableInvites, DROP KEY /* IF EXISTS */ RatioWatchDownload");
|
||||
$this->execute("ALTER TABLE users_history_ips DROP KEY /* IF EXISTS */ StartTime");
|
||||
$this->execute("ALTER TABLE users_leech_stats DROP KEY /* IF EXISTS */ uls_uploaded_idx");
|
||||
$this->execute("ALTER TABLE users_main DROP KEY /* IF EXISTS */ Invites, DROP KEY /* IF EXISTS */ IP");
|
||||
$this->execute("ALTER TABLE users_notify_filters DROP KEY /* IF EXISTS */ ToYear");
|
||||
$this->execute("ALTER TABLE users_sessions DROP KEY /* IF EXISTS */ LastUpdate");
|
||||
$this->execute("ALTER TABLE users_torrent_history DROP KEY /* IF EXISTS */ Date, DROP KEY /* IF EXISTS */ Finished");
|
||||
$this->execute("ALTER TABLE users_votes DROP KEY /* IF EXISTS */ Time, DROP KEY /* IF EXISTS */ Type");
|
||||
$this->execute("ALTER TABLE wiki_artists DROP KEY /* IF EXISTS */ Time, DROP KEY /* IF EXISTS */ UserID");
|
||||
$this->execute("ALTER TABLE wiki_torrents DROP KEY /* IF EXISTS */ Time, DROP KEY /* IF EXISTS */ UserID");
|
||||
$this->execute("ALTER TABLE xbt_snatched DROP KEY /* IF EXISTS */ tstamp");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
if (!getenv('LOCK_MY_DATABASE')) {
|
||||
die("Migration cannot proceed, use the source: " . __FILE__ . "\n");
|
||||
}
|
||||
$this->execute("ALTER TABLE comments_edits ADD KEY IF NOT EXISTS EditUser (EditUser)");
|
||||
$this->execute("ALTER TABLE collages_artists ADD KEY IF NOT EXISTS Sort (Sort)");
|
||||
$this->execute("ALTER TABLE collages_torrents ADD KEY IF NOT EXISTS Sort (Sort)");
|
||||
$this->execute("ALTER TABLE donations ADD KEY IF NOT EXISTS Amount (Amount)");
|
||||
$this->execute("ALTER TABLE forums ADD KEY IF NOT EXISTS MinClassRead (MinClassRead), ADD KEY IF NOT EXISTS Sort (Sort)");
|
||||
$this->execute("ALTER TABLE forums_categories ADD KEY IF NOT EXISTS Sort (Sort)");
|
||||
$this->execute("ALTER TABLE forums_topics ADD KEY IF NOT EXISTS Title (Title)");
|
||||
$this->execute("ALTER TABLE forums_topic_notes ADD KEY IF NOT EXISTS AuthorID (AuthorID)");
|
||||
$this->execute("ALTER TABLE friends ADD KEY IF NOT EXISTS UserID (UserID)");
|
||||
$this->execute("ALTER TABLE group_log ADD KEY IF NOT EXISTS UserID (UserID)");
|
||||
$this->execute("ALTER TABLE invite_tree ADD KEY IF NOT EXISTS InviterID (InviterID)");
|
||||
$this->execute("ALTER TABLE ip_bans ADD KEY IF NOT EXISTS ToIP (ToIP)");
|
||||
$this->execute("ALTER TABLE irc_channels ADD KEY IF NOT EXISTS Name (Name)");
|
||||
$this->execute("ALTER TABLE login_attempts ADD KEY IF NOT EXISTS UserID (UserID)");
|
||||
$this->execute("ALTER TABLE news ADD KEY IF NOT EXISTS UserID (UserID)");
|
||||
$this->execute("ALTER TABLE pm_conversations_users ADD KEY IF NOT EXISTS ForwardedTo (ForwardedTo), ADD KEY IF NOT EXISTS InSentbox (InSentbox), ADD KEY IF NOT EXISTS ReceivedDate (ReceivedDate), ADD KEY IF NOT EXISTS SentDate (SentDate), ADD KEY IF NOT EXISTS Sticky (Sticky)");
|
||||
$this->execute("ALTER TABLE reports ADD KEY IF NOT EXISTS ResolvedTime (ResolvedTime), ADD KEY IF NOT EXISTS Type (Type)");
|
||||
$this->execute("ALTER TABLE requests ADD KEY IF NOT EXISTS LastVote (LastVote), ADD KEY IF NOT EXISTS Name (Title), ADD KEY IF NOT EXISTS TimeFilled (TimeFilled), ADD KEY IF NOT EXISTS Year (Year)");
|
||||
$this->execute("ALTER TABLE sphinx_a ADD KEY IF NOT EXISTS gid (gid)");
|
||||
$this->execute("ALTER TABLE sphinx_requests ADD KEY IF NOT EXISTS Filled (TorrentID), ADD KEY IF NOT EXISTS FillerID (FillerID), ADD KEY IF NOT EXISTS LastVote (LastVote), ADD KEY IF NOT EXISTS Name (Title), ADD KEY IF NOT EXISTS TimeAdded (TimeAdded), ADD KEY IF NOT EXISTS TimeFilled (TimeFilled), ADD KEY IF NOT EXISTS Userid (Userid), ADD KEY IF NOT EXISTS Year (Year)");
|
||||
$this->execute("ALTER TABLE sphinx_requests_delta ADD KEY IF NOT EXISTS Filled (TorrentID), ADD KEY IF NOT EXISTS FillerID (FillerID), ADD KEY IF NOT EXISTS LastVote (LastVote), ADD KEY IF NOT EXISTS Name (Title), ADD KEY IF NOT EXISTS TimeFilled (TimeFilled), ADD KEY IF NOT EXISTS Year (Year)");
|
||||
$this->execute("ALTER TABLE sphinx_t ADD KEY IF NOT EXISTS format (format)");
|
||||
$this->execute("ALTER TABLE staff_blog ADD KEY IF NOT EXISTS UserID (UserID)");
|
||||
$this->execute("ALTER TABLE tags ADD KEY IF NOT EXISTS UserID (UserID)");
|
||||
$this->execute("ALTER TABLE torrents ADD KEY IF NOT EXISTS FileCount (FileCount), ADD KEY IF NOT EXISTS Size (Size), ADD KEY IF NOT EXISTS Year (RemasterYear)");
|
||||
$this->execute("ALTER TABLE torrents_cassette_approved ADD KEY IF NOT EXISTS TimeAdded (TimeAdded)");
|
||||
$this->execute("ALTER TABLE torrents_group ADD KEY IF NOT EXISTS RevisionID (RevisionID), ADD KEY IF NOT EXISTS Time (Time)");
|
||||
$this->execute("ALTER TABLE torrents_leech_stats ADD KEY IF NOT EXISTS tls_leechers_idx (Leechers)");
|
||||
$this->execute("ALTER TABLE torrents_lossymaster_approved ADD KEY IF NOT EXISTS TimeAdded (TimeAdded)");
|
||||
$this->execute("ALTER TABLE torrents_lossyweb_approved ADD KEY IF NOT EXISTS TimeAdded (TimeAdded)");
|
||||
$this->execute("ALTER TABLE torrents_peerlists ADD KEY IF NOT EXISTS GroupID (GroupID)");
|
||||
$this->execute("ALTER TABLE torrents_peerlists_compare ADD KEY IF NOT EXISTS GroupID (GroupID), ADD KEY IF NOT EXISTS Stats (TorrentID, Seeders, Leechers, Snatches)");
|
||||
$this->execute("ALTER TABLE torrents_tags ADD KEY IF NOT EXISTS PositiveVotes (PositiveVotes), ADD KEY IF NOT EXISTS UserID (UserID)");
|
||||
$this->execute("ALTER TABLE users_freeleeches ADD KEY IF NOT EXISTS Time (Time)");
|
||||
$this->execute("ALTER TABLE users_info ADD KEY IF NOT EXISTS AuthKey (AuthKey), ADD KEY IF NOT EXISTS BitcoinAddress (BitcoinAddress), ADD KEY IF NOT EXISTS DisableInvites (DisableInvites), ADD KEY IF NOT EXISTS RatioWatchDownload (RatioWatchDownload)");
|
||||
$this->execute("ALTER TABLE users_history_ips ADD KEY IF NOT EXISTS StartTime (StartTime)");
|
||||
$this->execute("ALTER TABLE users_leech_stats ADD KEY IF NOT EXISTS uls_uploaded_idx (Uploaded)");
|
||||
$this->execute("ALTER TABLE users_main ADD KEY IF NOT EXISTS Invites (Invites), ADD KEY IF NOT EXISTS IP (IP)");
|
||||
$this->execute("ALTER TABLE users_notify_filters ADD KEY IF NOT EXISTS ToYear (ToYear)");
|
||||
$this->execute("ALTER TABLE users_sessions ADD KEY IF NOT EXISTS LastUpdate (LastUpdate)");
|
||||
$this->execute("ALTER TABLE users_torrent_history ADD KEY IF NOT EXISTS Date (Date), ADD KEY IF NOT EXISTS Finished (Finished)");
|
||||
$this->execute("ALTER TABLE users_votes ADD KEY IF NOT EXISTS Time (Time), ADD KEY IF NOT EXISTS Type (Type)");
|
||||
$this->execute("ALTER TABLE wiki_artists ADD KEY IF NOT EXISTS Time (Time), ADD KEY IF NOT EXISTS UserID (UserID)");
|
||||
$this->execute("ALTER TABLE wiki_torrents ADD KEY IF NOT EXISTS Time (Time), ADD KEY IF NOT EXISTS UserID (UserID)");
|
||||
$this->execute("ALTER TABLE xbt_snatched ADD KEY IF NOT EXISTS tstamp (tstamp)");
|
||||
$this->execute("ALTER TABLE comments_edits ADD KEY /* IF NOT EXISTS */ EditUser (EditUser)");
|
||||
$this->execute("ALTER TABLE collages_artists ADD KEY /* IF NOT EXISTS */ Sort (Sort)");
|
||||
$this->execute("ALTER TABLE collages_torrents ADD KEY /* IF NOT EXISTS */ Sort (Sort)");
|
||||
$this->execute("ALTER TABLE donations ADD KEY /* IF NOT EXISTS */ Amount (Amount)");
|
||||
$this->execute("ALTER TABLE forums ADD KEY /* IF NOT EXISTS */ MinClassRead (MinClassRead), ADD KEY /* IF NOT EXISTS */ Sort (Sort)");
|
||||
$this->execute("ALTER TABLE forums_categories ADD KEY /* IF NOT EXISTS */ Sort (Sort)");
|
||||
$this->execute("ALTER TABLE forums_topics ADD KEY /* IF NOT EXISTS */ Title (Title)");
|
||||
$this->execute("ALTER TABLE forums_topic_notes ADD KEY /* IF NOT EXISTS */ AuthorID (AuthorID)");
|
||||
$this->execute("ALTER TABLE friends ADD KEY /* IF NOT EXISTS */ UserID (UserID)");
|
||||
$this->execute("ALTER TABLE group_log ADD KEY /* IF NOT EXISTS */ UserID (UserID)");
|
||||
$this->execute("ALTER TABLE invite_tree ADD KEY /* IF NOT EXISTS */ InviterID (InviterID)");
|
||||
$this->execute("ALTER TABLE ip_bans ADD KEY /* IF NOT EXISTS */ ToIP (ToIP)");
|
||||
$this->execute("ALTER TABLE irc_channels ADD KEY /* IF NOT EXISTS */ Name (Name)");
|
||||
$this->execute("ALTER TABLE login_attempts ADD KEY /* IF NOT EXISTS */ UserID (UserID)");
|
||||
$this->execute("ALTER TABLE news ADD KEY /* IF NOT EXISTS */ UserID (UserID)");
|
||||
$this->execute("ALTER TABLE pm_conversations_users ADD KEY /* IF NOT EXISTS */ ForwardedTo (ForwardedTo), ADD KEY /* IF NOT EXISTS */ InSentbox (InSentbox), ADD KEY /* IF NOT EXISTS */ ReceivedDate (ReceivedDate), ADD KEY /* IF NOT EXISTS */ SentDate (SentDate), ADD KEY /* IF NOT EXISTS */ Sticky (Sticky)");
|
||||
$this->execute("ALTER TABLE reports ADD KEY /* IF NOT EXISTS */ ResolvedTime (ResolvedTime), ADD KEY /* IF NOT EXISTS */ Type (Type)");
|
||||
$this->execute("ALTER TABLE requests ADD KEY /* IF NOT EXISTS */ LastVote (LastVote), ADD KEY /* IF NOT EXISTS */ Name (Title), ADD KEY /* IF NOT EXISTS */ TimeFilled (TimeFilled), ADD KEY /* IF NOT EXISTS */ Year (Year)");
|
||||
$this->execute("ALTER TABLE sphinx_a ADD KEY /* IF NOT EXISTS */ gid (gid)");
|
||||
$this->execute("ALTER TABLE sphinx_requests ADD KEY /* IF NOT EXISTS */ Filled (TorrentID), ADD KEY /* IF NOT EXISTS */ FillerID (FillerID), ADD KEY /* IF NOT EXISTS */ LastVote (LastVote), ADD KEY /* IF NOT EXISTS */ Name (Title), ADD KEY /* IF NOT EXISTS */ TimeAdded (TimeAdded), ADD KEY /* IF NOT EXISTS */ TimeFilled (TimeFilled), ADD KEY /* IF NOT EXISTS */ Userid (Userid), ADD KEY /* IF NOT EXISTS */ Year (Year)");
|
||||
$this->execute("ALTER TABLE sphinx_requests_delta ADD KEY /* IF NOT EXISTS */ Filled (TorrentID), ADD KEY /* IF NOT EXISTS */ FillerID (FillerID), ADD KEY /* IF NOT EXISTS */ LastVote (LastVote), ADD KEY /* IF NOT EXISTS */ Name (Title), ADD KEY /* IF NOT EXISTS */ TimeFilled (TimeFilled), ADD KEY /* IF NOT EXISTS */ Year (Year)");
|
||||
$this->execute("ALTER TABLE sphinx_t ADD KEY /* IF NOT EXISTS */ format (format)");
|
||||
$this->execute("ALTER TABLE staff_blog ADD KEY /* IF NOT EXISTS */ UserID (UserID)");
|
||||
$this->execute("ALTER TABLE tags ADD KEY /* IF NOT EXISTS */ UserID (UserID)");
|
||||
$this->execute("ALTER TABLE torrents ADD KEY /* IF NOT EXISTS */ FileCount (FileCount), ADD KEY /* IF NOT EXISTS */ Size (Size), ADD KEY /* IF NOT EXISTS */ Year (RemasterYear)");
|
||||
$this->execute("ALTER TABLE torrents_cassette_approved ADD KEY /* IF NOT EXISTS */ TimeAdded (TimeAdded)");
|
||||
$this->execute("ALTER TABLE torrents_group ADD KEY /* IF NOT EXISTS */ RevisionID (RevisionID), ADD KEY /* IF NOT EXISTS */ Time (Time)");
|
||||
$this->execute("ALTER TABLE torrents_leech_stats ADD KEY /* IF NOT EXISTS */ tls_leechers_idx (Leechers)");
|
||||
$this->execute("ALTER TABLE torrents_lossymaster_approved ADD KEY /* IF NOT EXISTS */ TimeAdded (TimeAdded)");
|
||||
$this->execute("ALTER TABLE torrents_lossyweb_approved ADD KEY /* IF NOT EXISTS */ TimeAdded (TimeAdded)");
|
||||
$this->execute("ALTER TABLE torrents_peerlists ADD KEY /* IF NOT EXISTS */ GroupID (GroupID)");
|
||||
$this->execute("ALTER TABLE torrents_peerlists_compare ADD KEY /* IF NOT EXISTS */ GroupID (GroupID), ADD KEY /* IF NOT EXISTS */ Stats (TorrentID, Seeders, Leechers, Snatches)");
|
||||
$this->execute("ALTER TABLE torrents_tags ADD KEY /* IF NOT EXISTS */ PositiveVotes (PositiveVotes), ADD KEY /* IF NOT EXISTS */ UserID (UserID)");
|
||||
$this->execute("ALTER TABLE users_freeleeches ADD KEY /* IF NOT EXISTS */ Time (Time)");
|
||||
$this->execute("ALTER TABLE users_info ADD KEY /* IF NOT EXISTS */ AuthKey (AuthKey), ADD KEY /* IF NOT EXISTS */ BitcoinAddress (BitcoinAddress), ADD KEY /* IF NOT EXISTS */ DisableInvites (DisableInvites), ADD KEY /* IF NOT EXISTS */ RatioWatchDownload (RatioWatchDownload)");
|
||||
$this->execute("ALTER TABLE users_history_ips ADD KEY /* IF NOT EXISTS */ StartTime (StartTime)");
|
||||
$this->execute("ALTER TABLE users_leech_stats ADD KEY /* IF NOT EXISTS */ uls_uploaded_idx (Uploaded)");
|
||||
$this->execute("ALTER TABLE users_main ADD KEY /* IF NOT EXISTS */ Invites (Invites), ADD KEY /* IF NOT EXISTS */ IP (IP)");
|
||||
$this->execute("ALTER TABLE users_notify_filters ADD KEY /* IF NOT EXISTS */ ToYear (ToYear)");
|
||||
$this->execute("ALTER TABLE users_sessions ADD KEY /* IF NOT EXISTS */ LastUpdate (LastUpdate)");
|
||||
$this->execute("ALTER TABLE users_torrent_history ADD KEY /* IF NOT EXISTS */ Date (Date), ADD KEY /* IF NOT EXISTS */ Finished (Finished)");
|
||||
$this->execute("ALTER TABLE users_votes ADD KEY /* IF NOT EXISTS */ Time (Time), ADD KEY /* IF NOT EXISTS */ Type (Type)");
|
||||
$this->execute("ALTER TABLE wiki_artists ADD KEY /* IF NOT EXISTS */ Time (Time), ADD KEY /* IF NOT EXISTS */ UserID (UserID)");
|
||||
$this->execute("ALTER TABLE wiki_torrents ADD KEY /* IF NOT EXISTS */ Time (Time), ADD KEY /* IF NOT EXISTS */ UserID (UserID)");
|
||||
$this->execute("ALTER TABLE xbt_snatched ADD KEY /* IF NOT EXISTS */ tstamp (tstamp)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class UnicodeDiscogsArtists extends AbstractMigration {
|
||||
$this->execute("ALTER TABLE artist_discogs
|
||||
MODIFY `stem` varchar(100) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin,
|
||||
MODIFY `name` varchar(100) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin,
|
||||
ADD KEY IF NOT EXISTS ad_stem_idx (stem)
|
||||
ADD KEY /* IF NOT EXISTS */ ad_stem_idx (stem)
|
||||
");
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class UnicodeDiscogsArtists extends AbstractMigration {
|
||||
$this->execute("ALTER TABLE artist_discogs
|
||||
MODIFY `stem` varchar(100) CHARACTER SET utf8mb4 NOT NULL,
|
||||
MODIFY `name` varchar(100) CHARACTER SET utf8mb4 NOT NULL,
|
||||
DROP KEY IF EXISTS ad_stem_idx
|
||||
DROP KEY /* IF EXISTS */ ad_stem_idx
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ class DropUserMainColumns extends AbstractMigration {
|
||||
public function down() {
|
||||
$this->execute("
|
||||
ALTER TABLE users_main
|
||||
ADD COLUMN LastLogin datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
ADD COLUMN LastAccess datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
ADD COLUMN LastLogin datetime NOT NULL DEFAULT NULL,
|
||||
ADD COLUMN LastAccess datetime NOT NULL DEFAULT NULL,
|
||||
ADD COLUMN BonusPoints float(20,5) NOT NULL DEFAULT 0.00000,
|
||||
ADD COLUMN RequiredRatioWork double(12,8) NOT NULL DEFAULT 0.00000000,
|
||||
ADD COLUMN FLTokens int(10) NOT NULL DEFAULT 0,
|
||||
|
||||
@@ -11,20 +11,15 @@ class NoZerodateUsersInfo extends AbstractMigration {
|
||||
MODIFY RatioWatchEnds datetime DEFAULT NULL,
|
||||
MODIFY BanDate datetime DEFAULT NULL
|
||||
");
|
||||
$this->execute("UPDATE users_info SET Warned = NULL WHERE Warned = '0000-00-00 00:00:00'");
|
||||
$this->execute("UPDATE users_info SET ResetExpires = NULL WHERE ResetExpires = '0000-00-00 00:00:00'");
|
||||
$this->execute("UPDATE users_info SET JoinDate = now() WHERE JoinDate = '0000-00-00 00:00:00'");
|
||||
$this->execute("UPDATE users_info SET RatioWatchEnds = NULL WHERE RatioWatchEnds = '0000-00-00 00:00:00'");
|
||||
$this->execute("UPDATE users_info SET BanDate = NULL WHERE BanDate = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE users_info
|
||||
MODIFY Warned timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
MODIFY ResetExpires datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
MODIFY JoinDate datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
MODIFY RatioWatchEnds datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
MODIFY BanDate datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Warned timestamp NOT NULL,
|
||||
MODIFY ResetExpires datetime NOT NULL,
|
||||
MODIFY JoinDate datetime NOT NULL,
|
||||
MODIFY RatioWatchEnds datetime NOT NULL,
|
||||
MODIFY BanDate datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@ class NoZerodateBlog extends AbstractMigration {
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE blog MODIFY Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'");
|
||||
$this->execute("ALTER TABLE blog MODIFY Time datetime NOT NULL");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@ class NoZerodateChangelog extends AbstractMigration {
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE changelog MODIFY Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'");
|
||||
$this->execute("ALTER TABLE changelog MODIFY Time datetime NOT NULL");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@ class NoZerodateCollagesArtists extends AbstractMigration {
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE collages_artists MODIFY AddedOn datetime NOT NULL DEFAULT '0000-00-00 00:00:00'");
|
||||
$this->execute("ALTER TABLE collages_artists MODIFY AddedOn datetime NOT NULL");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class NoZerodateComments extends AbstractMigration {
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE comments MODIFY AddedTime datetime NOT NULL DEFAULT '0000-00-00 00:00:00'");
|
||||
$this->execute("ALTER TABLE comments MODIFY AddedTime datetime NOT NULL");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,6 @@ class NoZerodateDonotupload extends AbstractMigration {
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE do_not_upload MODIFY Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'");
|
||||
$this->execute("ALTER TABLE do_not_upload MODIFY Time datetime NOT NULL");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,12 @@ class NoZerodateFeaturedAlbums extends AbstractMigration {
|
||||
MODIFY Started datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY Ended datetime DEFAULT NULL
|
||||
");
|
||||
$this->execute("UPDATE featured_albums SET Ended = NULL WHERE Ended = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE featured_albums
|
||||
MODIFY Started datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
MODIFY Ended datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Started datetime NOT NULL,
|
||||
MODIFY Ended datetime NOT NULL
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,11 @@ class NoZerodateForums extends AbstractMigration {
|
||||
$this->execute("ALTER TABLE forums
|
||||
MODIFY LastPostTime datetime DEFAULT NULL
|
||||
");
|
||||
$this->execute("UPDATE forums SET LastPostTime = NULL WHERE LastPostTime = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE forums
|
||||
MODIFY LastPostTime datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY LastPostTime datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,11 @@ class NoZerodateForumsPolls extends AbstractMigration {
|
||||
$this->execute("ALTER TABLE forums_polls
|
||||
MODIFY Featured datetime DEFAULT NULL
|
||||
");
|
||||
$this->execute("UPDATE forums_polls SET Featured = NULL WHERE Featured = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE forums_polls
|
||||
MODIFY Featured datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Featured datetime NOT NULL
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class NoZerodateForumsPosts extends AbstractMigration {
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE forums_posts
|
||||
MODIFY AddedTime datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY AddedTime datetime NOT NULL
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,11 @@ class NoZerodateForumsTopics extends AbstractMigration {
|
||||
$this->execute("ALTER TABLE forums_topics
|
||||
MODIFY LastPostTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
");
|
||||
$this->execute("UPDATE forums_topics SET LastPostTime = CreatedTime WHERE LastPostTime = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE forums_topics
|
||||
MODIFY LastPostTime datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY LastPostTime datetime NOT NULL
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,12 @@ class NoZerodateReportsv2 extends AbstractMigration {
|
||||
MODIFY ReportedTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY LastChangeTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
");
|
||||
$this->execute("UPDATE reportsv2 SET LastChangeTime = ReportedTime WHERE LastChangeTime = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE reportsv2
|
||||
MODIFY ReportedTime datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
MODIFY LastChangeTime datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY ReportedTime datetime,
|
||||
MODIFY LastChangeTime datetim
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,11 @@ class NoZerodateGroupLog extends AbstractMigration {
|
||||
$this->execute("ALTER TABLE group_log
|
||||
MODIFY Time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
");
|
||||
$this->execute("UPDATE group_log SET Time = now() WHERE Time = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE group_log
|
||||
MODIFY Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Time datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,11 @@ class NoZerodateInvites extends AbstractMigration {
|
||||
$this->execute("ALTER TABLE invites
|
||||
MODIFY Expires datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
");
|
||||
// unlikely, but whatever
|
||||
$this->execute("UPDATE invites SET Expires = now() + INTERVAL 1 DAY WHERE Expires = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE invites
|
||||
MODIFY Expires datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Expires datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class NoZerodateLog extends AbstractMigration {
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE log
|
||||
MODIFY Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Time datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,12 @@ class NoZerodateLoginAttempts extends AbstractMigration {
|
||||
MODIFY BannedUntil datetime DEFAULT NULL,
|
||||
MODIFY Attempts int(10) unsigned NOT NULL DEFAULT 1
|
||||
");
|
||||
$this->execute("UPDATE login_attempts SET LastAttempt = now() WHERE LastAttempt = '0000-00-00 00:00:00'");
|
||||
$this->execute("UPDATE login_attempts SET BannedUntil = NULL WHERE BannedUntil = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE login_attempts
|
||||
MODIFY LastAttempt datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
MODIFY BannedUntil datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
MODIFY LastAttempt datetime,
|
||||
MODIFY BannedUntil datetime,
|
||||
MODIFY Attempts int(10) unsigned NOT NULL
|
||||
");
|
||||
}
|
||||
|
||||
@@ -7,12 +7,11 @@ class NoZerodateNews extends AbstractMigration {
|
||||
$this->execute("ALTER TABLE news
|
||||
MODIFY Time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
");
|
||||
$this->execute("UPDATE news SET Time = now() WHERE Time = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE news
|
||||
MODIFY Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Time datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,13 +9,12 @@ class NoZerodatePmConversationsUsers extends AbstractMigration {
|
||||
MODIFY SentDate datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
");
|
||||
// not sure how this could have happened
|
||||
$this->execute("UPDATE pm_conversations_users SET SentDate = ReceivedDate WHERE SentDate = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE pm_conversations_users
|
||||
MODIFY ReceivedDate datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
MODIFY SentDate datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY ReceivedDate datetime,
|
||||
MODIFY SentDate datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class NoZerodatePmMessages extends AbstractMigration {
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE pm_messages
|
||||
MODIFY SentDate datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY SentDate datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,12 @@ class NoZerodateReports extends AbstractMigration {
|
||||
MODIFY ReportedTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY ResolvedTime datetime DEFAULT NULL
|
||||
");
|
||||
$this->execute("UPDATE reports SET ResolvedTime = NULL WHERE ResolvedTime = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE reports
|
||||
MODIFY ReportedTime datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY ResolvedTime datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY ReportedTime datetime
|
||||
MODIFY ResolvedTime datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,17 @@ class NoZerodateStaffBlog extends AbstractMigration {
|
||||
$this->execute("ALTER TABLE staff_blog
|
||||
MODIFY Time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
");
|
||||
$this->execute("UPDATE staff_blog SET Time = now() WHERE Time = '0000-00-00 00:00:00'");
|
||||
$this->execute("ALTER TABLE staff_blog_visits
|
||||
MODIFY Time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
");
|
||||
$this->execute("UPDATE staff_blog_visits SET Time = now() WHERE Time = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE staff_blog
|
||||
MODIFY Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Time datetime
|
||||
");
|
||||
$this->execute("ALTER TABLE staff_blog_visits
|
||||
MODIFY Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Time datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ class NoZerodateTorrentFlag extends AbstractMigration {
|
||||
$this->execute("ALTER TABLE $table
|
||||
MODIFY TimeAdded datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
");
|
||||
$this->execute("UPDATE $table SET TimeAdded = now() WHERE TimeAdded = '0000-00-00 00:00:00'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +20,7 @@ class NoZerodateTorrentFlag extends AbstractMigration {
|
||||
foreach ($this->torrentTables() as $table) {
|
||||
echo "=> $table\n";
|
||||
$this->execute("ALTER TABLE $table
|
||||
MODIFY TimeAdded datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY TimeAdded datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,11 @@ class NoZerodateUsersHistoryIps extends AbstractMigration {
|
||||
$this->execute("ALTER TABLE users_history_ips
|
||||
MODIFY StartTime datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
");
|
||||
$this->execute("UPDATE users_history_ips SET StartTime = now() WHERE StartTime = '0000-00-00 00:00:00'");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE users_history_ips
|
||||
MODIFY StartTime datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY StartTime datetime NOT NULL
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class NoZerodateTorrentsGroup extends AbstractMigration {
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE torrents_group
|
||||
MODIFY Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Time datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class NoZerodateUsersNotifyQuoted extends AbstractMigration {
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE users_notify_quoted
|
||||
MODIFY Date datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Date datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class NoZerodateUsersTop10History extends AbstractMigration {
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE top10_history
|
||||
MODIFY Date datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Date datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@ class NoZerodateWiki extends AbstractMigration {
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE wiki_artists
|
||||
MODIFY Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Time datetime
|
||||
");
|
||||
$this->execute("ALTER TABLE wiki_torrents
|
||||
MODIFY Time datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
MODIFY Time datetime
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ class NukeRecommendations extends AbstractMigration {
|
||||
'limit' => '10',
|
||||
])
|
||||
->addColumn('Time', 'datetime', [
|
||||
'null' => false,
|
||||
'default' => '0000-00-00 00:00:00',
|
||||
'null' => true,
|
||||
])
|
||||
->addIndex(['Time'], [
|
||||
'name' => 'Time',
|
||||
|
||||
@@ -11,9 +11,9 @@ class NullDateColumns extends AbstractMigration {
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE deleted_torrents MODIFY LastReseedRequest datetime NOT NULL DEFAULT '0000-00-00 00:00:00'");
|
||||
$this->execute("ALTER TABLE deleted_torrents MODIFY LastReseedRequest datetime");
|
||||
$this->execute("ALTER TABLE torrents_bad_folders MODIFY TimeAdded datetime NOT NULL");
|
||||
$this->execute("ALTER TABLE forums_topic_notes MODIFY AddedTime datetime NOT NULL");
|
||||
$this->execute("ALTER TABLE referral_users MODIFY Joined timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'");
|
||||
$this->execute("ALTER TABLE referral_users MODIFY Joined timestamp");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class EmailHistoryDate extends AbstractMigration {
|
||||
INNER JOIN users_info ui USING (UserID)
|
||||
SET
|
||||
uhm.Time = ui.JoinDate
|
||||
WHERE (uhm.Time = '0000-00-00 00:00:00' OR uhm.Time IS NULL)
|
||||
WHERE uhm.Time IS NULL
|
||||
");
|
||||
$this->execute("ALTER TABLE users_history_emails MODIFY Time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP");
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ class XfuByUid extends AbstractMigration {
|
||||
die("Migration cannot proceed, use the source: " . __FILE__ . "\n");
|
||||
}
|
||||
$this->execute("ALTER TABLE xbt_files_users
|
||||
ADD KEY IF NOT EXISTS xfu_uid_idx (uid)
|
||||
ADD KEY /* IF NOT EXISTS */ xfu_uid_idx (uid)
|
||||
");
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->execute("ALTER TABLE xbt_files_users
|
||||
DROP KEY IF EXISTS xfu_uid_idx
|
||||
DROP KEY /* IF EXISTS */ xfu_uid_idx
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@ use Phinx\Migration\AbstractMigration;
|
||||
class ContestClassRef extends AbstractMigration {
|
||||
public function up() {
|
||||
$this->execute("
|
||||
ALTER TABLE bonus_pool_contrib DROP FOREIGN KEY IF EXISTS bonus_pool_contrib_ibfk_1;
|
||||
ALTER TABLE bonus_pool_contrib DROP FOREIGN KEY IF EXISTS bonus_pool_contrib_ibfk_2;
|
||||
ALTER TABLE bonus_pool_contrib DROP FOREIGN KEY /* IF EXISTS */ bonus_pool_contrib_ibfk_1;
|
||||
ALTER TABLE bonus_pool_contrib DROP FOREIGN KEY /* IF EXISTS */ bonus_pool_contrib_ibfk_2;
|
||||
");
|
||||
$this->execute("
|
||||
ALTER TABLE contest_has_bonus_pool DROP FOREIGN KEY IF EXISTS contest_has_bonus_pool_ibfk_1;
|
||||
ALTER TABLE contest_has_bonus_pool DROP FOREIGN KEY IF EXISTS contest_has_bonus_pool_ibfk_2;
|
||||
ALTER TABLE contest_has_bonus_pool DROP FOREIGN KEY /* IF EXISTS */ contest_has_bonus_pool_ibfk_1;
|
||||
ALTER TABLE contest_has_bonus_pool DROP FOREIGN KEY /* IF EXISTS */ contest_has_bonus_pool_ibfk_2;
|
||||
");
|
||||
$this->execute("
|
||||
ALTER TABLE bonus_pool
|
||||
@@ -44,9 +44,8 @@ class ContestClassRef extends AbstractMigration {
|
||||
ADD CONSTRAINT bonus_pool_contrib_ibfk_2 FOREIGN KEY (user_id) REFERENCES users_main (ID)
|
||||
");
|
||||
$this->execute("
|
||||
ALTER TABLE contest DROP FOREIGN KEY IF EXISTS contest_type_fk;
|
||||
ALTER TABLE contest_leaderboard DROP FOREIGN KEY IF EXISTS contest_fk;
|
||||
ALTER TABLE contest_leaderboard DROP FOREIGN KEY IF EXISTS contest_leaderboard_fk;
|
||||
ALTER TABLE contest DROP FOREIGN KEY /* IF EXISTS */ contest_type_fk;
|
||||
ALTER TABLE contest_leaderboard DROP FOREIGN KEY /* IF EXISTS */ contest_leaderboard_fk;
|
||||
");
|
||||
$this->execute("
|
||||
ALTER TABLE contest_leaderboard
|
||||
@@ -92,12 +91,12 @@ class ContestClassRef extends AbstractMigration {
|
||||
|
||||
public function down() {
|
||||
$this->execute("
|
||||
ALTER TABLE bonus_pool_contrib DROP FOREIGN KEY IF EXISTS bonus_pool_contrib_ibfk_1;
|
||||
ALTER TABLE bonus_pool_contrib DROP FOREIGN KEY IF EXISTS bonus_pool_contrib_ibfk_2;
|
||||
ALTER TABLE bonus_pool_contrib DROP FOREIGN KEY /* IF EXISTS */ bonus_pool_contrib_ibfk_1;
|
||||
ALTER TABLE bonus_pool_contrib DROP FOREIGN KEY /* IF EXISTS */ bonus_pool_contrib_ibfk_2;
|
||||
");
|
||||
$this->execute("
|
||||
ALTER TABLE contest_has_bonus_pool DROP FOREIGN KEY IF EXISTS contest_has_bonus_pool_ibfk_1;
|
||||
ALTER TABLE contest_has_bonus_pool DROP FOREIGN KEY IF EXISTS contest_has_bonus_pool_ibfk_2;
|
||||
ALTER TABLE contest_has_bonus_pool DROP FOREIGN KEY /* IF EXISTS */ contest_has_bonus_pool_ibfk_1;
|
||||
ALTER TABLE contest_has_bonus_pool DROP FOREIGN KEY /* IF EXISTS */ contest_has_bonus_pool_ibfk_2;
|
||||
");
|
||||
$this->execute("
|
||||
ALTER TABLE bonus_pool
|
||||
@@ -134,8 +133,8 @@ class ContestClassRef extends AbstractMigration {
|
||||
ALTER TABLE contest_has_bonus_pool ADD CONSTRAINT contest_has_bonus_pool_ibfk_1 FOREIGN KEY (BonusPoolID) REFERENCES bonus_pool (ID);
|
||||
");
|
||||
$this->execute("
|
||||
ALTER TABLE contest DROP FOREIGN KEY IF EXISTS contest_type_fk;
|
||||
ALTER TABLE contest_leaderboard DROP FOREIGN KEY IF EXISTS contest_leaderboard_fk;
|
||||
ALTER TABLE contest DROP FOREIGN KEY /* IF EXISTS */ contest_type_fk;
|
||||
ALTER TABLE contest_leaderboard DROP FOREIGN KEY /* IF EXISTS */ contest_leaderboard_fk;
|
||||
");
|
||||
$this->execute("
|
||||
ALTER TABLE contest_leaderboard
|
||||
|
||||
@@ -12,7 +12,7 @@ class ApiToken extends AbstractMigration
|
||||
->addColumn('user_id', 'integer', ['limit' => 10, 'signed' => false])
|
||||
->addColumn('name', 'string', ['limit' => 40])
|
||||
->addColumn('token', 'string', ['limit' => 255])
|
||||
->addColumn('scope', 'text', ['default' => ''])
|
||||
->addColumn('scope', 'text')
|
||||
->addColumn('created', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
|
||||
->addColumn('revoked', 'integer', ['default' => 0, 'limit' => MysqlAdapter::INT_TINY])
|
||||
->addIndex(['user_id'], ['unique' => false])
|
||||
|
||||
@@ -18,8 +18,8 @@ final class IndexXbtFilesUsers extends AbstractMigration
|
||||
}
|
||||
$this->execute("
|
||||
ALTER TABLE xbt_files_users
|
||||
DROP KEY IF EXISTS xfu_uid_idx,
|
||||
DROP KEY IF EXISTS fid_idx,
|
||||
DROP KEY /* IF EXISTS */ xfu_uid_idx,
|
||||
DROP KEY /* IF EXISTS */ fid_idx,
|
||||
DROP PRIMARY KEY,
|
||||
ADD PRIMARY KEY (fid, uid, peer_id)
|
||||
");
|
||||
|
||||
@@ -17,7 +17,7 @@ final class UserDownloadsDropUnused extends AbstractMigration
|
||||
die("Migration cannot proceed, use the source: " . __FILE__ . "\n");
|
||||
}
|
||||
$this->execute("
|
||||
ALTER TABLE users_downloads DROP KEY IF EXISTS UserID
|
||||
ALTER TABLE users_downloads DROP KEY /* IF EXISTS */ UserID
|
||||
");
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ final class UserDownloadsDropUnused extends AbstractMigration
|
||||
die("Migration cannot proceed, use the source: " . __FILE__ . "\n");
|
||||
}
|
||||
$this->execute("
|
||||
ALTER TABLE users_downloads ADD KEY IF NOT EXISTS UserID (UserID)
|
||||
ALTER TABLE users_downloads ADD KEY /* IF NOT EXISTS */ UserID (UserID)
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ final class ReindexUsersComments extends AbstractMigration
|
||||
$this->execute("
|
||||
ALTER TABLE users_comments_last_read
|
||||
DROP PRIMARY KEY,
|
||||
DROP KEY IF EXISTS Page,
|
||||
DROP KEY /* IF EXISTS */ Page,
|
||||
ADD PRIMARY KEY (Page, PageID, UserID),
|
||||
ADD KEY uclr_user_idx (UserID)
|
||||
");
|
||||
@@ -32,7 +32,7 @@ final class ReindexUsersComments extends AbstractMigration
|
||||
$this->execute("
|
||||
ALTER TABLE users_comments_last_read
|
||||
DROP PRIMARY KEY,
|
||||
DROP KEY IF EXISTS uclr_user_idx,
|
||||
DROP KEY /* IF EXISTS */ uclr_user_idx,
|
||||
ADD PRIMARY KEY (UserID, Page, PageID),
|
||||
ADD KEY Page (Page, PageID)
|
||||
");
|
||||
|
||||
@@ -6,8 +6,6 @@ use Phinx\Migration\AbstractMigration;
|
||||
final class PostEditTime extends AbstractMigration
|
||||
{
|
||||
public function up(): void {
|
||||
$this->execute("UPDATE comments_edits SET EditTime = now() WHERE EditTime IS NULL OR EditTime = '0000-00-00 00:00:00'");
|
||||
|
||||
$this->table('comments_edits')
|
||||
->changeColumn('EditTime', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
|
||||
->save();
|
||||
|
||||
@@ -20,7 +20,7 @@ final class DeletedTorrentGroup extends AbstractMigration
|
||||
->addColumn('TagList', 'string', ['length' => 500, 'default' => ''])
|
||||
->addColumn('Time', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
|
||||
->addColumn('RevisionID', 'integer', ['length' => 12, 'null' => true])
|
||||
->addColumn('WikiBody', 'string', ['limit' => MysqlAdapter::TEXT_MEDIUM])
|
||||
->addColumn('WikiBody', 'text', ['limit' => MysqlAdapter::TEXT_MEDIUM])
|
||||
->addColumn('WikiImage', 'string', ['length' => 255])
|
||||
->addColumn('VanityHouse', 'integer', ['length' => 1, 'default' => 0, 'limit' => MysqlAdapter::INT_TINY])
|
||||
->save();
|
||||
|
||||
@@ -8,11 +8,11 @@ final class ErrorLogVars extends AbstractMigration
|
||||
public function up(): void
|
||||
{
|
||||
$this->table('error_log')
|
||||
->addColumn('logged_var', 'json', ['null' => true, 'default' => '[]'])
|
||||
->addColumn('logged_var', 'json', ['null' => true])
|
||||
->save();
|
||||
$this->query("UPDATE error_log SET logged_var = '[]'");
|
||||
$this->table('error_log')
|
||||
->changeColumn('logged_var', 'json', ['null' => false, 'default' => '[]'])
|
||||
->changeColumn('logged_var', 'json', ['null' => false])
|
||||
->save();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,14 +26,14 @@ final class MysqlUtf8mb4 extends AbstractMigration
|
||||
invites ip_bans irc_channels label_aliases lastfm_users log
|
||||
login_attempts nav_items news payment_reminders periodic_task
|
||||
periodic_task_history periodic_task_history_event permissions phinxlog
|
||||
pm_conversations_users push_notifications_usage recovery recovery_buffer
|
||||
pm_conversations_users push_notifications_usage recovery_buffer
|
||||
referral_accounts referral_users release_type reports reportsv2 requests
|
||||
requests_artists site_options sphinx_a sphinx_delta
|
||||
sphinx_index_last_pos sphinx_requests sphinx_requests_delta sphinx_t
|
||||
sphinx_tg staff_blog staff_groups staff_pm_conversations stylesheets
|
||||
tag_aliases tags thread_note thread_type top10_history
|
||||
top10_history_torrents torrent_attr torrent_group_attr torrents
|
||||
torrents_artists torrents_logs torrents_tags_votes user user_attr
|
||||
torrents_artists torrents_logs torrents_tags_votes user_attr
|
||||
user_seedbox users_comments_last_read users_enable_requests
|
||||
users_geodistribution users_history_emails users_history_ips
|
||||
users_history_passkeys users_history_passwords users_info users_main
|
||||
|
||||
@@ -5,7 +5,7 @@ use Phinx\Util\Literal;
|
||||
|
||||
require_once(__DIR__ . '/../../lib/util.php'); // for randomString()
|
||||
|
||||
class InitialUserSeeder extends AbstractSeed {
|
||||
class AaaInitialUserSeeder extends AbstractSeed {
|
||||
public function run() {
|
||||
/** @var \PDOStatement $stmt */
|
||||
$stmt = $this->getAdapter()->getConnection()->prepare("
|
||||
@@ -25,6 +25,7 @@ class InitialUserSeeder extends AbstractSeed {
|
||||
'Username' => 'admin',
|
||||
'Email' => 'admin@example.com',
|
||||
'PassHash' => password_hash(hash('sha256','password'), PASSWORD_DEFAULT),
|
||||
'Secret' => randomString(32),
|
||||
'torrent_pass' => randomString(32),
|
||||
'PermissionID' => SYSOP,
|
||||
'Invites' => STARTING_INVITES,
|
||||
@@ -36,6 +37,7 @@ class InitialUserSeeder extends AbstractSeed {
|
||||
'Username' => 'user',
|
||||
'Email' => 'user@example.com',
|
||||
'PassHash' => password_hash(hash('sha256','password'), PASSWORD_DEFAULT),
|
||||
'Secret' => randomString(32),
|
||||
'torrent_pass' => randomString(32),
|
||||
'PermissionID' => USER,
|
||||
'Invites' => STARTING_INVITES,
|
||||
@@ -53,11 +55,9 @@ class InitialUserSeeder extends AbstractSeed {
|
||||
$this->table('user_last_access')->insert([
|
||||
[
|
||||
'user_id' => $adminId,
|
||||
'last_access' => Literal::from('now()'),
|
||||
],
|
||||
[
|
||||
'user_id' => $userId,
|
||||
'last_access' => Literal::from('now()'),
|
||||
],
|
||||
])->saveData();
|
||||
|
||||
@@ -80,6 +80,9 @@ class InitialUserSeeder extends AbstractSeed {
|
||||
'ShowTags' => 1,
|
||||
'AuthKey' => '7d3b4750ea71502d25051875a250b71a',
|
||||
'Inviter' => 0,
|
||||
'Info' => 'Created by installation script',
|
||||
'AdminComment' => '',
|
||||
'SiteOptions' => serialize([]),
|
||||
],
|
||||
[
|
||||
'UserID' => $userId,
|
||||
@@ -88,6 +91,9 @@ class InitialUserSeeder extends AbstractSeed {
|
||||
'ShowTags' => 1,
|
||||
'AuthKey' => 'a1189fa8554776c6de31b6b4e2d0faea',
|
||||
'Inviter' => 0,
|
||||
'Info' => 'Created by installation script',
|
||||
'AdminComment' => '',
|
||||
'SiteOptions' => serialize([]),
|
||||
]
|
||||
])->saveData();
|
||||
|
||||
@@ -95,14 +101,12 @@ class InitialUserSeeder extends AbstractSeed {
|
||||
[
|
||||
'UserID' => $adminId,
|
||||
'Email' => 'admin@example.com',
|
||||
'Time' => Literal::from('now()'),
|
||||
'IP' => '127.0.0.1',
|
||||
'useragent' => 'initial-seed',
|
||||
],
|
||||
[
|
||||
'UserID' => $userId,
|
||||
'Email' => 'user@example.com',
|
||||
'Time' => Literal::from('now()'),
|
||||
'IP' => '127.0.0.1',
|
||||
'useragent' => 'initial-seed',
|
||||
]
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
use Phinx\Seed\AbstractSeed;
|
||||
|
||||
class TagSeeder extends AbstractSeed {
|
||||
public function run() {
|
||||
foreach ([
|
||||
'acoustic', 'alternative', 'alternative.rock', 'ambient', 'americana',
|
||||
'avant.garde', 'blues', 'blues.rock', 'breakbeat', 'breaks',
|
||||
'classic.rock', 'classical', 'country', 'dance', 'dark.ambient',
|
||||
'deep.house', 'disco', 'doom.metal', 'drum.and.bass', 'electro',
|
||||
'electronic', 'experimental', 'folk', 'folk.rock', 'free.jazz', 'funk',
|
||||
'garage.rock', 'hard.rock', 'hardcore', 'hip.hop', 'house', 'idm',
|
||||
'indie', 'indie.pop', 'indie.rock', 'industrial', 'instrumental',
|
||||
'jam.band', 'jazz', 'lo.fi', 'metal', 'minimal', 'new.age', 'new.wave',
|
||||
'noise', 'pop', 'pop.rock', 'post.punk', 'post.rock',
|
||||
'progressive.house', 'progressive.rock', 'psychedelic', 'punk',
|
||||
'punk.rock', 'reggae', 'rhythm.and.blues', 'rock', 'rock.and.roll',
|
||||
'shoegaze', 'singer.songwriter', 'soul', 'soundtrack', 'stoner.rock',
|
||||
'synth.pop', 'tech.house', 'techno', 'trance', 'trip.hop', 'video.game',
|
||||
'world.music'
|
||||
] as $tag) {
|
||||
$this->table('tags')->insert([
|
||||
'Name' => $tag,
|
||||
'TagType' => 'genre',
|
||||
'UserID' => 1,
|
||||
])->save();
|
||||
}
|
||||
|
||||
foreach ([
|
||||
'abstract', 'acid', 'black.metal', 'bluegrass', 'contemporary.jazz',
|
||||
'death.metal', 'downtempo', 'drone', 'dub', 'dubstep',
|
||||
'female.vocalist', 'free.improvisation', 'french', 'fusion',
|
||||
'heavy.metal', 'japanese', 'latin', 'modern.classical', 'post.hardcore',
|
||||
'progressive.metal', 'psychedelic.rock', 'score', 'vocal',
|
||||
] as $tag) {
|
||||
$this->table('tags')->insert([
|
||||
'Name' => $tag,
|
||||
'TagType' => 'other',
|
||||
'UserID' => 1,
|
||||
])->save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ TRUNCATE users_notifications_settings;
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
*/
|
||||
const DISCOGS_MAX = 11747136;
|
||||
const TORRENTS = 20;
|
||||
const TORRENTS = 10;
|
||||
|
||||
private function getRandomDiscogsAlbum() {
|
||||
$id = rand(1, self::DISCOGS_MAX);
|
||||
@@ -63,14 +63,9 @@ SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
$artists = [];
|
||||
$groups = [];
|
||||
$tags = [
|
||||
'rock' => ['id' => 1, 'genre' => 'rock'],
|
||||
'pop' => ['id' => 2, 'genre' => 'pop'],
|
||||
'female.fronted.symphonic.death.metal' => ['id' => 3, 'genre' => 'female.fronted.symphonic.death.metal']
|
||||
];
|
||||
$tags = [];
|
||||
|
||||
$i = 0;
|
||||
while ($i < self::TORRENTS) {
|
||||
while (count($insertData['torrents']) <= self::TORRENTS) {
|
||||
// Avoid rate limit of 25 albums per minute
|
||||
sleep(2);
|
||||
$album = $this->getRandomDiscogsAlbum();
|
||||
@@ -78,7 +73,7 @@ SET FOREIGN_KEY_CHECKS = 1;
|
||||
continue;
|
||||
}
|
||||
$user_id = rand($lowerUserId, $upperUserId);
|
||||
$this->output->writeln("Found torrent {$i}...");
|
||||
$this->output->writeln("Found torrent ...");
|
||||
|
||||
$artist = $album->artists[0];
|
||||
if (!isset($artists[$artist->name])) {
|
||||
@@ -114,7 +109,6 @@ SET FOREIGN_KEY_CHECKS = 1;
|
||||
'Year' => $album->year,
|
||||
'CatalogueNumber' => $album->labels[0]->catno,
|
||||
'RecordLabel' => $album->labels[0]->name,
|
||||
'Time' => '2018-03-22 02:24:19',
|
||||
'RevisionID' => count($groups) + 1,
|
||||
'WikiBody' => $wikiBody,
|
||||
'WikiImage' => '',
|
||||
@@ -127,7 +121,6 @@ SET FOREIGN_KEY_CHECKS = 1;
|
||||
'Body' => $wikiBody,
|
||||
'UserID' => $user_id,
|
||||
'Summary' => 'Uploaded new torrent',
|
||||
'Time' => '2018-03-22 02:24:19',
|
||||
'Image' => ''
|
||||
];
|
||||
|
||||
@@ -149,7 +142,7 @@ SET FOREIGN_KEY_CHECKS = 1;
|
||||
$groups[$album->title] = ['id' => count($groups) + 1, 'album' => $album];
|
||||
}
|
||||
|
||||
$media = ($album->formats[0]->name === 'Vinyl') ? 'Vinyl' : 'CD';
|
||||
$media = (isset($album->formats[0]) && $album->formats[0]->name === 'Vinyl') ? 'Vinyl' : 'CD';
|
||||
|
||||
$torrent_id = count($insertData['torrents']) + 1;
|
||||
$files = [];
|
||||
@@ -203,11 +196,6 @@ SET FOREIGN_KEY_CHECKS = 1;
|
||||
'FreeTorrent' => 0,
|
||||
'FreeLeechType' => 0
|
||||
];
|
||||
|
||||
$insertData['torrents_leech_stats'][] = [
|
||||
'TorrentID' => count($insertData['torrents']) + 1,
|
||||
];
|
||||
$i++;
|
||||
}
|
||||
|
||||
foreach ($insertData as $table => $data) {
|
||||
@@ -215,5 +203,6 @@ SET FOREIGN_KEY_CHECKS = 1;
|
||||
}
|
||||
|
||||
$this->execute('UPDATE tags SET Uses = ( SELECT COUNT(*) FROM torrents_tags WHERE torrents_tags.TagID = tags.ID GROUP BY TagID)');
|
||||
$this->execute('INSERT INTO torrents_leech_stats (TorrentID) SELECT ID FROM torrents');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,45 +4,52 @@ services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- 8080:80
|
||||
- 127.0.0.1:7001:80
|
||||
depends_on:
|
||||
- memcached
|
||||
- mysql
|
||||
- pg
|
||||
volumes:
|
||||
- .:/var/www
|
||||
- .docker/web/nginx.conf:/etc/nginx/sites-available/gazelle.conf
|
||||
environment:
|
||||
- ENV
|
||||
- ENV=dev
|
||||
# These should match what you set for your mysql container below
|
||||
- MYSQL_USER=gazelle
|
||||
- MYSQL_PASSWORD=password
|
||||
|
||||
memcached:
|
||||
image: memcached:1.6.12-alpine
|
||||
image: memcached:1.6.14-alpine
|
||||
|
||||
pg:
|
||||
image: postgres:14
|
||||
ports:
|
||||
- 54321:5432
|
||||
- 127.0.0.1:54321:5432
|
||||
volumes:
|
||||
- ./.docker/pg/data:/var/lib/postgresql/data
|
||||
- ./.docker/data/pg:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_DB=gzpg
|
||||
- POSTGRES_PASSWORD=gazpg
|
||||
- POSTGRES_USER=gus
|
||||
|
||||
mysql:
|
||||
image: mariadb:10.5.13-focal
|
||||
image: percona:ps-8.0
|
||||
ports:
|
||||
- 36000:3306
|
||||
- 127.0.0.1:36000:3306
|
||||
volumes:
|
||||
- ./.docker/mysql/mysqld_sql_mode.cnf:/etc/mysql/conf.d/mysqld_sql_mode.cnf
|
||||
- ./.docker/data/mysql:/var/lib/mysql
|
||||
- ./.docker/mysql-home:/home/mysql
|
||||
environment:
|
||||
- MYSQL_DATABASE=gazelle
|
||||
- MYSQL_USER=gazelle
|
||||
- MYSQL_PASSWORD=password
|
||||
- MYSQL_ROOT_PASSWORD=em%G9Lrey4^N
|
||||
- MYSQL_ROOT_PASSWORD=sc5tlc9JSCC6
|
||||
command:
|
||||
- /usr/sbin/mysqld
|
||||
- --group-concat-max-len=1048576
|
||||
- --character-set-server=utf8mb4
|
||||
- --userstat=on
|
||||
- --sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
|
||||
|
||||
sphinxsearch:
|
||||
build: ./.docker/sphinxsearch
|
||||
@@ -60,7 +67,7 @@ services:
|
||||
ocelot:
|
||||
image: ocelot
|
||||
ports:
|
||||
- 34000:34000
|
||||
- 127.0.0.1:34000:34000
|
||||
depends_on:
|
||||
- mysql
|
||||
volumes:
|
||||
|
||||
@@ -4,8 +4,8 @@ use Gazelle\Util\Crypto;
|
||||
|
||||
// 1. Basic sanity checks and initialization
|
||||
|
||||
if (PHP_VERSION_ID < 70427) {
|
||||
die("Gazelle (Orpheus fork) requires at least PHP version 7.4.27 or 8.1.2");
|
||||
if (PHP_VERSION_ID < 80104) {
|
||||
die("Gazelle (Orpheus fork) requires at least PHP version 8.1.4");
|
||||
}
|
||||
foreach (['memcached', 'mysqli'] as $e) {
|
||||
if (!extension_loaded($e)) {
|
||||
|
||||
@@ -23,5 +23,8 @@ define('RSS_HASH', "");
|
||||
define('SEEDBOX_SALT', "");
|
||||
define('AVATAR_SALT', "");
|
||||
|
||||
define('SQL_PHINX_USER', 'root');
|
||||
define('SQL_PHINX_PASS', 'sc5tlc9JSCC6');
|
||||
|
||||
// Docker setup runs the scheduler only once every 15 minutes
|
||||
define('SCHEDULER_DELAY', 1200);
|
||||
|
||||
@@ -2160,9 +2160,9 @@ caniuse-api@^3.0.0:
|
||||
lodash.uniq "^4.5.0"
|
||||
|
||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001039, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001248:
|
||||
version "1.0.30001251"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz#6853a606ec50893115db660f82c094d18f096d85"
|
||||
integrity sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==
|
||||
version "1.0.30001320"
|
||||
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001320.tgz"
|
||||
integrity sha512-MWPzG54AGdo3nWx7zHZTefseM5Y1ccM7hlQKHRqJkPozUaw3hNbBTMmLn16GG2FUzjR13Cr3NPfhIieX5PzXDA==
|
||||
|
||||
ccount@^1.0.0:
|
||||
version "1.0.5"
|
||||
|
||||
Reference in New Issue
Block a user