1. 修改創建公司資料庫的power_station 的生成SQL

This commit is contained in:
Kai 2022-01-24 10:09:12 +08:00
parent 09cca68d0f
commit 3c636bcc7c

View File

@ -543,79 +543,79 @@ namespace SolarPower.Repository.Implement
-- power_station
CREATE TABLE IF NOT EXISTS `power_station` (
`Id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`Deleted` TINYINT(4) NOT NULL DEFAULT '0' COMMENT ' 0: 1:',
`CompanyId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '',
`CityId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '',
`AreaId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '',
`Id` int(10) unsigned NOT NULL DEFAULT '0',
`Deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT ' 0: 1:',
`CompanyId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
`CityId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
`AreaId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
`Status` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT ' 0: 1:',
`HealthStatus` TINYINT(4) UNSIGNED NOT NULL DEFAULT '1' COMMENT '1: 2: 3:',
`Address` VARCHAR(100) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`Name` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`MainDisplay` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`Code` VARCHAR(50) NULL DEFAULT NULL COMMENT '++' COLLATE 'utf8mb4_unicode_ci',
`SerialNumber` VARCHAR(4) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`IsEscrow` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '0: 1:',
`EscrowName` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`ElectricityMeterAt` TIMESTAMP NULL DEFAULT NULL COMMENT '',
`EstimatedRecoveryTime` VARCHAR(10) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`GeneratingCapacity` DECIMAL(10,4) NOT NULL DEFAULT '0.0000' COMMENT '()',
`PowerRate` DECIMAL(10,4) NOT NULL DEFAULT '0.0000' COMMENT '',
`Coordinate` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`InverterBrand` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`InverterProductModel` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`InverterAmount` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '',
`PhotovoltaicPanelBrand` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`PhotovoltaicPanelProductModel` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`PhotovoltaicPanelSpecification` VARCHAR(100) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`PhotovoltaicPanelAmount` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '',
`BoEFileName` VARCHAR(255) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`BoEFile` VARCHAR(255) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`BoEDiscountRate` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '',
`BoEDeviceRegisterNumber` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`BoERentRatio` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '(%)',
`BoERegisterPostAt` TIMESTAMP NULL DEFAULT NULL COMMENT '',
`GUINumber` VARCHAR(16) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`TPCContractNumber` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`TPCInvoiceBuyer` VARCHAR(100) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`TPCInvoiceAddress` VARCHAR(100) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`TPCContractAt` TIMESTAMP NULL DEFAULT NULL COMMENT '',
`TPCSellDeadline` INT(10) UNSIGNED NULL DEFAULT '0' COMMENT '()',
`TPCMeterReading` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '',
`TPCPurchaseElectricityAt` TIMESTAMP NULL DEFAULT NULL COMMENT '',
`TPCSellElectricityAt` TIMESTAMP NULL DEFAULT NULL COMMENT '',
`TPCMeterNumber` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`SolarType` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '',
`kwh` DECIMAL(10,3) UNSIGNED NOT NULL DEFAULT '0.000',
`Today_kwh` DECIMAL(10,3) UNSIGNED NOT NULL DEFAULT '0.000' COMMENT '',
`Total_kwh` DECIMAL(10,3) UNSIGNED NOT NULL DEFAULT '0.000' COMMENT '',
`today_kwhkwp` DECIMAL(10,3) NULL DEFAULT NULL COMMENT 'kwhkwp',
`avg_kwhkwp` DECIMAL(10,3) NULL DEFAULT NULL COMMENT '30kwhkwp',
`today_money` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '',
`total_money` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '',
`today_PR` DECIMAL(5,2) NULL DEFAULT NULL COMMENT 'Pr值',
`avg_PR` DECIMAL(5,2) NULL DEFAULT NULL COMMENT 'Pr值',
`today_carbon` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '',
`total_carbon` DECIMAL(10,2) NOT NULL COMMENT '',
`today_irradiance` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '',
`avg_irradiance` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '',
`SolarHour` DECIMAL(10,2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '',
`SiteDB` VARCHAR(20) NULL DEFAULT NULL COMMENT ' DB name: solar_com' COLLATE 'utf8mb4_unicode_ci',
`TodayWeather` VARCHAR(20) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`TodayWeatherTemp` DECIMAL(5,2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '',
`WeathersStationId` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`RateOfRain` VARCHAR(50) NULL DEFAULT NULL COMMENT '' COLLATE 'utf8mb4_unicode_ci',
`line_token` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
`Estimate_kwh` DECIMAL(10,2) NULL DEFAULT '0.00' COMMENT '',
`EstimateEfficacy` DECIMAL(10,2) NULL DEFAULT '0.00' COMMENT '',
`CreatedBy` INT(10) UNSIGNED NOT NULL COMMENT '',
`CreatedAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`UpdatedBy` INT(10) UNSIGNED NULL DEFAULT NULL COMMENT '',
`UpdatedAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
PRIMARY KEY (`Id`) USING BTREE,
KEY `IDX_01` (`Deleted`) USING BTREE,
KEY `IDX_02` (`CompanyId`) USING BTREE,
KEY `IDX_03` (`CityId`,`AreaId`) USING BTREE
`HealthStatus` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '1: 2: 3:',
`Address` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`Name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`MainDisplay` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`Code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '++',
`SerialNumber` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`IsEscrow` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0: 1:',
`EscrowName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`ElectricityMeterAt` timestamp NULL DEFAULT NULL COMMENT '',
`EstimatedRecoveryTime` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`GeneratingCapacity` decimal(10,4) NOT NULL DEFAULT '0.0000' COMMENT '()',
`PowerRate` decimal(10,4) NOT NULL DEFAULT '0.0000' COMMENT '',
`Coordinate` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`InverterBrand` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`InverterProductModel` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`InverterAmount` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
`PhotovoltaicPanelBrand` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`PhotovoltaicPanelProductModel` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`PhotovoltaicPanelSpecification` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`PhotovoltaicPanelAmount` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
`BoEFileName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`BoEFile` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`BoEDiscountRate` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
`BoEDeviceRegisterNumber` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`BoERentRatio` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '(%)',
`BoERegisterPostAt` timestamp NULL DEFAULT NULL COMMENT '',
`GUINumber` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`TPCContractNumber` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`TPCInvoiceBuyer` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`TPCInvoiceAddress` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`TPCContractAt` timestamp NULL DEFAULT NULL COMMENT '',
`TPCSellDeadline` int(10) unsigned DEFAULT '0' COMMENT '()',
`TPCMeterReading` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
`TPCPurchaseElectricityAt` timestamp NULL DEFAULT NULL COMMENT '',
`TPCSellElectricityAt` timestamp NULL DEFAULT NULL COMMENT '',
`TPCMeterNumber` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`SolarType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '',
`kwh` decimal(10,3) unsigned NOT NULL DEFAULT '0.000',
`Today_kwh` decimal(10,3) unsigned NOT NULL DEFAULT '0.000' COMMENT '',
`Total_kwh` decimal(10,3) unsigned NOT NULL DEFAULT '0.000' COMMENT '',
`today_kwhkwp` decimal(10,3) NOT NULL DEFAULT '0.000' COMMENT 'kwhkwp',
`avg_kwhkwp` decimal(10,3) NOT NULL DEFAULT '0.000' COMMENT '30kwhkwp',
`today_money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
`total_money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
`today_PR` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT 'Pr值',
`avg_PR` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT 'Pr值',
`today_carbon` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
`total_carbon` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
`today_irradiance` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT '',
`avg_irradiance` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT '',
`SolarHour` decimal(5,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '',
`SiteDB` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT ' DB name: solar_com',
`TodayWeather` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`TodayWeatherTemp` decimal(5,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '',
`WeathersStationId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`RateOfRain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '',
`line_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`Estimate_kwh` decimal(10,2) DEFAULT '0.00' COMMENT '',
`EstimateEfficacy` decimal(10,2) DEFAULT '0.00' COMMENT '',
`CreatedBy` int(10) unsigned NOT NULL COMMENT '',
`CreatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`UpdatedBy` int(10) unsigned DEFAULT NULL COMMENT '',
`UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '',
PRIMARY KEY (`Id`),
KEY `IDX_01` (`Deleted`),
KEY `IDX_02` (`CompanyId`),
KEY `IDX_03` (`CityId`,`AreaId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='';