org.agbu.annualgrantbudgets/sql/auto_install.sql

16 lines
827 B
SQL

CREATE TABLE IF NOT EXISTS `civicrm_grant_budget` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Primary ID',
`financial_type_id` int(10) UNSIGNED NOT NULL COMMENT 'FK to Financial Type.',
`fiscal_year` int(10) UNSIGNED NOT NULL COMMENT 'Fiscal Year',
`budget` decimal(20,2) DEFAULT '0.00' COMMENT 'Grant annual budget',
PRIMARY KEY (`id`),
KEY `FK_civicrm_grant_budget_financial_type_id` (`financial_type_id`),
UNIQUE KEY `UI_financial_type_id_fiscal_year` (`financial_type_id`,`fiscal_year`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Constraints for table `civicrm_grant_budget`
--
ALTER TABLE `civicrm_grant_budget`
ADD CONSTRAINT `FK_civicrm_grant_budget_financial_type_id` FOREIGN KEY (`financial_type_id`) REFERENCES `civicrm_financial_type` (`id`) ON DELETE CASCADE;