sql
stringlengths 6
1.05M
|
|---|
<filename>oracle_script/Version_DDLs/4.1/YAO_migration_19c/yao_grants_run_as_sys.sql
--Run below grants as SYS
GRANT execute ON utl_mail TO YAOHDBA;
grant EXECUTE on IS_ROLE_GRANTED to PUBLIC ;
CREATE OR REPLACE PUBLIC SYNONYM IS_ROLE_GRANTED FOR IS_ROLE_GRANTED;
grant select on sys.dba_role_privs to SAVOIR_FAIRE;
grant select on sys.dba_role_privs to YAOHDBA;
@?/rdbms/admin/utlrp.sql
@?/rdbms/admin/utlrp.sql
|
<gh_stars>0
SELECT poi_id, name, id
FROM admin_boundary AS ab, {{ ref('poi_matched') }} AS poi
WHERE
kuwala_admin_level = 1 AND
st_contains(ab.geometry, st_setsrid(st_makepoint(poi.longitude, poi.latitude), 4326))
|
<gh_stars>0
SELECT i.uuid AS uuid,
it.uuid AS type_uuid,
it.name AS type_name,
i.name AS name,
i.description AS description,
i.published AS published,
u.uuid AS owner_uuid,
u.nick AS owner_nick,
u.provider_id AS owner_provider_id,
i.moderation AS moderation
FROM ingredient i
JOIN ingredient_type it on i.ingredient_type_uuid = it.uuid
LEFT JOIN "user" u on i.owner = u.uuid
WHERE i.uuid = :uuid
|
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 10, 2021 at 07:52 PM
-- Server version: 10.4.14-MariaDB
-- PHP Version: 7.4.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
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: `ultimate`
--
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
`id` int(10) UNSIGNED NOT NULL,
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`image` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` (`id`, `title`, `created_at`, `updated_at`, `image`) VALUES
(2, 'category1', '2020-11-16 06:02:45', '2021-01-10 18:50:06', '/img/profile/91ad9157c0fe3c3649911363cab4a493.png'),
(5, 'category3', '2021-01-10 18:47:32', '2021-01-10 18:47:32', '/img/profile/791a476858063523d6968e7cb2255e08.jpeg');
-- --------------------------------------------------------
--
-- Table structure for table `chat`
--
CREATE TABLE `chat` (
`id` int(10) UNSIGNED NOT NULL,
`msg` text COLLATE utf8mb4_unicode_ci NOT NULL,
`from_user` int(11) UNSIGNED DEFAULT NULL,
`booking_id` int(10) UNSIGNED DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`to_user` int(11) NOT NULL,
`msg_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT 'text'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `chat`
--
INSERT INTO `chat` (`id`, `msg`, `from_user`, `booking_id`, `created_at`, `updated_at`, `to_user`, `msg_type`) VALUES
(1, 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', 6, 1, '2020-11-13 12:20:23', NULL, 2, 'text'),
(2, 'iiiiiiiiiiiiii', 6, 1, '2020-11-24 12:23:15', NULL, 2, 'text'),
(3, 'kkkkkkkkkkkk', 2, 1, '2020-11-24 13:23:22', NULL, 6, 'text'),
(11, 'kkkkkkkllllllllllll', 2, 1, '2020-12-09 18:23:16', '2020-12-09 18:23:16', 6, 'text'),
(12, 'oooooooooo', 6, 1, '2020-12-09 18:23:26', '2020-12-09 18:23:26', 2, 'text'),
(13, 'ollllllllllll', 2, 1, '2020-12-09 18:23:43', '2020-12-09 18:23:43', 6, 'text'),
(14, 'okkkkjjjj', 6, 1, '2020-12-09 18:26:43', '2020-12-09 18:26:43', 2, 'text'),
(15, 'lllllllllllllljjjjjjjjjjjjj', 2, 1, '2020-12-09 18:26:51', '2020-12-09 18:26:51', 6, 'text'),
(16, 'jjjjjjjjjjkkkkkkkkkkk', 6, 1, '2020-12-09 18:28:42', '2020-12-09 18:28:42', 2, 'text'),
(19, 'hi theree', 6, 1, '2021-01-24 13:51:18', '2021-01-24 13:51:18', 2, 'text'),
(20, 'hi allow', 2, 1, '2021-01-24 13:55:09', '2021-01-24 13:55:09', 6, 'text'),
(21, 'hiiii', 2, 1, '2021-01-24 13:57:31', '2021-01-24 13:57:31', 6, 'text'),
(22, 'test', 2, 1, '2021-01-24 14:00:19', '2021-01-24 14:00:19', 6, 'text'),
(23, 'test test', 2, 1, '2021-01-24 14:01:46', '2021-01-24 14:01:46', 6, 'text'),
(24, 'ttt ttt', 2, 1, '2021-01-24 14:19:44', '2021-01-24 14:19:44', 6, 'text'),
(25, 'xxx rrr', 2, 1, '2021-01-24 14:20:43', '2021-01-24 14:20:43', 6, 'text'),
(26, 'okkkk', 6, 1, '2021-01-24 14:20:54', '2021-01-24 14:20:54', 2, 'text'),
(27, 'okk', 2, 1, '2021-01-24 14:34:02', '2021-01-24 14:34:02', 6, 'text'),
(41, '/img/profile/2279579bfe2220d345be09476d5414c6.jpeg', 2, 1, '2021-01-30 12:45:06', '2021-01-30 12:45:06', 6, 'image'),
(42, '/img/profile/cc6fecc168620d9663b47ff7395de794.png', 6, 1, '2021-01-30 12:50:51', '2021-01-30 12:50:51', 2, 'image'),
(43, 'xxx', 2, 1, '2021-01-30 12:56:32', '2021-01-30 12:56:32', 6, 'text'),
(44, 'test', 6, 1, '2021-01-31 06:37:05', '2021-01-31 06:37:05', 2, 'text'),
(45, 'okkk', 2, 1, '2021-01-31 06:37:35', '2021-01-31 06:37:35', 6, 'text'),
(46, 'okkkk', 2, 1, '2021-01-31 06:37:55', '2021-01-31 06:37:55', 6, 'text'),
(51, '/img/profile/042b5c6cace31921c9fda802db36cc36.gif', 2, 1, '2021-02-02 15:41:45', '2021-02-02 15:41:45', 6, 'image'),
(52, 'kiiiiiiiiiiiiiii', 2, 1, '2021-02-02 15:46:16', '2021-02-02 15:46:16', 6, 'text'),
(53, 'xxxxxxxxxx', 2, 1, '2021-02-02 15:57:43', '2021-02-02 15:57:43', 6, 'text'),
(54, 'ttttttt', 2, 1, '2021-02-02 15:58:52', '2021-02-02 15:58:52', 6, 'text'),
(55, '/img/profile/00cd1337679899d95cdd820babc29c8f.gif', 2, 1, '2021-02-02 15:59:01', '2021-02-02 15:59:01', 6, 'image'),
(56, '/img/profile/c13cd6cb23844e68463347461843dfa9.gif', 6, 1, '2021-02-02 16:05:51', '2021-02-02 16:05:51', 2, 'image'),
(57, 'kkkkkkkkkkk,,,,', 6, 1, '2021-02-02 16:06:02', '2021-02-02 16:06:02', 2, 'text'),
(58, '/img/profile/46fb4b7626eadfff45929ee06d03e34a.jpg', 6, 1, '2021-02-02 16:06:59', '2021-02-02 16:06:59', 2, 'image'),
(59, 'lllllllllll', 6, 1, '2021-02-02 16:07:10', '2021-02-02 16:07:10', 2, 'text'),
(60, '/img/profile/5c2998d8055e75e43c339af8abb3e5a1.jpeg', 2, 1, '2021-02-03 11:56:52', '2021-02-03 11:56:52', 6, 'image'),
(61, 'vvvv', 6, 1, '2021-03-08 19:15:55', '2021-03-08 19:15:55', 2, 'text'),
(62, 'jjjj', 6, 1, '2021-03-08 19:32:35', '2021-03-08 19:32:35', 2, 'text'),
(63, '/img/profile/6cbd0f1e0104a8c35aa65239ecce9628.png', 6, 1, '2021-03-08 19:32:47', '2021-03-08 19:32:47', 2, 'image');
-- --------------------------------------------------------
--
-- Table structure for table `complete_excercises`
--
CREATE TABLE `complete_excercises` (
`id` int(11) NOT NULL,
`programme_id` int(11) NOT NULL,
`day_num` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `complete_excercises`
--
INSERT INTO `complete_excercises` (`id`, `programme_id`, `day_num`, `user_id`, `created_at`, `updated_at`) VALUES
(4, 1, 1, 2, '2021-02-03 15:20:36', '2021-02-03 15:20:36'),
(5, 13, 2, 2, '2021-02-03 15:20:46', '2021-02-03 15:20:46');
-- --------------------------------------------------------
--
-- Table structure for table `countries`
--
CREATE TABLE `countries` (
`id` int(10) UNSIGNED NOT NULL,
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `countries`
--
INSERT INTO `countries` (`id`, `title`, `created_at`, `updated_at`) VALUES
(2, 'city 1', '2020-11-16 07:14:25', '2020-11-16 07:14:25');
-- --------------------------------------------------------
--
-- Table structure for table `messages`
--
CREATE TABLE `messages` (
`id` int(10) UNSIGNED NOT NULL,
`msg` text COLLATE utf8mb4_unicode_ci NOT NULL,
`send_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`from_user` int(11) UNSIGNED DEFAULT NULL,
`request_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `messages`
--
INSERT INTO `messages` (`id`, `msg`, `send_date`, `from_user`, `request_id`, `created_at`, `updated_at`) VALUES
(1, 'i will see the problem', '2020-11-15 22:00:00', 1, 1, '2020-11-16 16:35:10', '2020-11-16 16:35:10'),
(2, 'hi thereee any problem alse', '2020-11-17 22:00:00', 1, 1, '2020-11-18 10:57:44', '2020-11-18 10:57:44'),
(3, 'is the problem exist', '2020-11-17 22:00:00', 1, 1, '2020-11-18 18:45:04', '2020-11-18 18:45:04'),
(4, 'ok , bro', '2021-01-18 22:00:00', 2, 1, '2021-01-19 14:55:58', '2021-01-19 14:55:58'),
(5, 'ok', '2021-01-18 22:00:00', 2, 1, '2021-01-19 15:05:27', '2021-01-19 15:05:27'),
(6, 'hiiii theree i have problem', '2021-01-30 22:00:00', 2, 3, '2021-01-31 14:03:31', '2021-01-31 14:03:31'),
(7, 'okkkk', '2021-01-30 22:00:00', 1, 3, '2021-01-31 14:03:45', '2021-01-31 14:03:45'),
(8, 'hi', '2021-01-30 22:00:00', 1, 4, '2021-01-31 15:00:04', '2021-01-31 15:00:04'),
(9, 'i have problem', '2021-01-30 22:00:00', 2, 4, '2021-01-31 15:00:23', '2021-01-31 15:00:23');
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2020_11_04_174221_countries', 1),
(4, '2020_11_04_192309_roles', 1),
(5, '2020_11_04_192534_add_role_to_users', 1),
(8, '2020_11_14_093517_add_picture_to_user', 2),
(9, '2020_11_14_093810_add_discription_to_user', 2),
(10, '2020_11_14_180803_create_package_table', 3),
(11, '2020_11_14_195405_add_package_type_user_id', 4),
(12, '2020_11_15_095929_add_other_details_to_packages', 5),
(13, '2020_11_15_110411_add_transaction_table', 6),
(14, '2020_11_16_075324_add_category_table', 7),
(15, '2020_11_16_084919_add_category_city_in_users', 8),
(17, '2020_11_16_145252_add_notifications_table', 9),
(18, '2020_11_16_172556_add_requests_table', 10),
(19, '2020_11_16_172749_add_messages_table', 11),
(20, '2020_11_18_072910_add_programme_design', 12),
(21, '2020_11_18_073651_add_type_to_programm_design', 13),
(22, '2020_11_24_115415_add_chat_messages', 14),
(23, '2020_11_24_144102_add_programm_design_calendar', 15),
(24, '2020_11_24_161639_add_programme_desig_to_calendar', 16),
(25, '2020_11_24_183343_add_images_programme_design', 17),
(26, '2020_11_24_214943_add_trainer_withdrow', 18);
-- --------------------------------------------------------
--
-- Table structure for table `muscles`
--
CREATE TABLE `muscles` (
`id` int(11) NOT NULL,
`title` varchar(250) DEFAULT NULL,
`title_ar` varchar(250) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL,
`type` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `muscles`
--
INSERT INTO `muscles` (`id`, `title`, `title_ar`, `created_at`, `updated_at`, `type`) VALUES
(3, 'Chest', 'Chest', '2021-03-01 10:37:35', '2021-03-01 10:37:35', 'muscles'),
(5, 'Cardio', 'Cardio', '2021-03-01 10:39:38', '2021-03-01 10:39:38', 'exercisetype'),
(6, 'Bands', 'Bands', '2021-03-01 10:40:24', '2021-03-01 10:40:24', 'equipment'),
(7, 'Compound', 'Compound', '2021-03-01 10:40:42', '2021-03-01 10:40:42', 'mechanicstype'),
(8, 'Beginner', 'Beginner', '2021-03-01 10:40:57', '2021-03-01 10:40:57', 'level');
-- --------------------------------------------------------
--
-- Table structure for table `notifications`
--
CREATE TABLE `notifications` (
`id` int(10) UNSIGNED NOT NULL,
`msg` text COLLATE utf8mb4_unicode_ci NOT NULL,
`send_date` timestamp NULL DEFAULT NULL,
`user_id` int(11) UNSIGNED DEFAULT NULL,
`is_send` int(11) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`send_from` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `notifications`
--
INSERT INTO `notifications` (`id`, `msg`, `send_date`, `user_id`, `is_send`, `created_at`, `updated_at`, `send_from`) VALUES
(3, 'notifyyyyyyyyyyyyyyyy', '2021-01-27 22:00:00', 10, 1, '2020-11-18 10:58:13', '2021-01-27 22:03:35', NULL),
(4, 'hi user there are new notification', '2021-01-27 22:00:00', 2, 1, '2020-11-18 18:45:39', '2021-01-27 22:04:23', NULL),
(14, 'test', '2021-01-30 22:00:00', 2, 1, '2021-01-31 06:37:05', '2021-01-31 06:37:05', 6),
(15, 'okkk', '2021-01-30 22:00:00', 6, 1, '2021-01-31 06:37:35', '2021-01-31 06:37:35', 2),
(16, 'okkkk', '2021-01-30 22:00:00', 6, 1, '2021-01-31 06:37:56', '2021-01-31 06:37:56', 2),
(17, 'hi', '2021-01-30 22:00:00', 6, 1, '2021-01-31 13:44:05', '2021-01-31 13:44:05', 2),
(18, 'welcome', '2021-01-30 22:00:00', 2, 1, '2021-01-31 13:44:21', '2021-01-31 13:44:21', 6),
(19, '/img/profile/caaa0bfb203f5fe0b37a62181e41abba.png', '2021-01-30 22:00:00', 6, 1, '2021-01-31 13:44:54', '2021-01-31 13:44:54', 2),
(20, '/img/profile/a4b63372963ac2af8a70bf9001541454.png', '2021-01-30 22:00:00', 2, 1, '2021-01-31 13:45:16', '2021-01-31 13:45:16', 6),
(21, '/img/profile/042b5c6cace31921c9fda802db36cc36.gif', '2021-02-01 22:00:00', 6, 1, '2021-02-02 15:41:45', '2021-02-02 15:41:45', 2),
(22, 'kiiiiiiiiiiiiiii', '2021-02-01 22:00:00', 6, 1, '2021-02-02 15:46:16', '2021-02-02 15:46:16', 2),
(23, 'xxxxxxxxxx', '2021-02-01 22:00:00', 6, 1, '2021-02-02 15:57:43', '2021-02-02 15:57:43', 2),
(24, 'ttttttt', '2021-02-01 22:00:00', 6, 1, '2021-02-02 15:58:52', '2021-02-02 15:58:52', 2),
(25, '/img/profile/00cd1337679899d95cdd820babc29c8f.gif', '2021-02-01 22:00:00', 6, 1, '2021-02-02 15:59:01', '2021-02-02 15:59:01', 2),
(26, '/img/profile/c13cd6cb23844e68463347461843dfa9.gif', '2021-02-01 22:00:00', 2, 1, '2021-02-02 16:05:51', '2021-02-02 16:05:51', 6),
(27, 'kkkkkkkkkkk,,,,', '2021-02-01 22:00:00', 2, 1, '2021-02-02 16:06:02', '2021-02-02 16:06:02', 6),
(28, '/img/profile/46fb4b7626eadfff45929ee06d03e34a.jpg', '2021-02-01 22:00:00', 2, 1, '2021-02-02 16:06:59', '2021-02-02 16:06:59', 6),
(29, 'lllllllllll', '2021-02-01 22:00:00', 2, 1, '2021-02-02 16:07:10', '2021-02-02 16:07:10', 6),
(30, '/img/profile/5c2998d8055e75e43c339af8abb3e5a1.jpeg', '2021-02-02 22:00:00', 6, 1, '2021-02-03 11:56:52', '2021-02-03 11:56:52', 2),
(31, 'vvvv', '2021-03-07 22:00:00', 2, 1, '2021-03-08 19:15:55', '2021-03-08 19:15:55', 6),
(32, 'jjjj', '2021-03-07 22:00:00', 2, 1, '2021-03-08 19:32:35', '2021-03-08 19:32:35', 6),
(33, '/img/profile/6cbd0f1e0104a8c35aa65239ecce9628.png', '2021-03-07 22:00:00', 2, 1, '2021-03-08 19:32:47', '2021-03-08 19:32:47', 6);
-- --------------------------------------------------------
--
-- Table structure for table `package`
--
CREATE TABLE `package` (
`id` bigint(20) UNSIGNED NOT NULL,
`package_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`package_desc` text COLLATE utf8mb4_unicode_ci NOT NULL,
`package_duration_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`package_duration` int(11) NOT NULL,
`package_price` double(8,2) DEFAULT NULL,
`package_questionaire` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`package_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` int(11) UNSIGNED NOT NULL,
`accepted_from_admin` tinyint(1) NOT NULL DEFAULT 0,
`package_status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`package_name_ar` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`package_desc_ar` text COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `package`
--
INSERT INTO `package` (`id`, `package_name`, `package_desc`, `package_duration_type`, `package_duration`, `package_price`, `package_questionaire`, `created_at`, `updated_at`, `package_type`, `user_id`, `accepted_from_admin`, `package_status`, `package_name_ar`, `package_desc_ar`) VALUES
(1, 'package 1', 'package 1 111111111111111111111', 'week', 2, 200.00, 'ajdhajhdjas', NULL, '2021-01-11 17:08:21', 'paid', 6, 1, 'active', 'باك 1444', 'باكككككككككككك لالالالا'),
(5, 'package2222222', 'ggggggggggggggggg', 'week', 4, 100.00, 'ssssssssssssssssss', '2021-01-11 16:41:22', '2021-01-11 16:44:19', 'free', 6, 0, 'active', '', '');
-- --------------------------------------------------------
--
-- Table structure for table `package_user_plan`
--
CREATE TABLE `package_user_plan` (
`day_num` int(11) NOT NULL,
`package_id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED DEFAULT NULL,
`programme_design_id` int(10) UNSIGNED DEFAULT NULL,
`recepe_id` int(10) UNSIGNED DEFAULT NULL,
`section_id` int(10) UNSIGNED DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
`transaction_id` int(11) DEFAULT NULL,
`id` int(11) NOT NULL,
`set_num` varchar(150) DEFAULT NULL,
`suplement_serving_size` varchar(150) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `package_user_plan`
--
INSERT INTO `package_user_plan` (`day_num`, `package_id`, `user_id`, `programme_design_id`, `recepe_id`, `section_id`, `created_at`, `updated_at`, `transaction_id`, `id`, `set_num`, `suplement_serving_size`) VALUES
(8, 1, 2, 4, NULL, NULL, '2020-12-21 17:19:53', '2020-12-21 17:19:53', 1, 12, NULL, ''),
(1, 1, 2, 1, NULL, NULL, '2021-01-24 17:05:00', '2020-12-28 07:06:21', 1, 34, '3 sets x 12', ''),
(1, 1, 2, 2, NULL, NULL, '2021-01-24 17:11:31', '2020-12-28 10:40:32', 1, 35, '3 sets x 15', ''),
(1, 1, 2, 6, NULL, NULL, '2020-12-28 10:51:08', '2020-12-28 10:51:08', 1, 37, NULL, '6'),
(8, 1, 2, 1, NULL, NULL, '2021-01-04 20:15:57', '2021-01-04 20:15:57', 1, 41, NULL, NULL),
(8, 1, 2, 2, NULL, NULL, '2021-01-04 20:15:57', '2021-01-04 20:15:57', 1, 42, NULL, NULL),
(8, 1, 2, 6, NULL, NULL, '2021-01-04 20:15:57', '2021-01-04 20:15:57', 1, 43, NULL, NULL),
(8, 1, 2, 11, NULL, NULL, '2021-01-04 20:15:57', '2021-01-04 20:15:57', 1, 44, NULL, NULL),
(1, 1, 10, 1, NULL, NULL, '2021-01-04 20:17:09', '2021-01-04 20:17:09', 2, 45, NULL, NULL),
(1, 1, 10, 2, NULL, NULL, '2021-01-04 20:17:09', '2021-01-04 20:17:09', 2, 46, NULL, NULL),
(1, 1, 10, 6, NULL, NULL, '2021-01-04 20:17:09', '2021-01-04 20:17:09', 2, 47, NULL, NULL),
(1, 1, 10, 11, NULL, NULL, '2021-01-04 20:17:09', '2021-01-04 20:17:09', 2, 48, NULL, NULL),
(2, 1, 10, 1, NULL, NULL, '2021-01-04 20:33:58', '2021-01-04 20:33:58', 2, 49, NULL, NULL),
(2, 1, 10, 2, NULL, NULL, '2021-01-04 20:33:58', '2021-01-04 20:33:58', 2, 50, NULL, NULL),
(2, 1, 10, 6, NULL, NULL, '2021-01-04 20:33:58', '2021-01-04 20:33:58', 2, 51, NULL, NULL),
(2, 1, 10, 11, NULL, NULL, '2021-01-04 20:33:58', '2021-01-04 20:33:58', 2, 52, NULL, NULL),
(9, 1, 10, 1, NULL, NULL, '2021-01-04 20:34:43', '2021-01-04 20:34:43', 2, 53, NULL, NULL),
(9, 1, 10, 2, NULL, NULL, '2021-01-04 20:34:43', '2021-01-04 20:34:43', 2, 54, NULL, NULL),
(9, 1, 10, 6, NULL, NULL, '2021-01-04 20:34:43', '2021-01-04 20:34:43', 2, 55, NULL, NULL),
(9, 1, 10, 11, NULL, NULL, '2021-01-04 20:34:43', '2021-01-04 20:34:43', 2, 56, NULL, NULL),
(14, 1, 2, 1, NULL, NULL, '2021-01-11 18:22:51', '2021-01-11 18:22:51', 1, 60, NULL, NULL),
(14, 1, 2, 2, NULL, NULL, '2021-01-11 18:22:51', '2021-01-11 18:22:51', 1, 61, NULL, NULL),
(14, 1, 2, 6, NULL, NULL, '2021-01-11 18:22:51', '2021-01-11 18:22:51', 1, 62, NULL, NULL),
(14, 1, 2, 11, NULL, NULL, '2021-01-11 18:22:51', '2021-01-11 18:22:51', 1, 63, NULL, NULL),
(1, 1, 2, 13, NULL, NULL, '2021-01-24 15:09:52', '2021-01-24 15:09:52', 1, 65, '3 sets x 12', NULL),
(1, 1, 2, NULL, 2, NULL, '2021-01-24 16:32:37', '2021-01-24 16:32:37', 1, 66, NULL, NULL),
(2, 1, 2, 13, NULL, NULL, '2021-01-24 19:00:57', '2021-01-24 19:00:57', 1, 67, '2', NULL),
(1, 1, 2, 2, NULL, NULL, '2021-01-30 10:07:54', '2021-01-30 10:07:54', 6, 68, '5', NULL),
(1, 1, 2, 1, NULL, NULL, '2021-01-31 13:46:21', '2021-01-31 13:46:21', 10, 69, '3 sets x 12', NULL),
(1, 1, 2, NULL, 2, NULL, '2021-01-31 13:46:55', '2021-01-31 13:46:55', 10, 70, NULL, NULL),
(1, 1, 2, 6, NULL, NULL, '2021-01-31 13:47:29', '2021-01-31 13:47:29', 10, 71, NULL, NULL),
(1, 1, 2, 2, NULL, NULL, '2021-01-31 13:48:04', '2021-01-31 13:48:04', 10, 72, NULL, NULL),
(2, 1, 2, 6, NULL, NULL, '2021-03-08 13:55:52', '2021-03-08 13:55:52', 1, 84, NULL, NULL),
(2, 1, 2, 1, NULL, NULL, '2021-03-08 14:08:17', '2021-03-08 14:08:17', 1, 85, NULL, NULL),
(2, 1, 2, 2, NULL, NULL, '2021-03-08 14:08:17', '2021-03-08 14:08:17', 1, 86, NULL, NULL),
(2, 1, 2, 13, NULL, NULL, '2021-03-08 14:08:17', '2021-03-08 14:08:17', 1, 87, NULL, NULL),
(1, 1, 6, 3, NULL, NULL, '2021-03-08 15:59:10', '2021-03-08 15:59:10', 1, 91, NULL, NULL),
(1, 1, 6, 4, NULL, NULL, '2021-03-08 15:59:10', '2021-03-08 15:59:10', 1, 92, NULL, NULL);
-- --------------------------------------------------------
--
-- 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 `programe_design_integrent`
--
CREATE TABLE `programe_design_integrent` (
`id` int(11) UNSIGNED NOT NULL,
`programme_id` int(11) UNSIGNED NOT NULL,
`serving_size` varchar(250) NOT NULL,
`calories` float NOT NULL,
`carbs` float NOT NULL,
`protein` float NOT NULL,
`fat` float NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `programe_design_integrent`
--
INSERT INTO `programe_design_integrent` (`id`, `programme_id`, `serving_size`, `calories`, `carbs`, `protein`, `fat`, `created_at`, `updated_at`) VALUES
(8, 5, '1', 500, 500, 500, 500, '2020-12-06 19:39:31', '2020-12-06 19:39:31'),
(9, 16, '2', 200, 200, 200, 200, '2020-12-07 17:33:07', '2020-12-07 17:33:07'),
(10, 16, '3', 300, 300, 300, 300, '2020-12-07 17:33:07', '2020-12-07 17:33:07'),
(11, 16, '4', 400, 400, 400, 400, '2020-12-07 17:33:07', '2020-12-07 17:33:07');
-- --------------------------------------------------------
--
-- Table structure for table `programme_images`
--
CREATE TABLE `programme_images` (
`id` int(10) UNSIGNED NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`programme_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `programme_images`
--
INSERT INTO `programme_images` (`id`, `image`, `programme_id`, `created_at`, `updated_at`) VALUES
(1, '/img/programme/50342d96a8c99c04a2d40e9ab106e5b3.jpg', 6, '2020-11-24 16:40:33', '2020-11-24 16:40:33'),
(9, '/img/programme/a83f72adc5906dcd5f67da308be2dbae.jpg', 11, '2020-12-05 06:10:21', '2020-12-05 06:10:21'),
(10, '/img/programme/6a6985356d936742c56cb94eeb0608c6.jpg', 11, '2020-12-05 06:10:21', '2020-12-05 06:10:21'),
(11, '/img/programme/0de3ea07f4b835cce46c9a345bfd1406.jpg', 11, '2020-12-05 06:10:21', '2020-12-05 06:10:21'),
(12, '/img/programme/2849ea704328db2223e31d6df17538b3.jpg', 13, '2020-12-05 06:32:03', '2020-12-05 06:32:03'),
(14, '/img/programme/5fd11a44647259daa1c65abfeaf339f4.jpg', 13, '2020-12-05 09:34:27', '2020-12-05 09:34:27'),
(16, '/img/programme/031d90cfd0685209bb12ed1462eddb7c.png', 1, '2021-01-24 15:00:50', '2021-01-24 15:00:50');
-- --------------------------------------------------------
--
-- Table structure for table `programm_designs`
--
CREATE TABLE `programm_designs` (
`id` int(10) UNSIGNED NOT NULL,
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`desc` text COLLATE utf8mb4_unicode_ci NOT NULL,
`vedio` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`media_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`number_of_sets` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`serving_size` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`title_ar` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
`desc_ar` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
`num_of_reps` int(11) DEFAULT NULL,
`muscles` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`exercise_type` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`equipment` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`mechanics_type` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`level` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `programm_designs`
--
INSERT INTO `programm_designs` (`id`, `title`, `desc`, `vedio`, `media_type`, `created_at`, `updated_at`, `type`, `number_of_sets`, `serving_size`, `title_ar`, `desc_ar`, `num_of_reps`, `muscles`, `exercise_type`, `equipment`, `mechanics_type`, `level`) VALUES
(1, 'excerices 1', 'Look, my liege! The Knights Who Say Ni demand a sacrifice! …Are you suggesting that coconuts migr', NULL, 'image', '2020-11-18 07:11:46', '2021-01-24 15:00:50', 'exercises', '3 sets x 12', NULL, 'test', 'test', NULL, NULL, NULL, NULL, NULL, NULL),
(2, 'excercise two', 'excerrrrrrrrrrrrrrrrrrrrrrrr', 'https://www.youtube.com/embed/oc4QS2USKmk', 'vedio', '2020-11-18 10:06:40', '2020-11-24 16:09:37', 'exercises', NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(3, 'excercise3333', 'this is excercise 333', NULL, 'image', '2020-11-18 10:59:02', '2020-11-18 11:39:13', 'exercises', NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(4, 'excercise new edit', 'this is excercies new this is excercies new this is excercies new this is excercies new this is excercies new this is excercies new this is excercies new', '', 'image', '2020-11-18 18:46:48', '2020-11-19 11:56:31', 'exercises', NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(5, 'daily meals content', 'daily meals content daily meals content daily meals content', NULL, 'image', '2020-11-24 14:41:20', '2020-12-06 19:39:31', 'dietary meals', NULL, NULL, 'llllllllllllllllllll', 'kkkkkkkkkkkkkkkkkkkkkkkkkkk', NULL, NULL, NULL, NULL, NULL, NULL),
(6, 'food 3', 'food 3 food 3 food 3 food 3 food 3 food 3', '', 'image', '2020-11-24 15:16:11', '2020-11-24 16:59:17', 'food supplements', NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(11, 'test images', 'test test', NULL, 'image', '2020-12-05 06:10:21', '2020-12-05 06:10:21', 'exercises', NULL, NULL, '', '', NULL, NULL, NULL, NULL, NULL, NULL),
(12, 'test vedio', 'kkkkkkkkkkkkkkkkllllllllllllllllllll', 'https://www.youtube.com/embed/oc4QS2USKmk', 'vedio', '2020-12-05 06:14:56', '2020-12-05 09:39:49', 'exercises', '3', NULL, 'iiiiiiiiiiiiiiiiiiii', 'vvvvvvvvvvvvvvvv', NULL, NULL, NULL, NULL, NULL, NULL),
(13, 'test excercise', 'nnnnnnnnnnnnnnnn', NULL, 'image', '2020-12-05 06:32:03', '2020-12-05 09:34:27', 'exercises', '2', NULL, 'oooooooooooooo', 'pppppppppppppp', NULL, NULL, NULL, NULL, NULL, NULL),
(14, 'test supplement', 'lllllllllllllllllllll', NULL, NULL, '2020-12-05 06:35:12', '2020-12-05 09:31:28', 'food supplements', NULL, '3', 'kkkkkkkkkkkkkk', 'ppppppppppp', NULL, NULL, NULL, NULL, NULL, NULL),
(16, 'chicken', 'ccccccccccccccc', NULL, NULL, '2020-12-05 08:13:36', '2020-12-07 17:33:07', 'dietary meals', NULL, NULL, 'cccccccccccccccc', 'ttttttttttttttttttttttt', NULL, NULL, NULL, NULL, NULL, NULL),
(17, 'test tessss', 'wkdlwkldkwdlkwd', 'https://www.youtube.com/embed/oc4QS2USKmk', 'vedio', '2021-01-30 09:24:49', '2021-03-01 09:28:03', 'exercises', '3', NULL, 'tes', 'fgl;rkgkrkglrkg', 2, NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `programm_design_calendar`
--
CREATE TABLE `programm_design_calendar` (
`id` int(10) UNSIGNED NOT NULL,
`start` timestamp NULL DEFAULT NULL,
`end` timestamp NULL DEFAULT NULL,
`booking_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`programme_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `programm_design_calendar`
--
INSERT INTO `programm_design_calendar` (`id`, `start`, `end`, `booking_id`, `created_at`, `updated_at`, `programme_id`) VALUES
(1, '2020-11-20 16:26:16', '2020-11-21 16:26:16', 1, NULL, NULL, 1),
(2, '2020-11-23 16:41:37', NULL, 1, NULL, NULL, 5),
(3, '2020-11-26 17:16:22', '2020-11-27 17:16:22', 1, NULL, NULL, 6);
-- --------------------------------------------------------
--
-- Table structure for table `questionaire`
--
CREATE TABLE `questionaire` (
`id` int(11) NOT NULL,
`message` varchar(500) NOT NULL,
`answer` varchar(750) NOT NULL,
`user_id` int(11) NOT NULL,
`transaction_id` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `questionaire`
--
INSERT INTO `questionaire` (`id`, `message`, `answer`, `user_id`, `transaction_id`, `created_at`, `updated_at`) VALUES
(1, 'my first question', '', 2, 1, '2021-03-01 17:42:42', '2021-03-01 15:59:47');
-- --------------------------------------------------------
--
-- Table structure for table `questions`
--
CREATE TABLE `questions` (
`id` int(11) NOT NULL,
`title` varchar(250) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL,
`title_ar` varchar(250) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `questions`
--
INSERT INTO `questions` (`id`, `title`, `created_at`, `updated_at`, `title_ar`) VALUES
(1, 'weight', '2021-03-09 06:33:04', '2021-03-09 06:33:04', 'الوزن'),
(2, 'height', '2021-03-09 06:33:20', '2021-03-09 06:33:20', 'الطول');
-- --------------------------------------------------------
--
-- Table structure for table `questions_answers`
--
CREATE TABLE `questions_answers` (
`id` int(11) NOT NULL,
`question_id` int(11) NOT NULL,
`answer` text DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL,
`transaction_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `questions_answers`
--
INSERT INTO `questions_answers` (`id`, `question_id`, `answer`, `created_at`, `updated_at`, `transaction_id`) VALUES
(3, 1, '100', '2021-03-09 18:31:52', '2021-03-09 18:31:52', 16),
(4, 2, '160', '2021-03-09 18:31:52', '2021-03-09 18:31:52', 16);
-- --------------------------------------------------------
--
-- Table structure for table `ready_plan`
--
CREATE TABLE `ready_plan` (
`id` int(11) NOT NULL,
`day_num` int(11) NOT NULL,
`programme_design_id` int(10) UNSIGNED NOT NULL,
`recepe_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL,
`set_num` varchar(150) DEFAULT NULL,
`suplement_serving_size` varchar(150) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `ready_plan`
--
INSERT INTO `ready_plan` (`id`, `day_num`, `programme_design_id`, `recepe_id`, `created_at`, `updated_at`, `set_num`, `suplement_serving_size`) VALUES
(3, 1, 1, 0, '2021-03-10 16:30:10', '2021-03-10 16:30:10', '3 sets x 12', NULL),
(4, 1, 2, 0, '2021-03-10 16:30:10', '2021-03-10 16:30:10', '20', NULL),
(5, 2, 1, 0, '2021-03-10 16:30:29', '2021-03-10 16:30:29', '3 sets x 12', NULL),
(6, 1, 6, 0, '2021-03-10 16:30:50', '2021-03-10 16:30:50', NULL, '3'),
(7, 7, 0, 2, '2021-03-10 16:31:11', '2021-03-10 16:31:11', NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `receips`
--
CREATE TABLE `receips` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(250) NOT NULL,
`desciption` text NOT NULL,
`image` varchar(250) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `receips`
--
INSERT INTO `receips` (`id`, `name`, `desciption`, `image`, `created_at`, `updated_at`) VALUES
(2, 'recep one', 'recep one recep one recep one recep one v', '/img/programme/b35e74f0f2ca5212cfabf1b806bd5961.jpg', '2020-12-06 22:27:05', '2020-12-06 20:27:05'),
(3, 'recep2', 'ccccccccccccccbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', '/img/programme/3097cc8d54d8745b7ea2590678e6794a.jpg', '2020-12-21 14:50:22', '2020-12-21 14:50:22');
-- --------------------------------------------------------
--
-- Table structure for table `receips_integration`
--
CREATE TABLE `receips_integration` (
`recep_id` int(11) UNSIGNED NOT NULL,
`integrate_programme_id` int(11) UNSIGNED NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
`serving` int(11) NOT NULL,
`programme_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `receips_integration`
--
INSERT INTO `receips_integration` (`recep_id`, `integrate_programme_id`, `created_at`, `updated_at`, `serving`, `programme_id`) VALUES
(2, 8, '2020-12-06 20:27:05', '2020-12-06 20:27:05', 2, 5),
(3, 8, '2020-12-21 14:51:20', '2020-12-21 14:51:20', 4, 5),
(3, 11, '2020-12-21 14:51:20', '2020-12-21 14:51:20', 5, 16),
(2, 8, '2020-12-06 20:27:05', '2020-12-06 20:27:05', 2, 5),
(3, 8, '2020-12-21 14:51:20', '2020-12-21 14:51:20', 4, 5),
(3, 11, '2020-12-21 14:51:20', '2020-12-21 14:51:20', 5, 16);
-- --------------------------------------------------------
--
-- Table structure for table `recepis_sections`
--
CREATE TABLE `recepis_sections` (
`id` int(11) UNSIGNED NOT NULL,
`section_name` varchar(250) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `recepis_sections`
--
INSERT INTO `recepis_sections` (`id`, `section_name`, `created_at`, `updated_at`) VALUES
(2, 'Lanch', '2020-12-06 18:53:32', '2020-12-06 16:53:32'),
(3, 'Snakes', '2020-12-06 18:54:03', '2020-12-06 16:54:03'),
(5, 'Dinner', '2020-12-06 16:54:16', '2020-12-06 16:54:16'),
(6, 'Snake two', '2020-12-07 17:50:54', '2020-12-07 17:50:54');
-- --------------------------------------------------------
--
-- Table structure for table `requests`
--
CREATE TABLE `requests` (
`id` int(10) UNSIGNED NOT NULL,
`msg` text COLLATE utf8mb4_unicode_ci NOT NULL,
`send_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`user_id` int(11) UNSIGNED DEFAULT NULL,
`status` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`subject` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `requests`
--
INSERT INTO `requests` (`id`, `msg`, `send_date`, `user_id`, `status`, `created_at`, `updated_at`, `subject`) VALUES
(1, 'this is first request', '2021-01-19 17:50:30', 2, 'resolved', NULL, '2021-01-19 15:50:30', 'request one'),
(2, 'test test test support', '2021-01-18 22:00:00', 2, 'in progress', '2021-01-19 15:50:02', '2021-01-19 15:50:02', 'test support'),
(3, 'new hiiiii', '2021-01-31 16:34:32', 2, 'resolved', '2021-01-31 14:02:38', '2021-01-31 14:34:32', 'new ticket from user'),
(4, 'this is new ticket', '2021-01-31 17:00:45', 2, 'resolved', '2021-01-31 14:59:35', '2021-01-31 15:00:45', 'new ticket test2');
-- --------------------------------------------------------
--
-- Table structure for table `roles`
--
CREATE TABLE `roles` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `roles`
--
INSERT INTO `roles` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'admin', NULL, NULL),
(2, 'Trainer', NULL, NULL),
(3, 'user', NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `sliders`
--
CREATE TABLE `sliders` (
`id` int(11) NOT NULL,
`image` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `sliders`
--
INSERT INTO `sliders` (`id`, `image`, `created_at`, `updated_at`) VALUES
(3, '/img/profile/b5bbb2f899f5c20083abab1f82a5f77e.png', '2021-02-03 09:57:50', '2021-02-03 09:57:50');
-- --------------------------------------------------------
--
-- Table structure for table `tickets`
--
CREATE TABLE `tickets` (
`id` int(11) NOT NULL,
`title` varchar(250) NOT NULL,
`msg` text NOT NULL,
`send_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`user_id` int(11) NOT NULL,
`status` varchar(250) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL,
`assign_to_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `transactions`
--
CREATE TABLE `transactions` (
`id` int(10) UNSIGNED NOT NULL,
`transaction_num` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` int(11) UNSIGNED DEFAULT NULL,
`trainer_id` int(11) UNSIGNED DEFAULT NULL,
`package_id` bigint(20) UNSIGNED DEFAULT NULL,
`transfer_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`is_payable` int(11) NOT NULL,
`transfer_payment_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`paymentToken` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`paymentId` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`amount` double(8,2) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `transactions`
--
INSERT INTO `transactions` (`id`, `transaction_num`, `user_id`, `trainer_id`, `package_id`, `transfer_date`, `is_payable`, `transfer_payment_type`, `paymentToken`, `paymentId`, `amount`, `created_at`, `updated_at`) VALUES
(1, 'hjdsjfh', 2, 6, 1, '2020-11-16 12:52:37', 1, 'visa', 'hdfjhsjf', 'flkfgflgk', 200.00, NULL, NULL),
(13, 'I1QLdirJ6W', 2, 6, 1, '2021-01-30 22:00:00', 1, 'visa', 'none', 'none', 200.00, '2021-01-31 14:58:53', '2021-01-31 14:58:53'),
(14, 'yIv3jG7Elj', 2, 6, 1, '2021-03-08 22:00:00', 1, 'visa', 'none', 'none', 200.00, '2021-03-09 18:21:15', '2021-03-09 18:21:15'),
(15, 'CkBNdFpucV', 2, 6, 1, '2021-03-08 22:00:00', 1, 'visa', 'none', 'none', 200.00, '2021-03-09 18:24:26', '2021-03-09 18:24:26'),
(16, '6Mk3UdflTu', 2, 6, 1, '2021-03-08 22:00:00', 1, 'visa', 'none', 'none', 200.00, '2021-03-09 18:31:41', '2021-03-09 18:31:41');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT 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,
`role_id` int(10) UNSIGNED NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`desc` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`category_id` int(11) DEFAULT NULL,
`city_id` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`name_ar` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description_ar` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`city_ar` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`google_id` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`apple_id` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`phone` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`, `role_id`, `image`, `desc`, `category_id`, `city_id`, `name_ar`, `description_ar`, `city_ar`, `google_id`, `apple_id`, `phone`) VALUES
(1, 'admin', '<EMAIL>', NULL, '$2y$10$T1HpU833cwqKxqHTr0nXCOvQLMs0w19Z.Vg0I6WZzSEut//qQX7z2', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(2, 'test23333', '<EMAIL>', NULL, '$2y$10$zmnpfZLg6uNjhvNQetQnXu48vIR/68dOAUx0rRbvlZfnVk4bpSY7W', NULL, '2020-11-14 11:19:22', '2021-03-01 14:41:40', 3, '/img/profile/90a75251516a0b18297436dc1f215c89.jpg', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '01008754678'),
(6, 'trainer', '<EMAIL>', NULL, '$2y$10$12zAYY6SWhs5ymRHVEWhJ.aWP.nvEIvylf11Fc.2adN6UyIblqi5C', NULL, '2020-11-14 15:29:32', '2020-12-28 07:48:18', 2, '/img/profile/9048c6aacf6fc03dcc1d6f68ada63484.jpg', 'this is trainer description', 2, 'city 666', 'مدرب 111', 'وصف 1111', 'مدينة 1111', NULL, NULL, NULL),
(8, 'subadmin', '<EMAIL>', NULL, '$2y$10$Hg0nPKpQT2/tQDIdSEKleuWyZ6wth6hZbSL1gIFIAnrCpwJCv1n2.', NULL, '2020-11-16 06:23:20', '2020-11-16 06:23:20', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(9, 'trainer2', '<EMAIL>', NULL, '$2y$10$gIrm9vRq/Kwz72jiBCV57OH0ABKuH4e.oWPvYLht72b5m7RY0nOrS', NULL, '2020-11-16 07:16:49', '2020-11-16 07:16:49', 2, '/img/profile/cf60ce1b74487bbb83ee651077e7692f.png', 'this is trainer2', 2, '2', NULL, NULL, NULL, NULL, NULL, NULL),
(10, 'test3', '<EMAIL>', NULL, '$2y$10$7ulntF6hUYbal9zYqtu4XefODM6vJGS/qIyJZxpJEg4DoQGot9N/q', NULL, '2020-11-16 12:38:10', '2020-11-16 12:38:10', 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(17, 'trainer3', '<EMAIL>', NULL, '$2y$10$K5qivXyGgvrYnNTtVAHSXuKeS5qkrnrBAIrGXVYtEa4OXHWq15rE6', NULL, '2020-12-04 08:28:35', '2020-12-04 08:28:35', 2, '/img/profile/5f7ddc4ea4b3af08f7b9882b6311fa4e.jpg', 'trainer3 trainer3 trainer3 trainer3 trainer3', 2, 'citydddd', NULL, NULL, NULL, NULL, NULL, NULL),
(18, 'trainer test 8888', '<EMAIL>', NULL, '$2y$10$YytykpZRMGt.50U8.E6gY.RUFN.rrDgZdMrWVkbJ3IZCCYIP3IAvm', NULL, '2020-12-28 08:14:13', '2020-12-28 08:14:13', 2, '/img/profile/3b4ed8c30e2aebbedcdbc4250c15ed33.png', 'description1111', 2, 'city8888', 'مدرب 8888', 'وصف 1111', 'مدينة 8888', NULL, NULL, NULL),
(19, 'test4', '<EMAIL>', NULL, '$2y$10$snLsMPnxmKFvBFQtgvyHwudNpgObs8KtTelI.SoRqUA.sWbU.AEKy', NULL, '2021-01-05 15:25:30', '2021-01-05 15:25:30', 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(22, 'subadmn2', '<EMAIL>', NULL, '$2y$10$Ldltvbrn24Kg.A3NJTRjE.BcDX2GU8NbTexs1WDI3RbKIb5933j3u', NULL, '2021-01-06 07:42:17', '2021-01-06 07:42:17', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(23, 'testnnnn', '<EMAIL>', NULL, '$2y$10$xAAJGCNbbKEmfK/.i7jrG.vwNw3e.2jHeWXLvxwyLzszXxi4B5idu', NULL, '2021-01-19 11:27:27', '2021-03-01 14:41:24', 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '01008765456');
-- --------------------------------------------------------
--
-- Table structure for table `users_roles`
--
CREATE TABLE `users_roles` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`permssion_name` varchar(191) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `users_roles`
--
INSERT INTO `users_roles` (`id`, `user_id`, `permssion_name`, `created_at`, `updated_at`) VALUES
(13, 22, 'manage_user', '2021-01-11 15:37:49', '2021-01-11 15:37:49'),
(14, 22, 'view_sales', '2021-01-11 15:37:49', '2021-01-11 15:37:49'),
(15, 22, 'manage_program_design', '2021-01-11 15:37:49', '2021-01-11 15:37:49'),
(16, 22, 'manage_dashboard', '2021-01-11 15:37:49', '2021-01-11 15:37:49');
-- --------------------------------------------------------
--
-- Table structure for table `withdrow_record`
--
CREATE TABLE `withdrow_record` (
`id` int(10) UNSIGNED NOT NULL,
`withdrw_num` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`withdrw_amount` double(8,2) NOT NULL,
`is_execute` int(11) NOT NULL DEFAULT 0,
`execute_date` timestamp NULL DEFAULT NULL,
`trainer_id` int(11) UNSIGNED DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `withdrow_record`
--
INSERT INTO `withdrow_record` (`id`, `withdrw_num`, `withdrw_amount`, `is_execute`, `execute_date`, `trainer_id`, `created_at`, `updated_at`) VALUES
(1, 'xo4I5Ak097', 20.00, 0, NULL, 6, '2020-12-05 12:19:15', '2020-12-05 12:19:15');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `chat`
--
ALTER TABLE `chat`
ADD PRIMARY KEY (`id`),
ADD KEY `chat_booking_id_foreign` (`booking_id`),
ADD KEY `chat_user_foreign` (`from_user`);
--
-- Indexes for table `complete_excercises`
--
ALTER TABLE `complete_excercises`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `countries`
--
ALTER TABLE `countries`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `messages`
--
ALTER TABLE `messages`
ADD PRIMARY KEY (`id`),
ADD KEY `messages_request_id_foreign` (`request_id`),
ADD KEY `message_user_forign` (`from_user`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `muscles`
--
ALTER TABLE `muscles`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
ADD PRIMARY KEY (`id`),
ADD KEY `notification_user_forign` (`user_id`);
--
-- Indexes for table `package`
--
ALTER TABLE `package`
ADD PRIMARY KEY (`id`),
ADD KEY `package_user_forign` (`user_id`);
--
-- Indexes for table `package_user_plan`
--
ALTER TABLE `package_user_plan`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `programe_design_integrent`
--
ALTER TABLE `programe_design_integrent`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_programme_id` (`programme_id`);
--
-- Indexes for table `programme_images`
--
ALTER TABLE `programme_images`
ADD PRIMARY KEY (`id`),
ADD KEY `programme_images_programme_id_foreign` (`programme_id`);
--
-- Indexes for table `programm_designs`
--
ALTER TABLE `programm_designs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `programm_design_calendar`
--
ALTER TABLE `programm_design_calendar`
ADD PRIMARY KEY (`id`),
ADD KEY `programm_design_calendar_booking_id_foreign` (`booking_id`),
ADD KEY `programm_design_calendar_programme_id_foreign` (`programme_id`);
--
-- Indexes for table `questionaire`
--
ALTER TABLE `questionaire`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `questions`
--
ALTER TABLE `questions`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `questions_answers`
--
ALTER TABLE `questions_answers`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `ready_plan`
--
ALTER TABLE `ready_plan`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `receips`
--
ALTER TABLE `receips`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `receips_integration`
--
ALTER TABLE `receips_integration`
ADD KEY `fk_recept` (`recep_id`),
ADD KEY `fk_integrate` (`integrate_programme_id`),
ADD KEY `fk_programme` (`programme_id`);
--
-- Indexes for table `recepis_sections`
--
ALTER TABLE `recepis_sections`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `requests`
--
ALTER TABLE `requests`
ADD PRIMARY KEY (`id`),
ADD KEY `requests_user_forign` (`user_id`);
--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `sliders`
--
ALTER TABLE `sliders`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tickets`
--
ALTER TABLE `tickets`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
ADD PRIMARY KEY (`id`),
ADD KEY `transactions_package_id_foreign` (`package_id`),
ADD KEY `transaction_trainer_forign` (`trainer_id`),
ADD KEY `transaction_user_forign` (`user_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`),
ADD KEY `users_role_id_foreign` (`role_id`);
--
-- Indexes for table `users_roles`
--
ALTER TABLE `users_roles`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `withdrow_record`
--
ALTER TABLE `withdrow_record`
ADD PRIMARY KEY (`id`),
ADD KEY `withdrow_trainer_forign` (`trainer_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `chat`
--
ALTER TABLE `chat`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=64;
--
-- AUTO_INCREMENT for table `complete_excercises`
--
ALTER TABLE `complete_excercises`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `countries`
--
ALTER TABLE `countries`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
--
-- AUTO_INCREMENT for table `muscles`
--
ALTER TABLE `muscles`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `notifications`
--
ALTER TABLE `notifications`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- AUTO_INCREMENT for table `package`
--
ALTER TABLE `package`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `package_user_plan`
--
ALTER TABLE `package_user_plan`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=93;
--
-- AUTO_INCREMENT for table `programe_design_integrent`
--
ALTER TABLE `programe_design_integrent`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `programme_images`
--
ALTER TABLE `programme_images`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `programm_designs`
--
ALTER TABLE `programm_designs`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT for table `programm_design_calendar`
--
ALTER TABLE `programm_design_calendar`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `questionaire`
--
ALTER TABLE `questionaire`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `questions`
--
ALTER TABLE `questions`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `questions_answers`
--
ALTER TABLE `questions_answers`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `ready_plan`
--
ALTER TABLE `ready_plan`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `receips`
--
ALTER TABLE `receips`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `recepis_sections`
--
ALTER TABLE `recepis_sections`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `requests`
--
ALTER TABLE `requests`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `sliders`
--
ALTER TABLE `sliders`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `tickets`
--
ALTER TABLE `tickets`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;
--
-- AUTO_INCREMENT for table `users_roles`
--
ALTER TABLE `users_roles`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT for table `withdrow_record`
--
ALTER TABLE `withdrow_record`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `chat`
--
ALTER TABLE `chat`
ADD CONSTRAINT `chat_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `chat_user_foreign` FOREIGN KEY (`from_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `messages`
--
ALTER TABLE `messages`
ADD CONSTRAINT `message_user_forign` FOREIGN KEY (`from_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `messages_request_id_foreign` FOREIGN KEY (`request_id`) REFERENCES `requests` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `notifications`
--
ALTER TABLE `notifications`
ADD CONSTRAINT `notification_user_forign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `package`
--
ALTER TABLE `package`
ADD CONSTRAINT `package_user_forign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `programe_design_integrent`
--
ALTER TABLE `programe_design_integrent`
ADD CONSTRAINT `fk_programme_id` FOREIGN KEY (`programme_id`) REFERENCES `programm_designs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `programme_images`
--
ALTER TABLE `programme_images`
ADD CONSTRAINT `programme_images_programme_id_foreign` FOREIGN KEY (`programme_id`) REFERENCES `programm_designs` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `programm_design_calendar`
--
ALTER TABLE `programm_design_calendar`
ADD CONSTRAINT `programm_design_calendar_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `programm_design_calendar_programme_id_foreign` FOREIGN KEY (`programme_id`) REFERENCES `programm_designs` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `receips_integration`
--
ALTER TABLE `receips_integration`
ADD CONSTRAINT `fk_integrate` FOREIGN KEY (`integrate_programme_id`) REFERENCES `programe_design_integrent` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_programme` FOREIGN KEY (`programme_id`) REFERENCES `programm_designs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_recept` FOREIGN KEY (`recep_id`) REFERENCES `receips` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `requests`
--
ALTER TABLE `requests`
ADD CONSTRAINT `requests_user_forign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `transactions`
--
ALTER TABLE `transactions`
ADD CONSTRAINT `transaction_trainer_forign` FOREIGN KEY (`trainer_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `transaction_user_forign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `transactions_package_id_foreign` FOREIGN KEY (`package_id`) REFERENCES `package` (`id`) ON DELETE SET NULL;
--
-- Constraints for table `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `users_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `withdrow_record`
--
ALTER TABLE `withdrow_record`
ADD CONSTRAINT `withdrow_trainer_forign` FOREIGN KEY (`trainer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;
/*!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 */;
|
<gh_stars>1-10
-- Used to store Stores that support EBT
-- ===========================================================================
CREATE TABLE IF NOT EXISTS Stores
(
store_id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
store_name TEXT,
-- This is an extra column that is included in some chain stores. It represents the stores' unique code.
store_code TEXT,
latitude NUMERIC NOT NULL,
longitude NUMERIC NOT NULL,
location GEOGRAPHY,
address_line_one TEXT,
address_line_two TEXT,
city TEXT,
state TEXT,
county TEXT,
zip_code TEXT,
local_zip_code TEXT,
is_farmers_market BOOLEAN DEFAULT false,
CONSTRAINT Unique_Stores UNIQUE(store_name, latitude, longitude)
);
|
<reponame>DavidBenko/gateway
UPDATE endpoint_groups
SET name = ?, description = ?, updated_at = CURRENT_TIMESTAMP
WHERE endpoint_groups.id = ?
AND endpoint_groups.api_id IN
(SELECT id FROM apis WHERE id = ? AND account_id = ?)
|
<filename>conf/evolutions/default/8.sql
# add event type change
# --- !Ups
INSERT INTO event_types (name, event_category) VALUES('Form Step 2B', 'Form Step Submit');
# --- !Downs
DELETE FROM event_types WHERE name = 'Form Step 2B';
|
CREATE TABLE [dbo].[UserLogins]
(
[Id] int NOT NULL IDENTITY,
[UserId] int NOT NULL,
[ClientId] nvarchar(200) NOT NULL,
[LoginDate] datetime NOT NULL,
CONSTRAINT [PK_[UserLogins] PRIMARY KEY ([Id]),
CONSTRAINT [FK_UserLogins_Users_Id] FOREIGN KEY ([UserId]) REFERENCES [Users] ([Id])
)
ON [HCFabricIdentityData1];
|
<reponame>janakamarasena/carbon-business-process
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
CREATE TABLE ODE_ACTIVITY_RECOVERY (ID NUMBER NOT NULL, ACTIONS VARCHAR2(255), ACTIVITY_ID NUMBER, CHANNEL VARCHAR2(255), DATE_TIME TIMESTAMP, DETAILS CLOB, INSTANCE_ID NUMBER, REASON VARCHAR2(255), RETRIES NUMBER, PRIMARY KEY (ID));
CREATE TABLE ODE_CORRELATION_SET (CORRELATION_SET_ID NUMBER NOT NULL, CORRELATION_KEY VARCHAR2(255), NAME VARCHAR2(255), SCOPE_ID NUMBER, PRIMARY KEY (CORRELATION_SET_ID));
CREATE TABLE ODE_CORRELATOR (CORRELATOR_ID NUMBER NOT NULL, CORRELATOR_KEY VARCHAR2(255), PROC_ID NUMBER, PRIMARY KEY (CORRELATOR_ID));
CREATE TABLE ODE_CORSET_PROP (ID NUMBER NOT NULL, CORRSET_ID NUMBER, PROP_KEY VARCHAR2(255), PROP_VALUE VARCHAR2(255), PRIMARY KEY (ID));
CREATE TABLE ODE_EVENT (EVENT_ID NUMBER NOT NULL, DETAIL VARCHAR2(255), DATA BLOB, SCOPE_ID NUMBER, TSTAMP TIMESTAMP, TYPE VARCHAR2(255), INSTANCE_ID NUMBER, PROCESS_ID NUMBER, PRIMARY KEY (EVENT_ID));
CREATE TABLE ODE_FAULT (FAULT_ID NUMBER NOT NULL, ACTIVITY_ID NUMBER, DATA CLOB, MESSAGE VARCHAR2(4000), LINE_NUMBER NUMBER, NAME VARCHAR2(255), PRIMARY KEY (FAULT_ID));
CREATE TABLE ODE_MESSAGE (MESSAGE_ID NUMBER NOT NULL, DATA CLOB, HEADER CLOB, TYPE VARCHAR2(255), PRIMARY KEY (MESSAGE_ID));
CREATE TABLE ODE_MESSAGE_EXCHANGE (MESSAGE_EXCHANGE_ID VARCHAR2(255) NOT NULL, ACK_TYPE VARCHAR2(255), CALLEE VARCHAR2(255), CHANNEL VARCHAR2(255), CORRELATION_ID VARCHAR2(255), CORRELATION_KEYS VARCHAR2(255), CORRELATION_STATUS VARCHAR2(255), CREATE_TIME TIMESTAMP NOT NULL, DIRECTION NUMBER NOT NULL, EPR CLOB, FAILURE_TYPE VARCHAR2(255), FAULT VARCHAR2(255), FAULT_EXPLANATION VARCHAR2(255), ISTYLE VARCHAR2(255), OPERATION VARCHAR2(255) NOT NULL, PARTNER_LINK_MODEL_ID NUMBER NOT NULL, PATTERN VARCHAR2(255) NOT NULL, PIPED_ID VARCHAR2(255), PIPED_PID VARCHAR2(255), PORT_TYPE VARCHAR2(255), PROPAGATE_TRANS NUMBER, STATUS VARCHAR2(255), TIMEOUT NUMBER, CORRELATOR NUMBER, PLINK NUMBER, PROCESS NUMBER, INSTANCE NUMBER, REQUEST NUMBER, RESPONSE NUMBER, PRIMARY KEY (MESSAGE_EXCHANGE_ID));
CREATE TABLE ODE_MESSAGE_ROUTE (MESSAGE_ROUTE_ID NUMBER NOT NULL, CORRELATION_KEY VARCHAR2(255), GROUP_ID VARCHAR2(255), ROUTE_INDEX NUMBER, PROCESS_INSTANCE_ID NUMBER, CORR_ID NUMBER, PRIMARY KEY (MESSAGE_ROUTE_ID));
CREATE TABLE ODE_MEX_PROP (ID NUMBER NOT NULL, MEX_ID VARCHAR2(255), PROP_KEY VARCHAR2(255), PROP_VALUE VARCHAR2(2000), PRIMARY KEY (ID));
CREATE TABLE ODE_PARTNER_LINK (PARTNER_LINK_ID NUMBER NOT NULL, MY_EPR CLOB, MY_ROLE_NAME VARCHAR2(255), MY_ROLE_SERVICE_NAME VARCHAR2(255), MY_SESSION_ID VARCHAR2(255), PARTNER_EPR CLOB, PARTNER_LINK_MODEL_ID NUMBER, PARTNER_LINK_NAME VARCHAR2(255), PARTNER_ROLE_NAME VARCHAR2(255), PARTNER_SESSION_ID VARCHAR2(255), SCOPE_ID NUMBER, PRIMARY KEY (PARTNER_LINK_ID));
CREATE TABLE ODE_PROCESS (ID NUMBER NOT NULL, GUID VARCHAR2(255), PROCESS_ID VARCHAR2(255), PROCESS_TYPE VARCHAR2(255), VERSION NUMBER, PRIMARY KEY (ID));
CREATE TABLE ODE_PROCESS_INSTANCE (ID NUMBER NOT NULL, DATE_CREATED TIMESTAMP, EXEC_STATE_COUNTER NUMBER, EXECUTION_STATE BLOB, FAULT_ID NUMBER, LAST_ACTIVE_TIME TIMESTAMP, LAST_RECOVERY_DATE TIMESTAMP, PREVIOUS_STATE NUMBER, SEQUENCE NUMBER, INSTANCE_STATE NUMBER, INSTANTIATING_CORRELATOR_ID NUMBER, PROCESS_ID NUMBER, ROOT_SCOPE_ID NUMBER, PRIMARY KEY (ID));
CREATE TABLE ODE_SCOPE (SCOPE_ID NUMBER NOT NULL, MODEL_ID NUMBER, SCOPE_NAME VARCHAR2(255), SCOPE_STATE VARCHAR2(255), PARENT_SCOPE_ID NUMBER, PROCESS_INSTANCE_ID NUMBER, PRIMARY KEY (SCOPE_ID));
CREATE TABLE ODE_XML_DATA (XML_DATA_ID NUMBER NOT NULL, DATA CLOB, IS_SIMPLE_TYPE NUMBER, NAME VARCHAR2(255), SCOPE_ID NUMBER, PRIMARY KEY (XML_DATA_ID));
CREATE TABLE ODE_XML_DATA_PROP (ID NUMBER NOT NULL, XML_DATA_ID NUMBER, PROP_KEY VARCHAR2(255), PROP_VALUE VARCHAR2(255), PRIMARY KEY (ID));
CREATE TABLE OPENJPA_SEQUENCE_TABLE (ID NUMBER NOT NULL, SEQUENCE_VALUE NUMBER, PRIMARY KEY (ID));
CREATE TABLE STORE_DU (NAME VARCHAR2(255) NOT NULL, DEPLOYDT TIMESTAMP, DEPLOYER VARCHAR2(255), DIR VARCHAR2(255), PRIMARY KEY (NAME));
CREATE TABLE STORE_PROCESS (PID VARCHAR2(255) NOT NULL, STATE VARCHAR2(255), TYPE VARCHAR2(255), VERSION NUMBER, DU VARCHAR2(255), PRIMARY KEY (PID));
CREATE TABLE STORE_PROCESS_PROP (id NUMBER NOT NULL, PROP_KEY VARCHAR2(255), PROP_VAL VARCHAR2(255), PRIMARY KEY (id));
CREATE TABLE STORE_PROC_TO_PROP (ProcessConfDaoImpl_PID VARCHAR2(255), element_id NUMBER);
CREATE TABLE STORE_VERSIONS (id NUMBER NOT NULL, VERSION NUMBER, PRIMARY KEY (id));
CREATE INDEX I_D_CTVRY_INSTANCE ON ODE_ACTIVITY_RECOVERY (INSTANCE_ID);
CREATE INDEX I_D_CR_ST_SCOPE ON ODE_CORRELATION_SET (SCOPE_ID);
CREATE INDEX I_D_CRLTR_PROCESS ON ODE_CORRELATOR (PROC_ID);
CREATE INDEX I_D_CRPRP_CORRSET ON ODE_CORSET_PROP (CORRSET_ID);
CREATE INDEX I_OD_VENT_INSTANCE ON ODE_EVENT (INSTANCE_ID);
CREATE INDEX I_OD_VENT_PROCESS ON ODE_EVENT (PROCESS_ID);
CREATE INDEX I_D_MSHNG_CORRELATOR ON ODE_MESSAGE_EXCHANGE (CORRELATOR);
CREATE INDEX I_D_MSHNG_PARTNERLINK ON ODE_MESSAGE_EXCHANGE (PLINK);
CREATE INDEX I_D_MSHNG_PROCESS ON ODE_MESSAGE_EXCHANGE (PROCESS);
CREATE INDEX I_D_MSHNG_PROCESSINST ON ODE_MESSAGE_EXCHANGE (INSTANCE);
CREATE INDEX I_D_MSHNG_REQUEST ON ODE_MESSAGE_EXCHANGE (REQUEST);
CREATE INDEX I_D_MSHNG_RESPONSE ON ODE_MESSAGE_EXCHANGE (RESPONSE);
CREATE INDEX I_D_MS_RT_CORRELATOR ON ODE_MESSAGE_ROUTE (CORR_ID);
CREATE INDEX I_D_MS_RT_PROCESSINST ON ODE_MESSAGE_ROUTE (PROCESS_INSTANCE_ID);
CREATE INDEX I_D_MXPRP_MEX ON ODE_MEX_PROP (MEX_ID);
CREATE INDEX I_D_PRLNK_SCOPE ON ODE_PARTNER_LINK (SCOPE_ID);
CREATE INDEX I_D_PRTNC_FAULT ON ODE_PROCESS_INSTANCE (FAULT_ID);
CREATE INDEX I_D_PRTNC_INSTANTIATINGCORRELA ON ODE_PROCESS_INSTANCE (INSTANTIATING_CORRELATOR_ID);
CREATE INDEX I_D_PRTNC_PROCESS ON ODE_PROCESS_INSTANCE (PROCESS_ID);
CREATE INDEX I_D_PRTNC_ROOTSCOPE ON ODE_PROCESS_INSTANCE (ROOT_SCOPE_ID);
CREATE INDEX I_OD_SCOP_PARENTSCOPE ON ODE_SCOPE (PARENT_SCOPE_ID);
CREATE INDEX I_OD_SCOP_PROCESSINSTANCE ON ODE_SCOPE (PROCESS_INSTANCE_ID);
CREATE INDEX I_D_XM_DT_SCOPE ON ODE_XML_DATA (SCOPE_ID);
CREATE INDEX I_D_XMPRP_XMLDATA ON ODE_XML_DATA_PROP (XML_DATA_ID);
CREATE INDEX I_STR_CSS_DU ON STORE_PROCESS (DU);
CREATE INDEX I_STR_PRP_ELEMENT ON STORE_PROC_TO_PROP (element_id);
CREATE INDEX I_STR_PRP_PROCESSCONFDAOIMPL_P ON STORE_PROC_TO_PROP (ProcessConfDaoImpl_PID);
CREATE TABLE ODE_JOB (jobid varchar2(64 char) DEFAULT '' NOT NULL, ts number(19,0) DEFAULT 0 NOT NULL, nodeid varchar2(64 char) NULL, scheduled number(12,0) DEFAULT 0 NOT NULL, transacted number(12,0) DEFAULT 0 NOT NULL, details BLOB, PRIMARY KEY(jobid));
CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);
CREATE INDEX IDX_ODE_JOB_NODEID ON ode_job(nodeid);
|
create table `exotic``table````name` (a varchar(6) primary key, b int unique auto_increment) auto_increment=80000;
|
alter table monitoringpointset
modify year number(4,0) null;
alter table monitoringpointset
add academicyear number(4,0) default '0' not null;
|
<reponame>johnny0120/short-url
CREATE TABLE `url_shorten`
(
`id` CHAR(36) NOT NULL COMMENT 'Unique identifier of record',
`code` VARCHAR(22) NOT NULL COMMENT 'Result code of the full url',
`url` TEXT NOT NULL COMMENT 'Full url from the request',
`secret` TEXT NULL DEFAULT NULL COMMENT 'Secret code for update operation',
PRIMARY KEY (`id`)
);
CREATE UNIQUE INDEX `url_shorten_uq_code` ON `url_shorten` (`code`);
|
create table battles(
id serial not null,
name varchar(255) not null,
year varchar(255) null,
battle_number varchar(255) null,
attacker_king varchar(255) null,
defender_king varchar(255) null,
attacker_1 varchar(255) null,
attacker_2 varchar(255) null,
attacker_3 varchar(255) null,
attacker_4 varchar(255) null,
defender_1 varchar(255) null,
defender_2 varchar(255) null,
defender_3 varchar(255) null,
defender_4 varchar(255) null,
attacker_outcome varchar(255) not null,
battle_type varchar(255) null,
major_death varchar(255) null,
major_capture varchar(255)null,
attacker_size varchar(255) null,
defender_size varchar(255) not null,
attacker_commander varchar(255) null,
defender_commander varchar(255) null,
summer varchar(255) null,
location varchar(255) null,
region varchar(255) not null,
note varchar(255) null,
primary key (id)
);
|
CREATE OR REPLACE FUNCTION GetDayIsSelected(int, boolean) RETURNS int LANGUAGE SQL AS $$ select case when $2 then $1 else null end; $$;
CREATE OR REPLACE FUNCTION GetIsClosed(uuid) RETURNS boolean LANGUAGE SQL AS $$ select "Id" = $1 from "ExceptionHoursStatusType" where "Code" = 'Closed'; $$;
--select * from GetDayIsSelected(2, false);
--select * from GetIsClosed('6737b93c-7b4d-4668-543d-08d3c60ad665');
-- normal hours
-- creates daily
INSERT INTO public."DailyOpeningTime"(
"Created", "CreatedBy", "Modified", "ModifiedBy",
"OpeningHourId", "IsExtra", "DayFrom", "DayTo",
"From", "To")
SELECT sh."Created", sh."CreatedBy", sh."Modified", sh."ModifiedBy",
sh."Id", false, sh.day, null,
age(to_timestamp('2016-0101 ' || coalesce( trim(sh."Opens"), '00:00'), 'YYYY-MMDD HH24:MI'), timestamp '2016-01-01'), -- sh."Opens",
age(to_timestamp('2016-0101 ' || coalesce( trim(sh."Closes"), '24:00'), 'YYYY-MMDD HH24:MI'), timestamp '2016-01-01') --, sh."Closes"
FROM (
select *,
unnest(ARRAY[
GetDayIsSelected(0, "Monday")::int,
GetDayIsSelected(1, "Tuesday")::int,
GetDayIsSelected(2, "Wednesday")::int,
GetDayIsSelected(3, "Thursday")::int,
GetDayIsSelected(4, "Friday")::int,
GetDayIsSelected(5, "Saturday")::int,
GetDayIsSelected(6, "Sunday")::int]
) AS day from public."ServiceChannelServiceHours" ) sh
join public."ServiceHourType" sht on (sh."ServiceHourTypeId" = sht."Id")
where sht."Code" = 'Standard' and sh.day is not null;
-- exceptional
UPDATE public."ServiceChannelServiceHours"
SET "IsClosed"= coalesce(GetIsClosed("ExceptionHoursTypeId"), false);
INSERT INTO public."DailyOpeningTime"(
"Created", "CreatedBy", "Modified", "ModifiedBy",
"OpeningHourId", "IsExtra", "DayFrom", "DayTo",
"From", "To")
SELECT sh."Created", sh."CreatedBy", sh."Modified", sh."ModifiedBy",
sh."Id", false, 0, 6,
age(to_timestamp('2016-0101 ' || coalesce( trim(sh."Opens"), '00:00'), 'YYYY-MMDD HH24:MI'), timestamp '2016-01-01'),-- sh."Opens",
age(to_timestamp('2016-0101 ' || coalesce( trim(sh."Closes"), '00:00'), 'YYYY-MMDD HH24:MI'), timestamp '2016-01-01') --, sh."Closes"
FROM public."ServiceChannelServiceHours" sh
join public."ServiceHourType" sht on (sh."ServiceHourTypeId" = sht."Id")
where sht."Code" = 'Exception' and coalesce( trim("Opens"),'')!='' ;
DROP FUNCTION GetDayIsSelected(int, boolean);
DROP FUNCTION GetIsClosed(uuid);
|
<gh_stars>0
DELETE FROM COURSE_STUDENT;
DELETE FROM COURSE;
DELETE FROM USER;
|
-- CreateTable
CREATE TABLE "users" (
"id" SERIAL NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"name" TEXT,
"email" TEXT,
"email_verified" TIMESTAMP(3),
"image" TEXT,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Message" (
"id" SERIAL NOT NULL,
"text" TEXT NOT NULL,
"userId" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
-- Edit: create extension for path
CREATE EXTENSION ltree;
-- CreateTable
CREATE TABLE "Item" (
"id" SERIAL NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
"title" TEXT,
"text" TEXT,
"url" TEXT,
"userId" INTEGER NOT NULL,
"parentId" INTEGER,
"path" LTREE,
PRIMARY KEY ("id")
);
-- Edit: create index for path
CREATE INDEX "item_gist_path_index" ON "Item" USING GIST ("path");
-- Edit: create trigger for path
CREATE OR REPLACE FUNCTION update_item_path() RETURNS TRIGGER AS $$
DECLARE
npath ltree;
BEGIN
IF NEW."parentId" IS NULL THEN
SELECT NEW.id::text::ltree INTO npath;
ELSEIF TG_OP = 'INSERT' OR OLD."parentId" IS NULL OR OLD."parentId" != NEW."parentId" THEN
SELECT "path" || NEW.id::text FROM "Item" WHERE id = NEW."parentId" INTO npath;
IF npath IS NULL THEN
RAISE EXCEPTION 'Invalid parent_id %', NEW."parentId";
END IF;
END IF;
NEW."path" = npath;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER path_tgr
BEFORE INSERT OR UPDATE ON "Item"
FOR EACH ROW EXECUTE PROCEDURE update_item_path();
-- CreateTable
CREATE TABLE "Vote" (
"id" SERIAL NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
"sats" INTEGER NOT NULL DEFAULT 1,
"boost" BOOLEAN NOT NULL DEFAULT false,
"itemId" INTEGER NOT NULL,
"userId" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "accounts" (
"id" SERIAL NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
"compound_id" TEXT NOT NULL,
"user_id" INTEGER NOT NULL,
"provider_type" TEXT NOT NULL,
"provider_id" TEXT NOT NULL,
"provider_account_id" TEXT NOT NULL,
"refresh_token" TEXT,
"access_token" TEXT,
"access_token_expires" TIMESTAMP(3),
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "sessions" (
"id" SERIAL NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
"user_id" INTEGER NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,
"session_token" TEXT NOT NULL,
"access_token" TEXT NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "verification_requests" (
"id" SERIAL NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
"identifier" TEXT NOT NULL,
"token" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,
PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "users.name_unique" ON "users"("name");
-- CreateIndex
CREATE UNIQUE INDEX "users.email_unique" ON "users"("email");
-- CreateIndex
CREATE INDEX "Item.userId_index" ON "Item"("userId");
-- CreateIndex
CREATE INDEX "Item.parentId_index" ON "Item"("parentId");
-- CreateIndex
CREATE INDEX "Vote.itemId_index" ON "Vote"("itemId");
-- CreateIndex
CREATE INDEX "Vote.userId_index" ON "Vote"("userId");
-- CreateIndex
CREATE UNIQUE INDEX "accounts.compound_id_unique" ON "accounts"("compound_id");
-- CreateIndex
CREATE INDEX "accounts.provider_account_id_index" ON "accounts"("provider_account_id");
-- CreateIndex
CREATE INDEX "accounts.provider_id_index" ON "accounts"("provider_id");
-- CreateIndex
CREATE INDEX "accounts.user_id_index" ON "accounts"("user_id");
-- CreateIndex
CREATE UNIQUE INDEX "sessions.session_token_unique" ON "sessions"("session_token");
-- CreateIndex
CREATE UNIQUE INDEX "sessions.access_token_unique" ON "sessions"("access_token");
-- CreateIndex
CREATE UNIQUE INDEX "verification_requests.token_unique" ON "verification_requests"("token");
-- AddForeignKey
ALTER TABLE "Message" ADD FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Item" ADD FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Item" ADD FOREIGN KEY ("parentId") REFERENCES "Item"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Vote" ADD FOREIGN KEY ("itemId") REFERENCES "Item"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Vote" ADD FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
<gh_stars>0
CREATE TABLE ADMINS
(
id INT PRIMARY KEY AUTO_INCREMENT,
steamId VARCHAR(63) NOT NULL
);
INSERT INTO ADMINS (steamId) VALUES ('76561198163521155');
INSERT INTO ADMINS (steamId) VALUES ('76561198013105652');
INSERT INTO ADMINS (steamId) VALUES ('76561198068020344');
|
<filename>db/storedProcedures/usp_registerUpdate.sql
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- We check whether the sp already exists. If so, then we remove it.
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[usp_registerUpdate]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE [dbo].usp_registerUpdate
GO
create procedure usp_registerUpdate(
@p_json nvarchar(max),
@p_idUser int
)
as
begin
begin try
if @p_idUser is null
begin
select description from error with(nolock) where errorCode = -1
return -1
end
declare @step int,
@manageTran int = 1,
@idObject int,
@p_token nvarchar(MAX),
@p_idRegister int
-- Obtener par�metros
set @step = 1
select @p_idRegister = JSON_VALUE(@p_json, '$.idRegister'),
@p_token = JSON_VALUE(@p_json, '$.token')
-- validaciones
set @step = 2
if (@p_idRegister is null or @p_token is null)
begin
select description from error with(nolock) where errorCode = -2
return -2
end
if exists(select top 1 1 from register with(nolock) where id = @p_idRegister and token = @p_token and indActive = 0)
begin
select description from error with(nolock) where errorCode = -13
return -13
end
if not exists(select top 1 1 from register with(nolock) where id = @p_idRegister and token = @p_token and indActive = 1)
begin
select description from error with(nolock) where errorCode = -5
return -5
end
-- Validar registro y moverlo a tabla de usuarios.
set @step = 3
if (@@TRANCOUNT > 0)
begin
set @manageTran = 0
end
if @manageTran = 1 begin tran registerUpdate
-- Crear usuario.
insert into [user] (
idRegister,
email,
nickname,
password,
name,
phone,
indActive,
dateCreated,
dateUpdated,
userCreate,
userUpdate
)
select id,
email,
nickname,
password,
name,
phone,
1,
getdate(),
getdate(),
@p_idUser,
@p_idUser
from register with(nolock)
where id = @p_idRegister
and token = @p_token
and indActive = 1
set @idObject = SCOPE_IDENTITY()
-- Privacidad del usuario
insert into privacy(
idUser,
idVisibilityTypeProfile,
indActive,
dateCreated,
dateUpdated,
userCreate,
userUpdate
)
values (
@idObject,
1,
1,
getdate(),
getdate(),
@p_idUser,
@p_idUser
)
-- Actualizar registro como "confirmado"
update r
set r.indActive = 0,
r.userUpdate = @p_idUser,
r.dateUpdated = getdate()
output deleted.*, getdate() into registerUPDATED
from register r
where id = @p_idRegister
and token = @p_token
and indActive = 1
if @manageTran = 1 commit tran registerUpdate
-- Resultado
set @step = 4
select @idObject as idUser
RETURN 201
end try
begin catch
if @manageTran = 1 rollback tran registerUpdate
declare @errorProc NVARCHAR(MAX) = ERROR_PROCEDURE(), @errorMsg NVARCHAR(MAX) = ERROR_MESSAGE()
exec usp_logErrorInsert @step, @errorProc, @errorMsg, @p_json, @p_idUser
SELECT -9999 AS RESULT
RETURN -9999
end catch
end
|
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Anamakine: 127.0.0.1
-- Üretim Zamanı: 28 Şub 2022, 03:03:13
-- Sunucu sürümü: 10.4.21-MariaDB
-- PHP Sürümü: 7.3.31
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
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 */;
--
-- Veritabanı: `ytsistemi`
--
-- --------------------------------------------------------
--
-- Tablo için tablo yapısı `youtubers`
--
CREATE TABLE `youtubers` (
`yt_id` int(11) NOT NULL,
`yt_name` varchar(24) NOT NULL,
`yt_level` int(11) NOT NULL,
`yt_chname` varchar(32) NOT NULL,
`yt_passw` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Tablo döküm verisi `youtubers`
--
INSERT INTO `youtubers` (`yt_id`, `yt_name`, `yt_level`, `yt_chname`, `yt_passw`) VALUES
(1, 'R4IN', 1, 'aaaa', '<PASSWORD>'),
(2, 'Test', 1, 'selam', 'selam'),
(3, 'User', 1, 'GTAMulti.COM - R4IN', '1234');
--
-- Dökümü yapılmış tablolar için indeksler
--
--
-- Tablo için indeksler `youtubers`
--
ALTER TABLE `youtubers`
ADD PRIMARY KEY (`yt_id`);
--
-- Dökümü yapılmış tablolar için AUTO_INCREMENT değeri
--
--
-- Tablo için AUTO_INCREMENT değeri `youtubers`
--
ALTER TABLE `youtubers`
MODIFY `yt_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
/*!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 */;
|
SELECT m0.username, m0.first_message
FROM (
SELECT m1.id, m1.username, m1.message,
(
SELECT MIN(m1.id)
FROM message m2
WHERE m2.username = m1.username
AND NOT EXISTS (
SELECT 1
FROM message m3
WHERE m3.username <> m2.username
)
) first_message
FROM message m1
) m0
GROUP BY m0.username;
|
select distinct
`accounts_active_week_of_six_months_ago`.account_id
from
orders `accounts_active_week_of_six_months_ago`
left outer join (
select distinct
o.account_id
from
orders o
where
yearweek(o.order_date) between yearweek(curdate() - interval 6 month) and yearweek(curdate())
and o.type = 'sale'
and o.status = 'completed'
and o.`is_pickup` = 0
) `accounts_ordered_since`
on `accounts_active_week_of_six_months_ago`.`account_id` = `accounts_ordered_since`.account_id
where
yearweek(`accounts_active_week_of_six_months_ago`.order_date) = yearweek(curdate() - interval 6 month - interval 1 week)
and `accounts_active_week_of_six_months_ago`.type = 'sale'
and `accounts_active_week_of_six_months_ago`.status = 'completed'
and `accounts_active_week_of_six_months_ago`.`is_pickup` = 0
and `accounts_ordered_since`.account_id is null
|
----Donation Header master---
CREATE TABLE egwtr_donation_header_aud(
id integer NOT NULL,
rev integer NOT NULL,
category bigint,
usagetype bigint ,
propertytype bigint,
minpipesize bigint,
maxpipesize bigint,
active boolean,
lastmodifiedby bigint,
lastmodifieddate timestamp without time zone,
revtype numeric
);
ALTER TABLE ONLY egwtr_donation_header_aud ADD CONSTRAINT pk_egwtr_donation_header_aud PRIMARY KEY (id, rev);
------Donation Details master----
CREATE TABLE egwtr_donation_details_aud(
id integer NOT NULL,
rev integer NOT NULL,
donationheader bigint,
fromdate date ,
todate date,
amount double precision,
revtype numeric
);
ALTER TABLE ONLY egwtr_donation_details_aud ADD CONSTRAINT pk_egwtr_donation_details_aud PRIMARY KEY (id, rev);
-----Water Rates Header master-------
CREATE TABLE egwtr_water_rates_header_aud(
id integer NOT NULL,
rev integer NOT NULL,
connectiontype character varying(50),
usagetype bigint ,
watersource bigint,
pipesize bigint,
active boolean,
lastmodifiedby bigint,
lastmodifieddate timestamp without time zone,
revtype numeric
);
ALTER TABLE ONLY egwtr_water_rates_header_aud ADD CONSTRAINT pk_egwtr_water_rates_header_aud PRIMARY KEY (id, rev);
-----Water Rates Details master------
CREATE TABLE egwtr_water_rates_details_aud(
id integer NOT NULL,
rev integer NOT NULL,
waterratesheader bigint,
monthlyrate double precision,
fromdate date ,
todate date,
revtype numeric
);
ALTER TABLE ONLY egwtr_water_rates_details_aud ADD CONSTRAINT pk_egwtr_water_rates_details_aud PRIMARY KEY (id, rev);
|
--==============================================================================
--
-- Summary: SQLSaturday Montréal #758 - 2018
-- Date: 06/2018
--
-- ----------------------------------------------------------------------------
-- Written by <NAME>, SQL Server MVP / MCM
-- Blog : http://conseilit.wordpress.com
-- Twitter : @ConseilIT
--
-- You may alter this code for your own *non-commercial* purposes. You may
-- republish altered code as long as you give due credit.
--
-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF
-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
-- TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-- PARTICULAR PURPOSE.
--==============================================================================
USE [master]
GO
SELECT * FROM sys.dm_exec_session_wait_stats WHERE session_id = @@spid
ORDER BY wait_time_ms DESC;
GO
CREATE DATABASE [DemoDB]
ON PRIMARY
( NAME = N'DemoDB', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL14.SQL2017\MSSQL\DATA\DemoDB.mdf' , SIZE = 1GB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'DemoDB_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL14.SQL2017\MSSQL\DATA\DemoDB_log.ldf' , SIZE = 2GB , MAXSIZE = 2048GB , FILEGROWTH = 1024KB )
GO
-- ASYNC_IO_COMPLETION
SELECT * FROM sys.dm_exec_session_wait_stats WHERE session_id = @@spid
ORDER BY wait_time_ms DESC;
GO
CREATE TABLE [DemoDB].[dbo].[orders](
[id] uniqueidentifier default NEWID() PRIMARY KEY CLUSTERED,
[orderid] [int] NOT NULL,
[custid] [char](11) NOT NULL,
[empid] [int] NOT NULL,
[shipperid] [varchar](5) NOT NULL,
[orderdate] [datetime] NOT NULL,
[filler] [char](155) NOT NULL
) ON [PRIMARY]
GO
-- new session
SELECT * FROM sys.dm_exec_session_wait_stats WHERE session_id = @@spid
ORDER BY wait_time_ms DESC;
INSERT INTO [DemoDB].dbo.orders ([orderid], [custid], [empid], [shipperid], [orderdate], [filler] )
SELECT [orderid], [custid], [empid], [shipperid], [orderdate], [filler]
FROM Performance.dbo.Orders
OPTION (MAXDOP 1)
-- IO_COMPLETION
SELECT * FROM sys.dm_exec_session_wait_stats WHERE session_id = @@spid
ORDER BY wait_time_ms DESC;
-- new session
SELECT * FROM sys.dm_exec_session_wait_stats WHERE session_id = @@spid
ORDER BY wait_time_ms DESC;
CHECKPOINT
-- PAGEIOLATCH_UP
SELECT * FROM sys.dm_exec_session_wait_stats WHERE session_id = @@spid
ORDER BY wait_time_ms DESC;
-- informations about LDF file (SQL14 +)
SELECT *
FROM sys.dm_db_log_stats(db_id('DemoDB'))
SELECT *
FROM sys.dm_db_log_info(db_id('DemoDB'))
USE [master]
GO
DROP DATABASE [DemoDB]
GO
|
CREATE PROCEDURE [dbo].[uspEmployerUpdate]
@employerId INT,
@edsUrn int,
@fullName nvarchar(255),
@tradingName nvarchar(255),
@addressLine1 nvarchar(50),
@addressLine2 nvarchar(50) = NULL,
@addressLine3 nvarchar(50) = NULL,
@addressLine4 nvarchar(50) = NULL,
@town nvarchar(50),
@county int,
@postcode nvarchar(50),
@longitude decimal(20,15) = NULL,
@latitude decimal(20,15) = NULL,
@GeocodeEasting decimal(20,15) = NULL,
@GeocodeNorthing decimal (20,15) = NULL,
@primaryContact INT,
@businessDescription nvarchar(50) = NULL,
--@webpage nvarchar(100) = NULL,
@lscResponsibilityDetails nvarchar(200) = NULL,
@NumberofEmployeesAtSite int = NULL,
-- @status nvarchar(30) = NULL,
-- @isContractHolder bit = NULL,
-- @industrySector nvarchar(25) = NULL,
@OwnerOrganisation nvarchar(255) = NULL,
@companyRegistrationNumber varchar(8) = NULL,
@sicId INT,
@totalVacanciesPosted int,
@EmployerStatusTypeId int,
@DisableAllowed bit,
@TrackingAllowed bit
AS
BEGIN
--The [dbo].[Employer] table doesn't have a timestamp column. Optimistic concurrency logic cannot be generated
SET NOCOUNT ON
BEGIN TRY
UPDATE [dbo].[Employer]
SET
--[EdsUrn] = ISNULL(@edsUrn,[EdsUrn]),
[FullName] = ISNULL(@fullName,[FullName]),
[TradingName] = ISNULL(@tradingName,[TradingName]),
[AddressLine1]=ISNULL(@addressLine1,[AddressLine1]),
[AddressLine2]=ISNULL(@addressLine2,[AddressLine2]),
[AddressLine3]=ISNULL(@addressLine3,[AddressLine3]),
[AddressLine4]=ISNULL(@addressLine4,[AddressLine4]),
[Town]=ISNULL(@town,[Town]),
[CountyId]=ISNULL(@county,[CountyId]),
[PostCode]=ISNULL(@postcode,[PostCode]),
[Longitude]=ISNULL(@longitude,[Longitude]),
[Latitude]=ISNULL(@latitude,[Latitude]),
[GeocodeEasting]=ISNULL(@geocodeEasting,[GeocodeEasting]),
[GeocodeNorthing]=ISNULL(@geocodeNorthing,[GeocodeNorthing]),
[PrimaryContact] = ISNULL(@primaryContact,[PrimaryContact]),
--[BusinessDescription] = ISNULL(@businessDescription,[BusinessDescription]),
--[Webpage]= ISNULL(@webpage,[Webpage]),
--[LscResponsibilityDetails] = ISNULL(@lscResponsibilityDetails,[LscResponsibilityDetails]),
[NumberofEmployeesAtSite] = ISNULL(@NumberofEmployeesAtSite,[NumberofEmployeesAtSite]),
--[Status] = ISNULL(@status,[Status]),
--[IsContractHolder] = ISNULL(@isContractHolder,[IsContractHolder]),
--[IndustrySector] = ISNULL(@industrySector,[IndustrySector]),
[OwnerOrgnistaion] = ISNULL(@OwnerOrganisation,[OwnerOrgnistaion]),
[CompanyRegistrationNumber] = ISNULL(@companyRegistrationNumber,[CompanyRegistrationNumber]),
[TotalVacanciesPosted]= ISNULL(@totalVacanciesPosted,[TotalVacanciesPosted]),
[EmployerStatusTypeId] = @EmployerStatusTypeId,
[DisableAllowed] = @DisableAllowed,
[TrackingAllowed] = @TrackingAllowed
WHERE [EmployerId]=@employerId
IF @@ROWCOUNT = 0
BEGIN
RAISERROR('Concurrent update error. Updated aborted.', 16, 2)
END
END TRY
BEGIN CATCH
EXEC RethrowError;
END CATCH
SET NOCOUNT OFF
END
|
-- Single replace
select
* replace 'thing' as foo
from some_table;
-- Multi replace
select
* REPLACE (quantity/2 AS quantity, 'thing' as foo)
from some_table
|
/*[[Show high water mark, refer to Doc ID 1020006.6
The script lists the highwater marks for the following parameters:
- HIGH_DML_LOCKS
- MAX_DML_LOCKS
- HIGH_TRANS
- MAX_DML_LOCKS
- HIGH_ENQUEUE
- MAX_ENQUEUE
- HIGH_ENQ_RES
- MAX_ENQ_RES
- HIGH_SESSIONS
- MAX_SESSIONS
- HIGH_PROCESSES
- MAX_PROCESSES
]]*/
SELECT * FROM TABLE(GV$(CURSOR(
SELECT userenv('instance') inst_id,'HIGH_DML_LOCKS' NAME, COUNT(*) VALUE
FROM sys.x$ktadm
WHERE ksqlkses != hextoraw('00')
AND ksqlkres != hextoraw('00')
UNION ALL
SELECT userenv('instance') inst_id,'MAX_DML_LOCKS', COUNT(*) MAX_DML_LOCKS
FROM sys.x$ktadm
UNION ALL
SELECT userenv('instance') inst_id,'HIGH_TRANS', COUNT(*) HIGH_TRANS
FROM sys.x$ktcxb
WHERE ksqlkses != hextoraw('00')
AND ksqlkres != hextoraw('00')
UNION ALL
SELECT userenv('instance') inst_id,'MAX_DML_LOCKS', COUNT(*) MAX_DML_LOCKS
FROM sys.x$ktadm
UNION ALL
SELECT userenv('instance') inst_id,'HIGH_ENQUEUE', COUNT(*) HIGH_ENQUEUE
FROM sys.x$ksqeq
WHERE ksqlkses != hextoraw('00')
AND ksqlkres != hextoraw('00')
UNION ALL
SELECT userenv('instance') inst_id,'MAX_ENQUEUE', COUNT(*) MAX_ENQUEUE
FROM sys.x$ksqeq
UNION ALL
SELECT userenv('instance') inst_id,'HIGH_ENQ_RES', COUNT(*) HIGH_ENQ_RES
FROM sys.x$ksqrs
WHERE ksqrsidt != chr(0) || chr(0)
UNION ALL
SELECT userenv('instance') inst_id,'MAX_ENQ_RES', COUNT(*) MAX_ENQ_RES
FROM sys.x$ksqrs
UNION ALL
SELECT userenv('instance') inst_id,'HIGH_SESSIONS', COUNT(*) HIGH_SESSIONS
FROM sys.x$ksuse
WHERE ksuudnam IS NOT NULL
UNION ALL
SELECT userenv('instance') inst_id,'MAX_SESSIONS', COUNT(*) MAX_SESSIONS
FROM sys.x$ksuse
UNION ALL
SELECT userenv('instance') inst_id,'HIGH_PROCESSES', COUNT(*) HIGH_PROCESSES
FROM sys.x$ksupr
WHERE ksuprunm IS NOT NULL
UNION ALL
SELECT userenv('instance') inst_id,'MAX_PROCESSES', COUNT(*) MAX_PROCESSES
FROM sys.x$ksupr)))
PIVOT (MAX(VALUE) FOR INST_ID IN(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16))
ORDER BY 1
|
<reponame>navikt/syfomoteadmin
-- ROLLBACK-START
------------------
-- DROP TABLE FEED;
-- DROP SEQUENCE FEED_ID_SEQ;
---------------
-- ROLLBACK-END
CREATE SEQUENCE FEED_ID_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE FEED (
feed_id NUMBER(19, 0) NOT NULL,
uuid VARCHAR(50) NOT NULL,
mote_id NUMBER(19, 0) NOT NULL,
created TIMESTAMP NOT NULL,
sist_endret_av VARCHAR(30),
type VARCHAR(30) NOT NULL
);
|
{#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#}
SELECT
EVENT_NAME as name,
EVENT_SCHEMA as dbname
FROM information_schema.EVENTS
WHERE EVENT_SCHEMA = {{dbname|string_convert}};
|
<gh_stars>0
select Name from Country order by SurfaceArea desc, Name limit 5;
|
<gh_stars>1-10
insert into port_enc
select
port.port_id as port_id,
port.name as name,
port.latitude as latitude,
port.longitude as longitude,
port.offloadcapacity as offloadcapacity,
port.offloadtime as offloadtime,
port.available as available
from port;
insert into aggr_count_enc
select port.name as name, count(ship.ship_id) as cnt
from ship,
port_enc,
port,
parameters
where port_enc.name = parameters.portname
and port_enc.name = port.name
and ((ship.latitude - port_enc.latitude)^2 + (ship.longitude - port_enc.longitude)^2) ^ 0.5 / ship.max_speed <= parameters.deadline
group by port.name;
insert into aggr_count
select ac2.name as name,
ac2.cnt as cnt
from aggr_count_enc as ac2;
insert into capacities
select port.name as portname,
count(slot.slot_id) as slots_number
from port, slot, berth, parameters
where port.name = parameters.portname
AND port.port_id = berth.port_id
AND slot.port_id = berth.port_id
AND slot.berth_id = berth.berth_id
AND slot.slotstart <= parameters.deadline
AND slot.slotstart + port.offloadtime <= slot.slotend
group by port.name;
insert into ship_count
SELECT
ac.name as name,
least(ac.cnt, cp.slots_number) as num_of_ships
from aggr_count AS ac, capacities AS cp, parameters
where ac.name = cp.portname
and ac.name = parameters.portname
;
SELECT
port.name as name,
MAX(sc.num_of_ships) as num_of_ships
from ship_count as sc, port
where sc.name = port.name
group by port.name
;
|
<filename>spring-boot-test/src/main/resources/db/V1_2__test.sql<gh_stars>0
DROP TABLE IF EXISTS test_user;
CREATE TABLE IF NOT EXISTS test_user (
id BIGINT(20) NOT NULL AUTO_INCREMENT,
name VARCHAR(255),
password VARCHAR(255),
PRIMARY KEY (id),
INDEX (name)
);
INSERT INTO test_user values (1,'test','test');
INSERT INTO test_user values (2,'test2','test2');
INSERT INTO test_user values (3,'test1','test1');
|
<gh_stars>0
INSERT INTO k_x_app_workarea (id_app,gu_workarea,gu_admins,gu_powusers,gu_users,gu_guests,gu_other,path_files) VALUES (15,'c0a80146f4d1f5137b100047cde63b79','ce75c69a786f49cfa3beead8a961942c',NULL,NULL,NULL,NULL,'system_workarea');
INSERT INTO k_x_app_workarea (id_app,gu_workarea,gu_admins,gu_powusers,gu_users,gu_guests,gu_other,path_files) VALUES (30,'c0a80146f4d1f5137b100047cde63b79','ce75c69a786f49cfa3beead8a961942c',NULL,NULL,NULL,NULL,'system_workarea');
INSERT INTO k_x_app_workarea (id_app,gu_workarea,gu_admins,gu_powusers,gu_users,gu_guests,gu_other,path_files) VALUES (13,'aa0000ca39854673b17518ec5f870000','0fb03429fa3447a6be92142479fc6d52','c0a80146f4cc507f0e10021acf4aad60','c0a80146f4cc55e5d710021bc3e3ed97','c0a80146f4cc57e3cb10021c8d0629bc',NULL,'model_workarea');
INSERT INTO k_x_app_workarea (id_app,gu_workarea,gu_admins,gu_powusers,gu_users,gu_guests,gu_other,path_files) VALUES (14,'aa0000ca39854673b17518ec5f870000','<KEY>2','c0a80146f4cc507f0e10021acf4aad60','c0a80146f4cc55e5d710021bc3e3ed97','c0a80146f4cc57e3cb10021c8d0629bc',NULL,'model_workarea');
INSERT INTO k_x_app_workarea (id_app,gu_workarea,gu_admins,gu_powusers,gu_users,gu_guests,gu_other,path_files) VALUES (15,'aa0000ca39854673b17518ec5f870000','<KEY>','c0a80146f4cc507f0e10021acf4aad60','c0a80146f4cc55e5d710021bc3e3ed97','c0a80146f4cc57e3cb10021c8d0629bc',NULL,'model_workarea');
INSERT INTO k_x_app_workarea (id_app,gu_workarea,gu_admins,gu_powusers,gu_users,gu_guests,gu_other,path_files) VALUES (16,'aa0000ca39854673b17518ec5f870000','<KEY>','c0a80146f4cc507f0e10021acf4aad60','c0a80146f4cc55e5d710021bc3e3ed97','c0a80146f4cc57e3cb10021c8d0629bc',NULL,'model_workarea');
INSERT INTO k_x_app_workarea (id_app,gu_workarea,gu_admins,gu_powusers,gu_users,gu_guests,gu_other,path_files) VALUES (21,'aa0000ca39854673b17518ec5f870000','0fb03429fa3447a6be92142479fc6d52','c0a80146f4cc507f0e10021acf4aad60','c0a80146f4cc55e5d710021bc3e3ed97','c0a80146f4cc57e3cb10021c8d0629bc',NULL,'model_workarea');
INSERT INTO k_x_app_workarea (id_app,gu_workarea,gu_admins,gu_powusers,gu_users,gu_guests,gu_other,path_files) VALUES (30,'aa0000ca39854673b17518ec5f870000','0fb03429fa3447a6be92142479fc6d52','c0a80146f4cc507f0e10021acf4aad60','c0a80146f4cc55e5d710021bc3e3ed97','c0a80146f4cc57e3cb10021c8d0629bc',NULL,'model_workarea');
|
<filename>framework/resources/Functional/hive/hive_storage/hive_json/hive_json_16.sql<gh_stars>0
select cast((get_json_object(hive_json.json, '$.User.Orders.OrderPrice[0]')) as float) - cast((get_json_object(hive_json.json, '$.User.Orders.OrderPrice[1]')) as float) from hive_json;
|
/*
Copyright 2018 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS UserType,Car,User,Address;
SET FOREIGN_KEY_CHECKS = 1;
-- Create Address table
CREATE TABLE Address (
ID INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
Street VARCHAR(32)
) COLLATE utf8_general_ci ENGINE=INNODB;
-- Create User table
CREATE TABLE User (
ID INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
Name VARCHAR(32),
Address_ID INT UNSIGNED,
Car_ID INT UNSIGNED,
BestFriend_ID INT UNSIGNED
) COLLATE utf8_general_ci ENGINE=INNODB;
ALTER TABLE User ADD CONSTRAINT User_FK1 FOREIGN KEY (Address_ID) REFERENCES Address(ID);
ALTER TABLE User ADD CONSTRAINT User_FK2 FOREIGN KEY (BestFriend_ID) REFERENCES User(ID);
-- Create Car table
CREATE TABLE Car (
ID INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
Brand VARCHAR(32),
Owner_ID INT UNSIGNED
) COLLATE utf8_general_ci ENGINE=INNODB;
-- Connect Car and User
ALTER TABLE User ADD CONSTRAINT User_FK3 FOREIGN KEY (Car_ID) REFERENCES Car(ID);
ALTER TABLE Car ADD CONSTRAINT Car_FK2 FOREIGN KEY (Owner_ID) REFERENCES User(ID) ON DELETE CASCADE;
-- Create 3 subjects to test on
INSERT INTO Address
(ID, Street)
VALUES
(1,'Rapture'),
(2,'Gotham'),
(3,'Citadel');
INSERT INTO User
(ID,Name,Address_ID)
VALUES
(1,'Ryan',1),
(2,'Bruce',2),
(3,'John',3);
INSERT INTO Car
(ID,Brand,Owner_ID)
VALUES
(1,'Ford',1),
(2,'Tank',2),
(3,'Normandy',3);
UPDATE User SET Car_ID=1,BestFriend_ID=2 WHERE ID=1;
UPDATE User SET Car_ID=2,BestFriend_ID=3 WHERE ID=2;
UPDATE User SET Car_ID=3,BestFriend_ID=1 WHERE ID=3;
|
<filename>core/src/main/resources/schema/app/20170919144703_CLOUD-87001_create_separated_domain_for_sshkeys.sql
-- // CLOUD-87001 create separated domain for sshkeys
-- Migration SQL that makes the change goes here.
CREATE TABLE IF NOT EXISTS stackauthentication
(
id bigint NOT NULL,
publickey text,
publickeyid CHARACTER VARYING (255),
loginusername CHARACTER VARYING (255) NOT NULL,
temp_stackid BIGINT NOT NULL
);
CREATE SEQUENCE stackauthentication_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
ALTER TABLE stackauthentication ADD CONSTRAINT stackauthentication_pkey PRIMARY KEY (id);
ALTER TABLE stack ADD COLUMN stackauthentication_id BIGINT;
ALTER TABLE ONLY stack ADD CONSTRAINT fk_stack_stackauthentication_id FOREIGN KEY (stackauthentication_id) REFERENCES stackauthentication(id);
UPDATE stack SET loginusername = 'cloudbreak' WHERE loginusername IS NULL;
INSERT INTO stackauthentication (id, publickey, loginusername, temp_stackid) SELECT nextval('stackauthentication_id_seq') AS "id", publickey, loginusername, id FROM stack;
UPDATE stack SET stackauthentication_id=o.id FROM stackauthentication o WHERE o.temp_stackid=stack.id;
ALTER TABLE ONLY stackauthentication DROP COLUMN temp_stackid;
-- //@UNDO
-- SQL to undo the change goes here.
ALTER TABLE stack DROP COLUMN IF EXISTS stackauthentication_id;
ALTER TABLE stack ADD COLUMN IF NOT EXISTS loginusername text;
ALTER TABLE stack ADD COLUMN IF NOT EXISTS publickey text;
DROP TABLE IF EXISTS stackauthentication;
DROP SEQUENCE IF EXISTS stackauthentication_id_seq;
|
<reponame>Areso/sailmaster
USE sailmaster;
CREATE TABLE `portraits` (
`id_portrait` smallint(6) NOT NULL,
`id_race` smallint(6) NOT NULL,
`gender` tinyint(1) NOT NULL,
`allowed_to_use` tinyint(1) NOT NULL,
PRIMARY KEY (`id_portrait`),
FOREIGN KEY (`id_race`) REFERENCES `races`(`id_race`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf16;
INSERT INTO `portraits` (`id_portrait`, `id_race`, `gender`, `allowed_to_use`) VALUES
(1001, 1, 1, 1),
(1002, 1, 0, 1),
(1003, 1, 1, 0),
(2001, 2, 1, 1),
(2002, 2, 0, 1);
|
<filename>sql/01.drop.sql
DROP TABLE IF EXISTS `ilc_orange_sessioninscriptions`;
DROP TABLE IF EXISTS `ilc_orange_sessionformations`;
DROP TABLE IF EXISTS `ilc_orange_modulepreinscriptions`;
DROP TABLE IF EXISTS `ilc_orange_moduleformations`;
DROP TABLE IF EXISTS `ilc_orange_groupmodules`;
DROP TABLE IF EXISTS `ilc_orange_users_roles`;
DROP TABLE IF EXISTS `ilc_orange_users`;
DROP TABLE IF EXISTS `ilc_orange_role_parents`;
DROP TABLE IF EXISTS `ilc_orange_roles`;
|
<grammar.sql>
{_subqueryform |= "(select * from _table)"}
{_subqueryform |= "(select _variable[#arg int16], _variable[#numone int16] from _table[#self] order by __[#numone] limit 1 offset 1)"}
{_subqueryform |= "(select X._variable[#arg int16], __[#arg], X._variable[#numone int16] __[#numone] from _table[#self] X _jointype join __[#self] Y on X.__[#numone] = Y.__[#numone])"}
{_subqueryform |= "(select _numagg(_variable[#arg int16]) __[#arg], _variable[#numone int16] __[#numone] from _table[#self] group by __[#numone])"}
{_subqueryform |= "(select max(_variable[#numone float]) __[#numone], sum(_variable[#arg numeric]) __[#arg], _variable[#string string] from _table[#self] group by __[#string] order by __[#string] limit 1 offset 1)"}
{_basetables |= "P2"}
{_basetables |= "R2"}
{@aftermath = " _math _value[int:1,3]"}
{@agg = "_numagg"}
{@distinctableagg = "_distinctableagg"}
{@winagg = "_numwinagg"} -- [not used here?]
{@cmp = "_cmp"} -- use all comparison operators (=, <>, !=, <, >, <=, >=)
{@somecmp = "_somecmp"} -- a smaller list of comparison operators (=, <, >=) [not used here?]
{@columnpredicate = "_variable[#arg int16] @cmp _value[int16]"}
{@columntype = "int"}
{@comparableconstant = "42"}
{@comparabletype = "numeric"}
{@comparablevalue = "_numericvalue"}
{@dmlcolumnpredicate = "_variable[int] @cmp _value[int]"}
{@idcol = "V_G1"}
{@numcol = "V_SUM_AGE"}
{@plus10 = " + 10"}
{@rankorderbytype = "int"} -- as used in the ORDER BY clause in a RANK function (must be int or timestamp)
{@star = "*"}
{@lhsstar = "*"}
{@dmltable = "_basetables"}
{@fromtables = "_subqueryform"}
|
<gh_stars>1-10
select * from users
where user_username = $1;
|
SELECT * FROM LIKES;
|
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 16-01-2022 a las 23:43:42
-- Versión del servidor: 10.4.19-MariaDB
-- Versión de PHP: 8.0.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
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 */;
--
-- Base de datos: `galeria`
--
CREATE DATABASE galeria;
USE galeria;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `galerias`
--
CREATE TABLE `galerias` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`desc` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `galerias`
--
INSERT INTO `galerias` (`id`, `name`, `image`, `desc`, `created_at`, `updated_at`) VALUES
(25, '<NAME>', 'galeria/w8HeeToovms5cD7YNVP0qoYSySsvDV6YDnIXetqD.jpg', 'Woof and Bites!!!', NULL, NULL),
(27, 'The live and the dead', 'galeria/55Qfw9PTdtSYg87E03Oh1mCoieBQjfA9QrURPv0L.jpg', 'Ollie in live and dead, probably she die by Valleys girls', NULL, NULL),
(28, 'The God Yotsuba', 'galeria/Ycpfnv74FM0v7bv6WX9XnpzzxcIW9M2nW8SdtUIX.jpg', 'Is the god Yotsuba from Go Toubun no Hanayome... idk is the name of the animu', NULL, NULL),
(29, 'Koishi', 'galeria/yS9xj1I1pzQVX5HE3YBOFSRk2ldL5r2fJ4IjKLYm.png', 'Its Koishi try to play acoustic guitar, she is happy', NULL, NULL),
(30, 'wallpaper 1', 'galeria/Mibke5kkiVikofDTsIrNR5P1trm8CWJ5dAf2PC4W.png', 'Desert', NULL, NULL),
(31, 'wallpaper 2', 'galeria/3bOmg0cF4pk0Rwb5hujoK63eGKhurMts7KG9ihw7.png', 'idk', NULL, NULL),
(32, 'wallpaper 3', 'galeria/4lnQmFODNYOTzkrip38WX3NVssvpIhyylk8wtSwK.jpg', 'A warhammer wallpaper', NULL, NULL),
(33, 'wallpaper 4', 'galeria/4x08IjaeVWN786umB7GnYobnKuUT4K2f5AXNIEWY.jpg', 'Its Komachi Onozuka, a lazy shinigami', NULL, NULL),
(34, 'wallpaper 5', 'galeria/FY0x7nnPJzZe3l05fyhfnCpaZQfUjSB14WgdjBHH.png', 'Forte from Shadowverse', NULL, NULL),
(35, '<NAME>', 'galeria/Lum2XGTHyki7b3D9Tkd4j4JoDaYkTsjg69TOVjiA.png', 'The yokai who protect the hakurei shrine', NULL, NULL),
(36, 'Mumei', 'galeria/7meLlDpWdkHI47Sq5FeLKm5VYwph5ZcHv033wc2O.png', 'Nanashi Mumei From Hololive Council', NULL, NULL);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(5, '2021_11_18_185801_create_galerias_table', 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `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;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `personal_access_tokens`
--
CREATE TABLE `personal_access_tokens` (
`id` bigint(20) UNSIGNED NOT NULL,
`tokenable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`tokenable_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`abilities` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_used_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT 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;
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);
--
-- Indices de la tabla `galerias`
--
ALTER TABLE `galerias`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indices de la tabla `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);
--
-- Indices de la tabla `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `galerias`
--
ALTER TABLE `galerias`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37;
--
-- AUTO_INCREMENT de la tabla `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT de la tabla `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;
/*!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 */;
|
-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 12, 2019 at 08:27 PM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.1.26
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
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: `online_sms`
--
-- --------------------------------------------------------
--
-- Table structure for table `accessory`
--
CREATE TABLE `accessory` (
`id` int(11) NOT NULL,
`aname` varchar(50) NOT NULL,
`quantity` varchar(50) NOT NULL,
`price` varchar(50) NOT NULL,
`pimage` varchar(300) NOT NULL,
`delete_status` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `accessory`
--
INSERT INTO `accessory` (`id`, `aname`, `quantity`, `price`, `pimage`, `delete_status`) VALUES
(1, 'Armband phone pouch', '47', '150', '', 0),
(2, 'Cellphone holder stand', '44', '160', '', 0),
(3, 'Phone Cover', '99', '130', '', 0);
-- --------------------------------------------------------
--
-- Table structure for table `modal`
--
CREATE TABLE `modal` (
`id` int(5) NOT NULL,
`header` varchar(100) NOT NULL,
`title` varchar(100) NOT NULL,
`description` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `modal`
--
INSERT INTO `modal` (`id`, `header`, `title`, `description`) VALUES
(1, 'Notification', 'Hello, this is version 2.0 and I am still working on this. ', 'Please don\'t forget to give credit to original developer because I really worked hard to develop this project and please don\'t forget to like and share it if you found it useful :)\r\n\r\nFor students or anyone else who needs program or source code for thesis writing or any Professional Software Development,Website Development,Mobile Apps Development at affordable cost\r\ncontact me at\r\nEmail : <EMAIL>');
-- --------------------------------------------------------
--
-- Table structure for table `part`
--
CREATE TABLE `part` (
`id` int(11) NOT NULL,
`partname` varchar(50) NOT NULL,
`parttype` varchar(50) NOT NULL,
`price` varchar(50) NOT NULL,
`warranty` varchar(50) NOT NULL,
`quantity` varchar(50) NOT NULL,
`delete_status` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `part`
--
INSERT INTO `part` (`id`, `partname`, `parttype`, `price`, `warranty`, `quantity`, `delete_status`) VALUES
(1, 'Microphone', 'Speaker', '1500', '365', '15', 0),
(2, 'Camera Lens', 'Camera', '2000', '730', '20', 1),
(3, 'Menu Dial', 'keypad ', '1000', '730', '20', 0);
-- --------------------------------------------------------
--
-- Table structure for table `phone`
--
CREATE TABLE `phone` (
`id` int(11) NOT NULL,
`pname` varchar(50) NOT NULL,
`pbrand` varchar(50) NOT NULL,
`pmodel` varchar(50) NOT NULL,
`category` varchar(50) NOT NULL,
`pcolor` varchar(50) NOT NULL,
`pprice` varchar(50) NOT NULL,
`pimage` varchar(100) NOT NULL,
`emei1` varchar(50) NOT NULL,
`emei2` varchar(50) NOT NULL,
`description` varchar(200) NOT NULL,
`wperiod` varchar(50) NOT NULL,
`assign` tinyint(4) NOT NULL,
`delete_status` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `phone`
--
INSERT INTO `phone` (`id`, `pname`, `pbrand`, `pmodel`, `category`, `pcolor`, `pprice`, `pimage`, `emei1`, `emei2`, `description`, `wperiod`, `assign`, `delete_status`) VALUES
(31, 'Samsung on 5 pro', 'Samsung', 'On 5 Pro', 'Android', 'Black', '6290', '95997.jpg', '3563523235645665', '98564563456789', ' The Samsung Galaxy On5 Pro is powered by 1.3GHz quad-core processor and it comes with 2GB of RAM.', '365', 0, 0),
(33, 'Nokia', 'Nokia', 'Nokia Lumia', 'Iphone', 'Black', '9544', '4231.jpg', '90897876756', '986875675646', ' daewd ', '320', 0, 0),
(34, 'Samsung Gallexy', 'Samsung', 'Gallexy', 'Android', '', '', '', '567567567567567567567', '778989662456456', 'sdfsdf', '46', 0, 0),
(35, 'aaaa', '', 'sdfsf', '', '', '', 'jyoti.png', '435435', '345345', 'sdgsdgf', '34543545', 0, 1),
(36, 'sdfg', '', 'dsgf', '', '', '', '', 'dfsg', 'dfg', 'dsg', '456546', 1, 0),
(37, 'sg', '', 'dfg', '', '', '', '', 'dg', 'ertye', '456', '456', 1, 0);
-- --------------------------------------------------------
--
-- Table structure for table `tac`
--
CREATE TABLE `tac` (
`id` int(11) NOT NULL,
`description` varchar(600) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tac`
--
INSERT INTO `tac` (`id`, `description`) VALUES
(1, '1.sdfsdfsdfsdff<br>\r\n2.zsfsdfsdfsdfsd');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_admin`
--
CREATE TABLE `tbl_admin` (
`admin_id` int(11) NOT NULL,
`company` varchar(300) NOT NULL,
`name` varchar(50) NOT NULL,
`email` varchar(30) NOT NULL,
`password` varchar(100) NOT NULL,
`phone` text NOT NULL,
`address` varchar(100) NOT NULL,
`role` varchar(50) NOT NULL,
`image` varchar(100) NOT NULL,
`delete_status` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tbl_admin`
--
INSERT INTO `tbl_admin` (`admin_id`, `company`, `name`, `email`, `password`, `phone`, `address`, `role`, `image`, `delete_status`) VALUES
(1, 'SSS', '<NAME>', '<EMAIL>', 'd13a0dab8fa5b30a5d311034fca71a44e7c60a57566a086a78602a1f4f47125b', '+919423979339', 'Maharashtra, India', 'seller', '242695b607054e1a33.jpg', 0);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `accessory`
--
ALTER TABLE `accessory`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `modal`
--
ALTER TABLE `modal`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `part`
--
ALTER TABLE `part`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `phone`
--
ALTER TABLE `phone`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tac`
--
ALTER TABLE `tac`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tbl_admin`
--
ALTER TABLE `tbl_admin`
ADD PRIMARY KEY (`admin_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `accessory`
--
ALTER TABLE `accessory`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `modal`
--
ALTER TABLE `modal`
MODIFY `id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `part`
--
ALTER TABLE `part`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `phone`
--
ALTER TABLE `phone`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;
--
-- AUTO_INCREMENT for table `tac`
--
ALTER TABLE `tac`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tbl_admin`
--
ALTER TABLE `tbl_admin`
MODIFY `admin_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
/*!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 */;
|
<filename>is_valid_abn.sql
/*
Checks if the given text is a valid ABN (Australian Business Number) using the formula provided by the ABR:
https://abr.business.gov.au/Help/AbnFormat
Leading and trailing whitespace is allowed as is any whitespace between digits.
*/
create function is_valid_abn(text) returns boolean
as $$
declare
digits text[] := array[]::text[];
weighting_factors int[] := array[10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19];
total int := 0;
i int := 0;
begin
if $1 ~ '^(\s*\d\s*){11}$' then
digits := string_to_array(regexp_replace($1, '\s', '', 'g'), null);
digits[1] := cast(cast(digits[1] as int) - 1 as text);
for i in 1..11 loop
total := total + cast(digits[i] as int) * weighting_factors[i];
end loop;
return total % 89 = 0;
else
return false;
end if;
end;
$$
language 'plpgsql'
immutable
returns null on null input;
|
<gh_stars>0
CREATE TABLE `tblAccountActivity` (
`ActivityID` int(11) NOT NULL AUTO_INCREMENT,
`CompanyID` int(11) NOT NULL,
`Title` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`Description` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`Date` datetime DEFAULT NULL,
`ActivityType` tinyint(3) unsigned NOT NULL,
`CreatedBy` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`ModifiedBy` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`AccountID` int(11) DEFAULT NULL,
PRIMARY KEY (`ActivityID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1335797,
25,
250,
1933641964,
913353038,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(450)943,1726,3218,8056,3799,2801,1380,3911,5654,3414,8855');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1333172,
25,
250,
1257081855,
937293683,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(834)6932,5473,3568,9029,8765,2714,4149,7169,3796,4197,8817,1180,6411,9235,7917,4605,5928,9328,3043,4261');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1336167,
25,
250,
1463263541,
923330720,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(827)781,8719,4969,8442,1477,8222,481,2683,8100,11,1447,1622,3632,8037,8047');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1333335,
25,
250,
1496694413,
843370548,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(204)4314,1455,3194,7958,3743');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1333690,
25,
250,
310960804,
913735390,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(379)7558,6338,5511,240,4064,9828,1410,6709');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1333037,
25,
250,
1636084021,
918669123,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(556)3429,2584,4530,213,6434,7554,9804,3370,9985,2194,1463');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1333936,
25,
250,
656135395,
883674890,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(415)8910,6640,940,6485,5838,4721,605,2435');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1334592,
25,
250,
1839677462,
880495500,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(381)8199,3996,4774,2077,4104,1097,3550');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1332311,
25,
250,
2071059601,
957691090,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(614)2434,7729,6710,1807,623,4448,4925,7222,689,646,4218');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1332804,
25,
250,
426062511,
856933625,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(238)9418,8278,2915,1187,9292');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1332471,
25,
250,
1025893700,
949849285,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(898)9433,4129,2586,3196,4277,8242,1926,1753,5633,893,1516,8177,629,4731,760,1881');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1329697,
25,
250,
1427356977,
936705110,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(843)8554,6011,2889,2723,6666,1404,9569,5892,5498,8675,6998,6911,9058,5360,7517,3811');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1331738,
25,
250,
1040733461,
884015100,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(458)7854,2178,4897,9685,6148,5342,9950,3576,8320,5344,7261');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1333951,
25,
250,
508022108,
937594385,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(766)1050,2917,3949,6864,5645,1642,8622,3493,922,4337,5861,2903,4071,5653');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1334137,
25,
250,
1768433811,
918862310,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(441)976,5113,7223,4878,4047,7598,361,1429');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1332493,
25,
250,
850636724,
892373625,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(541)9231,2296,9672,4601,3725,914,6613,9747,588,6932,7553,505');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1332122,
25,
250,
880655515,
892877500,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(504)5485,8088,5034,5036,618,9826,6832,2114,562,9578,6769,9701,1379');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1330143,
25,
250,
546149610,
842898755,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(160)5920,3400,9505,2555,1754');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1334735,
25,
250,
812770535,
877233190,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(300)6457,4584,7262,7945,9576,6076,9654');
-- Test finished
INSERT INTO result(alg,vertcount,edgecount,elenadd,conn,task,cycles,batchname,result)
VALUES('dijkstraheapgeom',
10000,
1331918,
25,
250,
119497540,
880284900,
'dijkstraheapgeomFLAT_MINEDGECONN_NEAREST250',
'(410)2028,8386,7533,7225,4320,5403,8705,7093');
|
<reponame>noel-srocha/trybe-mysql-vocabulary-booster
SELECT
CONCAT(UCASE(empls.FIRST_NAME), ' ', UCASE(empls.LAST_NAME)) AS 'Nome completo',
jh.START_DATE AS 'Data de início',
empls.SALARY AS 'Salário'
FROM hr.employees empls
INNER JOIN hr.job_history jh
ON empls.EMPLOYEE_ID = jh.EMPLOYEE_ID
WHERE MONTH(jh.START_DATE) IN (1, 2, 3)
ORDER BY `Nome completo` ASC, jh.START_DATE ASC;
|
\connect app
set search_path to data;
create or replace function get_random_number(integer, integer)
returns integer
language sql
as $$
select trunc(random() * ($2-$1) + $1)::integer;
$$ ;
drop table if exists sample_data;
create table sample_data (
people text,
companies text,
emails text,
clients text,
projects text,
tasks text
);
COPY sample_data FROM '/vagrant/sample_data.csv' DELIMITER '|' CSV HEADER;
-- insert sample data
-- companies
insert into companies (name)
select companies
from sample_data;
-- clients
insert into clients (name, company_id)
select * from (
with source as
(
select field, row_number() over () as rn
from (
select field, generate_series(1, cnt)
from (
select field, get_random_number(3, 7) as cnt
from (
select id as field from companies
where id > 100
) t
) t
) t
),
random_data as (
select field, row_number() over() as rn
from (
select field, generate_series(1, 7)
from (
select clients as field from sample_data
) t
order by random()
) t
)
select random_data.field as name, source.field as company_id
from source
inner join
random_data on source.rn = random_data.rn
) t;
-- projects
insert into projects (name, client_id, company_id)
select * from (
with source as
(
select field1, field2, row_number() over () as rn
from (
select field1, field2, generate_series(1, cnt)
from (
select field1, field2, get_random_number(2, 4) as cnt
from (
select id as field1, company_id as field2 from clients
where id > 100
) t
) t
) t
),
random_data as (
select field, row_number() over() as rn
from (
select field, generate_series(1, 7)
from (
select projects as field from sample_data
) t
order by random()
) t
)
select random_data.field as name, source.field1 as client_id, source.field2 as company_id
from source
inner join
random_data on source.rn = random_data.rn
) t;
-- tasks
insert into tasks (name, project_id, company_id)
select * from (
with source as
(
select field1, field2, row_number() over () as rn
from (
select field1, field2, generate_series(1, cnt)
from (
select field1, field2, get_random_number(3, 10) as cnt
from (
select id as field1, company_id as field2 from projects
where id > 100
) t
) t
) t
),
random_data as (
select field, row_number() over() as rn
from (
select field, generate_series(1, 30)
from (
select tasks as field from sample_data
) t
order by random()
) t
)
select random_data.field as name, source.field1 as project_id, source.field2 as company_id
from source
inner join
random_data on source.rn = random_data.rn
) t;
|
select
train_regressor(
add_bias(features),
cltv
)
from
cltv_train_vectorized
|
-- OLE Automation Procedure - Download Cradle Example
-- Does not require a table, but can't handle larger payloads
-- Note: This also works with unc paths \\ip\file.txt
-- Note: This also works with webdav paths \\ip@80\file.txt However, the target web server needs to support propfind.
-- Setup Variables
DECLARE @url varchar(300)
DECLARE @WinHTTP int
DECLARE @handle int
DECLARE @Command varchar(8000)
-- Set target url containting TSQL
SET @url = 'http://127.0.0.1/mycmd.txt'
-- Setup namespace
EXEC @handle=sp_OACreate 'WinHttp.WinHttpRequest.5.1',@WinHTTP OUT
-- Call the Open method to setup the HTTP request
EXEC @handle=sp_OAMethod @WinHTTP, 'Open',NULL,'GET',@url,'false'
-- Call the Send method to send the HTTP GET request
EXEC @handle=sp_OAMethod @WinHTTP,'Send'
-- Capture the HTTP response content
EXEC @handle=sp_OAGetProperty @WinHTTP,'ResponseText', @Command out
-- Destroy the object
EXEC @handle=sp_OADestroy @WinHTTP
-- Display command
SELECT @Command
-- Run command
EXECUTE (@Command)
|
-- for testing
INSERT INTO account (account_username, email, password)
VALUES
('Joe', '<EMAIL>', 'password')
|
USE data_extracts;
-- ahui 9/2/2020
DROP PROCEDURE IF EXISTS filterMedicationsV2;
DELIMITER //
CREATE PROCEDURE filterMedicationsV2 (
IN filterType INT -- 0 earliest, 1 latest, 2 in past 4 months, 5 discontinued
)
BEGIN
DROP TABLE IF EXISTS filterMedicationsV2;
IF (filterType = 0) THEN -- earliest
CREATE TABLE filterMedicationsV2 as
SELECT
m.id,
m.original_code,
m.person_id,
m.patient_id,
m.group_by,
m.original_term,
m.clinical_effective_date,
m.rnk
FROM (
SELECT med.id,
med.group_by,
med.person_id,
med.patient_id,
med.original_code,
med.original_term,
med.clinical_effective_date,
@currank := IF(@curperson = med.person_id AND @curdmd = med.original_code AND @curmedid = med.id, @currank + 1, 1) AS rnk, -- per each medication
@curperson := med.person_id AS cur_person,
@curdmd := med.original_code AS cur_original_code,
@curmedid := med.id AS cur_med_id
FROM medicationsFromCohortV2 med, (SELECT @currank := 0, @curperson := 0, @curdmd := 0, @curmedid := 0) r
ORDER BY med.person_id, med.original_code, med.id ASC, med.clinical_effective_date ASC
) m
WHERE m.rnk = 1;
ELSEIF (filterType = 1 ) THEN -- latest
CREATE TABLE filterMedicationsV2 as
SELECT
m.id,
m.original_code,
m.person_id,
m.patient_id,
m.group_by,
m.original_term,
m.clinical_effective_date,
m.cancellation_date, -- discontinued date
m.rnk
FROM (
SELECT med.id,
med.group_by,
med.person_id,
med.patient_id,
med.original_code,
med.original_term,
med.clinical_effective_date,
med.cancellation_date,
@currank := IF(@curperson = med.person_id AND @curdmd = med.original_code AND @curmedid = med.id, @currank + 1, 1) AS rnk, -- per each medication
@curperson := med.person_id AS cur_person,
@curdmd := med.original_code AS cur_original_code,
@curmedid := med.id AS cur_med_id
FROM medicationsFromCohortV2 med, (SELECT @currank := 0, @curperson := 0, @curdmd := 0, @curmedid := 0) r
ORDER BY med.person_id, med.original_code, med.id DESC, med.clinical_effective_date DESC
) m
WHERE m.rnk = 1;
ELSEIF (filterType = 5 ) THEN -- latest
CREATE TABLE filterMedicationsV2 as
SELECT
m.id,
m.original_code,
m.person_id,
m.patient_id,
m.group_by,
m.original_term,
m.clinical_effective_date,
m.cancellation_date, -- discontinued date
m.rnk
FROM (
SELECT med.id,
med.group_by,
med.person_id,
med.patient_id,
med.original_code,
med.original_term,
med.clinical_effective_date,
med.cancellation_date,
@currank := IF(@curperson = med.person_id AND @curdmd = med.original_code AND @curmedid = med.id, @currank + 1, 1) AS rnk, -- per each medication
@curperson := med.person_id AS cur_person,
@curdmd := med.original_code AS cur_original_code,
@curmedid := med.id AS cur_med_id
FROM medicationsFromCohortV2 med, (SELECT @currank := 0, @curperson := 0, @curdmd := 0, @curmedid := 0) r
ORDER BY med.person_id, med.original_code, med.id DESC, med.cancellation_date IS NULL DESC, med.cancellation_date DESC
) m
WHERE m.rnk = 1;
ELSE
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'filterType not recognised';
END IF;
END//
DELIMITER ;
|
-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 30, 2019 at 04:48 PM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 5.6.40
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
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: `sgf`
--
-- --------------------------------------------------------
--
-- Table structure for table `drives`
--
CREATE TABLE `drives` (
`id` int(11) NOT NULL,
`name` varchar(65) NOT NULL,
`space` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `files`
--
CREATE TABLE `files` (
`Id` int(11) NOT NULL,
`Name` varchar(64) NOT NULL,
`Size` int(11) NOT NULL,
`ParentFolderId` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `folders`
--
CREATE TABLE `folders` (
`Id` int(11) NOT NULL,
`Name` varchar(64) NOT NULL,
`ParentFolderId` int(11) NOT NULL,
`Space` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`Name` varchar(32) NOT NULL,
`Password` varchar(64) NOT NULL,
`Permissions` tinyint(4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `drives`
--
ALTER TABLE `drives`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `files`
--
ALTER TABLE `files`
ADD PRIMARY KEY (`Id`);
--
-- Indexes for table `folders`
--
ALTER TABLE `folders`
ADD PRIMARY KEY (`Id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `files`
--
ALTER TABLE `files`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `folders`
--
ALTER TABLE `folders`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;
/*!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 */;
|
<filename>src/main/resources/db/migration/V202104121834__create_reviews_table.sql
DROP TABLE IF EXISTS reviews;
CREATE TABLE reviews
(
id BIGSERIAL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
score SMALLINT NOT NULL,
reviewer_id BIGINT NOT NULL,
book_id BIGINT NOT NULL,
deleted BOOLEAN DEFAULT (FALSE),
created_on TIMESTAMP WITH TIME ZONE,
updated_on TIMESTAMP WITH TIME ZONE,
CONSTRAINT reviewer_fk
FOREIGN KEY (reviewer_id)
REFERENCES users (id),
CONSTRAINT reviews_book_fk
FOREIGN KEY (book_id)
REFERENCES books (id)
);
|
# --- !Ups
alter table account drop column name;
alter table account drop column field_affiliation;
alter table account drop column url;
alter table account drop column edit_url;
alter table account drop column last_access;
alter table account drop column last_login;
alter table account drop column created;
alter table account drop column status;
alter table account drop column language;
alter table account drop column feed_nid;
alter table account drop column revision;
# --- !Downs
alter table account add name varchar(255);
alter table account add field_affiliation varchar(255);
alter table account add url varchar(255);
alter table account add edit_url varchar(255);
alter table account add last_access varchar(255);
alter table account add last_login varchar(255);
alter table account add created varchar(255);
alter table account add status bigint;
alter table account add language varchar(255);
alter table account add feed_nid bigint;
alter table account add revision TEXT;
|
------------------------------------------------------------------------------
CREATE TABLE ApiDB.GFF3 (
gff3_feature_id NUMBER(10),
na_sequence_id NUMBER(10) not null,
source VARCHAR2(50),
sequence_ontology_id NUMBER(10) not null,
mapping_start NUMBER(8),
mapping_end NUMBER(8),
score FLOAT,
is_reversed NUMBER(3),
phase VARCHAR2(1),
attr CLOB,
parent_attr VARCHAR2(100),
id_attr VARCHAR2(100),
external_database_release_id NUMBER(10),
MODIFICATION_DATE DATE,
USER_READ NUMBER(1),
USER_WRITE NUMBER(1),
GROUP_READ NUMBER(1),
GROUP_WRITE NUMBER(1),
OTHER_READ NUMBER(1),
OTHER_WRITE NUMBER(1),
ROW_USER_ID NUMBER(12),
ROW_GROUP_ID NUMBER(3),
ROW_PROJECT_ID NUMBER(4),
ROW_ALG_INVOCATION_ID NUMBER(12),
FOREIGN KEY (na_sequence_id) REFERENCES DoTS.NaSequenceImp (na_sequence_id),
FOREIGN KEY (sequence_ontology_id) REFERENCES Sres.OntologyTerm (ontology_term_id),
FOREIGN KEY (external_database_release_id) REFERENCES SRes.ExternalDatabaseRelease (external_database_release_id),
PRIMARY KEY (gff3_feature_id)
);
GRANT INSERT, SELECT, UPDATE, DELETE ON ApiDB.GFF3 TO gus_w;
GRANT SELECT ON ApiDB.GFF3 TO gus_r;
CREATE INDEX apidb.gff3_loc_idx
ON ApiDB.GFF3 (na_sequence_id, mapping_start, mapping_end) tablespace indx;
CREATE INDEX apidb.gff3_revfk1_idx
ON ApiDB.GFF3 (sequence_ontology_id, gff3_feature_id) tablespace indx;
CREATE INDEX apidb.gff3_revfk2_idx
ON ApiDB.GFF3 (external_database_release_id, gff3_feature_id) tablespace indx;
CREATE SEQUENCE apidb.GFF3_sq;
GRANT SELECT ON apidb.GFF3_sq TO gus_r;
GRANT SELECT ON apidb.GFF3_sq TO gus_w;
INSERT INTO core.TableInfo
(table_id, name, table_type, primary_key_column, database_id, is_versioned,
is_view, view_on_table_id, superclass_table_id, is_updatable,
modification_date, user_read, user_write, group_read, group_write,
other_read, other_write, row_user_id, row_group_id, row_project_id,
row_alg_invocation_id)
SELECT core.tableinfo_sq.nextval, 'GFF3',
'Standard', 'gff3_feature_id',
d.database_id, 0, 0, '', '', 1,sysdate, 1, 1, 1, 1, 1, 1, 1, 1,
p.project_id, 0
FROM dual,
(SELECT MAX(project_id) AS project_id FROM core.ProjectInfo) p,
(SELECT database_id FROM core.DatabaseInfo WHERE lower(name) = 'apidb') d
WHERE 'gff3' NOT IN (SELECT lower(name) FROM core.TableInfo
WHERE database_id = d.database_id);
CREATE TABLE ApiDB.GFF3AttributeKey (
gff3_attribute_key_id NUMBER(38) not null,
name VARCHAR2(64) not null,
MODIFICATION_DATE DATE,
USER_READ NUMBER(1),
USER_WRITE NUMBER(1),
GROUP_READ NUMBER(1),
GROUP_WRITE NUMBER(1),
OTHER_READ NUMBER(1),
OTHER_WRITE NUMBER(1),
ROW_USER_ID NUMBER(12),
ROW_GROUP_ID NUMBER(3),
ROW_PROJECT_ID NUMBER(4),
ROW_ALG_INVOCATION_ID NUMBER(12),
PRIMARY KEY (gff3_attribute_key_id)
);
GRANT INSERT, SELECT, UPDATE, DELETE ON ApiDB.GFF3AttributeKey TO gus_w;
GRANT SELECT ON ApiDB.GFF3AttributeKey TO gus_r;
CREATE SEQUENCE apidb.GFF3AttributeKey_sq;
GRANT SELECT ON apidb.GFF3AttributeKey_sq TO gus_r;
GRANT SELECT ON apidb.GFF3AttributeKey_sq TO gus_w;
INSERT INTO core.TableInfo
(table_id, name, table_type, primary_key_column, database_id, is_versioned,
is_view, view_on_table_id, superclass_table_id, is_updatable,
modification_date, user_read, user_write, group_read, group_write,
other_read, other_write, row_user_id, row_group_id, row_project_id,
row_alg_invocation_id)
SELECT core.tableinfo_sq.nextval, 'GFF3AttributeKey',
'Standard', 'gff3_attribute_key_id',
d.database_id, 0, 0, '', '', 1,sysdate, 1, 1, 1, 1, 1, 1, 1, 1,
p.project_id, 0
FROM dual,
(SELECT MAX(project_id) AS project_id FROM core.ProjectInfo) p,
(SELECT database_id FROM core.DatabaseInfo WHERE lower(name) = 'apidb') d
WHERE 'gff3attributekey' NOT IN (SELECT lower(name) FROM core.TableInfo
WHERE database_id = d.database_id);
CREATE TABLE ApiDB.GFF3Attributes (
gff3_attribute_id NUMBER(38) not null,
gff3_attribute_key_id NUMBER(38) not null,
gff3_feature_id NUMBER(10) not null,
value VARCHAR2(300) not null,
MODIFICATION_DATE DATE,
USER_READ NUMBER(1),
USER_WRITE NUMBER(1),
GROUP_READ NUMBER(1),
GROUP_WRITE NUMBER(1),
OTHER_READ NUMBER(1),
OTHER_WRITE NUMBER(1),
ROW_USER_ID NUMBER(12),
ROW_GROUP_ID NUMBER(3),
ROW_PROJECT_ID NUMBER(4),
ROW_ALG_INVOCATION_ID NUMBER(12),
FOREIGN KEY (gff3_attribute_key_id) REFERENCES Apidb.GFF3AttributeKey (gff3_attribute_key_id),
FOREIGN KEY (gff3_feature_id) REFERENCES ApiDB.GFF3 (gff3_feature_id),
PRIMARY KEY (gff3_attribute_id)
);
GRANT INSERT, SELECT, UPDATE, DELETE ON ApiDB.GFF3Attributes TO gus_w;
GRANT SELECT ON ApiDB.GFF3Attributes TO gus_r;
CREATE SEQUENCE apidb.GFF3Attributes_sq;
CREATE INDEX apidb.gff3att_revfk1_idx
ON ApiDB.GFF3Attributes (gff3_feature_id, gff3_attribute_id) tablespace indx;
CREATE INDEX apidb.gff3att_revfk2_idx
ON ApiDB.GFF3Attributes (gff3_attribute_key_id, gff3_attribute_id) tablespace indx;
GRANT SELECT ON apidb.GFF3Attributes_sq TO gus_r;
GRANT SELECT ON apidb.GFF3Attributes_sq TO gus_w;
INSERT INTO core.TableInfo
(table_id, name, table_type, primary_key_column, database_id, is_versioned,
is_view, view_on_table_id, superclass_table_id, is_updatable,
modification_date, user_read, user_write, group_read, group_write,
other_read, other_write, row_user_id, row_group_id, row_project_id,
row_alg_invocation_id)
SELECT core.tableinfo_sq.nextval, 'GFF3Attributes',
'Standard', 'gff3_attribute_id',
d.database_id, 0, 0, '', '', 1,sysdate, 1, 1, 1, 1, 1, 1, 1, 1,
p.project_id, 0
FROM dual,
(SELECT MAX(project_id) AS project_id FROM core.ProjectInfo) p,
(SELECT database_id FROM core.DatabaseInfo WHERE lower(name) = 'apidb') d
WHERE 'gff3attributes' NOT IN (SELECT lower(name) FROM core.TableInfo
WHERE database_id = d.database_id);
exit;
|
<reponame>WizardXiao/tidb<filename>br/tests/lightning_duplicate_detection/data/dup_detect-schema-create.sql
create schema dup_detect;
|
<gh_stars>0
create table ordering
(
order_no varchar(10) ,
item_code varchar(10) ,
quantity_received int not null ,
primary key (order_no) ,
foreign key (item_code) references item(item_code)
);
create table item
(
item_code varchar(10) not null ,
item_description varchar(100) not null ,
unit_price decimal(8,2) ,
EOQ decimal(8,2) ,
ROL number(20) ,
SOH number(20) ,
back_order_qty number(20) ,
primary key(item_code)
)
;
create table cheque
(
cheque_no varchar(10) not null ,
cheque_date date not null ,
cheque_amount int not null ,
primary key(cheque_no)
);
create table vendor
(
vendor_no varchar(10) not null ,
vendor_name varchar(10) ,
vendor_address varchar(100) ,
primary key(vendor_no)
);
create table section
(
section_code varchar(10) not null ,
section_name varchar(10) ,
primary key(section_code)
);
create table Indent
(
indent_no varchar(10) not null ,
quantity_demanded int not null ,
quantity_issued int not null ,
section_code varchar(10) ,
item_code varchar(10) ,
primary key (indent_no) ,
foreign key (section_code) references section(section_code) ,
foreign key (item_code) references item(item_code)
);
create table voucher
(
voucher_no varchar(10) ,
voucher_date date ,
vendor_no varchar(10) ,
cheque_no varchar(10) ,
primary key(voucher_no) ,
foreign key (cheque_no) references cheque(cheque_no) ,
foreign key (vendor_no) references vendor(vendor_no)
);
create table order1
(
order_no varchar(10) not null ,
order_date date ,
voucher_no varchar(10) ,
vendor_no varchar(10) ,
due_date date ,
primary key (order_no) ,
foreign key (voucher_no) references voucher(voucher_no) ,
foreign key (vendor_no) references vendor(vendor_no)
);
create table item
(
item_code varchar(10) not null ,
item_description varchar(100) not null ,
unit_price decimal(8,2) ,
EOQ decimal(8,2) ,
ROL number(20) ,
SOH number(20) ,
back_order_qty number(20) ,
primary key(item_code)
);
-- INSERT INTO TABLE
insert into item
values ('&item_code' , '&item_description' ,
'&unit_price' , '&EOF' , '&ROL' , '&SOH' , '&back_order_qty') ;
insert into ordering
values (
'&order_no', '&item_code' , '&quantity_received'
);
insert into order1
values (
'&order_no' , '&order_date' , '&voucher_no' , '&vender_no' , '&due_date'
);
insert into vendor
values (
'&vendor_no' , '&vendor_name' ,'&vendor_address'
);
insert into voucher
values (
'&voucher_no' , '&voucher_date' , '&vendor_no' , '&cheque_no'
);
insert into indent
values (
'&indent_no' , '&quantity_demanded' , '&quantity_issued' , '§ion_code', '&item_code'
);
insert into section
values (
'§ion_no' , '§ion_name'
);
insert into cheque
values (
'&cheque_no' , '&cheque_date' , '&cheque_amount'
);
|
SET CHARACTER_SET_CLIENT = utf8mb4;
SET CHARACTER_SET_CONNECTION = utf8mb4;
-- Project Name : hololive
-- Date/Time : 2020/02/25 20:50:00
-- Author : yukikaze506
-- RDBMS Type : MySQL
-- Application : A5:SQL Mk-2
-- Youtube情報
drop table if exists hololive.youtube cascade;
create table hololive.youtube (
id varchar(32) not null comment 'ID'
, members_id varchar(32) not null comment 'メンバーID'
, channel_id text not null comment 'チャンネルID'
, channel_name text comment 'チャンネル名'
, subscriber_count integer unsigned comment 'チャンネル登録者数'
, view_count integer unsigned comment '視聴回数'
, banner_image_url text comment 'バナー'
, banner_image_url_mobile text comment 'バナー(モバイル)'
, user_icon text comment 'ユーザーアイコン'
, original_data json comment 'オリジナルデータ'
, last_updated datetime comment '更新日時'
, constraint youtube_PKC primary key (id)
) comment 'Youtube情報' ;
-- メンバー
drop table if exists hololive.members cascade;
create table hololive.members (
id varchar(32) not null comment 'ID'
, name text comment '名前'
, name_alphabet text comment '名前(アルファベット)'
, name_bilibili text comment '名前(bilibili)'
, debut_date date comment 'デビュー日'
, birthday text comment '誕生日:MM-dd'
, twitter_account text comment 'Twitterアカウント'
, bilibili_account text comment 'bilibiliアカウント'
, constraint members_PKC primary key (id)
) comment 'メンバー' ;
alter table hololive.youtube
add constraint youtube_FK1 foreign key (members_id) references hololive.members(id)
on delete cascade
on update cascade;
|
<filename>blog-services/src/main/resources/flyway/V1.0.1__add_admin.sql
insert into blog_user (blog_user_id, email, password, role, username)
values (nextval('hibernate_sequence'),
'<EMAIL>',
<PASSWORD>',
'ADMIN',
'smiller');
|
<gh_stars>1-10
create table yellowtrips_3mo
(vendorid varchar(10),
tpep_pickup_datetime datetime,
tpep_dropoff_datetime datetime,
passenger_count int,
trip_distance float,
ratecodeid varchar(10),
store_and_fwd_flag char(1),
pulocationid varchar(10),
dolocationid varchar(10),
payment_type varchar(10),
fare_amount float,
extra float,
mta_tax float,
tip_amount float,
tolls_amount float,
improvement_surcharge float,
total_amount float,
congestion_surcharge float);
|
<reponame>Logiks/Logiks-Core
--
-- MySQL 5.6+
--
INSERT INTO `lgks_access` (`id`, `guid`, `name`, `sites`, `blocked`, `created_by`, `edited_by`) VALUES
(1, 'global', 'All Sites', '*', 'false', 'auto', 'auto');
INSERT INTO `lgks_privileges` (`id`, `guid`, `site`, `name`, `remarks`, `blocked`, `created_by`, `edited_by`) VALUES
(1, 'global', '*', 'root', 'Root User', 'false', 'auto', 'auto'),
(2, 'global', '*', 'suadmin', 'Super Admin', 'false', 'auto', 'auto'),
(5, 'global', '*', 'admin', 'Admin', 'false', 'auto', 'auto'),
(6, 'global', '*', 'manager', 'Manager', 'false', 'auto', 'auto'),
(7, 'global', '*', 'moderator', 'moderator', 'false', 'auto', 'auto'),
(8, 'global', '*', 'user', 'user', 'false', 'auto', 'auto');
INSERT INTO `lgks_users` (`id`, `guid`, `userid`, `pwd`, `<PASSWORD>`, `privilegeid`, `accessid`, `groupid`, `name`, `dob`, `gender`, `organization_name`, `organization_position`, `organization_email`, `email`, `mobile`, `address`, `region`, `country`, `zipcode`, `geolocation`, `geoip`, `tags`, `avatar_type`, `avatar`, `privacy`, `blocked`, `expires`, `registered_site`, `remarks`, `vcode`, `mauth`, `refid`, `security_policy`, `last_login`, `created_by`, `edited_by`) VALUES
(1, 'global', 'root', '', '', 1, 1, 0, 'Root User', '1985-01-01', 'male', NULL, NULL, NULL, '<EMAIL>', '', '', '', '', '', '', '', '', 'photoid', '', 'public', 'false', '2200-01-01', '', '', '', '', '', 'open', NULL, 'auto', 'auto');
INSERT INTO `lgks_users_group` (`id`, `guid`, `group_name`, `group_manager`, `group_descs`, `created_by`, `edited_by`) VALUES
(1, 'globals', 'Default', NULL, 'No description available', 'auto', 'auto');
|
<filename>migrations/311-perms-reviewers.sql
INSERT INTO groups VALUES (50002, 'Add-on Reviewers', 'Addons:Review', NOW(), NOW());
INSERT INTO groups VALUES (50003, 'App Reviewers', 'Apps:Review', NOW(), NOW());
INSERT INTO groups VALUES (50004, 'Persona Reviewers', 'Personas:Review', NOW(), NOW());
-- We will append to this group as we edit more permissions.
INSERT INTO groups VALUES (50005, 'Senior Add-on Reviewers', 'Addons:Review', NOW(), NOW());
INSERT INTO groups_users (
SELECT NULL, 50002, groups_users.user_id FROM groups, groups_users
WHERE groups.id=groups_users.group_id AND groups.name='Editors' AND groups.id < 50000);
INSERT INTO groups_users (
SELECT NULL, 50004, groups_users.user_id FROM groups, groups_users
WHERE groups.id=groups_users.group_id AND groups.name='Persona Reviewer' AND groups.id < 50000);
INSERT INTO groups_users (
SELECT NULL, 50005, groups_users.user_id FROM groups, groups_users
WHERE groups.id=groups_users.group_id AND groups.name='Senior Editors' AND groups.id < 50000);
|
<gh_stars>100-1000
SET client_min_messages = warning;
DROP SCHEMA IF EXISTS public CASCADE;
CREATE SCHEMA public;
CREATE TABLE "Users" (
"Id" SERIAL PRIMARY KEY
);
CREATE TABLE "Posts" (
"Id" SERIAL PRIMARY KEY,
"UserId" INTEGER,
"createdAt" timestamp,
"createdAtTz" timestamptz,
"createdOn" date,
CONSTRAINT "foreign_key_1" FOREIGN KEY ("UserId") REFERENCES "Users"("Id")
);
CREATE INDEX ON "Posts" ("createdAt");
INSERT INTO "Posts" ("createdAt", "createdAtTz", "createdOn") SELECT NOW(), NOW(), NOW() FROM generate_series(1, 10000) n;
|
select TOP 1
TO_TIMESTAMP(TO_VARCHAR("TIME", 'YYYY-MM-DD HH24:MI')) "TIME",
HOST,
PORT,
MAX(CPU) "CPU_PCT_INDEXSERVER",
MAX(SYSTEM_CPU) "SYSTEM_CPU_PCT_INDEXSERVER",
ROUND(MAX(MEMORY_USED)/1024/1024/1024, 1) "MEMORY_USED_GB",
ROUND(MAX(MEMORY_ALLOCATION_LIMIT)/1024/1024/1024, 1) "MEMORY_ALLOCATION_LIMIT_GB",
MAX(CS_UNLOAD_COUNT) "CS_UNLOAD_COUNT",
MAX(SWAP_IN) "SWAP_IN_BYTE",
MAX(PING_TIME) "PING_TIME_MS",
MAX(PENDING_SESSION_COUNT) "PENDING_SESSION_COUNT",
MAX(MVCC_VERSION_COUNT) "MVCC_VERSION_COUNT",
MAX(WAITING_THREAD_COUNT) "WAITING_THREAD_COUNT",
MAX(BLOCKED_TRANSACTION_COUNT) "BLOCKED_TRANSACTION_COUNT"
from
"M_LOAD_HISTORY_SERVICE"
WHERE
PORT LIKE '%03'
group by
TO_TIMESTAMP(TO_VARCHAR("TIME", 'YYYY-MM-DD HH24:MI')),
HOST,
PORT
order by
TIME desc
|
-- 27.10.2016 14:10
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET AD_Val_Rule_ID=NULL,Updated=TO_TIMESTAMP('2016-10-27 14:10:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541017
;
-- 27.10.2016 14:12
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET AD_Reference_Value_ID=540692,Updated=TO_TIMESTAMP('2016-10-27 14:12:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541017
;
-- 27.10.2016 15:41
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET AD_Element_ID=543213, EntityType='de.metas.swat', Name='Qualität-Notiz',Updated=TO_TIMESTAMP('2016-10-27 15:41:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541017
;
-- 27.10.2016 15:41
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para_Trl SET IsTranslated='N' WHERE AD_Process_Para_ID=541017
;
|
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 17, 2018 at 02:28 PM
-- Server version: 10.1.36-MariaDB
-- PHP Version: 5.6.38
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
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: `task3`
--
-- --------------------------------------------------------
--
-- Table structure for table `aregister`
--
CREATE TABLE `aregister` (
`aname` varchar(100) NOT NULL,
`aemail` varchar(100) NOT NULL,
`acno` varchar(10) NOT NULL,
`aadd` varchar(100) NOT NULL,
`apw` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `aregister`
--
INSERT INTO `aregister` (`aname`, `aemail`, `acno`, `aadd`, `apw`) VALUES
('Admin', '<EMAIL>', '8123469267', 'Hyderbad', '123');
-- --------------------------------------------------------
--
-- Table structure for table `caluculatebill`
--
CREATE TABLE `caluculatebill` (
`cname` varchar(100) NOT NULL,
`bno` varchar(100) NOT NULL,
`month` varchar(100) NOT NULL,
`edate` varchar(100) NOT NULL,
`money` varchar(100) NOT NULL,
`status` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `caluculatebill`
--
INSERT INTO `caluculatebill` (`cname`, `bno`, `month`, `edate`, `money`, `status`) VALUES
('Megha', '1', 'May', '10-1-2019', '120', 'Paid'),
('Nisha', '12', 'May', '10-10-2018', '60', 'Paid'),
('Asha', '1', 'May', '10-10-2018', '60', 'Paid');
-- --------------------------------------------------------
--
-- Table structure for table `feedback`
--
CREATE TABLE `feedback` (
`cid` varchar(100) NOT NULL,
`feedback` mediumtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `feedback`
--
INSERT INTO `feedback` (`cid`, `feedback`) VALUES
('Megha', 'Good\r\n'),
('Asha', 'good');
-- --------------------------------------------------------
--
-- Table structure for table `payment`
--
CREATE TABLE `payment` (
`cid` varchar(100) NOT NULL,
`sno` varchar(100) NOT NULL,
`month` varchar(100) NOT NULL,
`payvia` varchar(100) NOT NULL,
`status` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `payment`
--
INSERT INTO `payment` (`cid`, `sno`, `month`, `payvia`, `status`) VALUES
('Megha', '1', 'May', '', ''),
('Nisha', '12', 'May', '', ''),
('Asha', '1', 'May', '', '');
-- --------------------------------------------------------
--
-- Table structure for table `update1`
--
CREATE TABLE `update1` (
`update1` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `update1`
--
INSERT INTO `update1` (`update1`) VALUES
('15');
-- --------------------------------------------------------
--
-- Table structure for table `uregister`
--
CREATE TABLE `uregister` (
`uname` varchar(100) NOT NULL,
`uemail` varchar(100) NOT NULL,
`ucno` varchar(10) NOT NULL,
`uadd` varchar(100) NOT NULL,
`upw` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `uregister`
--
INSERT INTO `uregister` (`uname`, `uemail`, `ucno`, `uadd`, `upw`) VALUES
('Megha', '<EMAIL>', '9611487498', 'Banglore', '123'),
('Nisha', '<EMAIL>', '123456', 'Bangalore', '123'),
('Asha', '<EMAIL>', '123456789', 'Banglore', '123');
COMMIT;
/*!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 */;
|
<filename>framework/resources/Functional/window_functions/order_by/dense_rank_04.sql<gh_stars>0
select c_integer, dense_rank() over(order by c_integer desc nulls first ) from j1 order by 1, 2;
|
metadata :name => "ZeroMQ Connector",
:description => "Connector plugin for mc0 ZeroMQ middleware",
:author => "Puppet Labs",
:license => "ASL 2.0",
:version => "0.0.1",
:url => "http://github.com/puppetlabs/mcollective-zeromq-connector",
:timeout => 60
requires :mcollective => "2.5.0"
|
<filename>TABLE/CTWATER_FEATURE.sql<gh_stars>1-10
CREATE TABLE "CTWATER_FEATURE"
( "WATER_FEATURE" VARCHAR2(50) NOT NULL ENABLE,
CONSTRAINT "CTWATER_FEATURE_PK" PRIMARY KEY ("WATER_FEATURE")
USING INDEX ENABLE
)
|
CREATE TABLE `oauth_access_tokens` (
`access_token` varchar(40) NOT NULL,
`client_id` varchar(80) NOT NULL,
`user_id` varchar(255) DEFAULT NULL,
`expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`scope` varchar(2000) DEFAULT NULL,
PRIMARY KEY (`access_token`)
);
CREATE TABLE `oauth_authorization_codes` (
`authorization_code` varchar(40) NOT NULL,
`client_id` varchar(80) NOT NULL,
`user_id` varchar(255) DEFAULT NULL,
`redirect_uri` varchar(2000) DEFAULT NULL,
`expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`scope` varchar(2000) DEFAULT NULL,
PRIMARY KEY (`authorization_code`)
);
CREATE TABLE `oauth_clients` (
`client_id` varchar(80) NOT NULL,
`client_secret` varchar(80) NOT NULL,
`redirect_uri` varchar(2000) NOT NULL,
`grant_types` varchar(80) DEFAULT NULL,
`scope` varchar(100) DEFAULT NULL,
`user_id` varchar(80) DEFAULT NULL,
PRIMARY KEY (`client_id`)
);
CREATE TABLE `oauth_jwt` (
`client_id` varchar(80) NOT NULL,
`subject` varchar(80) DEFAULT NULL,
`public_key` varchar(2000) DEFAULT NULL,
PRIMARY KEY (`client_id`)
);
CREATE TABLE `oauth_refresh_tokens` (
`refresh_token` varchar(40) NOT NULL,
`client_id` varchar(80) NOT NULL,
`user_id` varchar(255) DEFAULT NULL,
`expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`scope` varchar(2000) DEFAULT NULL,
PRIMARY KEY (`refresh_token`)
);
CREATE TABLE `oauth_scopes` (
`scope` text,
`is_default` tinyint(1) DEFAULT NULL
);
CREATE TABLE `oauth_users` (
`user_id` int NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`password` varchar(2000) DEFAULT NULL,
`firstname` varchar(255) DEFAULT NULL,
`lastname` varchar(255) DEFAULT NULL,
PRIMARY KEY (`user_id`)
);
CREATE TABLE Post (
`postId` int NOT NULL AUTO_INCREMENT,
`postTitle` varchar(255) NOT NULL,
`postBody` text,
`postDate` timestamp,
`userId` int NOT NULL,
PRIMARY KEY (`postId`)
);
INSERT INTO `oauth_clients` VALUES ('webapp','','',NULL,NULL,NULL);
|
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
CREATE TABLE external_test_users (
id integer NOT NULL,
survey_id character varying(32) NOT NULL,
user_id character varying(512) NOT NULL,
external_user_id character varying(512) NOT NULL,
confirmation_code character varying(32) NOT NULL
);
ALTER TABLE external_test_users OWNER TO postgres;
CREATE SEQUENCE external_test_users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE external_test_users_id_seq OWNER TO postgres;
ALTER SEQUENCE external_test_users_id_seq OWNED BY external_test_users.id;
CREATE TABLE gen_user_counters (
id integer NOT NULL,
survey_id character varying(32) NOT NULL,
count integer DEFAULT 0 NOT NULL
);
ALTER TABLE gen_user_counters OWNER TO postgres;
CREATE SEQUENCE gen_user_counters_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE gen_user_counters_id_seq OWNER TO postgres;
ALTER SEQUENCE gen_user_counters_id_seq OWNED BY gen_user_counters.id;
CREATE TABLE global_support_staff (
user_survey_id character varying(64) NOT NULL,
user_id character varying(256) NOT NULL,
sms_notifications boolean DEFAULT true NOT NULL
);
ALTER TABLE global_support_staff OWNER TO postgres;
CREATE TABLE global_values (
name character varying(64) NOT NULL,
value character varying(512) NOT NULL
);
ALTER TABLE global_values OWNER TO postgres;
CREATE TABLE help_requests (
id integer NOT NULL,
survey_id character varying(64) NOT NULL,
user_id character varying(256) NOT NULL,
last_help_request_at timestamp without time zone NOT NULL
);
ALTER TABLE help_requests OWNER TO postgres;
CREATE SEQUENCE help_requests_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE help_requests_id_seq OWNER TO postgres;
ALTER SEQUENCE help_requests_id_seq OWNED BY help_requests.id;
CREATE TABLE last_help_request_times (
survey_id character varying(32) NOT NULL,
user_id character varying(512) NOT NULL,
last_help_request_time timestamp without time zone NOT NULL
);
ALTER TABLE last_help_request_times OWNER TO postgres;
CREATE TABLE local_nutrient_types (
id integer NOT NULL,
locale_id character varying(16) NOT NULL,
nutrient_type_id integer NOT NULL
);
ALTER TABLE local_nutrient_types OWNER TO postgres;
CREATE SEQUENCE local_nutrient_types_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE local_nutrient_types_id_seq OWNER TO postgres;
ALTER SEQUENCE local_nutrient_types_id_seq OWNED BY local_nutrient_types.id;
CREATE TABLE locales (
id character varying(16) NOT NULL,
english_name character varying(64) NOT NULL,
local_name character varying(64) NOT NULL,
respondent_language_id character varying(16) NOT NULL,
admin_language_id character varying(16) NOT NULL,
country_flag_code character varying(16) NOT NULL,
prototype_locale_id character varying(16)
);
ALTER TABLE locales OWNER TO postgres;
CREATE TABLE missing_foods (
id integer NOT NULL,
survey_id character varying(32) NOT NULL,
user_id character varying(256) NOT NULL,
name character varying(512) NOT NULL,
brand character varying(512) NOT NULL,
description character varying(512) NOT NULL,
portion_size character varying(512) NOT NULL,
leftovers character varying(512) NOT NULL,
submitted_at timestamp without time zone NOT NULL
);
ALTER TABLE missing_foods OWNER TO postgres;
CREATE SEQUENCE missing_foods_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE missing_foods_id_seq OWNER TO postgres;
ALTER SEQUENCE missing_foods_id_seq OWNED BY missing_foods.id;
CREATE TABLE nutrient_types (
id integer NOT NULL,
description character varying(512) NOT NULL,
unit_id integer NOT NULL
);
ALTER TABLE nutrient_types OWNER TO postgres;
CREATE TABLE nutrient_units (
id integer NOT NULL,
description character varying(512) NOT NULL,
symbol character varying(32) NOT NULL
);
ALTER TABLE nutrient_units OWNER TO postgres;
CREATE TABLE popularity_counters (
food_code character(8) NOT NULL,
counter integer DEFAULT 0 NOT NULL
);
ALTER TABLE popularity_counters OWNER TO postgres;
CREATE TABLE schema_version (
version integer NOT NULL
);
ALTER TABLE schema_version OWNER TO postgres;
CREATE TABLE survey_submission_custom_fields (
id integer NOT NULL,
survey_submission_id uuid NOT NULL,
name character varying(64) NOT NULL,
value character varying(512) NOT NULL
);
ALTER TABLE survey_submission_custom_fields OWNER TO postgres;
CREATE SEQUENCE survey_submission_custom_fields_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE survey_submission_custom_fields_id_seq OWNER TO postgres;
ALTER SEQUENCE survey_submission_custom_fields_id_seq OWNED BY survey_submission_custom_fields.id;
CREATE TABLE survey_submission_food_custom_fields (
id integer NOT NULL,
food_id integer NOT NULL,
name character varying(64) NOT NULL,
value character varying(512) NOT NULL
);
ALTER TABLE survey_submission_food_custom_fields OWNER TO postgres;
CREATE SEQUENCE survey_submission_food_custom_fields_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE survey_submission_food_custom_fields_id_seq OWNER TO postgres;
ALTER SEQUENCE survey_submission_food_custom_fields_id_seq OWNED BY survey_submission_food_custom_fields.id;
CREATE TABLE survey_submission_foods (
id integer NOT NULL,
meal_id integer NOT NULL,
code character varying(8) NOT NULL,
english_description character varying(128) NOT NULL,
local_description character varying(128),
ready_meal boolean NOT NULL,
search_term character varying(256) NOT NULL,
portion_size_method_id character varying(32) NOT NULL,
reasonable_amount boolean NOT NULL,
food_group_id integer NOT NULL,
food_group_english_description character varying(256) NOT NULL,
food_group_local_description character varying(256),
brand character varying(128) NOT NULL,
nutrient_table_id character varying(64) NOT NULL,
nutrient_table_code character varying(64) NOT NULL
);
ALTER TABLE survey_submission_foods OWNER TO postgres;
CREATE SEQUENCE survey_submission_foods_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE survey_submission_foods_id_seq OWNER TO postgres;
ALTER SEQUENCE survey_submission_foods_id_seq OWNED BY survey_submission_foods.id;
CREATE TABLE survey_submission_meal_custom_fields (
id integer NOT NULL,
meal_id integer NOT NULL,
name character varying(64) NOT NULL,
value character varying(512) NOT NULL
);
ALTER TABLE survey_submission_meal_custom_fields OWNER TO postgres;
CREATE SEQUENCE survey_submission_meal_custom_fields_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE survey_submission_meal_custom_fields_id_seq OWNER TO postgres;
ALTER SEQUENCE survey_submission_meal_custom_fields_id_seq OWNED BY survey_submission_meal_custom_fields.id;
CREATE TABLE survey_submission_meals (
id integer NOT NULL,
survey_submission_id uuid NOT NULL,
hours integer NOT NULL,
minutes integer NOT NULL,
name character varying(64)
);
ALTER TABLE survey_submission_meals OWNER TO postgres;
CREATE SEQUENCE survey_submission_meals_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE survey_submission_meals_id_seq OWNER TO postgres;
ALTER SEQUENCE survey_submission_meals_id_seq OWNED BY survey_submission_meals.id;
CREATE TABLE survey_submission_nutrients (
id integer NOT NULL,
food_id integer NOT NULL,
amount double precision NOT NULL,
nutrient_type_id integer NOT NULL
);
ALTER TABLE survey_submission_nutrients OWNER TO postgres;
CREATE SEQUENCE survey_submission_nutrients_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE survey_submission_nutrients_id_seq OWNER TO postgres;
ALTER SEQUENCE survey_submission_nutrients_id_seq OWNED BY survey_submission_nutrients.id;
CREATE TABLE survey_submission_portion_size_fields (
id integer NOT NULL,
food_id integer NOT NULL,
name character varying(64) NOT NULL,
value character varying(512) NOT NULL
);
ALTER TABLE survey_submission_portion_size_fields OWNER TO postgres;
CREATE SEQUENCE survey_submission_portion_size_fields_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE survey_submission_portion_size_fields_id_seq OWNER TO postgres;
ALTER SEQUENCE survey_submission_portion_size_fields_id_seq OWNED BY survey_submission_portion_size_fields.id;
CREATE TABLE survey_submission_user_custom_fields (
id integer NOT NULL,
survey_submission_id uuid NOT NULL,
name character varying(64) NOT NULL,
value character varying(512) NOT NULL
);
ALTER TABLE survey_submission_user_custom_fields OWNER TO postgres;
CREATE SEQUENCE survey_submission_user_custom_fields_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE survey_submission_user_custom_fields_id_seq OWNER TO postgres;
ALTER SEQUENCE survey_submission_user_custom_fields_id_seq OWNED BY survey_submission_user_custom_fields.id;
CREATE TABLE survey_submissions (
id uuid NOT NULL,
survey_id character varying(64) NOT NULL,
user_id character varying(256) NOT NULL,
start_time timestamp without time zone NOT NULL,
end_time timestamp without time zone NOT NULL,
log text
);
ALTER TABLE survey_submissions OWNER TO postgres;
CREATE TABLE survey_support_staff (
survey_id character varying(64) NOT NULL,
user_survey_id character varying(64) NOT NULL,
user_id character varying(256) NOT NULL,
sms_notifications boolean DEFAULT true NOT NULL
);
ALTER TABLE survey_support_staff OWNER TO postgres;
CREATE TABLE surveys (
id character varying(64) NOT NULL,
state integer NOT NULL,
start_date timestamp without time zone DEFAULT now() NOT NULL,
end_date timestamp without time zone DEFAULT now() NOT NULL,
scheme_id character varying(64) NOT NULL,
locale character varying(16) NOT NULL,
allow_gen_users boolean NOT NULL,
suspension_reason character varying(512),
survey_monkey_url character varying(512),
support_email character varying(512) DEFAULT '<EMAIL>'::character varying NOT NULL
);
ALTER TABLE surveys OWNER TO postgres;
CREATE TABLE user_custom_fields (
id integer NOT NULL,
survey_id character varying(64) NOT NULL,
user_id character varying(256) NOT NULL,
name character varying(128) NOT NULL,
value character varying(512) NOT NULL
);
ALTER TABLE user_custom_fields OWNER TO postgres;
CREATE SEQUENCE user_custom_fields_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE user_custom_fields_id_seq OWNER TO postgres;
ALTER SEQUENCE user_custom_fields_id_seq OWNED BY user_custom_fields.id;
CREATE TABLE user_permissions (
id integer NOT NULL,
survey_id character varying(64) NOT NULL,
user_id character varying(256) NOT NULL,
permission character varying(64) NOT NULL
);
ALTER TABLE user_permissions OWNER TO postgres;
CREATE SEQUENCE user_permissions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE user_permissions_id_seq OWNER TO postgres;
ALTER SEQUENCE user_permissions_id_seq OWNED BY user_permissions.id;
CREATE TABLE user_roles (
id integer NOT NULL,
survey_id character varying(64) NOT NULL,
user_id character varying(256) NOT NULL,
role character varying(64) NOT NULL
);
ALTER TABLE user_roles OWNER TO postgres;
CREATE SEQUENCE user_roles_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE user_roles_id_seq OWNER TO postgres;
ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
CREATE TABLE users (
id character varying(256) NOT NULL,
survey_id character varying(64) DEFAULT ''::character varying NOT NULL,
password_hash character varying(128) NOT NULL,
password_salt character varying(128) NOT NULL,
password_hasher character varying(64) NOT NULL,
name character varying(512),
email character varying(512),
phone character varying(32)
);
ALTER TABLE users OWNER TO postgres;
ALTER TABLE ONLY external_test_users ALTER COLUMN id SET DEFAULT nextval('external_test_users_id_seq'::regclass);
ALTER TABLE ONLY gen_user_counters ALTER COLUMN id SET DEFAULT nextval('gen_user_counters_id_seq'::regclass);
ALTER TABLE ONLY help_requests ALTER COLUMN id SET DEFAULT nextval('help_requests_id_seq'::regclass);
ALTER TABLE ONLY local_nutrient_types ALTER COLUMN id SET DEFAULT nextval('local_nutrient_types_id_seq'::regclass);
ALTER TABLE ONLY missing_foods ALTER COLUMN id SET DEFAULT nextval('missing_foods_id_seq'::regclass);
ALTER TABLE ONLY survey_submission_custom_fields ALTER COLUMN id SET DEFAULT nextval('survey_submission_custom_fields_id_seq'::regclass);
ALTER TABLE ONLY survey_submission_food_custom_fields ALTER COLUMN id SET DEFAULT nextval('survey_submission_food_custom_fields_id_seq'::regclass);
ALTER TABLE ONLY survey_submission_foods ALTER COLUMN id SET DEFAULT nextval('survey_submission_foods_id_seq'::regclass);
ALTER TABLE ONLY survey_submission_meal_custom_fields ALTER COLUMN id SET DEFAULT nextval('survey_submission_meal_custom_fields_id_seq'::regclass);
ALTER TABLE ONLY survey_submission_meals ALTER COLUMN id SET DEFAULT nextval('survey_submission_meals_id_seq'::regclass);
ALTER TABLE ONLY survey_submission_nutrients ALTER COLUMN id SET DEFAULT nextval('survey_submission_nutrients_id_seq'::regclass);
ALTER TABLE ONLY survey_submission_portion_size_fields ALTER COLUMN id SET DEFAULT nextval('survey_submission_portion_size_fields_id_seq'::regclass);
ALTER TABLE ONLY survey_submission_user_custom_fields ALTER COLUMN id SET DEFAULT nextval('survey_submission_user_custom_fields_id_seq'::regclass);
ALTER TABLE ONLY user_custom_fields ALTER COLUMN id SET DEFAULT nextval('user_custom_fields_id_seq'::regclass);
ALTER TABLE ONLY user_permissions ALTER COLUMN id SET DEFAULT nextval('user_permissions_id_seq'::regclass);
ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
ALTER TABLE ONLY external_test_users
ADD CONSTRAINT external_test_user_unique UNIQUE (survey_id, user_id, external_user_id);
ALTER TABLE ONLY external_test_users
ADD CONSTRAINT external_test_users_pk PRIMARY KEY (id);
ALTER TABLE ONLY gen_user_counters
ADD CONSTRAINT gen_user_count_id_pk PRIMARY KEY (id);
ALTER TABLE ONLY global_support_staff
ADD CONSTRAINT global_support_staff_pk PRIMARY KEY (user_survey_id, user_id);
ALTER TABLE ONLY global_values
ADD CONSTRAINT global_values_pk PRIMARY KEY (name);
ALTER TABLE ONLY help_requests
ADD CONSTRAINT help_requests_pk PRIMARY KEY (id);
ALTER TABLE ONLY last_help_request_times
ADD CONSTRAINT last_help_request_times_pk PRIMARY KEY (survey_id, user_id);
ALTER TABLE ONLY local_nutrient_types
ADD CONSTRAINT local_nutrient_types_pk PRIMARY KEY (id);
ALTER TABLE ONLY locales
ADD CONSTRAINT locales_pk PRIMARY KEY (id);
ALTER TABLE ONLY missing_foods
ADD CONSTRAINT missing_foods_pk PRIMARY KEY (id);
ALTER TABLE ONLY user_permissions
ADD CONSTRAINT no_duplicate_permissions UNIQUE (survey_id, user_id, permission);
ALTER TABLE ONLY user_roles
ADD CONSTRAINT no_duplicate_roles UNIQUE (survey_id, user_id, role);
ALTER TABLE ONLY nutrient_types
ADD CONSTRAINT nutrient_types_pk PRIMARY KEY (id);
ALTER TABLE ONLY nutrient_units
ADD CONSTRAINT nutrient_units_pk PRIMARY KEY (id);
ALTER TABLE ONLY popularity_counters
ADD CONSTRAINT popularity_counters_pk PRIMARY KEY (food_code);
ALTER TABLE ONLY schema_version
ADD CONSTRAINT schema_version_pk PRIMARY KEY (version);
ALTER TABLE ONLY survey_submission_custom_fields
ADD CONSTRAINT survey_submission_custom_field_pk PRIMARY KEY (id);
ALTER TABLE ONLY survey_submission_food_custom_fields
ADD CONSTRAINT survey_submission_food_custom_fields_pk PRIMARY KEY (id);
ALTER TABLE ONLY survey_submission_foods
ADD CONSTRAINT survey_submission_foods_pk PRIMARY KEY (id);
ALTER TABLE ONLY survey_submission_meal_custom_fields
ADD CONSTRAINT survey_submission_meal_custom_fields_pk PRIMARY KEY (id);
ALTER TABLE ONLY survey_submission_meals
ADD CONSTRAINT survey_submission_meals_pk PRIMARY KEY (id);
ALTER TABLE ONLY survey_submission_nutrients
ADD CONSTRAINT survey_submission_nutrients_pk PRIMARY KEY (id);
ALTER TABLE ONLY survey_submission_portion_size_fields
ADD CONSTRAINT survey_submission_portion_size_fields_pk PRIMARY KEY (id);
ALTER TABLE ONLY survey_submission_user_custom_fields
ADD CONSTRAINT survey_submission_user_custom_fields_pk PRIMARY KEY (id);
ALTER TABLE ONLY survey_submissions
ADD CONSTRAINT survey_submissions_id_pk PRIMARY KEY (id);
ALTER TABLE ONLY survey_support_staff
ADD CONSTRAINT survey_support_staff_pk PRIMARY KEY (survey_id, user_survey_id, user_id);
ALTER TABLE ONLY surveys
ADD CONSTRAINT surveys_id_pk PRIMARY KEY (id);
ALTER TABLE ONLY user_custom_fields
ADD CONSTRAINT user_custom_fields_pk PRIMARY KEY (id);
ALTER TABLE ONLY user_permissions
ADD CONSTRAINT user_permissions_pk PRIMARY KEY (id);
ALTER TABLE ONLY user_roles
ADD CONSTRAINT user_roles_pk PRIMARY KEY (id);
ALTER TABLE ONLY users
ADD CONSTRAINT users_id_pk PRIMARY KEY (id, survey_id);
CREATE INDEX gen_user_counters_survey_id_index ON gen_user_counters USING btree (survey_id);
CREATE INDEX help_requests_user_id_index ON help_requests USING btree (survey_id, user_id);
CREATE INDEX missing_foods_user_index ON missing_foods USING btree (survey_id, user_id);
CREATE INDEX survey_submission_custom_fields_submission_index ON survey_submission_custom_fields USING btree (survey_submission_id);
CREATE INDEX survey_submission_food_custom_fields_food_index ON survey_submission_food_custom_fields USING btree (food_id);
CREATE INDEX survey_submission_foods_meal_index ON survey_submission_foods USING btree (meal_id);
CREATE INDEX survey_submission_meal_custom_fields_meal_id_index ON survey_submission_meal_custom_fields USING btree (meal_id);
CREATE INDEX survey_submission_nutrients_food_index ON survey_submission_nutrients USING btree (food_id);
CREATE INDEX survey_submission_portion_size_fields_food_index ON survey_submission_portion_size_fields USING btree (food_id);
CREATE INDEX survey_submission_user_custom_fields_submission_index ON survey_submission_user_custom_fields USING btree (survey_submission_id);
CREATE INDEX survey_submissions_meals_submission_index ON survey_submission_meals USING btree (survey_submission_id);
CREATE INDEX survey_submissions_user_index ON survey_submissions USING btree (survey_id, user_id);
CREATE INDEX user_custom_fields_user_id_index ON user_custom_fields USING btree (survey_id, user_id);
CREATE INDEX user_permissions_user_id_index ON user_permissions USING btree (survey_id, user_id);
CREATE INDEX user_roles_user_id_index ON user_roles USING btree (survey_id, user_id);
ALTER TABLE ONLY external_test_users
ADD CONSTRAINT external_test_users_survey_id_fk FOREIGN KEY (survey_id, user_id) REFERENCES users(survey_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY gen_user_counters
ADD CONSTRAINT gen_user_count_survey_id_fk FOREIGN KEY (survey_id) REFERENCES surveys(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY global_support_staff
ADD CONSTRAINT global_support_staff_user_id_fk FOREIGN KEY (user_survey_id, user_id) REFERENCES users(survey_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY help_requests
ADD CONSTRAINT help_requests_users_fk FOREIGN KEY (survey_id, user_id) REFERENCES users(survey_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY last_help_request_times
ADD CONSTRAINT last_help_request_times_user_fk FOREIGN KEY (survey_id, user_id) REFERENCES users(survey_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY local_nutrient_types
ADD CONSTRAINT local_nutrient_types_locale_fk FOREIGN KEY (locale_id) REFERENCES locales(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY local_nutrient_types
ADD CONSTRAINT local_nutrient_types_nutrient_type_fk FOREIGN KEY (nutrient_type_id) REFERENCES nutrient_types(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY locales
ADD CONSTRAINT locales_prototype_locale_id_fk FOREIGN KEY (prototype_locale_id) REFERENCES locales(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY missing_foods
ADD CONSTRAINT missing_foods_user_fk FOREIGN KEY (survey_id, user_id) REFERENCES users(survey_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY nutrient_types
ADD CONSTRAINT nutrient_types_nutrient_unit_fk FOREIGN KEY (unit_id) REFERENCES nutrient_units(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY survey_submission_nutrients
ADD CONSTRAINT ssn_nutrient_type_id_fk FOREIGN KEY (nutrient_type_id) REFERENCES nutrient_types(id);
ALTER TABLE ONLY survey_submission_custom_fields
ADD CONSTRAINT survey_submission_custom_fields_survey_submission_id_fk FOREIGN KEY (survey_submission_id) REFERENCES survey_submissions(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY survey_submission_food_custom_fields
ADD CONSTRAINT survey_submission_food_custom_fields_food_id_fk FOREIGN KEY (food_id) REFERENCES survey_submission_foods(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY survey_submission_foods
ADD CONSTRAINT survey_submission_foods_survey_submission_id_fk FOREIGN KEY (meal_id) REFERENCES survey_submission_meals(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY survey_submission_meal_custom_fields
ADD CONSTRAINT survey_submission_meal_custom_fields_meal_id_fk FOREIGN KEY (meal_id) REFERENCES survey_submission_meals(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY survey_submission_meals
ADD CONSTRAINT survey_submission_meals_survey_submission_id_fk FOREIGN KEY (survey_submission_id) REFERENCES survey_submissions(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY survey_submission_nutrients
ADD CONSTRAINT survey_submission_nutrients_food_id_fk FOREIGN KEY (food_id) REFERENCES survey_submission_foods(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY survey_submission_portion_size_fields
ADD CONSTRAINT survey_submission_portion_size_fields_food_id_fk FOREIGN KEY (food_id) REFERENCES survey_submission_foods(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY survey_submission_user_custom_fields
ADD CONSTRAINT survey_submission_user_custom_fields_survey_submission_id_fk FOREIGN KEY (survey_submission_id) REFERENCES survey_submissions(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY survey_submissions
ADD CONSTRAINT survey_submissions_users_fk FOREIGN KEY (survey_id, user_id) REFERENCES users(survey_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY survey_support_staff
ADD CONSTRAINT survey_support_staff_survey_id_fk FOREIGN KEY (survey_id) REFERENCES surveys(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY survey_support_staff
ADD CONSTRAINT survey_support_staff_user_id_fk FOREIGN KEY (user_survey_id, user_id) REFERENCES users(survey_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY user_custom_fields
ADD CONSTRAINT user_custom_fields_users_fk FOREIGN KEY (survey_id, user_id) REFERENCES users(survey_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY user_permissions
ADD CONSTRAINT user_permissions_users_fk FOREIGN KEY (survey_id, user_id) REFERENCES users(survey_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY user_roles
ADD CONSTRAINT user_roles_users_fk FOREIGN KEY (survey_id, user_id) REFERENCES users(survey_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY users
ADD CONSTRAINT users_surveys_id_fk FOREIGN KEY (survey_id) REFERENCES surveys(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
<reponame>ds201891/choco-solver<gh_stars>1-10
create table BENCHMARKS (BID MEDIUMINT(11) NOT NULL AUTO_INCREMENT, NAME VARCHAR(32) NOT NULL, DATE DATE NOT NULL, PRIMARY KEY(BID,NAME));
create table PROBLEMS (PID MEDIUMINT(11) NOT NULL AUTO_INCREMENT,NAME VARCHAR(256) NOT NULL,
RESOLUTION ENUM('SAT','MIN','MAX') NOT NULL, OBJECTIVE BIGINT(20) NULL, OPTIMAL TINYINT(1) NOT NULL,
PRIMARY KEY(PID, NAME));
create table RESOLUTIONS (BID MEDIUMINT(11) NOT NULL, PID MEDIUMINT(11) NOT NULL,
SOLVING_TIME BIGINT(20) NOT NULL, OBJECTIVE BIGINT(20) NULL, NB_SOL BIGINT(20) NOT NULL, NB_NODES BIGINT(20) NOT NULL,
NB_FAILS BIGINT(20) NOT NULL,
FOREIGN KEY (BID) references BENCHMARKS(BID), FOREIGN KEY (PID) references PROBLEMS(PID), PRIMARY KEY (BID, PID));
create table CONSTRAINTS (CID MEDIUMINT(11) NOT NULL AUTO_INCREMENT, NAME VARCHAR(32) NOT NULL, PRIMARY KEY(CID,NAME));
create table MODELS (BID MEDIUMINT(11) NOT NULL, PID MEDIUMINT(11) NOT NULL, CID MEDIUMINT(11) NOT NULL, NB MEDIUMINT(11),
FOREIGN KEY (BID) references BENCHMARKS(BID), FOREIGN KEY (PID) references PROBLEMS(PID), FOREIGN KEY (CID) references CONSTRAINTS(CID),PRIMARY KEY (BID, PID,CID));
|
UNWIND $urls AS urls
UNWIND urls.urls as url
WITH url
WHERE url IS NOT NULL
MERGE (:Url {name:url});
|
ALTER TABLE `#__joomgallery` CHANGE `imgfilename` `imgfilename` VARCHAR(255) NOT NULL;
ALTER TABLE `#__joomgallery` CHANGE `imgthumbname` `imgthumbname` VARCHAR(255) NOT NULL;
ALTER TABLE `#__joomgallery_catg` CHANGE `alias` `alias` VARCHAR(2048) NOT NULL;
ALTER TABLE `#__joomgallery_catg` CHANGE `catpath` `catpath` VARCHAR(2048) NOT NULL;
|
<filename>internal/db/aggregates.sql<gh_stars>0
-- version 1
DROP SCHEMA IF EXISTS midgard_agg CASCADE;
CREATE SCHEMA midgard_agg;
CREATE VIEW midgard_agg.pending_adds AS
SELECT *
FROM pending_liquidity_events AS p
WHERE pending_type = 'add'
AND NOT EXISTS(
-- Filter out pending liquidity which was already added
SELECT *
FROM stake_events AS s
WHERE
p.rune_addr = s.rune_addr
AND p.pool = s.pool
AND p.block_timestamp <= s.block_timestamp)
AND NOT EXISTS(
-- Filter out pending liquidity which was withdrawn without adding
SELECT *
FROM pending_liquidity_events AS pw
WHERE
pw.pending_type = 'withdraw'
AND p.rune_addr = pw.rune_addr
AND p.pool = pw.pool
AND p.block_timestamp <= pw.block_timestamp);
CREATE TABLE midgard_agg.watermarks (
materialized_table varchar PRIMARY KEY,
watermark bigint NOT NULL
);
CREATE FUNCTION midgard_agg.watermark(t varchar) RETURNS bigint
LANGUAGE SQL STABLE AS $$
SELECT watermark FROM midgard_agg.watermarks
WHERE materialized_table = t;
$$;
CREATE PROCEDURE midgard_agg.refresh_watermarked_view(t varchar, w_new bigint)
LANGUAGE plpgsql AS $BODY$
DECLARE
w_old bigint;
BEGIN
SELECT watermark FROM midgard_agg.watermarks WHERE materialized_table = t
FOR UPDATE INTO w_old;
IF w_new <= w_old THEN
RAISE WARNING 'Updating % into past: % -> %', t, w_old, w_new;
RETURN;
END IF;
EXECUTE format($$
INSERT INTO midgard_agg.%1$I_materialized
SELECT * from midgard_agg.%1$I
WHERE $1 <= block_timestamp AND block_timestamp < $2
$$, t) USING w_old, w_new;
UPDATE midgard_agg.watermarks SET watermark = w_new WHERE materialized_table = t;
END
$BODY$;
-------------------------------------------------------------------------------
-- Actions
-------------------------------------------------------------------------------
-- TODO(huginn): there types and functions should go into the main DDL,
-- so we can use them unqualified.
CREATE TYPE midgard_agg.coin_rec as (asset text, amount bigint);
CREATE FUNCTION midgard_agg.non_null_array(VARIADIC elems text[])
RETURNS text[] LANGUAGE SQL IMMUTABLE AS $$
SELECT array_remove(elems, NULL)
$$;
CREATE FUNCTION midgard_agg.coins(VARIADIC coins midgard_agg.coin_rec[])
RETURNS jsonb[] LANGUAGE SQL IMMUTABLE AS $$
SELECT array_agg(jsonb_build_object('asset', asset, 'amount', amount))
FROM unnest(coins)
WHERE amount > 0
$$;
CREATE FUNCTION midgard_agg.mktransaction(
txid text,
address text,
VARIADIC coins midgard_agg.coin_rec[]
) RETURNS jsonb LANGUAGE SQL IMMUTABLE AS $$
SELECT jsonb_build_object(
'txID', txid,
'address', address,
'coins', midgard_agg.coins(VARIADIC coins)
)
$$;
-- TODO(huginn): better condition in WHERE
CREATE FUNCTION midgard_agg.transaction_list(VARIADIC txs jsonb[])
RETURNS jsonb LANGUAGE SQL IMMUTABLE AS $$
SELECT COALESCE(jsonb_agg(tx), '[]' :: jsonb)
FROM unnest(txs) t(tx)
WHERE tx->>'coins' <> 'null';
$$;
-- TODO(huginn): this is useful, keep is somewhere
CREATE OR REPLACE FUNCTION midgard_agg.ts_nano(t timestamptz) RETURNS bigint
LANGUAGE SQL IMMUTABLE AS $$
SELECT CAST(1000000000 * EXTRACT(EPOCH FROM t) AS bigint)
$$;
--
-- Main table and its indices
--
CREATE TABLE midgard_agg.actions (
height bigint NOT NULL,
block_timestamp bigint NOT NULL,
-- TODO(huginn): rename
type text NOT NULL,
main_ref text,
addresses text[] NOT NULL,
transactions text[] NOT NULL,
assets text[] NOT NULL,
pools text[],
ins jsonb NOT NULL,
outs jsonb NOT NULL,
fees jsonb NOT NULL,
meta jsonb
);
-- TODO(huginn): should it be a hypertable? Measure both ways and decide!
CREATE INDEX ON midgard_agg.actions (block_timestamp);
CREATE INDEX ON midgard_agg.actions (type, block_timestamp);
CREATE INDEX ON midgard_agg.actions (main_ref, block_timestamp);
CREATE INDEX ON midgard_agg.actions USING gin (addresses);
CREATE INDEX ON midgard_agg.actions USING gin (transactions);
CREATE INDEX ON midgard_agg.actions USING gin (assets);
--
-- Basic VIEWs that build actions
--
CREATE VIEW midgard_agg.switch_actions AS
SELECT
0 :: bigint as height,
block_timestamp,
'switch' as type,
tx :: text as main_ref,
ARRAY[from_addr, to_addr] :: text[] as addresses,
midgard_agg.non_null_array(tx) as transactions,
ARRAY[burn_asset, 'THOR.RUNE'] :: text[] as assets,
NULL :: text[] as pools,
jsonb_build_array(midgard_agg.mktransaction(tx, from_addr, (burn_asset, burn_e8))) as ins,
jsonb_build_array(midgard_agg.mktransaction(NULL, to_addr, ('THOR.RUNE', burn_e8))) as outs,
jsonb_build_array() as fees,
NULL :: jsonb as meta
FROM switch_events;
CREATE VIEW midgard_agg.refund_actions AS
SELECT
0 :: bigint as height,
block_timestamp,
'refund' as type,
tx :: text as main_ref,
ARRAY[from_addr, to_addr] :: text[] as addresses,
ARRAY[tx] :: text[] as transactions,
midgard_agg.non_null_array(asset, asset_2nd) as assets,
NULL :: text[] as pools,
jsonb_build_array(midgard_agg.mktransaction(tx, from_addr, (asset, asset_e8))) as ins,
jsonb_build_array() as outs,
jsonb_build_array() as fees,
jsonb_build_object('reason', reason) as meta
FROM refund_events;
CREATE VIEW midgard_agg.donate_actions AS
SELECT
0 :: bigint as height,
block_timestamp,
'donate' as type,
tx :: text as main_ref,
ARRAY[from_addr, to_addr] :: text[] as addresses,
ARRAY[tx] :: text[] as transactions,
CASE WHEN rune_e8 > 0 THEN ARRAY[asset, 'THOR.RUNE']
ELSE ARRAY[asset] END :: text[] as assets,
ARRAY[pool] :: text[] as pools,
jsonb_build_array(midgard_agg.mktransaction(tx, from_addr, (asset, asset_e8),
('THOR.RUNE', rune_e8))) as ins,
jsonb_build_array() as outs,
jsonb_build_array() as fees,
NULL :: jsonb as meta
FROM add_events;
CREATE VIEW midgard_agg.withdraw_actions AS
SELECT
0 :: bigint as height,
block_timestamp,
'withdraw' as type,
tx :: text as main_ref,
ARRAY[from_addr, to_addr] :: text[] as addresses,
ARRAY[tx] :: text[] as transactions,
ARRAY[pool] :: text[] as assets,
ARRAY[pool] :: text[] as pools,
jsonb_build_array(midgard_agg.mktransaction(tx, from_addr, (asset, asset_e8))) as ins,
jsonb_build_array() as outs,
jsonb_build_array() as fees,
jsonb_build_object(
'asymmetry', asymmetry,
'basisPoints', basis_points,
'impermanentLossProtection', imp_loss_protection_e8,
'liquidityUnits', -stake_units,
'emitAssetE8', emit_asset_e8,
'emitRuneE8', emit_rune_e8
) as meta
FROM unstake_events;
-- TODO(huginn): use _direction for join
CREATE VIEW midgard_agg.swap_actions AS
-- Single swap (unique txid)
SELECT
0 :: bigint as height,
block_timestamp,
'swap' as type,
tx :: text as main_ref,
ARRAY[from_addr, to_addr] :: text[] as addresses,
ARRAY[tx] :: text[] as transactions,
ARRAY[from_asset, to_asset] :: text[] as assets,
ARRAY[pool] :: text[] as pools,
jsonb_build_array(midgard_agg.mktransaction(tx, from_addr, (from_asset, from_e8))) as ins,
jsonb_build_array() as outs,
jsonb_build_array() as fees,
jsonb_build_object(
'swapSingle', TRUE,
'liquidityFee', liq_fee_in_rune_e8,
'swapTarget', to_e8_min,
'swapSlip', swap_slip_bp
) as meta
FROM swap_events AS single_swaps
WHERE NOT EXISTS (
SELECT tx FROM swap_events
WHERE block_timestamp = single_swaps.block_timestamp AND tx = single_swaps.tx
AND from_asset <> single_swaps.from_asset
)
UNION ALL
-- Double swap (same txid in different pools)
SELECT
0 :: bigint as height,
swap_in.block_timestamp,
'swap' as type,
swap_in.tx :: text as main_ref,
ARRAY[swap_in.from_addr, swap_in.to_addr] :: text[] as addresses,
ARRAY[swap_in.tx] :: text[] as transactions,
ARRAY[swap_in.from_asset, swap_out.to_asset] :: text[] as assets,
CASE WHEN swap_in.pool <> swap_out.pool THEN ARRAY[swap_in.pool, swap_out.pool]
ELSE ARRAY[swap_in.pool] END :: text[] as pools,
jsonb_build_array(midgard_agg.mktransaction(swap_in.tx, swap_in.from_addr,
(swap_in.from_asset, swap_in.from_e8))) as ins,
jsonb_build_array() as outs,
jsonb_build_array() as fees,
jsonb_build_object(
'swapSingle', FALSE,
'liquidityFee', swap_in.liq_fee_in_rune_e8 + swap_out.liq_fee_in_rune_e8,
'swapTarget', swap_out.to_e8_min,
'swapSlip', swap_in.swap_slip_BP + swap_out.swap_slip_BP
- swap_in.swap_slip_BP*swap_out.swap_slip_BP/10000
) as meta
FROM swap_events AS swap_in
INNER JOIN swap_events AS swap_out
ON swap_in.tx = swap_out.tx AND swap_in.block_timestamp = swap_out.block_timestamp
WHERE swap_in.from_asset <> swap_out.to_asset AND swap_in.to_asset = 'THOR.RUNE'
AND swap_out.from_asset = 'THOR.RUNE'
;
CREATE VIEW midgard_agg.addliquidity_actions AS
SELECT
0 :: bigint as height,
block_timestamp,
'addLiquidity' as type,
NULL :: text as main_ref,
midgard_agg.non_null_array(rune_addr, asset_addr) as addresses,
midgard_agg.non_null_array(rune_tx, asset_tx) as transactions,
ARRAY[pool, 'THOR.RUNE'] :: text[] as assets,
ARRAY[pool] :: text[] as pools,
midgard_agg.transaction_list(
midgard_agg.mktransaction(rune_tx, rune_addr, ('THOR.RUNE', rune_e8)),
midgard_agg.mktransaction(asset_tx, asset_addr, (pool, asset_e8))
) as ins,
jsonb_build_array() as outs,
jsonb_build_array() as fees,
jsonb_build_object(
'status', 'success',
'liquidityUnits', stake_units
) as meta
FROM stake_events
UNION ALL
-- Pending `add`s will be removed when not pending anymore
SELECT
0 :: bigint as height,
block_timestamp,
'addLiquidity' as type,
'PL:' || rune_addr || ':' || pool :: text as main_ref,
midgard_agg.non_null_array(rune_addr, asset_addr) as addresses,
midgard_agg.non_null_array(rune_tx, asset_tx) as transactions,
ARRAY[pool, 'THOR.RUNE'] :: text[] as assets,
ARRAY[pool] :: text[] as pools,
midgard_agg.transaction_list(
midgard_agg.mktransaction(rune_tx, rune_addr, ('THOR.RUNE', rune_e8)),
midgard_agg.mktransaction(asset_tx, asset_addr, (pool, asset_e8))
) as ins,
jsonb_build_array() as outs,
jsonb_build_array() as fees,
jsonb_build_object('status', 'pending') as meta
FROM pending_liquidity_events
WHERE pending_type = 'add'
;
--
-- Procedures for updating actions
--
CREATE PROCEDURE midgard_agg.insert_actions(t1 bigint, t2 bigint)
LANGUAGE plpgsql AS $BODY$
BEGIN
EXECUTE $$ INSERT INTO midgard_agg.actions
SELECT * FROM midgard_agg.switch_actions
WHERE $1 <= block_timestamp AND block_timestamp < $2 $$ USING t1, t2;
EXECUTE $$ INSERT INTO midgard_agg.actions
SELECT * FROM midgard_agg.refund_actions
WHERE $1 <= block_timestamp AND block_timestamp < $2 $$ USING t1, t2;
EXECUTE $$ INSERT INTO midgard_agg.actions
SELECT * FROM midgard_agg.donate_actions
WHERE $1 <= block_timestamp AND block_timestamp < $2 $$ USING t1, t2;
EXECUTE $$ INSERT INTO midgard_agg.actions
SELECT * FROM midgard_agg.withdraw_actions
WHERE $1 <= block_timestamp AND block_timestamp < $2 $$ USING t1, t2;
EXECUTE $$ INSERT INTO midgard_agg.actions
SELECT * FROM midgard_agg.swap_actions
WHERE $1 <= block_timestamp AND block_timestamp < $2 $$ USING t1, t2;
EXECUTE $$ INSERT INTO midgard_agg.actions
SELECT * FROM midgard_agg.addliquidity_actions
WHERE $1 <= block_timestamp AND block_timestamp < $2 $$ USING t1, t2;
END
$BODY$;
CREATE PROCEDURE midgard_agg.set_actions_height(t1 bigint, t2 bigint)
LANGUAGE SQL AS $BODY$
UPDATE midgard_agg.actions AS a
SET height = bl.height
FROM block_log AS bl
WHERE bl.timestamp = a.block_timestamp AND t1 <= a.block_timestamp AND a.block_timestamp < t2;
$BODY$;
-- TODO(muninn): Check the pending logic regarding nil rune address
CREATE PROCEDURE midgard_agg.trim_pending_actions(t1 bigint, t2 bigint)
LANGUAGE SQL AS $BODY$
DELETE FROM midgard_agg.actions AS a
USING stake_events AS s
WHERE
t1 <= s.block_timestamp AND s.block_timestamp < t2
AND a.block_timestamp <= s.block_timestamp
AND a.main_ref = 'PL:' || s.rune_addr || ':' || s.pool;
DELETE FROM midgard_agg.actions AS a
USING pending_liquidity_events AS pw
WHERE
t1 <= pw.block_timestamp AND pw.block_timestamp < t2
AND a.block_timestamp <= pw.block_timestamp
AND pw.pending_type = 'withdraw'
AND a.main_ref = 'PL:' || pw.rune_addr || ':' || pw.pool;
$BODY$;
-- TODO(huginn): Remove duplicates from these lists?
CREATE PROCEDURE midgard_agg.actions_add_outbounds(t1 bigint, t2 bigint)
LANGUAGE SQL AS $BODY$
UPDATE midgard_agg.actions AS a
SET
addresses = a.addresses || o.froms || o.tos,
transactions = a.transactions || array_remove(o.transactions, NULL),
assets = a.assets || o.assets,
outs = a.outs || o.outs
FROM (
SELECT
in_tx,
array_agg(from_addr :: text) AS froms,
array_agg(to_addr :: text) AS tos,
array_agg(tx :: text) AS transactions,
array_agg(asset :: text) AS assets,
jsonb_agg(midgard_agg.mktransaction(tx, to_addr, (asset, asset_e8))) AS outs
FROM outbound_events
WHERE t1 <= block_timestamp AND block_timestamp < t2
GROUP BY in_tx
) AS o
WHERE
o.in_tx = a.main_ref;
$BODY$;
CREATE PROCEDURE midgard_agg.actions_add_fees(t1 bigint, t2 bigint)
LANGUAGE SQL AS $BODY$
UPDATE midgard_agg.actions AS a
SET
fees = a.fees || f.fees
FROM (
SELECT
tx,
jsonb_agg(jsonb_build_object('asset', asset, 'amount', asset_e8)) AS fees
FROM fee_events
WHERE t1 <= block_timestamp AND block_timestamp < t2
GROUP BY tx
) AS f
WHERE
f.tx = a.main_ref;
$BODY$;
CREATE PROCEDURE midgard_agg.update_actions_interval(t1 bigint, t2 bigint)
LANGUAGE SQL AS $BODY$
CALL midgard_agg.insert_actions(t1, t2);
CALL midgard_agg.trim_pending_actions(t1, t2);
CALL midgard_agg.set_actions_height(t1, t2);
CALL midgard_agg.actions_add_outbounds(t1, t2);
CALL midgard_agg.actions_add_fees(t1, t2);
$BODY$;
INSERT INTO midgard_agg.watermarks (materialized_table, watermark)
VALUES ('actions', 0);
CREATE PROCEDURE midgard_agg.update_actions(w_new bigint)
LANGUAGE plpgsql AS $BODY$
DECLARE
w_old bigint;
BEGIN
SELECT watermark FROM midgard_agg.watermarks WHERE materialized_table = 'actions'
FOR UPDATE INTO w_old;
IF w_new <= w_old THEN
RAISE WARNING 'Updating actions into past: % -> %', w_old, w_new;
RETURN;
END IF;
CALL midgard_agg.update_actions_interval(w_old, w_new);
UPDATE midgard_agg.watermarks SET watermark = w_new WHERE materialized_table = 'actions';
END
$BODY$;
|
--------------------------------------------------------
-- DDL for Table LFREPORT
--------------------------------------------------------
CREATE TABLE "GROUNDFISH"."LFREPORT"
( "RPTROWNUM" NUMBER,
"TITLE1" CHAR(15 BYTE),
"COLG3" CHAR(55 BYTE),
"TITLE2" CHAR(7 BYTE),
"COLG2" CHAR(19 BYTE),
"TITLE3" CHAR(7 BYTE),
"COLG1" CHAR(157 BYTE)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 81920 NEXT 65536 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "MFD_GROUNDFISH" ;
GRANT SELECT ON "GROUNDFISH"."LFREPORT" TO "BONDS";
GRANT SELECT ON "GROUNDFISH"."LFREPORT" TO "MFD_OBFMI";
GRANT SELECT ON "GROUNDFISH"."LFREPORT" TO "MFLIB" WITH GRANT OPTION;
GRANT SELECT ON "GROUNDFISH"."LFREPORT" TO "VDC";
GRANT SELECT ON "GROUNDFISH"."LFREPORT" TO "VDC_DEV";
GRANT SELECT ON "GROUNDFISH"."LFREPORT" TO "RICARDD";
GRANT SELECT ON "GROUNDFISH"."LFREPORT" TO "HUBLEYB";
GRANT SELECT ON "GROUNDFISH"."LFREPORT" TO "GREYSONP";
|
<filename>scripts/setup.sql
@?/md/admin/catsem.sql
DROP TABLESPACE rdftbs INCLUDING CONTENTS AND DATAFILES;
CREATE BIGFILE TABLESPACE rdftbs
DATAFILE '/opt/oracle/oradata/XE/XEPDB1/rdftbs01.dbf' SIZE 1G;
--GRANT INHERIT PRIVILEGES ON USER sys TO mdsys;
CONNECT system/Welcome1@XEPDB1
EXECUTE SEM_APIS.CREATE_SEM_NETWORK('rdftbs');
DROP USER rdfuser CASCADE;
CREATE USER rdfuser IDENTIFIED BY Welcome1
DEFAULT TABLESPACE rdftbs TEMPORARY TABLESPACE temp;
GRANT connect, resource, unlimited tablespace TO rdfuser;
EXIT
|
ALTER TABLE device_up
DROP COLUMN dev_addr,
DROP COLUMN confirmed_uplink;
|
<reponame>lucaleone/University-Roma-Tre-tests-and-exams
set search_path to "22 settembre 2014";
--creo la relazione produttori
create table produttori (
codProduttore numeric not null primary key,
nome character(20) not null,
nazione character(20) not null
);
--creo la relazione molecole
create table molecole (
ID character(10) not null primary key,
nomeMolecola character(20) not null,
Categoria character(20) not null
);
--creo la relazione farmaci
create table farmaci (
codice numeric not null primary key,
nomeFarmaco character(20) not null,
molecola character(10) not null references Molecole(id),
produttore numeric not null references produttori(codProduttore),
prezzo numeric not null
);
--popolo la relazione produttori
insert into produttori values (1, 'marco', 'italia');
insert into produttori values (2, 'giovanni', 'francia');
insert into produttori values (3, 'franco', 'spagna');
insert into produttori values (4, 'titto', 'germania');
--popolo la relazione molecole
insert into molecole values ('h2o', 'acqua', 'liquido');
insert into molecole values ('h2o2', 'acqua ossigenata', 'liquido');
insert into molecole values ('co2', 'anidride carbonica', 'gas');
insert into molecole values ('h2', 'idrogeno', 'gas');
insert into molecole values ('nacr', 'sale', 'solido');
insert into molecole values ('c6', 'diamante ', 'solido');
--popolo la relazione vendite
insert into farmaci values (01,'tachipirina', 'h2o', 1, 14);
insert into farmaci values (02,'farmaco2', 'nacr', 1, 52);
insert into farmaci values (03,'farmaco3', 'c6', 1, 7);
insert into farmaci values (04,'tachipirina', 'h2o', 4, 33);
insert into farmaci values (05,'farmaco2', 'nacr', 4, 14);
insert into farmaci values (06,'farmaco6', 'nacr', 3, 20);
insert into farmaci values (07,'farmaco7', 'c6', 3, 11);
insert into farmaci values (08,'farmaco8', 'co2', 2, 85);
insert into farmaci values (09,'farmaco9', 'c6', 2, 52);
|
<reponame>Alejandro-sin/Learning_Notebooks
-- SQL Example
CREATE TABLE IF NOT EXISTS logs (
time TIMESTAMP,
level VARCHAR(32),
message TEXT
);
|
DROP DATABASE IF EXISTS travel;
CREATE DATABASE travel;
USE travel;
-- Create syntax for TABLE 'airlines'
CREATE TABLE airlines (
iata_code CHAR(2) DEFAULT NULL,
airline VARCHAR(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Create syntax for TABLE 'airports'
CREATE TABLE airports (
iata_code CHAR(3) DEFAULT NULL,
airport VARCHAR(80) DEFAULT NULL,
city VARCHAR(30) DEFAULT NULL,
`state` CHAR(2) DEFAULT NULL,
country VARCHAR(30) DEFAULT NULL,
latitude FLOAT DEFAULT NULL,
longitude FLOAT DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Create syntax for TABLE 'flights'
CREATE TABLE `flights` (
`year` smallint(6) DEFAULT NULL,
`month` tinyint(4) DEFAULT NULL,
`day` tinyint(4) DEFAULT NULL,
`day_of_week` tinyint(4) DEFAULT NULL,
`fl_date` date DEFAULT NULL,
`carrier` char(2) DEFAULT NULL,
`tail_num` char(6) DEFAULT NULL,
`fl_num` smallint(6) DEFAULT NULL,
`origin` varchar(5) DEFAULT NULL,
`dest` varchar(5) DEFAULT NULL,
`crs_dep_time` char(4) DEFAULT NULL,
`dep_time` char(4) DEFAULT NULL,
`dep_delay` smallint(6) DEFAULT NULL,
`taxi_out` smallint(6) DEFAULT NULL,
`wheels_off` char(4) DEFAULT NULL,
`wheels_on` char(4) DEFAULT NULL,
`taxi_in` smallint(6) DEFAULT NULL,
`crs_arr_time` char(4) DEFAULT NULL,
`arr_time` char(4) DEFAULT NULL,
`arr_delay` smallint(6) DEFAULT NULL,
`cancelled` smallint(6) DEFAULT NULL,
`cancellation_code` char(1) DEFAULT NULL,
`diverted` smallint(6) DEFAULT NULL,
`crs_elapsed_time` smallint(6) DEFAULT NULL,
`actual_elapsed_time` smallint(6) DEFAULT NULL,
`air_time` smallint(6) DEFAULT NULL,
`distance` smallint(6) DEFAULT NULL,
`carrier_delay` smallint(6) DEFAULT NULL,
`weather_delay` smallint(6) DEFAULT NULL,
`nas_delay` smallint(6) DEFAULT NULL,
`security_delay` smallint(6) DEFAULT NULL,
`late_aircraft_delay` smallint(6) DEFAULT NULL
) ENGINE=InnoDB;
-- Create syntax for TABLE 'tickets'
CREATE TABLE `tickets` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`fl_date` date NOT NULL,
`fl_num` smallint(6) NOT NULL,
`carrier` char(2) NOT NULL DEFAULT '',
`origin` varchar(5) NOT NULL DEFAULT '',
`dest` varchar(5) NOT NULL DEFAULT '',
`price` decimal(9,2) NOT NULL DEFAULT 0.00,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
-- Create syntax for TABLE 'trips'
CREATE TABLE `trips` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ticket_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
|
<gh_stars>10-100
CREATE TABLE `Permissions` (
`id` varchar(36) NOT NULL,
`label` text NOT NULL,
`permission` text NOT NULL,
`type` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `Roles` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`assignedUserCount` int(11) NOT NULL,
`description` text,
`name` text NOT NULL,
`role_type` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
CREATE TABLE `Role_assignments` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`role_id` bigint(20) NOT NULL,
`school_id` varchar(180) DEFAULT NULL,
`user_id` varchar(36) NOT NULL,
`vault_id` varchar(36) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_inpjm7k16ph1lrue5o38yiact` (`role_id`,`user_id`,`school_id`,`vault_id`),
KEY `FK_mtrvvfub5q70r6jkcw5gggg0k` (`school_id`),
KEY `FK_2j93l0yx740l9r9hjeinwia1f` (`user_id`),
KEY `FK_by9fc9iswmf9l5q7c243gdprl` (`vault_id`),
CONSTRAINT `FK_2j93l0yx740l9r9hjeinwia1f` FOREIGN KEY (`user_id`) REFERENCES `Users` (`id`),
CONSTRAINT `FK_by9fc9iswmf9l5q7c243gdprl` FOREIGN KEY (`vault_id`) REFERENCES `Vaults` (`id`),
CONSTRAINT `FK_mtrvvfub5q70r6jkcw5gggg0k` FOREIGN KEY (`school_id`) REFERENCES `Groups` (`id`),
CONSTRAINT `FK_spyctngrr3ou9iyr5ld3h28fs` FOREIGN KEY (`role_id`) REFERENCES `Roles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `Role_permissions` (
`role_id` bigint(20) NOT NULL,
`permission_id` varchar(36) NOT NULL,
KEY `FK_ack8r2th4oy2wqlf3ljutfg6s` (`permission_id`),
KEY `FK_nrwjc3i7g5d4udpcpe6llcuc5` (`role_id`),
CONSTRAINT `FK_ack8r2th4oy2wqlf3ljutfg6s` FOREIGN KEY (`permission_id`) REFERENCES `Permissions` (`id`),
CONSTRAINT `FK_nrwjc3i7g5d4udpcpe6llcuc5` FOREIGN KEY (`role_id`) REFERENCES `Roles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
<reponame>Shuttl-Tech/antlr_psql<filename>src/test/resources/sql/create/95af3ec7.sql
-- file:conversion.sql ln:18 expect:true
CREATE DEFAULT CONVERSION public.mydef2 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8
|
begin;
create table londiste.subscriber_pending_fkeys(
from_table text not null,
to_table text not null,
fkey_name text not null,
fkey_def text not null,
primary key (from_table, fkey_name)
);
create table londiste.subscriber_pending_triggers (
table_name text not null,
trigger_name text not null,
trigger_def text not null,
primary key (table_name, trigger_name)
);
-- drop function londiste.denytrigger();
create or replace function londiste.find_table_fkeys(i_table_name text)
returns setof londiste.subscriber_pending_fkeys as $$
declare
fkey record;
tbl_oid oid;
begin
select londiste.find_table_oid(i_table_name) into tbl_oid;
for fkey in
select n1.nspname || '.' || t1.relname as from_table, n2.nspname || '.' || t2.relname as to_table,
conname::text as fkey_name,
'alter table only ' || quote_ident(n1.nspname) || '.' || quote_ident(t1.relname)
|| ' add constraint ' || quote_ident(conname::text) || ' ' || pg_get_constraintdef(c.oid)
as fkey_def
from pg_constraint c, pg_namespace n1, pg_class t1, pg_namespace n2, pg_class t2
where c.contype = 'f' and (c.conrelid = tbl_oid or c.confrelid = tbl_oid)
and t1.oid = c.conrelid and n1.oid = t1.relnamespace
and t2.oid = c.confrelid and n2.oid = t2.relnamespace
order by 1,2,3
loop
return next fkey;
end loop;
return;
end;
$$ language plpgsql strict stable;
create or replace function londiste.find_table_triggers(i_table_name text)
returns setof londiste.subscriber_pending_triggers as $$
declare
tg record;
begin
for tg in
select n.nspname || '.' || c.relname as table_name, t.tgname::text as name, pg_get_triggerdef(t.oid) as def
from pg_trigger t, pg_class c, pg_namespace n
where n.oid = c.relnamespace and c.oid = t.tgrelid
and t.tgrelid = londiste.find_table_oid(i_table_name)
and not t.tgisconstraint
loop
return next tg;
end loop;
return;
end;
$$ language plpgsql strict stable;
create or replace function londiste.find_column_types(tbl text)
returns text as $$
declare
res text;
col record;
tbl_oid oid;
begin
tbl_oid := londiste.find_table_oid(tbl);
res := '';
for col in
SELECT CASE WHEN k.attname IS NOT NULL THEN 'k' ELSE 'v' END AS type
FROM pg_attribute a LEFT JOIN (
SELECT k.attname FROM pg_index i, pg_attribute k
WHERE i.indrelid = tbl_oid AND k.attrelid = i.indexrelid
AND i.indisprimary AND k.attnum > 0 AND NOT k.attisdropped
) k ON (k.attname = a.attname)
WHERE a.attrelid = tbl_oid AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
loop
res := res || col.type;
end loop;
return res;
end;
$$ language plpgsql strict stable;
create or replace function londiste.subscriber_get_table_pending_fkeys(i_table_name text)
returns setof londiste.subscriber_pending_fkeys as $$
declare
fkeys record;
begin
for fkeys in
select *
from londiste.subscriber_pending_fkeys
where from_table=i_table_name or to_table=i_table_name
order by 1,2,3
loop
return next fkeys;
end loop;
return;
end;
$$ language plpgsql;
create or replace function londiste.subscriber_get_queue_valid_pending_fkeys(i_queue_name text)
returns setof londiste.subscriber_pending_fkeys as $$
declare
fkeys record;
begin
for fkeys in
select pf.*
from londiste.subscriber_pending_fkeys pf
left join londiste.subscriber_table st_from on (st_from.table_name = pf.from_table)
left join londiste.subscriber_table st_to on (st_to.table_name = pf.to_table)
where (st_from.table_name is null or (st_from.merge_state = 'ok' and st_from.snapshot is null))
and (st_to.table_name is null or (st_to.merge_state = 'ok' and st_to.snapshot is null))
and (coalesce(st_from.queue_name = i_queue_name, false)
or coalesce(st_to.queue_name = i_queue_name, false))
order by 1, 2, 3
loop
return next fkeys;
end loop;
return;
end;
$$ language plpgsql;
create or replace function londiste.subscriber_drop_table_fkey(i_from_table text, i_fkey_name text)
returns integer as $$
declare
fkey record;
begin
select * into fkey
from londiste.find_table_fkeys(i_from_table)
where fkey_name = i_fkey_name and from_table = i_from_table;
if not found then
return 0;
end if;
insert into londiste.subscriber_pending_fkeys values (fkey.from_table, fkey.to_table, i_fkey_name, fkey.fkey_def);
execute 'alter table only ' || londiste.quote_fqname(fkey.from_table)
|| ' drop constraint ' || quote_ident(i_fkey_name);
return 1;
end;
$$ language plpgsql;
create or replace function londiste.subscriber_restore_table_fkey(i_from_table text, i_fkey_name text)
returns integer as $$
declare
fkey record;
begin
select * into fkey
from londiste.subscriber_pending_fkeys
where fkey_name = i_fkey_name and from_table = i_from_table;
if not found then
return 0;
end if;
delete from londiste.subscriber_pending_fkeys where fkey_name = fkey.fkey_name;
execute fkey.fkey_def;
return 1;
end;
$$ language plpgsql;
create or replace function londiste.subscriber_get_table_pending_triggers(i_table_name text)
returns setof londiste.subscriber_pending_triggers as $$
declare
trigger record;
begin
for trigger in
select *
from londiste.subscriber_pending_triggers
where table_name = i_table_name
loop
return next trigger;
end loop;
return;
end;
$$ language plpgsql strict stable;
create or replace function londiste.subscriber_drop_table_trigger(i_table_name text, i_trigger_name text)
returns integer as $$
declare
trig_def record;
begin
select * into trig_def
from londiste.find_table_triggers(i_table_name)
where trigger_name = i_trigger_name;
if FOUND is not true then
return 0;
end if;
insert into londiste.subscriber_pending_triggers(table_name, trigger_name, trigger_def)
values (i_table_name, i_trigger_name, trig_def.trigger_def);
execute 'drop trigger ' || i_trigger_name || ' on ' || i_table_name;
return 1;
end;
$$ language plpgsql;
create or replace function londiste.subscriber_drop_all_table_triggers(i_table_name text)
returns integer as $$
declare
trigger record;
begin
for trigger in
select trigger_name as name
from londiste.find_table_triggers(i_table_name)
loop
perform londiste.subscriber_drop_table_trigger(i_table_name, trigger.name);
end loop;
return 1;
end;
$$ language plpgsql;
create or replace function londiste.subscriber_restore_table_trigger(i_table_name text, i_trigger_name text)
returns integer as $$
declare
trig_def text;
begin
select trigger_def into trig_def
from londiste.subscriber_pending_triggers
where (table_name, trigger_name) = (i_table_name, i_trigger_name);
if not found then
return 0;
end if;
delete from londiste.subscriber_pending_triggers
where table_name = i_table_name and trigger_name = i_trigger_name;
execute trig_def;
return 1;
end;
$$ language plpgsql;
create or replace function londiste.subscriber_restore_all_table_triggers(i_table_name text)
returns integer as $$
declare
trigger record;
begin
for trigger in
select trigger_name as name
from londiste.subscriber_get_table_pending_triggers(i_table_name)
loop
perform londiste.subscriber_restore_table_trigger(i_table_name, trigger.name);
end loop;
return 1;
end;
$$ language plpgsql;
create or replace function londiste.quote_fqname(i_name text)
returns text as $$
declare
res text;
pos integer;
s text;
n text;
begin
pos := position('.' in i_name);
if pos > 0 then
s := substring(i_name for pos - 1);
n := substring(i_name from pos + 1);
else
s := 'public';
n := i_name;
end if;
return quote_ident(s) || '.' || quote_ident(n);
end;
$$ language plpgsql strict immutable;
create or replace function londiste.find_rel_oid(tbl text, kind text)
returns oid as $$
declare
res oid;
pos integer;
schema text;
name text;
begin
pos := position('.' in tbl);
if pos > 0 then
schema := substring(tbl for pos - 1);
name := substring(tbl from pos + 1);
else
schema := 'public';
name := tbl;
end if;
select c.oid into res
from pg_namespace n, pg_class c
where c.relnamespace = n.oid
and c.relkind = kind
and n.nspname = schema and c.relname = name;
if not found then
if kind = 'r' then
raise exception 'table not found';
elsif kind = 'S' then
raise exception 'seq not found';
else
raise exception 'weird relkind';
end if;
end if;
return res;
end;
$$ language plpgsql strict stable;
create or replace function londiste.find_table_oid(tbl text)
returns oid as $$
begin
return londiste.find_rel_oid(tbl, 'r');
end;
$$ language plpgsql strict stable;
create or replace function londiste.find_seq_oid(tbl text)
returns oid as $$
begin
return londiste.find_rel_oid(tbl, 'S');
end;
$$ language plpgsql strict stable;
create or replace function londiste.get_last_tick(i_consumer text)
returns bigint as $$
declare
res bigint;
begin
select last_tick_id into res
from londiste.completed
where consumer_id = i_consumer;
return res;
end;
$$ language plpgsql security definer strict stable;
create or replace function londiste.provider_add_table(
i_queue_name text,
i_table_name text,
i_col_types text
) returns integer strict as $$
declare
tgname text;
sql text;
begin
if londiste.link_source(i_queue_name) is not null then
raise exception 'Linked queue, manipulation not allowed';
end if;
if position('k' in i_col_types) < 1 then
raise exception 'need key column';
end if;
if position('.' in i_table_name) < 1 then
raise exception 'need fully-qualified table name';
end if;
select queue_name into tgname
from pgq.queue where queue_name = i_queue_name;
if not found then
raise exception 'no such event queue';
end if;
tgname := i_queue_name || '_logger';
tgname := replace(lower(tgname), '.', '_');
insert into londiste.provider_table
(queue_name, table_name, trigger_name)
values (i_queue_name, i_table_name, tgname);
perform londiste.provider_create_trigger(
i_queue_name, i_table_name, i_col_types);
return 1;
end;
$$ language plpgsql security definer;
create or replace function londiste.provider_add_table(
i_queue_name text,
i_table_name text
) returns integer as $$
begin
return londiste.provider_add_table(i_queue_name, i_table_name,
londiste.find_column_types(i_table_name));
end;
$$ language plpgsql security definer;
create or replace function londiste.provider_create_trigger(
i_queue_name text,
i_table_name text,
i_col_types text
) returns integer strict as $$
declare
tgname text;
begin
select trigger_name into tgname
from londiste.provider_table
where queue_name = i_queue_name
and table_name = i_table_name;
if not found then
raise exception 'table not found';
end if;
execute 'create trigger ' || tgname
|| ' after insert or update or delete on '
|| i_table_name
|| ' for each row execute procedure pgq.logtriga('
|| quote_literal(i_queue_name) || ', '
|| quote_literal(i_col_types) || ', '
|| quote_literal(i_table_name) || ')';
return 1;
end;
$$ language plpgsql security definer;
create or replace function londiste.provider_notify_change(i_queue_name text)
returns integer as $$
declare
res text;
tbl record;
begin
res := '';
for tbl in
select table_name from londiste.provider_table
where queue_name = i_queue_name
order by nr
loop
if res = '' then
res := tbl.table_name;
else
res := res || ',' || tbl.table_name;
end if;
end loop;
perform pgq.insert_event(i_queue_name, 'T', res);
return 1;
end;
$$ language plpgsql security definer;
create or replace function londiste.provider_remove_table(
i_queue_name text,
i_table_name text
) returns integer as $$
declare
tgname text;
begin
if londiste.link_source(i_queue_name) is not null then
raise exception 'Linked queue, manipulation not allowed';
end if;
select trigger_name into tgname from londiste.provider_table
where queue_name = i_queue_name
and table_name = i_table_name;
if not found then
raise exception 'no such table registered';
end if;
begin
execute 'drop trigger ' || tgname || ' on ' || i_table_name;
exception
when undefined_table then
raise notice 'table % does not exist', i_table_name;
when undefined_object then
raise notice 'trigger % does not exist on table %', tgname, i_table_name;
end;
delete from londiste.provider_table
where queue_name = i_queue_name
and table_name = i_table_name;
return 1;
end;
$$ language plpgsql security definer;
create or replace function londiste.set_last_tick(
i_consumer text,
i_tick_id bigint)
returns integer as $$
begin
if i_tick_id is null then
delete from londiste.completed
where consumer_id = i_consumer;
else
update londiste.completed
set last_tick_id = i_tick_id
where consumer_id = i_consumer;
if not found then
insert into londiste.completed (consumer_id, last_tick_id)
values (i_consumer, i_tick_id);
end if;
end if;
return 1;
end;
$$ language plpgsql security definer;
create or replace function londiste.subscriber_remove_table(
i_queue_name text, i_table text)
returns integer as $$
declare
link text;
begin
delete from londiste.subscriber_table
where queue_name = i_queue_name
and table_name = i_table;
if not found then
raise exception 'no such table';
end if;
-- sync link
link := londiste.link_dest(i_queue_name);
if link is not null then
delete from londiste.provider_table
where queue_name = link
and table_name = i_table;
perform londiste.provider_notify_change(link);
end if;
return 0;
end;
$$ language plpgsql security definer;
grant usage on schema londiste to public;
grant select on londiste.provider_table to public;
grant select on londiste.completed to public;
grant select on londiste.link to public;
grant select on londiste.subscriber_table to public;
end;
|
<reponame>Lantern-chat/server<gh_stars>1-10
DROP INDEX IF EXISTS user_block_user_idx CASCADE;
ALTER TABLE IF EXISTS lantern.user_blocks DROP CONSTRAINT IF EXISTS user_fk CASCADE;
ALTER TABLE IF EXISTS lantern.user_blocks DROP CONSTRAINT IF EXISTS block_fk CASCADE;
DROP TABLE IF EXISTS user_blocks CASCADE;
|
<filename>Assignment03/2. Assignment03_SQL Query.sql<gh_stars>0
-- SELEKTO TABELAT E DATABAZES AEROPORTI
SELECT * FROM Aeroplani
SELECT * FROM Aeroporti
SELECT * FROM Fluturimet
SELECT * FROM Kompanit
SELECT * FROM Pasagjeret
/*
1. Të përdoret funksion agregativ me RANK për të gjeturë shumën për një fushë të caktuarë
*/
SELECT ID_Aeroplani, Lloji_Aeroplanit, ID_Pasagjeri,
SUM(Nr_Uleseve) OVER(PARTITION BY ID_Pasagjeri) AS ShumaPerNrUleseve
FROM Aeroplani
/*
2. Të përdoret RANK për një fushë të caktuarë pa PARTITION
*/
SELECT ID_Pasagjeri, Nr_Pasaportes, Emri, Mbiemri, Datelindja, Vendlindja,
RANK() OVER(ORDER BY Vendlindja DESC) AS RankVendlindja
FROM Pasagjeret
/*
3. Të përdoret RANK për një fushë të caktuarë me PARTITION
*/
SELECT ID_Pasagjeri, Nr_Pasaportes, Emri, Mbiemri, Datelindja, Vendlindja,
RANK() OVER(PARTITION BY Vendlindja ORDER BY Nr_Pasaportes DESC) AS RankVendlindja
FROM Pasagjeret
/*
4. Të përdoret DENSE RANK për një fushë të caktuarë me PARTITION
*/
SELECT ID_Pasagjeri, Nr_Pasaportes, Emri, Mbiemri, Datelindja, Vendlindja,
DENSE_RANK() OVER(PARTITION BY Vendlindja ORDER BY Nr_Pasaportes) AS DenseRankVendlindja
FROM Pasagjeret
/*
5. Të bëhet SELECT shprehje duke shfrytëzuar TOP 10 rekordet
*/
SELECT TOP (10) ID_Kompania, Emri_Plote, Emri_Shkurte, Nr_Destinacioneve
FROM Kompanit
ORDER BY Nr_Destinacioneve ASC
/*
6. Të bëhet SELECT shprehje duke shfrytëzuar OFFSET FETCH duke marrë 5-10 rreshta
*/
SELECT ID_Kompania, Emri_Plote, Emri_Shkurte, Nr_Destinacioneve
FROM Kompanit
ORDER BY Nr_Destinacioneve DESC
OFFSET 5 ROWS FETCH FIRST 10 ROWS ONLY
/*
7. Të bëhet CREATE i një PROCEDURE që kryen INSERT dhe UPDATE
*/
-- Krjimi i procederurës
CREATE PROCEDURE PasagjeretAeroplani
(@Vendlindja nvarchar(15))
AS
SELECT ID_Pasagjeri, Emri, Mbiemri, Datelindja, Vendlindja, Nr_Pasaportes, Nr_Uleses, Statusi
FROM Pasagjeret
WHERE Vendlindja = @Vendlindja
ORDER BY ID_Pasagjeri
EXEC PasagjeretAeroplani @Vendlindja = 'Kosovo';
-- Insertimi i një rekordi në procedurë
ALTER PROCEDURE PasagjeretAeroplani
AS
INSERT INTO Pasagjeret (ID_Pasagjeri, Emri, Mbiemri, Datelindja, Vendlindja, Nr_Pasaportes, Nr_Uleses, Statusi)
VALUES (96020,'Jetmir','Hoxha','1994-11-23','Albania',8448,266,0)
EXEC PasagjeretAeroplani
SELECT * FROM Pasagjeret
-- Update i një fushe në procedurë
ALTER PROCEDURE PasagjeretAeroplani
AS
UPDATE Pasagjeret
SET Statusi = 1
EXEC PasagjeretAeroplani
SELECT * FROM Pasagjeret
|
CREATE TABLE test_table (
`id` INT(11) UNSIGNED auto_increment,
`name` VARCHAR(255),
PRIMARY KEY(id)
);
INSERT INTO test_table VALUES (1,"Linus");
INSERT INTO test_table VALUES (2,"Jason");
INSERT INTO test_table VALUES (3,"Dan");
INSERT INTO test_table VALUES (4,"John");
INSERT INTO test_table VALUES (5,"Jon");
INSERT INTO test_table VALUES (6,"Jez");
|
BEGIN;
DELETE FROM rfam_go_terms rfam
USING load_rfam_go_terms load
WHERE
load.rfam_model_id = rfam.rfam_model_id
;
INSERT INTO rfam_go_terms (
ontology_term_id,
rfam_model_id
) (
SELECT
ontology_term_id,
rfam_model_id
FROM load_rfam_go_terms
)
ON CONFLICT (ontology_term_id, rfam_model_id) DO UPDATE SET
ontology_term_id = excluded.ontology_term_id,
rfam_model_id = excluded.rfam_model_id
;
DROP TABLE load_rfam_go_terms;
COMMIT;
|
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;
begin;
select plan(3);
select has_function(
'ggircs_portal_private', 'check_for_immutable_application_revision_status',
'Function signature_md5 should exist'
);
alter table ggircs_portal.application_revision_status disable trigger _status_change_email;
-- Set the timesamp to a time where the application window is open
-- 2020 open date
select mocks.set_mocked_time_in_transaction('2021-04-01 14:49:54.191757-07'::timestamptz);
truncate ggircs_portal.application restart identity cascade;
select ggircs_portal.create_application_mutation_chain(1);
select ggircs_portal.create_application_revision_mutation_chain(1,1);
select throws_like(
$$
insert into ggircs_portal.application_revision_status(application_id, version_number)
values (1,1)
$$,
'%You cannot change the status of an application revision unless it is the current version%',
'Trigger function throws error on application revision status change to a non-current version'
);
select lives_ok(
$$
insert into ggircs_portal.application_revision_status(application_id, version_number)
values (1,2)
$$,
'Trigger function does not throw when it should not'
);
select finish();
rollback;
|
REVOKE DELETE ON "api"."channel" FROM "social";
|
<reponame>lauracristinaes/aula-java<filename>hibernate-release-5.3.7.Final/project/documentation/src/main/asciidoc/userguide/chapters/domain/extras/basic/mapping-filter-sql-fragment-alias-query-example.sql
select
filtersqlf0_.id as id1_0_,
filtersqlf0_.active as active2_0_,
filtersqlf0_.amount as amount3_0_,
filtersqlf0_.rate as rate4_0_,
filtersqlf0_1_.deleted as deleted1_1_
from
account filtersqlf0_
left outer join
account_details filtersqlf0_1_
on filtersqlf0_.id=filtersqlf0_1_.id
where
filtersqlf0_.active = ?
and filtersqlf0_1_.deleted = false
-- binding parameter [1] as [BOOLEAN] - [true]
|
create public synonym emp for hr.employees
|
SELECT '< HIVE-972: Support views >' AS ' ';
ALTER TABLE `TBLS` ADD `VIEW_EXPANDED_TEXT` mediumtext;
ALTER TABLE `TBLS` ADD `VIEW_ORIGINAL_TEXT` mediumtext;
|
-- limit_price_adjustments_and_discounts_globally_and_per_employee --
ALTER TABLE `phppos_employees`
ADD COLUMN `max_discount_percent` decimal(15,3) DEFAULT NULL;
|
-- phpMyAdmin SQL Dump
-- version 4.8.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 08, 2019 at 05:46 PM
-- Server version: 10.1.32-MariaDB
-- PHP Version: 5.6.36
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
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: `alumni`
--
-- --------------------------------------------------------
--
-- Table structure for table `about`
--
CREATE TABLE `about` (
`id` int(11) NOT NULL,
`title` text NOT NULL,
`description` text NOT NULL,
`image` text NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `about`
--
INSERT INTO `about` (`id`, `title`, `description`, `image`, `date`) VALUES
(2, 'about 2', 'AAAAAAAA', 'a127d3cf675a3f11ec657e750c6a040b.jpg', '2018-09-10'),
(3, 'about 3', 'AAAAAAAA', 'bbba466ceb7278336c94d4f693188de7.jpg', '2018-09-10'),
(4, 'about 4', 'AAAAAAAA', 'bbba466ceb7278336c94d4f693188de7.jpg', '2018-09-10');
-- --------------------------------------------------------
--
-- Table structure for table `contact_reply`
--
CREATE TABLE `contact_reply` (
`id` int(11) NOT NULL,
`contact_id` int(11) NOT NULL,
`message` text NOT NULL,
`seen` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `contact_reply`
--
INSERT INTO `contact_reply` (`id`, `contact_id`, `message`, `seen`) VALUES
(1, 5, 'test', 1),
(2, 5, 'wesfsdsf', 1),
(3, 6, 'asdsasda adasdas', 1);
-- --------------------------------------------------------
--
-- Table structure for table `contact_us`
--
CREATE TABLE `contact_us` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`message` text NOT NULL,
`type` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`file` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `contact_us`
--
INSERT INTO `contact_us` (`id`, `name`, `email`, `message`, `type`, `user_id`, `file`) VALUES
(3, 'mohamed', '<EMAIL>', 'Please check this new event ...\r\ndescription : new event\r\ndate : 30-11-2018.', 2, 0, ''),
(5, 'test', '<EMAIL>', 'asdasdasdasdasdasdasd', 1, 4, 'e79091e3d510538a8cd2c4b292f9ab83.png'),
(6, 'VM', '<EMAIL>', 'asdjkhasjhkasjhdjhkasdhasjkhdashjdka had jkas hdashjdashkd ', 1, 5, '');
-- --------------------------------------------------------
--
-- Table structure for table `events`
--
CREATE TABLE `events` (
`id` int(11) NOT NULL,
`title` text NOT NULL,
`description` text NOT NULL,
`image` text NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `events`
--
INSERT INTO `events` (`id`, `title`, `description`, `image`, `date`) VALUES
(1, 'Test Event', 'test test test test test test test test test test test test test test test test test test test test test test test test ', '3f5e7ab33c36ecdfe4ba43f76b7f4f27.png', '2018-10-31'),
(2, 'Test Event 2', 'test test test test test test test test test test test test test test test test test test test test test test test test ', 'ea83ef7fdb93c914ad5c54899f1bba35.jpg', '2018-10-31'),
(3, 'Test Event 3', 'test test test test test test test test test test test test test test test test test test test test test test test test ', '', '2018-10-31'),
(4, 'Test Event 4', 'test test test test test test test test test test test test test test test test test test test test test test test test ', '', '2018-10-31'),
(5, 'test news', 'test news', 'a10e7cb502888e4bdf17eeae1770bb6b.png', '2018-11-20');
-- --------------------------------------------------------
--
-- Table structure for table `job`
--
CREATE TABLE `job` (
`id` int(11) NOT NULL,
`title` text NOT NULL,
`description` text NOT NULL,
`company` int(11) NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `job`
--
INSERT INTO `job` (`id`, `title`, `description`, `company`, `date`) VALUES
(1, 'New Job edited', 'New JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew Job v New Job', 5, '2018-11-30'),
(2, 'New Job', 'New JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew Job v New Job', 7, '2018-11-30'),
(3, 'New Job', 'New JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew JobNew Job v New Job', 8, '2018-11-30'),
(5, 'job gdeeda', 'description', 7, '2018-11-15'),
(6, 'test job', 'aaaa', 8, '2018-11-23');
-- --------------------------------------------------------
--
-- Table structure for table `news`
--
CREATE TABLE `news` (
`id` int(11) NOT NULL,
`title` text NOT NULL,
`description` text NOT NULL,
`image` text NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `news`
--
INSERT INTO `news` (`id`, `title`, `description`, `image`, `date`) VALUES
(1, 'News', 'NewsNewsNewsNewsNewsNewsNewsNewsNewsNewsNewsNewsNewsNewsNewsNewsNewsNews', '298c60757835937b93c4c0f5ac08e266.jpeg', '2018-11-29'),
(2, 'news', 'news news news news news news news news ', '', '2018-10-29'),
(3, 'news', 'news news news news news news news news ', '', '2018-10-29'),
(4, 'news', 'news news news news news news news news ', '', '2018-10-29'),
(5, 'news', 'news news news news news news news news ', '', '2018-10-29'),
(6, 'news', 'news news news news news news news news ', '', '2018-10-29'),
(7, 'news', 'news news news news news news news news ', 'fc0aa5aa7865a9c23638e7ab96359d58.jpg', '2018-10-29'),
(8, 'asdasdasd', 'asjdsmdjhkas', '0712b39800f1094de4c067ef2a2ae83e.png', '2018-11-23');
-- --------------------------------------------------------
--
-- Table structure for table `role`
--
CREATE TABLE `role` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `role`
--
INSERT INTO `role` (`id`, `name`) VALUES
(1, 'admin'),
(2, 'company'),
(3, 'graduated student');
-- --------------------------------------------------------
--
-- Table structure for table `service`
--
CREATE TABLE `service` (
`id` int(11) NOT NULL,
`title` text NOT NULL,
`description` text NOT NULL,
`file` text NOT NULL,
`date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `service`
--
INSERT INTO `service` (`id`, `title`, `description`, `file`, `date`) VALUES
(1, 'service', 'serviceserviceserviceservicev service service serviceservice serviceserviceserviceservicev service service serviceservice serviceserviceserviceservicev service service serviceservice serviceserviceserviceservicev service service serviceservice serviceserviceserviceservicev service service serviceservice', '9d87e8faa406cf2d64512f20a966a018.png', '2018-11-30'),
(2, 'new service', 'new service', '71597b279761f2b45072b30504af2197.pdf', '2018-11-23');
-- --------------------------------------------------------
--
-- Table structure for table `statistics`
--
CREATE TABLE `statistics` (
`id` int(11) NOT NULL,
`name` text NOT NULL,
`number` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `statistics`
--
INSERT INTO `statistics` (`id`, `name`, `number`) VALUES
(1, 'Graduated Student', '30 Student'),
(3, 'Companies', '80 Company'),
(4, 'Events', '50 Event'),
(5, 'News', '100 News'),
(6, 'Jobs', '1000 Job\r\n');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`first_name` varchar(255) NOT NULL,
`last_name` varchar(255) NOT NULL,
`user_name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`description` text NOT NULL,
`phone` varchar(255) NOT NULL,
`address` text NOT NULL,
`role` int(11) NOT NULL,
`status` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `first_name`, `last_name`, `user_name`, `email`, `password`, `description`, `phone`, `address`, `role`, `status`) VALUES
(1, 'mohamed', 'ahmed', '<NAME>', '<EMAIL>', '21232f297a57a5a743894a0e4a801fc3', '', '', '', 1, 1),
(4, 'test', 'test', 'test', '<EMAIL>', '21232f297a57a5a743894a0e4a801fc3', '', '', '', 3, 1),
(5, 'VM', 'VM', 'VM', '<EMAIL>', '21232f297a57a5a743894a0e4a801fc3', '', '', '', 2, 1),
(7, 'gateOut', 'gateOut', 'gateOut', '<EMAIL>', '6<PASSWORD>', 'asdasdasasasdasd', '01158233977', 'gateOut gateOut gateOutsssssssssss', 2, 0),
(8, 'Vision', 'Vision', 'Vision', '<EMAIL>', '21232f297a57a5a743894a0e4a801fc3', 'asdasdasdasdsad asd asd asd asd a dasd ', '01115823232', 'aaaaaaa', 2, 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `about`
--
ALTER TABLE `about`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `contact_reply`
--
ALTER TABLE `contact_reply`
ADD PRIMARY KEY (`id`),
ADD KEY `contact_id` (`contact_id`);
--
-- Indexes for table `contact_us`
--
ALTER TABLE `contact_us`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `events`
--
ALTER TABLE `events`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `job`
--
ALTER TABLE `job`
ADD PRIMARY KEY (`id`),
ADD KEY `company` (`company`);
--
-- Indexes for table `news`
--
ALTER TABLE `news`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `role`
--
ALTER TABLE `role`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `service`
--
ALTER TABLE `service`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `statistics`
--
ALTER TABLE `statistics`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD KEY `role` (`role`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `about`
--
ALTER TABLE `about`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `contact_reply`
--
ALTER TABLE `contact_reply`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `contact_us`
--
ALTER TABLE `contact_us`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `events`
--
ALTER TABLE `events`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `job`
--
ALTER TABLE `job`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `news`
--
ALTER TABLE `news`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `role`
--
ALTER TABLE `role`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `service`
--
ALTER TABLE `service`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `statistics`
--
ALTER TABLE `statistics`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `contact_reply`
--
ALTER TABLE `contact_reply`
ADD CONSTRAINT `contact_reply_ibfk_1` FOREIGN KEY (`contact_id`) REFERENCES `contact_us` (`id`);
--
-- Constraints for table `job`
--
ALTER TABLE `job`
ADD CONSTRAINT `job_ibfk_1` FOREIGN KEY (`company`) REFERENCES `users` (`id`);
--
-- Constraints for table `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`role`) REFERENCES `role` (`id`);
COMMIT;
/*!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 */;
|
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: May 17, 2018 at 08:19 AM
-- Server version: 10.1.28-MariaDB
-- PHP Version: 5.6.32
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
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: `dbkeuangan`
--
-- --------------------------------------------------------
--
-- Table structure for table `tm_data`
--
CREATE TABLE `tm_data` (
`id_data` int(5) NOT NULL,
`bagian` varchar(125) DEFAULT NULL,
`asisten` varchar(125) DEFAULT NULL,
`uraian` varchar(512) DEFAULT NULL,
`anggaran` varchar(64) DEFAULT NULL,
`realisasi` varchar(64) DEFAULT NULL,
`persen` varchar(64) DEFAULT NULL,
`sisa_anggaran` varchar(64) DEFAULT NULL,
`tgl_sistem` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tm_data`
--
INSERT INTO `tm_data` (`id_data`, `bagian`, `asisten`, `uraian`, `anggaran`, `realisasi`, `persen`, `sisa_anggaran`, `tgl_sistem`) VALUES
(10, '1', '2', 'perjalanan', '18400000', '2400000', '13.04347826087', '16000000', '2018-05-16 04:56:23'),
(11, '1', '1', 'asasa', '5100000', '2530000', '49.607843137255', '2570000', '2018-05-14 08:34:09'),
(12, '3', '3', 'kerjasama', '5000', '635', '12.7', '4365', '2018-05-16 04:56:03'),
(13, '2', '2', 'pembelian atk', '1300000', '1000000', '76.923076923077', '300000', '2018-05-16 05:42:19'),
(14, '7', '1', 'belanja', '1000', '500', '50', '500', '2018-05-17 03:52:45');
-- --------------------------------------------------------
--
-- Table structure for table `tm_detail_pegawai`
--
CREATE TABLE `tm_detail_pegawai` (
`id_detail_pegawai` int(5) NOT NULL,
`id_pegawai` int(5) NOT NULL,
`anggaran` varchar(64) NOT NULL,
`realisasi` varchar(64) NOT NULL,
`persen` varchar(12) NOT NULL,
`sisa_anggaran` varchar(64) NOT NULL,
`tgl_sistem` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tm_detail_pegawai`
--
INSERT INTO `tm_detail_pegawai` (`id_detail_pegawai`, `id_pegawai`, `anggaran`, `realisasi`, `persen`, `sisa_anggaran`, `tgl_sistem`) VALUES
(1, 3, '12000000', 'beli komputer all in one', '10%', '30000000', '2018-05-09 07:51:12'),
(2, 3, '5000000', 'belanja mouse', '9%', '22000000', '2018-05-09 07:55:55'),
(3, 2, '90000', 'transport', '1%', '100000', '2018-05-09 09:33:56');
-- --------------------------------------------------------
--
-- Table structure for table `tm_level`
--
CREATE TABLE `tm_level` (
`id_level` int(3) UNSIGNED ZEROFILL NOT NULL,
`keterangan` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
--
-- Dumping data for table `tm_level`
--
INSERT INTO `tm_level` (`id_level`, `keterangan`) VALUES
(001, 'admin'),
(002, 'operator');
-- --------------------------------------------------------
--
-- Table structure for table `tm_pegawai`
--
CREATE TABLE `tm_pegawai` (
`id_pegawai` int(5) NOT NULL,
`tgl_update` date DEFAULT NULL,
`nama_anggaran` varchar(256) DEFAULT NULL,
`total_anggaran` varchar(64) NOT NULL,
`tgl_sistem` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `tm_pegawai`
--
INSERT INTO `tm_pegawai` (`id_pegawai`, `tgl_update`, `nama_anggaran`, `total_anggaran`, `tgl_sistem`) VALUES
(2, '2018-05-09', 'belanja keperluan pegawai', '2000000', '2018-05-09 07:42:50'),
(3, '2018-05-10', 'belanja komputer', '40000000', '2018-05-09 07:44:22');
-- --------------------------------------------------------
--
-- Table structure for table `tm_user`
--
CREATE TABLE `tm_user` (
`id_user` int(3) UNSIGNED ZEROFILL NOT NULL,
`id_level` int(3) UNSIGNED ZEROFILL NOT NULL,
`nama` varchar(64) NOT NULL,
`username` varchar(64) NOT NULL,
`password` varchar(64) NOT NULL,
`last_login` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
--
-- Dumping data for table `tm_user`
--
INSERT INTO `tm_user` (`id_user`, `id_level`, `nama`, `username`, `password`, `last_login`) VALUES
(003, 001, '<PASSWORD>', 'admin', '<PASSWORD>', '2017-03-29 13:25:37');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tm_data`
--
ALTER TABLE `tm_data`
ADD PRIMARY KEY (`id_data`);
--
-- Indexes for table `tm_detail_pegawai`
--
ALTER TABLE `tm_detail_pegawai`
ADD PRIMARY KEY (`id_detail_pegawai`),
ADD KEY `id_pegawai` (`id_pegawai`);
--
-- Indexes for table `tm_level`
--
ALTER TABLE `tm_level`
ADD PRIMARY KEY (`id_level`);
--
-- Indexes for table `tm_pegawai`
--
ALTER TABLE `tm_pegawai`
ADD PRIMARY KEY (`id_pegawai`);
--
-- Indexes for table `tm_user`
--
ALTER TABLE `tm_user`
ADD PRIMARY KEY (`id_user`),
ADD KEY `id_level` (`id_level`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `tm_data`
--
ALTER TABLE `tm_data`
MODIFY `id_data` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `tm_detail_pegawai`
--
ALTER TABLE `tm_detail_pegawai`
MODIFY `id_detail_pegawai` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tm_level`
--
ALTER TABLE `tm_level`
MODIFY `id_level` int(3) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `tm_pegawai`
--
ALTER TABLE `tm_pegawai`
MODIFY `id_pegawai` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `tm_user`
--
ALTER TABLE `tm_user`
MODIFY `id_user` int(3) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `tm_detail_pegawai`
--
ALTER TABLE `tm_detail_pegawai`
ADD CONSTRAINT `tm_detail_pegawai_ibfk_1` FOREIGN KEY (`id_pegawai`) REFERENCES `tm_pegawai` (`id_pegawai`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!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 */;
|
<reponame>pradeepjy/razorpay-intergration-in-codeigniter
-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 04, 2020 at 03:07 PM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.4.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
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: `rozerpay`
--
-- --------------------------------------------------------
--
-- Table structure for table `paymentss`
--
CREATE TABLE `paymentss` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` varchar(150) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
`product_id` varchar(150) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
`payment_id` varchar(45) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
`amount` varchar(45) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `paymentss`
--
INSERT INTO `paymentss` (`id`, `user_id`, `product_id`, `payment_id`, `amount`) VALUES
(1, '1', '1', 'pay_EmI5SFMDlwt3dd', '1000');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `paymentss`
--
ALTER TABLE `paymentss`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `paymentss`
--
ALTER TABLE `paymentss`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
/*!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 */;
|
BEGIN;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
COMMIT;
|
alter table "public"."invoices" alter column "user_id" drop not null;
|
-- Create pcc database
-- Take values from cluster db
-- DROP TABLE IF EXISTS pcc;
CREATE TABLE IF NOT EXISTS pcc(
clusterID INTEGER NOT NULL UNIQUE,
birdID STRING,
taskName STRING,
taskSession INT,
taskSessionDeafening INT,
taskSessionPostDeafening INT,
dph INT,
block10days INT,
baselineFR REAL,
motifFRUndir REAL,
motifFRDir REAL,
pccUndir REAL,
pccDir REAL,
corrRContext REAL,
pccUndirSig REAL,
pccDirSig REAL,
cvSpkCountUndir REAL,
cvSpkCountDir REAL,
fanoSpkCountUndir REAL,
fanoSpkCountDir REAL,
sparsenessUndir REAL,
sparsenessDir REAL,
FOREIGN KEY(clusterID) REFERENCES cluster(id));
INSERT OR IGNORE INTO pcc
(clusterID, birdID, taskName, taskSession, taskSessionDeafening, taskSessionPostDeafening, dph, block10days)
SELECT id, birdID, taskName, taskSession, taskSessionDeafening, taskSessionPostDeafening, dph, block10days FROM main.cluster
WHERE analysisOK is TRUE
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.