Skip to content

Instantly share code, notes, and snippets.

@BrookeDot
Created October 16, 2025 23:05
Show Gist options
  • Select an option

  • Save BrookeDot/958d04349e2743cf5420362a1ed8bb0e to your computer and use it in GitHub Desktop.

Select an option

Save BrookeDot/958d04349e2743cf5420362a1ed8bb0e to your computer and use it in GitHub Desktop.
Bike[R] database structure
DROP TABLE IF EXISTS `rwg_career_totals`;
CREATE TABLE `rwg_career_totals` (
`id` bigint(20) UNSIGNED NOT NULL,
`date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`trips` int(10) UNSIGNED NOT NULL,
`moving_time` int(11) UNSIGNED NOT NULL,
`elevation_gain` decimal(22,12) UNSIGNED NOT NULL,
`distance` decimal(22,12) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `rwg_goal_totals`
--
DROP TABLE IF EXISTS `rwg_goal_totals`;
CREATE TABLE `rwg_goal_totals` (
`id` int(11) NOT NULL,
`goalid` mediumint(8) UNSIGNED NOT NULL,
`name` text NOT NULL,
`start` date NOT NULL,
`end` date NOT NULL,
`percent` decimal(22,18) UNSIGNED NOT NULL,
`percent_human` tinytext NOT NULL,
`updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `rwg_hashes`
--
DROP TABLE IF EXISTS `rwg_hashes`;
CREATE TABLE `rwg_hashes` (
`id` int(11) NOT NULL,
`hash` varchar(32) NOT NULL,
`type` int(11) NOT NULL,
`meta` int(11) DEFAULT NULL,
`created` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `rwg_year_totals`
--
DROP TABLE IF EXISTS `rwg_year_totals`;
CREATE TABLE `rwg_year_totals` (
`id` int(11) NOT NULL,
`year` year(4) NOT NULL,
`trips` int(4) UNSIGNED NOT NULL,
`moving_time` int(11) UNSIGNED NOT NULL,
`elevation_gain` decimal(22,12) UNSIGNED NOT NULL,
`distance` decimal(22,12) UNSIGNED NOT NULL,
`updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `rwg_career_totals`
--
ALTER TABLE `rwg_career_totals`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `rwg_goal_totals`
--
ALTER TABLE `rwg_goal_totals`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `goalid` (`goalid`) USING BTREE;
--
-- Indexes for table `rwg_hashes`
--
ALTER TABLE `rwg_hashes`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `type` (`type`,`meta`);
--
-- Indexes for table `rwg_year_totals`
--
ALTER TABLE `rwg_year_totals`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `rwg_career_totals`
--
ALTER TABLE `rwg_career_totals`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `rwg_goal_totals`
--
ALTER TABLE `rwg_goal_totals`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `rwg_hashes`
--
ALTER TABLE `rwg_hashes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `rwg_year_totals`
--
ALTER TABLE `rwg_year_totals`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment