create database rl_test;
use database rl_test;

CREATE TABLE `client1spenddata_20191003` (
`id` int(10) unsigned DEFAULT NULL,
`data_source` varchar(255) DEFAULT NULL,
`file_name` varchar(255) DEFAULT NULL,
`transferred` tinyint(3) unsigned DEFAULT NULL,
`normalized_vendor_name` varchar(255) DEFAULT NULL,
`original_vendor_name` varchar(255) DEFAULT NULL,
`simple_vendor_name` varchar(255) DEFAULT NULL,
`amount` decimal(18,5) unsigned DEFAULT NULL,
`date` date DEFAULT NULL,
`category` varchar(255) DEFAULT NULL,
`subcategory` varchar(255) DEFAULT NULL,
`gl_description` varchar(255) DEFAULT NULL,
`spendanalysis_id` smallint(5) unsigned DEFAULT NULL,
`date_updated` datetime DEFAULT NULL,
`normalization_source` smallint(6) DEFAULT NULL,
`original_currency` varchar(255) DEFAULT NULL,
`product_type` varchar(255) DEFAULT NULL,
`company_company` varchar(255) DEFAULT NULL,
`division` varchar(255) DEFAULT NULL,
`plant_name` varchar(255) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL,
`region` varchar(255) DEFAULT NULL,
`state` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`payment_terms` varchar(255) DEFAULT NULL,
`sourcing_manager` varchar(255) DEFAULT NULL,
`original_amount` decimal(18,5) DEFAULT NULL,
`source_table_name` varchar(255) DEFAULT NULL,
`amount_cad` decimal(18,5) DEFAULT NULL,
`amount_eur` decimal(18,5) DEFAULT NULL,
`amount_gbp` decimal(18,5) DEFAULT NULL,
`amount_jpy` decimal(18,5) DEFAULT NULL
) ENGINE=Columnstore DEFAULT CHARSET=utf8;

CREATE TABLE `rl_test1spenddata` (
`year` int(10) unsigned DEFAULT NULL,
`month` int(10) unsigned DEFAULT NULL,
`is_preferred` tinyint(3) unsigned DEFAULT 0,
`is_managed` tinyint(3) unsigned DEFAULT 0,
`impactable` tinyint(4) DEFAULT 1,
`include_in_savings` tinyint(4) DEFAULT 1,
`lost_savings_rate` int(11) DEFAULT NULL,
`enable_lost_savings` tinyint(4) DEFAULT 1,
`default_savings_rate` int(11) DEFAULT NULL,
`managed_spend_target_isg` int(11) DEFAULT NULL,
`managed_spend_target_company` int(11) DEFAULT NULL,
`enable_managed_spend_isg` tinyint(4) DEFAULT 1,
`compliance_target_isg` int(11) DEFAULT NULL,
`compliance_target_company` int(11) DEFAULT NULL,
`enable_compliance_target_isg` tinyint(4) DEFAULT 1,
`id` int(10) unsigned DEFAULT NULL,
`data_source` varchar(255) DEFAULT NULL,
`file_name` varchar(255) DEFAULT NULL,
`transferred` tinyint(3) unsigned DEFAULT NULL,
`normalized_vendor_name` varchar(255) DEFAULT NULL,
`original_vendor_name` varchar(255) DEFAULT NULL,
`simple_vendor_name` varchar(255) DEFAULT NULL,
`amount` decimal(18,5) unsigned DEFAULT NULL,
`date` date DEFAULT NULL,
`category` varchar(255) DEFAULT NULL,
`subcategory` varchar(255) DEFAULT NULL,
`gl_description` varchar(255) DEFAULT NULL,
`spendanalysis_id` smallint(5) unsigned DEFAULT NULL,
`date_updated` datetime DEFAULT NULL,
`normalization_source` smallint(6) DEFAULT NULL,
`original_currency` varchar(255) DEFAULT NULL,
`product_type` varchar(255) DEFAULT NULL,
`company_company` varchar(255) DEFAULT NULL,
`division` varchar(255) DEFAULT NULL,
`plant_name` varchar(255) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL,
`region` varchar(255) DEFAULT NULL,
`state` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`payment_terms` varchar(255) DEFAULT NULL,
`sourcing_manager` varchar(255) DEFAULT NULL,
`original_amount` decimal(18,5) DEFAULT NULL,
`source_table_name` varchar(255) DEFAULT NULL,
`amount_cad` decimal(18,5) DEFAULT NULL,
`amount_eur` decimal(18,5) DEFAULT NULL,
`amount_gbp` decimal(18,5) DEFAULT NULL,
`amount_jpy` decimal(18,5) DEFAULT NULL
) ENGINE=Columnstore DEFAULT CHARSET=utf8;

CREATE TABLE `rl_test_preferred_vendors` (
`normalized_vendor_name` varchar(255) DEFAULT NULL,
`start_date` date DEFAULT NULL,
`end_date` date DEFAULT NULL,
`category` varchar(255) DEFAULT NULL,
`subcategory` varchar(255) DEFAULT NULL,
`is_preferred` tinyint(3) unsigned DEFAULT 0
) ENGINE=Columnstore DEFAULT CHARSET=utf8;

CREATE TABLE `rl_test_company_settings` (
`subcategory` varchar(255) DEFAULT NULL,
`impactable` tinyint(4) DEFAULT 1,
`include_in_savings` tinyint(4) DEFAULT 1,
`lost_savings_rate` int(11) DEFAULT NULL,
`enable_lost_savings` tinyint(4) DEFAULT 1,
`default_savings_rate` int(11) DEFAULT NULL,
`managed_spend_target_isg` int(11) DEFAULT NULL,
`managed_spend_target_company` int(11) DEFAULT NULL,
`enable_managed_spend_isg` tinyint(4) DEFAULT 1,
`compliance_target_isg` int(11) DEFAULT NULL,
`compliance_target_company` int(11) DEFAULT NULL,
`enable_compliance_target_isg` tinyint(4) DEFAULT 1
) ENGINE=Columnstore DEFAULT CHARSET=utf8;
