rushm 发表于 2012-12-7 13:26
show create table accounts来看下
mysql> show create table accounts\G
*************************** 1. row ***************************
Table: accounts
Create Table: CREATE TABLE `accounts` (
`account_id` varchar(25) NOT NULL,
`account_type_id` int(11) NOT NULL,
`hotel_id` char(10) DEFAULT NULL,
`register_id` varchar(25) DEFAULT NULL,
`guest_id` varchar(50) DEFAULT NULL,
`group_id` varchar(50) DEFAULT NULL,
`company_id` int(11) DEFAULT NULL,
`money` double NOT NULL,
`phone_bill_id` varchar(50) DEFAULT NULL,
`product_bill_id` varchar(50) DEFAULT NULL,
`payment_method_id` tinyint(4) DEFAULT NULL,
`is_reversed` tinyint(1) NOT NULL DEFAULT '0',
`is_balanced` tinyint(1) DEFAULT '0',
`from_account_id` varchar(25) DEFAULT NULL,
`to_account_id` varchar(25) DEFAULT NULL,
`cash_bill_no` varchar(25) DEFAULT NULL,
`shift_id` tinyint(4) DEFAULT NULL,
`account_date` date NOT NULL,
`created_at` datetime DEFAULT NULL,
`note` varchar(255) DEFAULT NULL,
`hotel_operator_id` varchar(50) NOT NULL,
`pos_site_id` int(11) DEFAULT NULL,
`room_order_id` varchar(50) DEFAULT NULL,
`close_date` date DEFAULT NULL,
`close_shift_id` tinyint(4) DEFAULT NULL,
`close_hotel_operator_id` varchar(50) DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`credit_card_type_id` int(11) DEFAULT NULL,
`account_page` tinyint(4) DEFAULT '0',
`ar_date` date DEFAULT NULL,
`ar_shift_id` tinyint(4) DEFAULT NULL,
`ar_operator_id` varchar(50) DEFAULT NULL,
`is_hedged` tinyint(1) NOT NULL DEFAULT '0',
`source_room_id` int(11) DEFAULT NULL,
`hedge_date` date DEFAULT NULL,
`hedge_account_id` varchar(25) DEFAULT NULL,
`foreign_currency_code` varchar(10) DEFAULT NULL,
`foreign_money` double DEFAULT NULL,
`card_type_id` varchar(25) DEFAULT NULL,
`card_no` varchar(25) DEFAULT NULL,
`voucher_type_id` varchar(25) DEFAULT NULL,
`voucher_no` varchar(25) DEFAULT NULL,
`owner_id` varchar(25) DEFAULT NULL,
`owner_type` tinyint(4) DEFAULT NULL,
`hotelgroup_id` varchar(50) DEFAULT NULL,
`meeting_room_id` int(11) DEFAULT NULL,
`balance_no` varchar(25) DEFAULT NULL,
`ar_no` varchar(25) DEFAULT NULL,
`sign_guest` varchar(50) DEFAULT NULL,
`res_revenue_group_id` int(11) DEFAULT NULL,
`res_discount_id` int(11) DEFAULT NULL,
`credit_card_no` varchar(25) DEFAULT NULL,
PRIMARY KEY (`account_id`),
KEY `FK_R_LT` (`phone_bill_id`),
KEY `FK_R_LX` (`from_account_id`),
KEY `FK_R_LY` (`to_account_id`),
KEY `FK_R_LZ` (`hotel_operator_id`),
KEY `FK_R_MQ` (`product_bill_id`),
KEY `FK_R_NA` (`account_type_id`),
KEY `FK_R_OE` (`room_order_id`),
KEY `FK_R_NV` (`group_id`),
KEY `FK_R_NU` (`register_id`),
KEY `FK_R_NS` (`company_id`),
KEY `FK_R_OG` (`hotel_id`,`updated_at`),
KEY `owner_id` (`owner_id`),
KEY `FK_R_FX` (`hotelgroup_id`),
KEY `FK_R_IQ` (`meeting_room_id`),
KEY `FK_R_NR` (`pos_site_id`),
KEY `FK_R_KF` (`res_revenue_group_id`),
KEY `voucher_type_id` (`voucher_type_id`),
KEY `FK_R_QV` (`account_date`,`hotel_id`),
KEY `idx_close_date` (`close_date`,`hotel_id`),
KEY `idx_bill` (`cash_bill_no`,`hotel_id`),
KEY `idx_guest` (`guest_id`),
KEY `idx_ar_date` (`ar_date`,`hotel_id`),
KEY `idx_card` (`card_type_id`,`card_no`),
CONSTRAINT `FK_R_FX` FOREIGN KEY (`hotelgroup_id`) REFERENCES `hotelgroups` (`hotelgroup_id`),
CONSTRAINT `FK_R_IQ` FOREIGN KEY (`meeting_room_id`) REFERENCES `meeting_rooms` (`id`),
CONSTRAINT `FK_R_KF` FOREIGN KEY (`res_revenue_group_id`) REFERENCES `res_revenue_groups` (`id`),
CONSTRAINT `FK_R_LZ` FOREIGN KEY (`hotel_operator_id`) REFERENCES `users` (`user_id`),
CONSTRAINT `FK_R_MQ` FOREIGN KEY (`product_bill_id`) REFERENCES `product_bills` (`id`),
CONSTRAINT `FK_R_NA` FOREIGN KEY (`account_type_id`) REFERENCES `account_types` (`id`),
CONSTRAINT `FK_R_NR` FOREIGN KEY (`pos_site_id`) REFERENCES `pos_sites` (`id`),
CONSTRAINT `FK_R_NS` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`),
CONSTRAINT `FK_R_NU` FOREIGN KEY (`register_id`) REFERENCES `registers` (`id`),
CONSTRAINT `FK_R_NV` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`),
CONSTRAINT `FK_R_OG` FOREIGN KEY (`hotel_id`) REFERENCES `hotels` (`hotel_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|