Lines 11-19
return {
Link Here
|
11 |
primary_key_exists( 'user_permissions', 'module_bit' ) && |
11 |
primary_key_exists( 'user_permissions', 'module_bit' ) && |
12 |
primary_key_exists( 'user_permissions', 'code') |
12 |
primary_key_exists( 'user_permissions', 'code') |
13 |
){ |
13 |
){ |
14 |
$dbh->do(q{ |
14 |
my $exists = $dbh->do(q{ |
15 |
ALTER TABLE user_permissions DROP INDEX IF EXISTS `PRIMARY` |
15 |
SELECT true FROM information_schema.TABLE_CONSTRAINTS WHERE CONSTRAINT_SCHEMA = DATABASE() |
|
|
16 |
AND TABLE_NAME = 'user_permissions' AND CONSTRAINT_NAME = 'PRIMARY'; |
16 |
}); |
17 |
}); |
|
|
18 |
$dbh->do(q{ |
19 |
ALTER TABLE user_permissions DROP INDEX `PRIMARY` |
20 |
}) if $exists > 0; |
17 |
say $out "Dropped any previously created primary key"; |
21 |
say $out "Dropped any previously created primary key"; |
18 |
|
22 |
|
19 |
$dbh->do(q{ALTER TABLE user_permissions ADD COLUMN temp SERIAL PRIMARY KEY}); |
23 |
$dbh->do(q{ALTER TABLE user_permissions ADD COLUMN temp SERIAL PRIMARY KEY}); |
20 |
- |
|
|