From 6bfe8b59847006e81a6d251f97dda74f52fee1d2 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 19 Sep 2014 11:46:20 -0700 Subject: [PATCH] Generate expected schemata for Calendar Summary: Ref T1191. - There was a varchar(50) column. I changed it to `text64`, since this length is unusual. - There was an int(3) column. I changed it to `int32`, since this length is unusual. Test Plan: Ran migrations, saw warnings disappear from config tool. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T1191 Differential Revision: https://secure.phabricator.com/D10524 --- .../sql/autopatches/20140919.schema.01.calstatus.sql | 2 ++ .../sql/autopatches/20140919.schema.02.calname.sql | 2 ++ src/__phutil_library_map__.php | 2 ++ .../calendar/storage/PhabricatorCalendarEvent.php | 6 ++++++ .../calendar/storage/PhabricatorCalendarHoliday.php | 9 +++++++++ .../calendar/storage/PhabricatorCalendarSchemaSpec.php | 10 ++++++++++ .../config/schema/PhabricatorConfigSchemaSpec.php | 3 +++ 7 files changed, 34 insertions(+) create mode 100644 resources/sql/autopatches/20140919.schema.01.calstatus.sql create mode 100644 resources/sql/autopatches/20140919.schema.02.calname.sql create mode 100644 src/applications/calendar/storage/PhabricatorCalendarSchemaSpec.php diff --git a/resources/sql/autopatches/20140919.schema.01.calstatus.sql b/resources/sql/autopatches/20140919.schema.01.calstatus.sql new file mode 100644 index 0000000000..0eb1907404 --- /dev/null +++ b/resources/sql/autopatches/20140919.schema.01.calstatus.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_calendar.calendar_event + CHANGE status status INT UNSIGNED NOT NULL; diff --git a/resources/sql/autopatches/20140919.schema.02.calname.sql b/resources/sql/autopatches/20140919.schema.02.calname.sql new file mode 100644 index 0000000000..49b5d6aee2 --- /dev/null +++ b/resources/sql/autopatches/20140919.schema.02.calname.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_calendar.calendar_holiday + CHANGE name name VARCHAR(64) NOT NULL COLLATE utf8_general_ci; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index bcc66e5d26..942df33897 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1300,6 +1300,7 @@ phutil_register_library_map(array( 'PhabricatorCalendarEventViewController' => 'applications/calendar/controller/PhabricatorCalendarEventViewController.php', 'PhabricatorCalendarHoliday' => 'applications/calendar/storage/PhabricatorCalendarHoliday.php', 'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php', + 'PhabricatorCalendarSchemaSpec' => 'applications/calendar/storage/PhabricatorCalendarSchemaSpec.php', 'PhabricatorCalendarViewController' => 'applications/calendar/controller/PhabricatorCalendarViewController.php', 'PhabricatorCampfireProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php', 'PhabricatorChangeParserTestCase' => 'applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php', @@ -4208,6 +4209,7 @@ phutil_register_library_map(array( 'PhabricatorCalendarEventViewController' => 'PhabricatorCalendarController', 'PhabricatorCalendarHoliday' => 'PhabricatorCalendarDAO', 'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase', + 'PhabricatorCalendarSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhabricatorCalendarViewController' => 'PhabricatorCalendarController', 'PhabricatorCampfireProtocolAdapter' => 'PhabricatorBotBaseStreamingProtocolAdapter', 'PhabricatorChangeParserTestCase' => 'PhabricatorWorkingCopyTestCase', diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php index 00eff61558..481e5112b5 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -37,6 +37,12 @@ final class PhabricatorCalendarEvent public function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, + self::CONFIG_COLUMN_SCHEMA => array( + 'dateFrom' => 'epoch', + 'dateTo' => 'epoch', + 'status' => 'uint32', + 'description' => 'text', + ), ) + parent::getConfiguration(); } diff --git a/src/applications/calendar/storage/PhabricatorCalendarHoliday.php b/src/applications/calendar/storage/PhabricatorCalendarHoliday.php index 2de0a63cd5..e6d6a2c708 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarHoliday.php +++ b/src/applications/calendar/storage/PhabricatorCalendarHoliday.php @@ -8,6 +8,15 @@ final class PhabricatorCalendarHoliday extends PhabricatorCalendarDAO { public function getConfiguration() { return array( self::CONFIG_TIMESTAMPS => false, + self::CONFIG_COLUMN_SCHEMA => array( + 'day' => 'date', + 'name' => 'text64', + ), + self::CONFIG_KEY_SCHEMA => array( + 'day' => array( + 'columns' => array('day'), + ), + ), ) + parent::getConfiguration(); } diff --git a/src/applications/calendar/storage/PhabricatorCalendarSchemaSpec.php b/src/applications/calendar/storage/PhabricatorCalendarSchemaSpec.php new file mode 100644 index 0000000000..96f25f3b85 --- /dev/null +++ b/src/applications/calendar/storage/PhabricatorCalendarSchemaSpec.php @@ -0,0 +1,10 @@ +buildLiskSchemata('PhabricatorCalendarDAO'); + } + +} diff --git a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php index bae0a9d0fe..0a2aa5fbba 100644 --- a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php +++ b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php @@ -292,6 +292,9 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject { case 'double': $column_type = 'double'; break; + case 'date': + $column_type = 'date'; + break; default: $column_type = pht(''); $charset = pht('');