software-admin-panel/database/schema.sql

314 lines
10 KiB
MySQL
Raw Normal View History

2018-07-20 19:57:48 -05:00
-- phpMyAdmin SQL Dump
-- version 4.6.4deb1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Feb 04, 2017 at 09:12 AM
-- Server version: 5.7.17-0ubuntu0.16.10.1
-- PHP Version: 7.0.13-0ubuntu0.16.10.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `softwareprotection`
--
-- --------------------------------------------------------
--
-- Table structure for table `activity_logs`
--
CREATE TABLE `activity_logs` (
`id` int(10) UNSIGNED NOT NULL,
`session_id` char(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`program_id` int(10) UNSIGNED NOT NULL,
`ip` int(10) UNSIGNED NOT NULL,
`activity_time` timestamp NULL DEFAULT NULL,
`action` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `groups`
--
CREATE TABLE `groups` (
`id` int(10) UNSIGNED NOT NULL,
`program_limit` int(10) UNSIGNED NOT NULL,
`update_limit` int(10) UNSIGNED NOT NULL,
`support_ticket_limit` int(10) UNSIGNED NOT NULL,
`name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `groups`
--
INSERT INTO `groups` (`id`, `program_limit`, `update_limit`, `support_ticket_limit`, `name`, `description`) VALUES
(1, 1, 0, 0, 'Trial version', 'Access to 1 program of your choice for 24 hours\r\nOne time fee $30'),
(2, 2, 4, 5, 'Bronze Package', 'Access to 2 programs\r\nLimited Updates (4)\r\n5 support tickets\r\nPrice: $ 50 weekly\r\nDiscount: 150 monthly'),
(3, 5, 4, 5, 'Silver Package', 'Access to 5 programs\r\nLimited Updates (4)\r\n5 support tickets\r\nPrice: $100 weekely\r\nDiscount: Monthly $300'),
(4, 10, 10, 15, 'Gold Package', 'Access to 10 programs\r\nLimited Updates (10)\r\n15 support tickets\r\nPrice: $200 weekely\r\nDiscount: Monthly $600'),
(5, 0, 0, 0, 'Platinum Package', 'Unlimited access to all programs\r\nUnlimited Updates\r\nUnlimited Support Tickets\r\nPrince: $500 weekly\r\nDiscount: Monthly $1500\r\n');
-- --------------------------------------------------------
--
-- Table structure for table `ip_bans`
--
CREATE TABLE `ip_bans` (
`id` int(10) UNSIGNED NOT NULL,
`ip` int(10) UNSIGNED NOT NULL,
`creation_time` timestamp NULL DEFAULT NULL,
`expiration_time` timestamp NULL DEFAULT NULL,
`reason` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `link_logs`
--
CREATE TABLE `link_logs` (
`id` int(10) UNSIGNED NOT NULL,
`session_id` char(32) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`program_id` int(10) UNSIGNED NOT NULL,
`server_time` timestamp NULL DEFAULT NULL,
`url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `permissions`
--
CREATE TABLE `permissions` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`program_id` int(10) UNSIGNED NOT NULL,
`expiration_time` timestamp NULL DEFAULT NULL,
`max_session_count` int(10) UNSIGNED NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `programs`
--
CREATE TABLE `programs` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`major_version` int(10) UNSIGNED NOT NULL DEFAULT '1',
`minor_version` int(10) UNSIGNED NOT NULL DEFAULT '0',
`revision_version` int(10) UNSIGNED NOT NULL DEFAULT '0',
`last_updated` int(10) UNSIGNED NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `sessions`
--
CREATE TABLE `sessions` (
`session_id` char(32) COLLATE utf8mb4_unicode_ci NOT NULL,
`terminated` tinyint(1) NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`program_id` int(10) UNSIGNED NOT NULL,
`creation_time` timestamp NULL DEFAULT NULL,
`last_ping_time` timestamp NULL DEFAULT NULL,
`ip` int(10) UNSIGNED NOT NULL,
`os_username` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `settings`
--
CREATE TABLE `settings` (
`id` int(10) UNSIGNED NOT NULL,
`display_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`display_desc` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`value` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`data_type` char(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'string'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `settings`
--
INSERT INTO `settings` (`id`, `display_name`, `display_desc`, `name`, `value`, `data_type`) VALUES
(1, 'Timezone', 'This affects how date stamps will be displayed globally.', 'timezone', 'America/Chicago', 'timezone'),
(2, 'Session Expiration Time', 'This controls how long it takes for lingering programs session to expire. Sessions expire if the server fails to ping the API.', 'session_expiration_time', '900', 'int'),
(3, 'Max Sessions Per User', 'Limits the maximum number of sessions per user. (0 is infinite)', 'session_max_per_user', '0', 'int'),
(4, 'Maintenance Mode', 'Temporarily blocks access to everything', 'maintenance_mode', '0', 'bool'),
(5, 'Maximum Login Attempts', 'This determines the maximum number of login attempts in a given time period before locking an IP address out of the system.', 'max_login_attempts', '5', 'int'),
(6, 'Login Attempts Time Limit (minutes)', 'This determines the span of time in minutes which you can make X number of failed login attempts.', 'max_login_attempts_time', '15', 'int'),
(7, 'Lockout Period (hours)', 'This determines the amount of time to lock someone out of the system in the event that they hit the max login threshold.', 'max_login_lockout_period', '24', 'int'),
(8, 'Activity Log Prune Age (days)', 'This determines how long to hold on to activity logs.', 'activity_log_prune_age', '14', 'int');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `activity_logs`
--
ALTER TABLE `activity_logs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `groups`
--
ALTER TABLE `groups`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `ip_bans`
--
ALTER TABLE `ip_bans`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `link_logs`
--
ALTER TABLE `link_logs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`),
ADD KEY `password_resets_token_index` (`token`);
--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `user_id` (`user_id`,`program_id`);
--
-- Indexes for table `programs`
--
ALTER TABLE `programs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
ADD PRIMARY KEY (`session_id`);
--
-- Indexes for table `settings`
--
ALTER TABLE `settings`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `activity_logs`
--
ALTER TABLE `activity_logs`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `groups`
--
ALTER TABLE `groups`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `ip_bans`
--
ALTER TABLE `ip_bans`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `link_logs`
--
ALTER TABLE `link_logs`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `programs`
--
ALTER TABLE `programs`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `settings`
--
ALTER TABLE `settings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;