| Server IP : 103.243.232.44 / Your IP : 216.73.216.250 Web Server : LiteSpeed System : Linux server17213-10344.hostycare.online 5.14.0-687.38.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 12 17:19:12 EDT 2026 x86_64 User : iamakash ( 1400) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/iamakash/.trash/sql/ |
Upload File : |
-- Shaurya WPI Index Factor schema -- Apply with: mysql -u root < sql/schema.sql CREATE DATABASE IF NOT EXISTS `shaurya_index` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; USE `shaurya_index`; -- Commodities master (hierarchy) CREATE TABLE IF NOT EXISTS `commodities` ( `comm_code` VARCHAR(20) NOT NULL, `comm_name` VARCHAR(255) NOT NULL, `level` TINYINT NOT NULL, -- 2..6 (All=2, Section=2, A/B/C=3, a/b=4, a1/a2=5, leaf=6) `parent_code` VARCHAR(20) NULL, `comm_wt` DECIMAL(10,4) NULL, `base_year` VARCHAR(10) NOT NULL DEFAULT '2011-12', `display_name` VARCHAR(300) NOT NULL, -- "1101010107 - Ragi" `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`comm_code`, `base_year`), KEY `idx_parent` (`parent_code`), KEY `idx_level` (`level`), KEY `idx_name` (`comm_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Monthly index values CREATE TABLE IF NOT EXISTS `monthly_indices` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `comm_code` VARCHAR(20) NOT NULL, `base_year` VARCHAR(10) NOT NULL DEFAULT '2011-12', `period_year` SMALLINT NOT NULL, `period_month` TINYINT NOT NULL, -- 1..12 `index_value` DECIMAL(10,2) NULL, `is_provisional` TINYINT(1) NOT NULL DEFAULT 0, `upload_id` INT UNSIGNED NULL, `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `uk_comm_period` (`comm_code`, `base_year`, `period_year`, `period_month`), KEY `idx_period` (`period_year`, `period_month`), KEY `idx_upload` (`upload_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Upload audit log CREATE TABLE IF NOT EXISTS `uploads` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `filename` VARCHAR(255) NOT NULL, `stored_path` VARCHAR(500) NOT NULL, `size_bytes` INT UNSIGNED NOT NULL, `base_year` VARCHAR(10) NOT NULL DEFAULT '2011-12', `commodities_seen` INT UNSIGNED NOT NULL DEFAULT 0, `periods_seen` INT UNSIGNED NOT NULL DEFAULT 0, `values_written` INT UNSIGNED NOT NULL DEFAULT 0, `latest_period` VARCHAR(10) NULL, -- "022026" `status` VARCHAR(32) NOT NULL DEFAULT 'pending', `notes` TEXT NULL, `uploaded_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `idx_uploaded_at` (`uploaded_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;