Skip to content

Commit a85d412

Browse files
committed
fix 0.2.14 sql error
1 parent 12b0b7d commit a85d412

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sql/codepush-v0.2.15.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ ALTER TABLE `packages_metrics` CHANGE `created_at` `created_at` TIMESTAMP NULL;
99
ALTER TABLE `user_tokens` CHANGE `expires_at` `expires_at` TIMESTAMP NULL,CHANGE `created_at` `created_at` TIMESTAMP NULL;
1010
ALTER TABLE `users` CHANGE `created_at` `created_at` TIMESTAMP NULL;
1111

12+
DROP PROCEDURE IF EXISTS schema_change;
13+
CREATE PROCEDURE schema_change()
14+
BEGIN
15+
DECLARE CurrentDatabase VARCHAR(100);
16+
SELECT DATABASE() INTO CurrentDatabase;
17+
IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema=CurrentDatabase AND table_name = 'packages' AND column_name = 'is_mandatory') THEN
18+
ALTER TABLE `packages` ADD `is_mandatory` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0';
19+
END IF;
20+
END;
21+
CALL schema_change();
22+
DROP PROCEDURE IF EXISTS schema_change;
23+
1224
ALTER TABLE `deployments_versions` DROP INDEX idx_did_appversion, ADD INDEX `idx_did_appversion` (`deployment_id`, `app_version`),ADD `deleted_at` TIMESTAMP NULL;
1325
ALTER TABLE `packages` ADD `deleted_at` TIMESTAMP NULL;
1426
ALTER TABLE `packages_metrics` DROP INDEX `udx_packageid`,ADD INDEX `idx_packageid` (`package_id`),ADD `deleted_at` TIMESTAMP NULL;

0 commit comments

Comments
 (0)