工作记录(待续)

1,增加一个Sql远程登录用户

SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
GRANT select ON endysis.* TO eshop@localhost IDENTIFIED BY 'abc';
GRANT select ON endysis.* TO eshop@"%" IDENTIFIED BY 'abc';

2,rails_sql_views
[url]https://github.com/activewarehouse/rails_sql_views[/url]

create_view "v_retail_sales", "select `retail_sales`.`id` AS `id`,`retail_sales`.`description` AS `description`,`retail_sales`.`commodity` AS `commodity`,`retail_sales`.`main_raw_material` AS `main_raw_material`,`retail_sales`.`main_raw_material_composition` AS `main_raw_material_composition`,`retail_sales`.`customer_code` AS `customer_code`,`retail_sales`.`product_part` AS `product_part`,`prices`.`value` AS `selling_price_value`,`prices`.`currency` AS `selling_price_currency`,`retail_sales`.`pantone_code` AS `pantone_code`,`retail_sales`.`quantity` AS `quantity`,`retail_sale_secondary_features`.`consumer` AS `consumer`,`retail_sale_secondary_features`.`size_group` AS `size_group`,`retail_sale_secondary_features`.`uom` AS `uom`,`retail_sale_marketings`.`brandname` AS `brandname`,`retail_sale_marketings`.`season` AS `season`,`retail_sale_marketings`.`year` AS `year`,`retail_sale_marketings`.`marketability` AS `marketability`,`retail_sale_marketings`.`sales_class` AS `sales_class`,`retail_sale_marketings`.`purchasing` AS `purchasing` from (`retail_sales` left join ((`retail_sale_secondary_features` join `retail_sale_marketings`) join `prices`) on(((`retail_sale_secondary_features`.`retail_sale_id` = `retail_sales`.`id`) and (`retail_sale_marketings`.`retail_sale_id` = `retail_sales`.`id`) and (`prices`.`id` = `retail_sales`.`selling_price`)))) where ((`retail_sales`.`status` = 'Available') and (`retail_sales`.`company_id` = 1))", :force => true do |v|
v.column :id
v.column :description
v.column :commodity
v.column :main_raw_material
v.column :main_raw_material_composition
v.column :customer_code
v.column :product_part
v.column :selling_price_value
v.column :selling_price_currency
v.column :pantone_code
v.column :quantity
v.column :consumer
v.column :size_group
v.column :uom
v.column :brandname
v.column :season
v.column :year
v.column :marketability
v.column :sales_class
v.column :purchasing
end


require 'active_record/view'

class VRetailSale < ActiveRecord::View
has_many :v_logistics_cycle_per_sizes
end


revoke all ON endysis.* from eshop@"%";
GRANT select ON endysis.v_retail_sales TO eshop@"%" IDENTIFIED BY 'abc';
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值