sql
stringlengths 6
1.05M
|
|---|
<gh_stars>1-10
insert into t_role (id,name,code,`describe`) values('42ed144b-76ef-4634-ba6b-b6664105401d','美容','service','洗澡,修剪');
-- ----------------------------
-- Table data for t_role_menu
-- ----------------------------
-- 美容 --
insert into t_role_menu (id,menu_code,role_code) values(uuid(),'FM0320','nurse');
INSERT INTO t_role_menu (id, menu_code, role_code) VALUES (uuid(), 'FM0320', 'face');
INSERT INTO t_role_menu (id, menu_code, role_code) VALUES (uuid(), 'FM0320', 'sales-staff');
|
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."notebook_event" add column "structure" varchar
-- null;
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."notebook_event" add column "event" varchar
-- null;
alter table "public"."notebook_event" alter column "data" drop not null;
alter table "public"."notebook_event" add column "data" jsonb;
|
BEGIN
FOR s IN (SELECT sequence_name FROM user_sequences) LOOP
EXECUTE IMMEDIATE ('DROP SEQUENCE ' || s.sequence_name);
END LOOP;
FOR c IN (SELECT table_name FROM user_tables where table_name not like 'DR$%' ) LOOP
EXECUTE IMMEDIATE ('DROP TABLE "' || c.table_name || '" CASCADE CONSTRAINTS');
END LOOP;
END;
|
.@classpath mysql ../drivers/mysql-connector-java-8.0.25.jar
.open -u root mysql://localhost/?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
<reponame>csamak/asterixdb
/*
* 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.
*/
use test;
insert into TestOpen ({
"c_id": 1,
"c_x": 1,
"c_s": "hello",
"c_i64": 2,
"c_i8": 2,
"c_d": 2
});
insert into TestOpen ({
"c_id": 2,
"c_x": 2,
"c_s": 2,
"c_i64": "2",
"c_i8": 2.5,
"c_d": 3
});
insert into TestOpen ({
"c_id": 3,
"c_x": 3,
"c_s": "world",
"c_i64": 2,
"c_i8": 4,
"c_d": 3.125
});
insert into TestOpen ({
"c_id": 4,
"c_x": 4,
"c_s": null,
"c_i64": null,
"c_i8": 500,
"c_d": 3.25
});
insert into TestOpen ({
"c_id": 5,
"c_x": 5,
"c_s": "hello",
"c_i64": 2.25,
"c_i8": 10000.25,
"c_d": 3.5
});
insert into TestOpen ({
"c_id": 6,
"c_x": 6,
"c_s": false,
"c_i64": false,
"c_i8": 2e100,
"c_d": 2e100
});
insert into TestOpen ({
"c_id": 7,
"c_x": 7,
"c_s": "world",
"c_i64": 3
});
insert into TestOpen ({
"c_id": 8,
"c_x": 8
});
insert into TestOpen ({
"c_id": 9,
"c_x": 9,
"c_d": 3.25
});
|
DROP view if exists view_beban_penyusutan_pm_2020_r2_a1 CASCADE;
create view view_beban_penyusutan_pm_2020_r2_a1 as
select register,
nama_skpd,
id_skpd,
nama_lokasi_bidang,
id_lokasi_bidang,
nama_kabupaten,
id_kabupaten,
nama_provinsi,
id_provinsi,
id_mutasi_berkurang,
mutasi_berkurang,
keadaan_barang,
nama_barang,
kode_barang,
tahun_awal,
nilai_perolehan as nilai_perolehan_sd_2019,
0 as nilai_perolehan_sd_2020,
nilai_buku as nilai_buku_sd_2019,
0 as nilai_buku_sd_2020
from
view_penyusutan_pm_2019_r2_a4
UNION ALL
select register,
nama_skpd,
id_skpd,
nama_lokasi_bidang,
id_lokasi_bidang,
nama_kabupaten,
id_kabupaten,
nama_provinsi,
id_provinsi,
id_mutasi_berkurang,
mutasi_berkurang,
keadaan_barang,
nama_barang,
kode_barang,
tahun_awal,
0 as nilai_perolehan_sd_2019,
nilai_perolehan as nilai_perolehan_sd_2020,
0 as nilai_buku_sd_2019,
nilai_buku as nilai_buku_sd_2020
from
view_penyusutan_pm_2020_r2_a4
order by register;
DROP view if exists view_beban_penyusutan_pm_2020_r2_a2 CASCADE;
create view view_beban_penyusutan_pm_2020_r2_a2 as
select register,
nama_skpd,
id_skpd,
nama_lokasi_bidang,
id_lokasi_bidang,
nama_kabupaten,
id_kabupaten,
nama_provinsi,
id_provinsi,
id_mutasi_berkurang,
mutasi_berkurang,
keadaan_barang,
nama_barang,
kode_barang,
min(tahun_awal) as tahun_awal,
sum(nilai_perolehan_sd_2019) as nilai_perolehan_sd_2019,
sum(nilai_perolehan_sd_2020) - sum(nilai_perolehan_sd_2019) as penambahan_nilai_di_2020,
sum(nilai_perolehan_sd_2020) as nilai_perolehan_sd_2020,
sum(nilai_perolehan_sd_2019) - sum(nilai_buku_sd_2019) as nilai_penyusutan_sd_2019,
sum(nilai_buku_sd_2019) as nilai_buku_sd_2019,
sum(nilai_buku_sd_2019) +
(sum(nilai_perolehan_sd_2020) - sum(nilai_perolehan_sd_2019)) -
sum(nilai_buku_sd_2020) as beban_penyusutan_2020,
sum(nilai_perolehan_sd_2020) - sum(nilai_buku_sd_2020) as nilai_penyusutan_sd_2020,
sum(nilai_buku_sd_2020) as nilai_buku_sd_2020
from
view_beban_penyusutan_pm_2020_r2_a1
GROUP BY
register,
nama_skpd,
id_skpd,
nama_lokasi_bidang,
id_lokasi_bidang,
nama_kabupaten,
id_kabupaten,
nama_provinsi,
id_provinsi,
id_mutasi_berkurang,
mutasi_berkurang,
keadaan_barang,
nama_barang,
kode_barang
order by register;
GRANT ALL PRIVILEGES ON view_beban_penyusutan_pm_2020_r2_a2 TO lap_kabupaten;
REVOKE INSERT, UPDATE, DELETE ON view_beban_penyusutan_pm_2020_r2_a2 FROM lap_kabupaten;
|
<reponame>Chronopolis-Digital-Preservation/chronopolis-core
-- just doing a naive update on the ace_token tables take a tremendous amount of time, likely
-- because of the indexes which need updated. to mitigate this we take a few extra steps:
-- 1: create a new table for ace_tokens (ace_token_migration)
-- 2: insert into the new table from joining the ace_token table with the file table
-- this takes roughly as long as the select
-- 3: drop the old ace_tokens table
-- 4: rename the ace_token_migration table
-- 5: add constraints and indexes
-- 1
CREATE TABLE ace_token_migration(
id bigint default nextval('ace_token_id_seq'),
bag_id bigint, -- note the change from bag -> bag_id
file_id bigint,
round bigint,
ims_host varchar(255),
ims_service varchar(255),
algorithm varchar(255),
proof text,
create_date timestamp
);
-- 2
INSERT INTO ace_token_migration(id, bag_id, file_id, round, ims_host, ims_service, algorithm, proof, create_Date)
SELECT a.id, a.bag, f.id, a.round, a.ims_host, a.ims_service, a.algorithm, a.proof, a.create_date
FROM ace_token a INNER JOIN file f ON a.filename = f.filename AND a.bag = f.bag_id;
-- 3/4
DROP TABLE ace_token;
ALTER TABLE ace_token_migration RENAME TO ace_token;
|
<reponame>apfrankowski/insights
DELIMITER $$
CREATE DEFINER=`symulator`@`%` PROCEDURE `InsightsIndicatorsUpdate`( IN in_id_szpital INT(10) unsigned, IN id_data_od int(7), IN id_data_do int(7) )
BEGIN
DROP TABLE IF EXISTS afr_osobodni_azl;
CALL PoliczOsobodniAZLPlanowe_AFR( in_id_szpital, id_data_od-100, id_data_do );
DROP TABLE IF EXISTS afr_indicators;
CREATE TABLE afr_indicators (
id integer auto_increment primary key,
id_szpital integer,
id_oddzial integer,
id_data integer,
id_specjalizacja integer,
occupancy decimal(5,2),
occupancy_ly decimal(5,2),
occupancy_benchmark decimal (5,2),
exceeded_occupancy decimal (5,2),
exceeded_occupancy_ly decimal(5,2),
alos decimal(5,1),
alos_ly decimal(5,1),
alos_ben decimal(5,1),
planned_admission_pop decimal(5,2),
planned_admission_pop_ben decimal(5,2),
emergency_admission_pop decimal(5,2),
emergency_admission_pop_ben decimal(5,2),
occupancy_stddev decimal (5,2),
contract_fulfillment decimal(5,2),
max_daily_occupancy decimal(5,2),
avg_thu_occupancy decimal(5,2),
avg_fri_occupancy decimal(5,2)
);
INSERT INTO afr_indicators (
id_szpital,
id_oddzial,
id_data,
id_specjalizacja
) SELECT
o.id_szpital,
azl.id_oddzial,
id_data_do,
id_specjalizacja
FROM afr_osobodni_azl azl
JOIN oddzial o ON o.id=azl.id_oddzial
GROUP BY id_oddzial;
DROP TEMPORARY TABLE IF EXISTS afr_dp_count;
CREATE TEMPORARY TABLE afr_dp_count AS (
SELECT
p.id_szpital,
p.id_oddzial,
p.id_diagproc,
o.id_specjalizacja,
count(*) AS dp_count
FROM pobyt p
JOIN oddzial o ON o.id=p.id_oddzial
WHERE id_data BETWEEN id_data_od AND id_data_do
AND p.id_szpital = in_id_szpital
GROUP BY p.id_oddzial, p.id_diagproc
);
#oblożenie
UPDATE afr_indicators afr INNER JOIN (
select id_oddzial, (sum(il_osobodni) + sum(il_przyjec) - sum(il_jednodniowych)) / sum(liczba_lozek) as occupancy
from afr_osobodni_azl azl
join oddzial_informacje oi using (id_oddzial, id_data)
where id_data between id_data_od AND id_data_do
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.occupancy = rel.occupancy;
#oblożenie_ly
update afr_indicators afr inner join (
select id_oddzial, (sum(il_osobodni) + sum(il_przyjec) - sum(il_jednodniowych)) / sum(liczba_lozek) as occupancy_ly
from afr_osobodni_azl azl
join oddzial_informacje oi using (id_oddzial, id_data)
where id_data between id_data_od AND id_data_do
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.occupancy_ly = rel.occupancy_ly;
#oblozenie ben
update afr_indicators afr inner join (
select azl.id_oddzial, value as occupancy_benchmark
from afr_osobodni_azl azl
join oddzial o on o.id=azl.id_oddzial
join l_grupa_szpitali_szpital lgss on lgss.id_szpital=o.id_szpital
join benchmark b on b.id_specjalizacja=o.id_specjalizacja and b.id_grupa_szpitali=lgss.id_grupa_szpitali
where id_benchmark_dimensions = 'oblozenie.9' and b.id_data_od=201401 and b.id_data_do=201506
group by azl.id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.occupancy_benchmark = rel.occupancy_benchmark;
#oblozenie ponad 100% => udzial
update afr_indicators afr inner join (
select id_oddzial,
SUM( IF(((il_osobodni+il_przyjec-il_jednodniowych)/liczba_lozek)>1, 1, 0 ) )/count(dzien) as exceeded_occupancy
from afr_osobodni_azl azl
join oddzial_informacje oi using (id_oddzial, id_data)
where id_data between id_data_od AND id_data_do
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.exceeded_occupancy = rel.exceeded_occupancy;
#oblozenie ponad 100% => udzial LY
update afr_indicators afr inner join
(select id_oddzial,
SUM( IF(((il_osobodni+il_przyjec-il_jednodniowych)/liczba_lozek)>1, 1, 0 ) )/count(dzien) as exceeded_occupancy_ly
from afr_osobodni_azl azl
join oddzial_informacje oi using (id_oddzial, id_data)
where id_data between id_data_od AND id_data_do
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.exceeded_occupancy_ly = rel.exceeded_occupancy_ly;
#alos
update afr_indicators afr inner join
(select id_oddzial,
(sum(il_osobodni_wypisowych)/sum(il_wypisow)) as alos
from afr_osobodni_azl azl
where id_data between id_data_od AND id_data_do
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.alos = rel.alos;
#alos LY
update afr_indicators afr inner join
(select id_oddzial,
(sum(il_osobodni_wypisowych)/sum(il_wypisow)) as alos_ly
from afr_osobodni_azl azl
where id_data between id_data_od-100 AND id_data_do-100
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.alos_ly = rel.alos_ly;
#alos ben
update afr_indicators afr inner join
(select sum(afr.dp_count*b.value)/sum(afr.dp_count) as alos_ben, afr.id_oddzial as id_oddzial
from afr_dp_count afr
left join benchmark b using (id_diagproc, id_specjalizacja)
where b.id_data_od=201401 and b.id_data_do=201506
and b.id_benchmark_dimensions='dlugosc_pobytu.41'
and b.id_statistical_measure='AVG'
and b.id_grupa_szpitali=2
group by afr.id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.alos_ben = rel.alos_ben;
#udzial planowe
update afr_indicators afr inner join
(select id_oddzial, sum(il_przyjec_planowych)/sum(il_przyjec) as planned_admission_pop
from afr_osobodni_azl
where id_data between id_data_od AND id_data_do
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.planned_admission_pop = rel.planned_admission_pop;
#udzial_planow_ben
update afr_indicators afr inner join
(select id_specjalizacja, sum(il_przyjec_planowych)/sum(il_przyjec) as planned_admission_pop_ben
from afr_osobodni_azl azl
join oddzial o on o.id=azl.id_oddzial
where id_data between id_data_od AND id_data_do
group by o.id_specjalizacja) rel
on rel.id_specjalizacja = afr.id_specjalizacja
set afr.planned_admission_pop_ben = rel.planned_admission_pop_ben;
#udzial ostre
update afr_indicators afr inner join
(select id_oddzial, sum(il_przyjec_pozostalych)/sum(il_przyjec) as emergency_admission_pop
from afr_osobodni_azl
where id_data between id_data_od AND id_data_do
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.emergency_admission_pop = rel.emergency_admission_pop;
#udzial_ostre_ben
update afr_indicators afr inner join
(select id_specjalizacja, sum(il_przyjec_pozostalych)/sum(il_przyjec) as emergency_admission_pop_ben
from afr_osobodni_azl azl
join oddzial o on o.id=azl.id_oddzial
where id_data between id_data_od AND id_data_do
group by o.id_specjalizacja) rel
on rel.id_specjalizacja = afr.id_specjalizacja
set afr.emergency_admission_pop_ben = rel.emergency_admission_pop_ben;
#occ stddev
update afr_indicators afr inner join
(select id_oddzial, std((il_osobodni+il_przyjec-il_jednodniowych)/liczba_lozek) as occupancy_stddev
from afr_osobodni_azl azl
join oddzial_informacje oi using (id_oddzial, id_data)
where id_data between id_data_od AND id_data_do
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.occupancy_stddev = rel.occupancy_stddev;
#contract fulfillment
update afr_indicators afr inner join
(select id_oddzial, sum(realizacja_produktu_narastajaco)/sum(limit_produktu_narastajaco) as contract_fulfillment
from miesieczne_wykonania_produktow mwp
join afr_osobodni_azl azl using(id_oddzial)
where mwp.id_data=id_data_do
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.contract_fulfillment = rel.contract_fulfillment;
#max daily occ
update afr_indicators afr inner join
(select id_oddzial, max((il_osobodni+il_przyjec-il_jednodniowych)/liczba_lozek) as max_daily_occupancy
from afr_osobodni_azl azl
join oddzial_informacje oi using (id_oddzial, id_data)
where id_data between id_data_od AND id_data_do
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.max_daily_occupancy = rel.max_daily_occupancy;
#avg thursday occ
update afr_indicators afr inner join
(select id_oddzial, avg((il_osobodni+il_przyjec-il_jednodniowych)/liczba_lozek) as avg_thu_occupancy
from afr_osobodni_azl azl
join oddzial_informacje oi using (id_oddzial, id_data)
where id_data between id_data_od AND id_data_do and weekday(dzien) = 3
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.avg_thu_occupancy = rel.avg_thu_occupancy;
#avg friday occ
update afr_indicators afr inner join
(select id_oddzial, avg((il_osobodni+il_przyjec-il_jednodniowych)/liczba_lozek) as avg_fri_occupancy
from afr_osobodni_azl azl
join oddzial_informacje oi using (id_oddzial, id_data)
where id_data between id_data_od AND id_data_do and weekday(dzien) = 4
group by id_oddzial) rel
on rel.id_oddzial = afr.id_oddzial
set afr.avg_fri_occupancy = rel.avg_fri_occupancy;
DROP TABLE IF EXISTS afr_osobodni_azl;
END$$
DELIMITER ;
|
<reponame>martinligotnis/tech<filename>venden_techreport_19.02.2020.sql
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 19, 2021 at 03:37 PM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 8.0.2
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: `venden_techreport`
--
CREATE DATABASE IF NOT EXISTS `venden_techreport` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `venden_techreport`;
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`id` int(11) NOT NULL,
`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`first_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`last_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`status` smallint(6) NOT NULL DEFAULT 10,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
`verification_token` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`id`, `username`, `first_name`, `last_name`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`, `verification_token`) VALUES
(1, 'admin', 'Mārtiņš', 'Līgotnis', 'XPReQddB-HZnlGUCZS<PASSWORD>IQ<PASSWORD>', <PASSWORD>', NULL, '<EMAIL>', 10, 1613137650, 1613137650, 'uUpZsg2OPcnHKMyR_uNQjQ5zv93hJAx6_1613137650');
-- --------------------------------------------------------
--
-- Table structure for table `equipment`
--
DROP TABLE IF EXISTS `equipment`;
CREATE TABLE `equipment` (
`id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`production_line_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `equipment`
--
INSERT INTO `equipment` (`id`, `name`, `production_line_id`) VALUES
(1, 'Preformu bunkurs', 1),
(2, 'PET Pūtējs', 1),
(3, 'Gaisa Transportieris', 1),
(4, 'Stikla transportieris pie pildāmās mašīnas', 1),
(5, 'Pildītājs un korķu bunkurs', 1),
(6, 'Transportieris starp pildītāju un etiķētāju', 1),
(7, 'Ukrpack etiķētājs', 1),
(8, 'Slīverotājs', 1),
(9, 'Videojet Tintes printeris', 1),
(10, 'Transportieris zem tvaika tuneļa un nopūtēja', 1),
(11, 'Tvaika tunelis', 1),
(12, 'Nopūtējs', 1),
(13, 'Transportieris starp nopūtēju un plēvotāju', 1),
(14, 'Stikla etiķētājs', 1),
(15, 'Plēvotājs', 1),
(16, 'Transportieris aiz plēvotāja', 1),
(17, 'Pakošanas un gravitācijas transportieri', 1),
(18, 'Palešu aptinējs', 1),
(19, 'Saturators un Starptvertne', 1),
(20, 'CIP Sistēma ar pārsūknēšanu', 1),
(21, 'Konteineru transportieris un pudeļu padeves mehānisms', 2),
(22, 'Pudeļu izlādes transportieris', 2),
(23, 'Brāķēšanas ekrāns ar ekrānu', 2),
(24, 'Atkorķētājs', 2),
(25, 'Priekšmazgātājs ar transportieri', 2),
(26, 'Transportieris starp priekšmazgātāju un pudeļu hermētiskuma pārbaudes mezglu', 2),
(27, 'Pudeļu hermētiskuma pārbaudes mezgls ar transportieriem', 2),
(28, 'Mazgāšanas mašīna ar ieejas un izejas transportieriem', 2),
(29, 'Transportieris starp mazgājumo mašīnu un Pildāmo bloku', 2),
(30, 'Pildīšanas bloks ar ieejas un izejas transportieri, darba sūkni un 5m3 starptvertne', 2),
(31, 'Aizkorķēšanas bloks ar korķu bunkuru', 2),
(32, 'Tintes printeris', 2),
(33, 'Slīverotājs', 2),
(34, 'Gatavā produkta brāķēšanas ekrāns ar transportieri', 2),
(35, 'Termo tunelis', 2),
(36, 'Gatavās produkcijas pagrieziena transportieris', 2),
(37, 'Robota ielādes transportieris', 2),
(38, 'Robota transportieris ar vārstiem', 2),
(39, 'Robots', 2),
(40, 'Filtri ar paneli', 2),
(41, 'Āra mucas ar diviem pārsūknēšanas sūkņiem', 2);
-- --------------------------------------------------------
--
-- Table structure for table `migration`
--
DROP TABLE IF EXISTS `migration`;
CREATE TABLE `migration` (
`version` varchar(180) COLLATE utf8_unicode_ci NOT NULL,
`apply_time` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `migration`
--
INSERT INTO `migration` (`version`, `apply_time`) VALUES
('m000000_000000_base', 1613136619),
('m130524_201442_init', 1613136625),
('m190124_110200_add_verification_token_column_to_user_table', 1613136625),
('m210212_135137_admin', 1613139145),
('m210216_130013_production_line', 1613739535),
('m210216_130014_equipment', 1613739535),
('m210216_133958_create_junction_table_for_production_line_and_equipment_tables', 1613739536),
('m210216_134001_unit_type', 1613739536),
('m210216_134002_unit', 1613739536),
('m210216_145519_create_junction_table_for_unit_andequipment_tables', 1613739536),
('m210216_145600_spare_part', 1613739536);
-- --------------------------------------------------------
--
-- Table structure for table `production_line`
--
DROP TABLE IF EXISTS `production_line`;
CREATE TABLE `production_line` (
`id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `production_line`
--
INSERT INTO `production_line` (`id`, `name`) VALUES
(2, '5 Gallon Līnija'),
(1, 'PET Līnija');
-- --------------------------------------------------------
--
-- Table structure for table `production_line_equipment`
--
DROP TABLE IF EXISTS `production_line_equipment`;
CREATE TABLE `production_line_equipment` (
`production_line_id` int(11) NOT NULL,
`equipment_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `spare_part`
--
DROP TABLE IF EXISTS `spare_part`;
CREATE TABLE `spare_part` (
`id` int(11) NOT NULL,
`producer` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`model` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`description` text COLLATE utf8_unicode_ci DEFAULT NULL,
`unit_type_id` int(11) NOT NULL,
`unit_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `unit`
--
DROP TABLE IF EXISTS `unit`;
CREATE TABLE `unit` (
`id` int(11) NOT NULL,
`equipment_id` int(11) DEFAULT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`unit_type_id` int(11) NOT NULL,
`function` text COLLATE utf8_unicode_ci NOT NULL,
`service_interval` int(11) NOT NULL,
`installation_date` int(11) NOT NULL,
`last_maintenance` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `unit_equipment`
--
DROP TABLE IF EXISTS `unit_equipment`;
CREATE TABLE `unit_equipment` (
`unit_id` int(11) NOT NULL,
`equipment_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `unit_type`
--
DROP TABLE IF EXISTS `unit_type`;
CREATE TABLE `unit_type` (
`id` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`first_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`last_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`auth_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`password_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password_reset_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`status` smallint(6) NOT NULL DEFAULT 10,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
`verification_token` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `username`, `first_name`, `last_name`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`, `verification_token`) VALUES
(1, 'martins', 'Mārtiņš', 'Līgotnis', 'XPReQddB-HZnlGUCZS<PASSWORD>IQ<PASSWORD>', '$2y$13$ljyWKcAct0M11ZDKfYpoaO5YVtcjKDpLaHef7Zn3eYTqTEqH8cvta', NULL, '<EMAIL>', 10, 1613137650, 1613137650, 'uUpZsg2OPcnHKMyR_uNQjQ5zv93hJAx6_1613137650'),
(2, 'arnis', 'Arnis', 'Celms', 'elWtyYYulChgpk470X-jTdDlI969NtKq', '$2y$13$Wwd3yk2mZ0AgLyQ9.aWMfeXoAEGWrrpMwSCFl8I3pOalL3b1bWxne', NULL, '<EMAIL>', 10, 1613478018, 1613478018, 'E3K_Fj8BUlPtf1IQWqivRpNzCMjl9549_1613478018');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`),
ADD UNIQUE KEY `email` (`email`),
ADD UNIQUE KEY `password_reset_token` (`password_reset_token`);
--
-- Indexes for table `equipment`
--
ALTER TABLE `equipment`
ADD PRIMARY KEY (`id`),
ADD KEY `idx-equipment-production_line_id` (`production_line_id`);
--
-- Indexes for table `migration`
--
ALTER TABLE `migration`
ADD PRIMARY KEY (`version`);
--
-- Indexes for table `production_line`
--
ALTER TABLE `production_line`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
--
-- Indexes for table `production_line_equipment`
--
ALTER TABLE `production_line_equipment`
ADD PRIMARY KEY (`production_line_id`,`equipment_id`),
ADD KEY `idx-production_line_equipment-production_line_id` (`production_line_id`),
ADD KEY `idx-production_line_equipment-equipment_id` (`equipment_id`);
--
-- Indexes for table `spare_part`
--
ALTER TABLE `spare_part`
ADD PRIMARY KEY (`id`),
ADD KEY `idx-spare_part-unit_type_id` (`unit_type_id`),
ADD KEY `idx-spare_part-unit_id` (`unit_id`);
--
-- Indexes for table `unit`
--
ALTER TABLE `unit`
ADD PRIMARY KEY (`id`),
ADD KEY `idx-unit-unit_type_id` (`unit_type_id`),
ADD KEY `idx-unit-equipment_id` (`equipment_id`);
--
-- Indexes for table `unit_equipment`
--
ALTER TABLE `unit_equipment`
ADD PRIMARY KEY (`unit_id`,`equipment_id`),
ADD KEY `idx-unit_equipment-unit_id` (`unit_id`),
ADD KEY `idx-unit_equipment-equipment_id` (`equipment_id`);
--
-- Indexes for table `unit_type`
--
ALTER TABLE `unit_type`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`),
ADD UNIQUE KEY `email` (`email`),
ADD UNIQUE KEY `password_reset_token` (`<PASSWORD>`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `equipment`
--
ALTER TABLE `equipment`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;
--
-- AUTO_INCREMENT for table `production_line`
--
ALTER TABLE `production_line`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `spare_part`
--
ALTER TABLE `spare_part`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `unit`
--
ALTER TABLE `unit`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `unit_type`
--
ALTER TABLE `unit_type`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `equipment`
--
ALTER TABLE `equipment`
ADD CONSTRAINT `fk-equipment-production_line_id` FOREIGN KEY (`production_line_id`) REFERENCES `production_line` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `production_line_equipment`
--
ALTER TABLE `production_line_equipment`
ADD CONSTRAINT `fk-production_line_equipment-equipment_id` FOREIGN KEY (`equipment_id`) REFERENCES `equipment` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `fk-production_line_equipment-production_line_id` FOREIGN KEY (`production_line_id`) REFERENCES `production_line` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `spare_part`
--
ALTER TABLE `spare_part`
ADD CONSTRAINT `fk-spare_part-unit_id` FOREIGN KEY (`unit_id`) REFERENCES `unit` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `fk-spare_part-unit_type_id` FOREIGN KEY (`unit_type_id`) REFERENCES `unit_type` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `unit`
--
ALTER TABLE `unit`
ADD CONSTRAINT `fk-unit-equipment_id` FOREIGN KEY (`equipment_id`) REFERENCES `equipment` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `fk-unit-unit_type_id` FOREIGN KEY (`unit_type_id`) REFERENCES `unit_type` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `unit_equipment`
--
ALTER TABLE `unit_equipment`
ADD CONSTRAINT `fk-unit_equipment-equipment_id` FOREIGN KEY (`equipment_id`) REFERENCES `equipment` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `fk-unit_equipment-unit_id` FOREIGN KEY (`unit_id`) REFERENCES `unit` (`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 */;
|
<reponame>vivivibo/pipeline
BEGIN;
select _v.unregister_patch( '003-msm-index' );
-- Bring our bugs back!
alter table http_control alter column msm_no drop not null;
alter table http_request alter column msm_no drop not null;
alter table http_verdict alter column msm_no drop not null;
alter table tcp alter column msm_no drop not null;
-- MOAR full-scans!
drop index dns_a_msm_no_idx;
drop index http_control_msm_no_idx;
drop index http_request_msm_no_idx;
drop index http_verdict_msm_no_idx;
drop index tcp_msm_no_idx;
COMMIT;
|
<reponame>opengauss-mirror/Yat<gh_stars>0
-- @testpoint:opengauss关键字outer(保留),作为角色名
--关键字不带引号-合理报错
drop role if exists outer;
create role outer with password '<PASSWORD>' valid until '2020-12-31';
--关键字带双引号-成功
drop role if exists "outer";
create role "outer" with password '<PASSWORD>' valid until '2020-12-31';
--清理环境
drop role "outer";
--关键字带单引号-合理报错
drop role if exists 'outer';
create role 'outer' with password '<PASSWORD>' valid until '2020-12-31';
--关键字带反引号-合理报错
drop role if exists `outer`;
create role `outer` with password '<PASSWORD>' valid until '2020-12-31';
|
<filename>StoredProcedureStatistics.sql
CREATE EVENT SESSION [StoredProcedureStatistics] ON SERVER
ADD EVENT sqlserver.rpc_completed(SET collect_statement=(1)
ACTION(package0.collect_system_time,sqlos.task_time,sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.session_id)
WHERE ([sqlserver].[equal_i_sql_unicode_string]([sqlserver].[database_name],N'Staples') AND [sqlserver].[equal_i_sql_unicode_string]([object_name],N'get_subject_profile')
AND [duration]>(200000)))
ADD TARGET package0.event_file(SET filename=N'c:\temp\StoredProcedureStatistics.xel',max_file_size=(5))
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)
GO
--I am trying to show long durations calls to the SP and long IO waits.
CREATE EVENT SESSION [StoredProcedureStatistics] ON SERVER
ADD EVENT sqlos.wait_info(
ACTION(package0.collect_system_time,sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.session_id)
WHERE ([sqlserver].[equal_i_sql_unicode_string]([sqlserver].[database_name],N'staples')
AND [package0].[equal_binary_data]([sqlserver].[plan_handle],0x05000500A455397EC05C85634000000001000000000000000000000000000000000000000000000000000000)
AND [package0].[greater_than_uint64]([duration],(50)))),
ADD EVENT sqlos.wait_info_external(
ACTION(package0.collect_system_time,sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.session_id)
WHERE ([sqlserver].[equal_i_sql_unicode_string]([sqlserver].[database_name],N'staples')
AND [package0].[equal_binary_data]([sqlserver].[plan_handle],0x05000500A455397EC05C85634000000001000000000000000000000000000000000000000000000000000000)
AND [package0].[greater_than_uint64]([duration],(50)))),
ADD EVENT sqlserver.rpc_completed(SET collect_statement=(1)
ACTION(package0.collect_system_time,sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.session_id)
WHERE ([sqlserver].[equal_i_sql_unicode_string]([sqlserver].[database_name],N'Staples') AND [sqlserver].[equal_i_sql_unicode_string]([object_name],N'get_subject_profile')
AND [package0].[greater_than_uint64]([duration],(300000))))
ADD TARGET package0.event_file(SET filename=N'c:\temp\StoredProcedureStatistics.xel',max_file_size=(10))
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF
,STARTUP_STATE=OFF)
GO
|
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.3.16
-- Dumped by pg_dump version 9.6.1
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_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;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: Fj6L8ZM_applies; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_applies" (
id integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
user_id integer DEFAULT 0 NOT NULL,
clan_id integer DEFAULT 0 NOT NULL,
apply_status text DEFAULT 'Рассматривается'::text NOT NULL,
apply_answer boolean DEFAULT false NOT NULL
);
ALTER TABLE "Fj6L8ZM_applies" OWNER TO postgres;
--
-- Name: Fj6L8ZM_clan_gamers; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_clan_gamers" (
id integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
clan_id integer DEFAULT 0 NOT NULL,
user_id integer DEFAULT 0 NOT NULL,
role text DEFAULT 'gamer'::text NOT NULL,
main boolean DEFAULT false NOT NULL
);
ALTER TABLE "Fj6L8ZM_clan_gamers" OWNER TO postgres;
--
-- Name: Fj6L8ZM_clans; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_clans" (
id integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
clan_avatar text,
clan_name text,
clan_rating integer DEFAULT 0 NOT NULL,
clan_description text,
clan_seats integer DEFAULT 10 NOT NULL,
"clan_Employed_seats" integer DEFAULT 0 NOT NULL,
clan_badge text,
clan_recruitment boolean DEFAULT true,
clan_user_id integer DEFAULT 0 NOT NULL,
clan_slogan text,
clan_count_apply integer DEFAULT 0 NOT NULL,
clan_widget text,
clan_rules text,
clan_vip_status boolean DEFAULT false NOT NULL
);
ALTER TABLE "Fj6L8ZM_clans" OWNER TO postgres;
--
-- Name: Fj6L8ZM_heroes; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_heroes" (
id integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
hero_name text,
hero_poster text,
hero_ru_name text,
hero_role text
);
ALTER TABLE "Fj6L8ZM_heroes" OWNER TO postgres;
--
-- Name: Fj6L8ZM_migrations; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_migrations" (
id integer NOT NULL,
migration character varying(255) NOT NULL,
batch integer NOT NULL
);
ALTER TABLE "Fj6L8ZM_migrations" OWNER TO postgres;
--
-- Name: Fj6L8ZM_navigations; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_navigations" (
id integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
navigation_img text,
navigation_status boolean DEFAULT false NOT NULL,
navigation_setting integer,
navigation_title text,
navigation_slug text,
navigation_order integer
);
ALTER TABLE "Fj6L8ZM_navigations" OWNER TO postgres;
--
-- Name: Fj6L8ZM_password_resets; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_password_resets" (
email character varying(255) NOT NULL,
token character varying(255) NOT NULL,
created_at timestamp(0) without time zone
);
ALTER TABLE "Fj6L8ZM_password_resets" OWNER TO postgres;
--
-- Name: Fj6L8ZM_posts; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_posts" (
id integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
post_title text,
post_content text,
post_setting text,
post_comment boolean DEFAULT false NOT NULL,
post_image text,
post_description text
);
ALTER TABLE "Fj6L8ZM_posts" OWNER TO postgres;
--
-- Name: Fj6L8ZM_posts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Fj6L8ZM_posts_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE "Fj6L8ZM_posts_id_seq" OWNER TO postgres;
--
-- Name: Fj6L8ZM_posts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Fj6L8ZM_posts_id_seq" OWNED BY "Fj6L8ZM_posts".id;
--
-- Name: Fj6L8ZM_products; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_products" (
id integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
products_name text,
products_status boolean DEFAULT true NOT NULL,
products_price integer DEFAULT 0 NOT NULL,
products_img text
);
ALTER TABLE "Fj6L8ZM_products" OWNER TO postgres;
--
-- Name: Fj6L8ZM_products_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Fj6L8ZM_products_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE "Fj6L8ZM_products_id_seq" OWNER TO postgres;
--
-- Name: Fj6L8ZM_products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Fj6L8ZM_products_id_seq" OWNED BY "Fj6L8ZM_products".id;
--
-- Name: Fj6L8ZM_rating_heroes; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_rating_heroes" (
id integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
user_id integer DEFAULT 0 NOT NULL,
rating_heroes json,
your_hero text,
best_kills text,
best_damage text
);
ALTER TABLE "Fj6L8ZM_rating_heroes" OWNER TO postgres;
--
-- Name: Fj6L8ZM_referal_users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_referal_users" (
id integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
ref_user_id integer,
reg_user_id integer
);
ALTER TABLE "Fj6L8ZM_referal_users" OWNER TO postgres;
--
-- Name: Fj6L8ZM_referal_users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Fj6L8ZM_referal_users_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE "Fj6L8ZM_referal_users_id_seq" OWNER TO postgres;
--
-- Name: Fj6L8ZM_referal_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Fj6L8ZM_referal_users_id_seq" OWNED BY "Fj6L8ZM_referal_users".id;
--
-- Name: Fj6L8ZM_tournaments; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_tournaments" (
id integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
turnir_title text,
turnir_description text,
turnir_avatar text,
turnir_autor text,
turnir_prize_money integer DEFAULT 0 NOT NULL,
turnir_status boolean DEFAULT false NOT NULL,
turnir_count_comands integer DEFAULT 0 NOT NULL,
turnir_data text
);
ALTER TABLE "Fj6L8ZM_tournaments" OWNER TO postgres;
--
-- Name: Fj6L8ZM_tournaments_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Fj6L8ZM_tournaments_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE "Fj6L8ZM_tournaments_id_seq" OWNER TO postgres;
--
-- Name: Fj6L8ZM_tournaments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Fj6L8ZM_tournaments_id_seq" OWNED BY "Fj6L8ZM_tournaments".id;
--
-- Name: Fj6L8ZM_user_payments; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_user_payments" (
id integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
pay_code_tranzaction numeric DEFAULT 0 NOT NULL,
pay_coins integer DEFAULT 0 NOT NULL,
pay_money money DEFAULT 0 NOT NULL,
pay_status boolean DEFAULT false NOT NULL,
pay_user_id integer DEFAULT 0 NOT NULL
);
ALTER TABLE "Fj6L8ZM_user_payments" OWNER TO postgres;
--
-- Name: Fj6L8ZM_user_payments_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE "Fj6L8ZM_user_payments_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE "Fj6L8ZM_user_payments_id_seq" OWNER TO postgres;
--
-- Name: Fj6L8ZM_user_payments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE "Fj6L8ZM_user_payments_id_seq" OWNED BY "Fj6L8ZM_user_payments".id;
--
-- Name: Fj6L8ZM_users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "Fj6L8ZM_users" (
id integer NOT NULL,
name character varying(255),
email character varying(255),
password character varying(255),
remember_token character varying(100),
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
user_battle_id integer,
user_battle_tag text,
user_battle_token text,
user_battle_avatar text,
user_battle_rating integer DEFAULT 0 NOT NULL,
user_clan_status boolean DEFAULT false NOT NULL,
user_server text DEFAULT 'eu'::text NOT NULL,
user_activ_clan_id integer DEFAULT 0 NOT NULL,
user_referal_code text,
user_email_code integer,
user_api_token text,
user_money integer DEFAULT 0 NOT NULL,
update_info boolean DEFAULT false NOT NULL
);
ALTER TABLE "Fj6L8ZM_users" OWNER TO postgres;
--
-- Name: applies_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE applies_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE applies_id_seq OWNER TO postgres;
--
-- Name: applies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE applies_id_seq OWNED BY "Fj6L8ZM_applies".id;
--
-- Name: clan_gamers_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE clan_gamers_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE clan_gamers_id_seq OWNER TO postgres;
--
-- Name: clan_gamers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE clan_gamers_id_seq OWNED BY "Fj6L8ZM_clan_gamers".id;
--
-- Name: clans_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE clans_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE clans_id_seq OWNER TO postgres;
--
-- Name: clans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE clans_id_seq OWNED BY "Fj6L8ZM_clans".id;
--
-- Name: heroes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE heroes_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE heroes_id_seq OWNER TO postgres;
--
-- Name: heroes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE heroes_id_seq OWNED BY "Fj6L8ZM_heroes".id;
--
-- Name: migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE migrations_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE migrations_id_seq OWNER TO postgres;
--
-- Name: migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE migrations_id_seq OWNED BY "Fj6L8ZM_migrations".id;
--
-- Name: navigations_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE navigations_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE navigations_id_seq OWNER TO postgres;
--
-- Name: navigations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE navigations_id_seq OWNED BY "Fj6L8ZM_navigations".id;
--
-- Name: rating_heroes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE rating_heroes_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE rating_heroes_id_seq OWNER TO postgres;
--
-- Name: rating_heroes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE rating_heroes_id_seq OWNED BY "Fj6L8ZM_rating_heroes".id;
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE users_id_seq OWNER TO postgres;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE users_id_seq OWNED BY "Fj6L8ZM_users".id;
--
-- Name: Fj6L8ZM_applies id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_applies" ALTER COLUMN id SET DEFAULT nextval('applies_id_seq'::regclass);
--
-- Name: Fj6L8ZM_clan_gamers id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_clan_gamers" ALTER COLUMN id SET DEFAULT nextval('clan_gamers_id_seq'::regclass);
--
-- Name: Fj6L8ZM_clans id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_clans" ALTER COLUMN id SET DEFAULT nextval('clans_id_seq'::regclass);
--
-- Name: Fj6L8ZM_heroes id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_heroes" ALTER COLUMN id SET DEFAULT nextval('heroes_id_seq'::regclass);
--
-- Name: Fj6L8ZM_migrations id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_migrations" ALTER COLUMN id SET DEFAULT nextval('migrations_id_seq'::regclass);
--
-- Name: Fj6L8ZM_navigations id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_navigations" ALTER COLUMN id SET DEFAULT nextval('navigations_id_seq'::regclass);
--
-- Name: Fj6L8ZM_posts id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_posts" ALTER COLUMN id SET DEFAULT nextval('"Fj6L8ZM_posts_id_seq"'::regclass);
--
-- Name: Fj6L8ZM_products id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_products" ALTER COLUMN id SET DEFAULT nextval('"Fj6L8ZM_products_id_seq"'::regclass);
--
-- Name: Fj6L8ZM_rating_heroes id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_rating_heroes" ALTER COLUMN id SET DEFAULT nextval('rating_heroes_id_seq'::regclass);
--
-- Name: Fj6L8ZM_referal_users id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_referal_users" ALTER COLUMN id SET DEFAULT nextval('"Fj6L8ZM_referal_users_id_seq"'::regclass);
--
-- Name: Fj6L8ZM_tournaments id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_tournaments" ALTER COLUMN id SET DEFAULT nextval('"Fj6L8ZM_tournaments_id_seq"'::regclass);
--
-- Name: Fj6L8ZM_user_payments id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_user_payments" ALTER COLUMN id SET DEFAULT nextval('"Fj6L8ZM_user_payments_id_seq"'::regclass);
--
-- Name: Fj6L8ZM_users id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_users" ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
--
-- Data for Name: Fj6L8ZM_applies; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- Data for Name: Fj6L8ZM_clan_gamers; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- Data for Name: Fj6L8ZM_clans; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO "Fj6L8ZM_clans" (id, created_at, updated_at, clan_avatar, clan_name, clan_rating, clan_description, clan_seats, "clan_Employed_seats", clan_badge, clan_recruitment, clan_user_id, clan_slogan, clan_count_apply, clan_widget, clan_rules, clan_vip_status) VALUES (47, '2017-06-26 11:52:02', '2017-07-08 07:41:58', '/img/ClanLogos/7/const-icon-7.png', 'asdas', 0, 'dasdasdasd', 10, 0, NULL, true, 7, 'dasdas', 0, NULL, NULL, false);
INSERT INTO "Fj6L8ZM_clans" (id, created_at, updated_at, clan_avatar, clan_name, clan_rating, clan_description, clan_seats, "clan_Employed_seats", clan_badge, clan_recruitment, clan_user_id, clan_slogan, clan_count_apply, clan_widget, clan_rules, clan_vip_status) VALUES (45, '2017-06-16 13:56:47', '2017-06-16 13:56:47', '/img/ClanLogos/7/17126268_220413351765544_1862101883137556480_n.jpg', 'ываыв', 0, 'аываыва', 10, 0, NULL, true, 7, 'аываыв', 0, NULL, NULL, false);
INSERT INTO "Fj6L8ZM_clans" (id, created_at, updated_at, clan_avatar, clan_name, clan_rating, clan_description, clan_seats, "clan_Employed_seats", clan_badge, clan_recruitment, clan_user_id, clan_slogan, clan_count_apply, clan_widget, clan_rules, clan_vip_status) VALUES (46, '2017-06-16 13:57:30', '2017-06-16 13:57:30', '/img/ClanLogos/40/ab11dcdf27c3cb2fc1f50b59906704e2.jpg', 'LIBERTY TEAM', 0, '*boop*', 10, 0, NULL, true, 40, 'У нас бурлит адреналин наш отряд НЕПОБЕДИМ!', 0, NULL, NULL, false);
INSERT INTO "Fj6L8ZM_clans" (id, created_at, updated_at, clan_avatar, clan_name, clan_rating, clan_description, clan_seats, "clan_Employed_seats", clan_badge, clan_recruitment, clan_user_id, clan_slogan, clan_count_apply, clan_widget, clan_rules, clan_vip_status) VALUES (40, '2017-06-05 17:54:50', '2017-06-08 12:54:06', '', 'reyert', 63, 'gergerg', 10, 0, NULL, true, 7, 'gergertger', 0, NULL, NULL, false);
INSERT INTO "Fj6L8ZM_clans" (id, created_at, updated_at, clan_avatar, clan_name, clan_rating, clan_description, clan_seats, "clan_Employed_seats", clan_badge, clan_recruitment, clan_user_id, clan_slogan, clan_count_apply, clan_widget, clan_rules, clan_vip_status) VALUES (48, '2017-07-11 08:28:36', '2017-07-11 08:29:24', '/img/ClanLogos/18/1024.png', 'tttttt', 2036, 'fgh fghfghf', 10, 1, NULL, true, 18, 'tyrtyrty', 0, NULL, NULL, false);
INSERT INTO "Fj6L8ZM_clans" (id, created_at, updated_at, clan_avatar, clan_name, clan_rating, clan_description, clan_seats, "clan_Employed_seats", clan_badge, clan_recruitment, clan_user_id, clan_slogan, clan_count_apply, clan_widget, clan_rules, clan_vip_status) VALUES (7, '2017-06-05 06:16:04', '2017-07-11 08:29:24', '/img/ClanLogos/7/justiceLogo.png', 'Justice', 17300, 'Набор игроков в клан 2000+, пока роли не важны', 30, 12, 'https://blzgdapipro-a.akamaihd.net/game/rank-icons/season-2/rank-4.png', true, 7, 'Цель наказания - не мщение, а исправление.', 0, '316523418809794560', 'Главное правило - уважайте друг друга. Оскорбление или переход на личности карается незамедлительно и сурово. Под оскорблением понимаются все высказывания, касающиеся совокупления с родителями оппонента, его происхождения, умственного развития, в грубой или не очень форме - разницы нет', true);
--
-- Data for Name: Fj6L8ZM_heroes; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (5, NULL, NULL, 'torbiorn', '/img/heros/Torbjorn-portrait.png', 'Торбьорн', 'support');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (13, NULL, NULL, 'junkrat', '/img/heros/Junkrat_portrait.png', 'Крысавчик', 'dps');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (14, NULL, NULL, 'zarya', '/img/heros/ZaryaPortrait.png', 'Заря', 'tank');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (15, NULL, NULL, 'soldier:76', '/img/heros/soldier76.png', 'Солдат-76', 'dps');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (16, NULL, NULL, 'orisa', '/img/heros/Orisa_portrait.png', 'Ориса', 'tank');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (17, NULL, NULL, 'zenyatta', '/img/heros/Zenyatta_portrait.png', 'Дзенъятта', 'support');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (18, NULL, NULL, 'D.Va', '/img/heros/Dva_portrait.png', 'D.Va', 'tank');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (19, NULL, NULL, 'genji', '/img/heros/Genji_portrait.png', 'Гэндзи', 'dps');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (20, NULL, NULL, 'mcCree', '/img/heros/Mccree_portrait.png', 'Маккри', 'dps');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (21, NULL, NULL, 'mei', '/img/heros/Mei_portrait.png', 'Мей', 'tank');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (22, NULL, NULL, 'sombra', '/img/heros/Sombra_portrait.png', 'Сомбра', 'dps');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (23, NULL, NULL, 'ana', '/img/heros/Ana_portrait.png', 'Ана', 'support');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (24, NULL, NULL, 'widowmaker', '/img/heros/widowmaker.png', 'Роковая вдова', 'dps');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (1, NULL, NULL, 'reaper', '/img/heros/reaper.png', 'Жнец', 'dps');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (2, NULL, NULL, 'bastion', '/img/heros/Bastion_portrait.png', 'Бастион', 'dps');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (3, NULL, NULL, 'mercy', '/img/heros/Mercy_portrait.png', 'Ангел', 'support');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (4, NULL, NULL, 'tracer', '/img/heros/tracer.png', 'Трейсер', 'dps');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (6, NULL, NULL, 'hanzo', '/img/heros/hanzo.png', 'Хандзо', 'dps');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (7, NULL, NULL, 'reinhardt', '/img/heros/reinhard.png', 'Райнхардт', 'tank');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (8, NULL, NULL, 'lucio', '/img/heros/Lucio_portrait.png', 'Люсио', 'support');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (9, NULL, NULL, 'pharah', '/img/heros/Pharah_portrait.png', 'Фарра', 'dps');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (10, NULL, NULL, 'symmetra', '/img/heros/summetra.png', 'Симметра', 'support');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (11, NULL, NULL, 'winston', '/img/heros/Winston.png', 'Уинстон', 'tank');
INSERT INTO "Fj6L8ZM_heroes" (id, created_at, updated_at, hero_name, hero_poster, hero_ru_name, hero_role) VALUES (12, NULL, NULL, 'roadhog', '/img/heros/Roadhog.png', 'Турбосвин', 'tank');
--
-- Data for Name: Fj6L8ZM_migrations; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (1, '2014_10_12_000000_create_users_table', 1);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (2, '2014_10_12_100000_create_password_resets_table', 1);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (3, '2017_05_12_160637_create_navigations_table', 2);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (4, '2017_05_15_071408_create_clans_table', 3);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (5, '2017_05_15_102244_create_clan_gamers_table', 4);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (6, '2017_05_21_094104_create_applies_table', 5);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (7, '2017_05_23_111016_create_rating_heroes_table', 6);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (8, '2017_05_26_065827_create_heroes_table', 7);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (9, '2017_05_29_074304_create_referal_users_table', 8);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (10, '2017_05_29_084507_create_posts_table', 9);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (11, '2017_06_06_131554_create_user_payments_table', 10);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (12, '2017_06_07_120113_create_products_table', 11);
INSERT INTO "Fj6L8ZM_migrations" (id, migration, batch) VALUES (13, '2017_07_08_113550_create_tournaments_table', 12);
--
-- Data for Name: Fj6L8ZM_navigations; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO "Fj6L8ZM_navigations" (id, created_at, updated_at, navigation_img, navigation_status, navigation_setting, navigation_title, navigation_slug, navigation_order) VALUES (1, NULL, NULL, 'img/icons/icon-1.png', true, 1, 'Турниры', 'tournaments', 1);
INSERT INTO "Fj6L8ZM_navigations" (id, created_at, updated_at, navigation_img, navigation_status, navigation_setting, navigation_title, navigation_slug, navigation_order) VALUES (2, NULL, NULL, 'img/icons/icon-1.png', true, 1, 'Новости', 'news', 2);
INSERT INTO "Fj6L8ZM_navigations" (id, created_at, updated_at, navigation_img, navigation_status, navigation_setting, navigation_title, navigation_slug, navigation_order) VALUES (4, NULL, NULL, 'img/icons/icon-1.png', true, 1, 'Рейтинги', 'ratings', 3);
INSERT INTO "Fj6L8ZM_navigations" (id, created_at, updated_at, navigation_img, navigation_status, navigation_setting, navigation_title, navigation_slug, navigation_order) VALUES (5, NULL, NULL, 'img/icons/icon-1.png', true, 2, 'Кланы', 'clans', 1);
INSERT INTO "Fj6L8ZM_navigations" (id, created_at, updated_at, navigation_img, navigation_status, navigation_setting, navigation_title, navigation_slug, navigation_order) VALUES (3, NULL, NULL, 'img/icons/icon-1.png', true, NULL, 'Создать клан', 'addClan', 9);
INSERT INTO "Fj6L8ZM_navigations" (id, created_at, updated_at, navigation_img, navigation_status, navigation_setting, navigation_title, navigation_slug, navigation_order) VALUES (6, NULL, NULL, 'img/icons/icon-1.png', true, 2, 'Акции', 'shares', 2);
INSERT INTO "Fj6L8ZM_navigations" (id, created_at, updated_at, navigation_img, navigation_status, navigation_setting, navigation_title, navigation_slug, navigation_order) VALUES (8, NULL, NULL, 'img/icons/icon-1.png', true, 2, 'Видео каналы', 'videoMatches', 3);
INSERT INTO "Fj6L8ZM_navigations" (id, created_at, updated_at, navigation_img, navigation_status, navigation_setting, navigation_title, navigation_slug, navigation_order) VALUES (7, NULL, NULL, 'img/icons/icon-1.png', false, 2, 'Настройки', 'settings', 5);
INSERT INTO "Fj6L8ZM_navigations" (id, created_at, updated_at, navigation_img, navigation_status, navigation_setting, navigation_title, navigation_slug, navigation_order) VALUES (9, NULL, NULL, 'img/icons/icon-1.png', true, 3, 'Баланс', 'balans', 4);
INSERT INTO "Fj6L8ZM_navigations" (id, created_at, updated_at, navigation_img, navigation_status, navigation_setting, navigation_title, navigation_slug, navigation_order) VALUES (10, NULL, NULL, 'img/icons/icon-1.png', true, 2, 'Настройки', 'settings', 4);
--
-- Data for Name: Fj6L8ZM_password_resets; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- Data for Name: Fj6L8ZM_posts; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO "Fj6L8ZM_posts" (id, created_at, updated_at, post_title, post_content, post_setting, post_comment, post_image, post_description) VALUES (1, NULL, NULL, 'СКИДКА 800 ₽ НА OVERWATCH: GAME OF THE YEAR EDITION', '<div class="blog-content"><div class="blog-header-image"><img src="//bnetcmsus-a.akamaihd.net/cms/blog_header/qp/QPKDGDJBLD0I1495507584711.jpg" alt="Скидка 800 ₽ на Overwatch: Game of the Year Edition"></div><div data="blog-body" class="blog-detail"><p>Чтобы стать героем будущего, лучший момент — сейчас. Присоединяйтесь 30 миллионам игроков во всем мире! Тем более что в эти дни действует внушительная скидка на издания <strong>Overwatch®</strong> и <strong>Overwatch®: Game of the Year Edition</strong>.</p>
<p style="text-align: center;"><a class="btn btn-default btn-lg" href="http://blizz.ly/BuyOverwatch" target="_blank" type="button">ПРИОБРЕСТИ</a></p>
<p>Вступайте в ряды агентов и готовьтесь спасать мир! Сегодня вышло новое электронное издание игры: <strong>Overwatch: Game of the Year Edition</strong>. Оно поступило в продажу по специальной цене: 2499 ₽ (для PC). В это издание входят все герои Overwatch, все карты и функции игры, а также целый арсенал внутриигровых подарков в стиле Overwatch для других игр Blizzard. </p>
<div class="centered" style="margin-bottom: 25px; text-align: center;"><iframe allowfullscreen="" frameborder="0" height="394" src="https://www.youtube.com/embed/B7BUbhG2Azo?theme=light&color=white&cc_load_policy=1&HD=1&rel=0&showinfo=0" style="border-bottom:1px solid lightgray;" width="700"></iframe></div>
<p style="text-align: justify; margin-left: 60px; margin-right: 60px"><strong><a href="https://playoverwatch.com/ru-ru/" target="_blank">[Overwatch] </a>Контейнеры с наградами. </strong>10 стандартных контейнеров со случайным набором предметов, чтобы придать героям индивидуальности. В контейнерах вам могут попасться облики, эмоции, победные позы, реплики, граффити и лучшие моменты матчей, а также внутриигровая валюта, которую можно потратить на пополнение коллекции.</p>
<p style="text-align: justify; margin-left: 60px; margin-right: 60px"><strong><a href="https://playoverwatch.com/ru-ru/" target="_blank">[Overwatch] </a>Облики из издания Origins.</strong> Прямиком из славного прошлого организации Overwatch — облики «Рейес из Blackwatch» (Жнец), «Командир Моррисон» (Солдат-76), а также «Заросший Бастион», «Начальник охраны Фарра» и «Пилот Трейсер».</p>
<p style="text-align: justify; margin-left: 60px; margin-right: 60px"><strong><a href="https://eu.battle.net/d3/ru/" target="_blank">[Diablo III] </a>Крылья Ангела. </strong>Ведите праведную войну с демонами на Небесах и в Преисподней, украсив героя крыльями Ангела. Пусть каждая (еще) живая душа в Санктуарии узнает, что вы состоите и в Overwatch.</p>
<p style="text-align: justify; margin-left: 60px; margin-right: 60px"><strong><a href="http://eu.battle.net/sc2/ru/">[StarCraft II]</a> Портреты игрока. </strong>Новые эффектные портреты Трейсер, Жнеца, Фарры, Уинстона, Бастиона и Солдата-76, чтобы покорить весь сектор Копрулу.</p>
<p style="text-align: justify; margin-left: 60px; margin-right: 60px"><strong><a href="http://eu.battle.net/hearthstone/ru/">[Hearthstone] </a>Рубашка для карт Overwatch. </strong>Покажите своему противнику в потасовке, что на вашей стороне агенты Overwatch.</p>
<p style="text-align: justify; margin-left: 60px; margin-right: 60px"><strong><a href="https://worldofwarcraft.com/ru-ru/">[World of Warcraft]</a> Малыш Уинстон (питомец). </strong>Невероятно симпатичный и не по годам интеллектуальный малыш Уинстон составит вам компанию в бою с Пылающим Легионом.</p>
<p style="text-align: justify; margin-left: 60px; margin-right: 60px"><strong><a href="http://eu.battle.net/heroes/ru/">[Heroes of the Storm] </a>Герой Трейсер.</strong> Кавалерия уже здесь! Вместе с Трейсер вы ошеломите противников в Нексусе неожиданными трюками.</p>
<p>И это не все! В честь первой годовщины Overwatch мы как следует прошлись по ценам ракетным молотом. Так что в ближайшие несколько дней на игру действуют скидки от 25 до 50%. Вот цены для PC, а цены на консольные версии вы можете посмотреть в PlayStation®Store и Xbox Store.</p>
<ul style="margin-left: 40px;">
<li><strong>Overwatch</strong> — <s>1999 ₽</s> 999 ₽</li>
<li><strong>Overwatch: Game of the Year Edition </strong>— <s>3299 ₽</s> 2499 ₽</li>
</ul>
<p>Если вы еще не вступили в битву за будущее — или у вас на есть примете друг, который не откажется сопровождать груз, — готовьтесь к бою! Реализовать эту уникальную тактическую возможность можно будет только до утра 6 июня (до 10:59 МСК). </p>
<p style="text-align: center;"><a class="btn btn-default btn-lg" href="http://blizz.ly/BuyOverwatch" target="_blank" type="button">ПРИОБРЕСТИ</a></p>
<p><span style="font-size:10px;"><em>*Время проведения акции и стоимость игры в разных магазинах могут различаться.</em></span></p>
<div class="keyword-list"></div></div></div>', 'news', false, 'https://bnetcmsus-a.akamaihd.net/cms/blog_header/qp/QPKDGDJBLD0I1495507584711.jpg', 'Чтобы стать героем будущего, лучший момент — сейчас.');
--
-- Name: Fj6L8ZM_posts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Fj6L8ZM_posts_id_seq"', 1, true);
--
-- Data for Name: Fj6L8ZM_products; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO "Fj6L8ZM_products" (id, created_at, updated_at, products_name, products_status, products_price, products_img) VALUES (2, NULL, NULL, 'coints', true, 500, '/img/my-img/500.jpg');
INSERT INTO "Fj6L8ZM_products" (id, created_at, updated_at, products_name, products_status, products_price, products_img) VALUES (1, NULL, NULL, 'coints', true, 1000, '/img/my-img/1000.jpg');
INSERT INTO "Fj6L8ZM_products" (id, created_at, updated_at, products_name, products_status, products_price, products_img) VALUES (3, NULL, NULL, 'coints', true, 2000, '/img/my-img/2000.jpg');
INSERT INTO "Fj6L8ZM_products" (id, created_at, updated_at, products_name, products_status, products_price, products_img) VALUES (4, NULL, NULL, 'coints', true, 3000, '/img/my-img/3000.jpg');
--
-- Name: Fj6L8ZM_products_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Fj6L8ZM_products_id_seq"', 4, true);
--
-- Data for Name: Fj6L8ZM_rating_heroes; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (17, NULL, '2017-06-09 10:17:24', 20, '{"reaper":[{"wins":"00:19","win_rate":"00:20"}],"bastion":[],"tracer":[],"mercy":[],"hanzo":[],"torbiorn":[],"reinhardt":[{"wins":"0","win_rate":"1"}],"pharah":[],"lucio":[{"wins":"1","win_rate":"25%"}],"symmetra":[{"wins":"00:33","win_rate":"00:20"}],"winston":[{"wins":"01:51","win_rate":"100%"}],"roadhog":[],"junkrat":[{"wins":"3","win_rate":"87%"}],"zarya":[{"wins":"00:36","win_rate":"00:36"}],"soldier:76":[{"wins":"1","win_rate":"76%"}],"orisa":[{"wins":"1","win_rate":"100%"}],"zenyatta":[{"wins":"00:04","win_rate":"00:04"}],"genji":[{"wins":"1","win_rate":"38%"}],"mcCree":[],"D.Va":[{"wins":"1","win_rate":"25%"}],"mei":[],"sombra":[{"win_rate":"0"}],"ana":[{"win_rate":"0"}],"widowmaker":[]}', 'dva', '27,05', '15 021');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (18, NULL, '2017-06-09 10:45:40', 21, '{"reaper":[{"wins":"0","win_rate":"2"}],"bastion":[],"tracer":[{"wins":"0","win_rate":"0"}],"mercy":[{"wins":"1","win_rate":"100%"}],"hanzo":[],"torbiorn":[{"wins":"0"}],"reinhardt":[{"wins":"03:49","win_rate":"03:49"}],"pharah":[{"wins":"00:09","win_rate":"00:09"}],"lucio":[{"wins":"0","win_rate":"23%"}],"symmetra":[],"winston":[{"wins":"0","win_rate":"0"}],"roadhog":[],"junkrat":[{"wins":"00:17","win_rate":"00:20"}],"zarya":[{"wins":"00:01","win_rate":"00:01"}],"soldier:76":[{"wins":"0","win_rate":"10%"}],"orisa":[],"zenyatta":[],"genji":[],"mcCree":[{"wins":"0","win_rate":"100%"}],"D.Va":[{"wins":"01:37","win_rate":"01:37"}],"mei":[],"sombra":[],"ana":[],"widowmaker":[]}', 'soldier-76', '16,81', '11 562');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (22, '2017-06-09 19:43:07', '2017-06-09 19:44:31', 24, '{"reaper":[],"bastion":[],"tracer":[],"mercy":[{"wins":"00:43","win_rate":"0"}],"hanzo":[],"torbiorn":[],"reinhardt":[{"wins":"2","win_rate":"51%"}],"pharah":[],"lucio":[{"wins":"00:28","win_rate":"76%"}],"symmetra":[],"winston":[],"roadhog":[{"wins":"10:36","win_rate":"12%"}],"junkrat":[],"zarya":[],"soldier:76":[{"wins":"00:23","win_rate":"1"}],"orisa":[{"wins":"6","win_rate":"51%"}],"zenyatta":[],"genji":[],"mcCree":[],"D.Va":[{"wins":"0","win_rate":"0"}],"mei":[],"sombra":[],"ana":[],"widowmaker":[]}', 'orisa', '19,5', '10 740');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (19, NULL, '2017-06-09 11:46:21', 22, '{"reaper":[],"bastion":[],"tracer":[],"mercy":[{"wins":"5","win_rate":"82%"}],"hanzo":[],"torbiorn":[],"reinhardt":[],"pharah":[],"lucio":[],"symmetra":[],"winston":[],"roadhog":[],"junkrat":[],"zarya":[],"soldier:76":[{"wins":"2","win_rate":"43%"}],"orisa":[],"zenyatta":[{"wins":"1","win_rate":"62%"}],"genji":[],"mcCree":[],"D.Va":[],"mei":[],"sombra":[],"ana":[{"wins":"0","win_rate":"17%"}],"widowmaker":[]}', 'mercy', '10,99', '6 047');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (21, '2017-06-09 19:37:56', '2017-06-10 13:10:05', 23, '{"reaper":[],"bastion":[{"wins":"00:04","win_rate":"00:04"}],"tracer":[],"mercy":[{"wins":"0","win_rate":"15%"}],"hanzo":[{"wins":"2","win_rate":"53%"}],"torbiorn":[],"reinhardt":[{"wins":"0","win_rate":"15%"}],"pharah":[{"wins":"0","win_rate":"0%"}],"lucio":[{"wins":"3","win_rate":"78%"}],"symmetra":[],"winston":[{"wins":"00:03","win_rate":"00:03"}],"roadhog":[{"wins":"0","win_rate":"17%"}],"junkrat":[{"wins":"00:03","win_rate":"00:03"}],"zarya":[],"soldier:76":[{"wins":"1","win_rate":"60%"}],"orisa":[],"zenyatta":[{"wins":"0","win_rate":"11%"}],"genji":[],"mcCree":[],"D.Va":[{"wins":"6","win_rate":"53%"}],"mei":[],"sombra":[],"ana":[{"wins":"0","win_rate":"100%"}],"widowmaker":[{"wins":"270","win_rate":"270"}]}', 'dva', '20,44', '10 866');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (28, '2017-06-13 10:16:01', '2017-06-13 10:16:01', 30, '{"reaper":[],"bastion":[{"wins":"6","win_rate":"81%"}],"tracer":[],"mercy":[{"wins":"1","win_rate":"54%"}],"hanzo":[],"torbiorn":[{"win_rate":"46%"}],"reinhardt":[],"pharah":[{"wins":"1","win_rate":"44%"}],"lucio":[{"wins":"4","win_rate":"64%"}],"symmetra":[],"winston":[],"roadhog":[],"junkrat":[],"zarya":[{"wins":"14","win_rate":"47%"}],"soldier:76":[{"wins":"23","win_rate":"60%"}],"orisa":[],"zenyatta":[{"wins":"01:32","win_rate":"01:32"}],"genji":[{"wins":"0","win_rate":"0"}],"mcCree":[{"wins":"00:05","win_rate":"00:05"}],"D.Va":[{"wins":"7","win_rate":"39%"}],"mei":[],"sombra":[],"ana":[{"wins":"4","win_rate":"56%"}],"widowmaker":[]}', NULL, NULL, NULL);
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (23, '2017-06-09 19:45:42', '2017-06-09 19:54:27', 25, '{"reaper":[{"wins":"1","win_rate":"84%"}],"bastion":[{"wins":"00:15","win_rate":"00:40"}],"tracer":[],"mercy":[],"hanzo":[],"torbiorn":[],"reinhardt":[{"wins":"1","win_rate":"41%"}],"pharah":[{"wins":"1","win_rate":"73%"}],"lucio":[],"symmetra":[{"wins":"00:36","win_rate":"00:36"}],"winston":[{"wins":"0","win_rate":"47%"}],"roadhog":[{"wins":"00:31","win_rate":"00:31"}],"junkrat":[{"wins":"4","win_rate":"50%"}],"zarya":[{"wins":"00:58","win_rate":"00:58"}],"soldier:76":[{"wins":"1","win_rate":"65%"}],"orisa":[],"zenyatta":[],"genji":[{"wins":"12","win_rate":"67%"}],"mcCree":[{"wins":"0","win_rate":"51%"}],"D.Va":[{"wins":"1","win_rate":"100%"}],"mei":[{"win_rate":"0"}],"sombra":[],"ana":[{"wins":"0","win_rate":"100%"}],"widowmaker":[{"win_rate":"0"}]}', 'genji', '30,83', '15 198');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (27, '2017-06-13 08:08:18', '2017-06-15 15:02:52', 29, '{"reaper":[{"wins":"0","win_rate":"22%"}],"bastion":[{"wins":"1","win_rate":"46%"}],"tracer":[{"wins":"3","win_rate":"36%"}],"mercy":[{"wins":"6","win_rate":"52%"}],"hanzo":[{"wins":"0","win_rate":"16%"}],"torbiorn":[{"wins":"3","win_rate":"00:00"}],"reinhardt":[{"wins":"13","win_rate":"37%"}],"pharah":[{"wins":"2","win_rate":"66%"}],"lucio":[{"wins":"17","win_rate":"53%"}],"symmetra":[{"wins":"01:27","win_rate":"00:31"}],"winston":[{"wins":"3","win_rate":"63%"}],"roadhog":[{"wins":"11","win_rate":"53%"}],"junkrat":[{"wins":"0","win_rate":"57%"}],"zarya":[{"wins":"1","win_rate":"43%"}],"soldier:76":[{"wins":"2","win_rate":"65%"}],"orisa":[{"wins":"1","win_rate":"38%"}],"zenyatta":[{"wins":"0","win_rate":"11%"}],"genji":[{"wins":"10","win_rate":"27%"}],"mcCree":[{"win_rate":"0"}],"D.Va":[{"wins":"1","win_rate":"39%"}],"mei":[{"wins":"00:03","win_rate":"00:03"}],"sombra":[{"wins":"00:15","win_rate":"00:15"}],"ana":[{"wins":"1","win_rate":"61%"}],"widowmaker":[{"wins":"2","win_rate":"59%"}]}', 'genji', '19,01', '9 246');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (26, '2017-06-11 03:45:32', '2017-06-11 03:45:32', 28, '{"reaper":[],"bastion":[{"wins":"6","win_rate":"81%"}],"tracer":[],"mercy":[{"wins":"1","win_rate":"54%"}],"hanzo":[],"torbiorn":[{"win_rate":"46%"}],"reinhardt":[],"pharah":[{"wins":"1","win_rate":"44%"}],"lucio":[{"wins":"4","win_rate":"64%"}],"symmetra":[],"winston":[],"roadhog":[],"junkrat":[],"zarya":[{"wins":"14","win_rate":"47%"}],"soldier:76":[{"wins":"23","win_rate":"60%"}],"orisa":[],"zenyatta":[{"wins":"01:32","win_rate":"01:32"}],"genji":[{"wins":"0","win_rate":"0"}],"mcCree":[{"wins":"00:05","win_rate":"00:05"}],"D.Va":[{"wins":"7","win_rate":"39%"}],"mei":[],"sombra":[],"ana":[{"wins":"4","win_rate":"56%"}],"widowmaker":[]}', NULL, NULL, NULL);
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (24, '2017-06-10 16:46:06', '2017-06-13 16:19:18', 26, '{"reaper":[{"wins":"0","win_rate":"23%"}],"bastion":[{"wins":"2","win_rate":"72%"}],"tracer":[{"wins":"3","win_rate":"35%"}],"mercy":[{"wins":"2","win_rate":"56%"}],"hanzo":[],"torbiorn":[{"wins":"3"}],"reinhardt":[{"wins":"4","win_rate":"74%"}],"pharah":[{"wins":"1","win_rate":"39%"}],"lucio":[{"wins":"1","win_rate":"69%"}],"symmetra":[],"winston":[{"wins":"3","win_rate":"70%"}],"roadhog":[{"wins":"00:10","win_rate":"00:10"}],"junkrat":[{"wins":"0","win_rate":"100%"}],"zarya":[{"wins":"0","win_rate":"14%"}],"soldier:76":[{"wins":"4","win_rate":"38%"}],"orisa":[{"wins":"1","win_rate":"100%"}],"zenyatta":[{"wins":"00:44","win_rate":"00:44"}],"genji":[{"wins":"00:33","win_rate":"00:33"}],"mcCree":[{"wins":"0","win_rate":"28%"}],"D.Va":[{"wins":"8","win_rate":"58%"}],"mei":[{"wins":"0","win_rate":"0"}],"sombra":[{"wins":"0","win_rate":"0"}],"ana":[{"wins":"00:17","win_rate":"00:17"}],"widowmaker":[{"win_rate":"0"}]}', 'dva', '21,64', '10 122');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (32, '2017-06-13 19:55:23', '2017-07-03 03:05:49', 34, '{"reaper":[],"bastion":[{"wins":"6","win_rate":"77%"}],"tracer":[{"wins":"0","win_rate":"8%"}],"mercy":[{"wins":"3","win_rate":"54%"}],"hanzo":[],"torbiorn":[{"wins":"0","win_rate":"40%"}],"reinhardt":[{"wins":"00:05","win_rate":"00:05"}],"pharah":[{"wins":"1","win_rate":"36%"}],"lucio":[{"wins":"7","win_rate":"54%"}],"symmetra":[],"winston":[{"wins":"00:14","win_rate":"00:14"}],"roadhog":[],"junkrat":[],"zarya":[{"wins":"17","win_rate":"44%"}],"soldier:76":[{"wins":"25","win_rate":"54%"}],"orisa":[],"zenyatta":[{"wins":"2","win_rate":"76%"}],"genji":[{"wins":"0","win_rate":"100%"}],"mcCree":[{"wins":"00:05","win_rate":"00:05"}],"D.Va":[{"wins":"17","win_rate":"47%"}],"mei":[],"sombra":[],"ana":[{"wins":"4","win_rate":"52%"}],"widowmaker":[]}', 'soldier-76', '22,35', '15');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (33, '2017-06-13 20:09:52', '2017-06-13 20:09:52', 35, '{"reaper":[],"bastion":[{"wins":"6","win_rate":"81%"}],"tracer":[],"mercy":[{"wins":"1","win_rate":"54%"}],"hanzo":[],"torbiorn":[{"win_rate":"46%"}],"reinhardt":[],"pharah":[{"wins":"1","win_rate":"44%"}],"lucio":[{"wins":"4","win_rate":"64%"}],"symmetra":[],"winston":[],"roadhog":[],"junkrat":[],"zarya":[{"wins":"14","win_rate":"47%"}],"soldier:76":[{"wins":"23","win_rate":"60%"}],"orisa":[],"zenyatta":[{"wins":"01:32","win_rate":"01:32"}],"genji":[{"wins":"0","win_rate":"0"}],"mcCree":[{"wins":"00:05","win_rate":"00:05"}],"D.Va":[{"wins":"7","win_rate":"39%"}],"mei":[],"sombra":[],"ana":[{"wins":"4","win_rate":"56%"}],"widowmaker":[]}', NULL, NULL, NULL);
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (31, '2017-06-13 17:17:33', '2017-06-13 17:17:33', 33, '{"reaper":[],"bastion":[{"wins":"6","win_rate":"81%"}],"tracer":[],"mercy":[{"wins":"1","win_rate":"54%"}],"hanzo":[],"torbiorn":[{"win_rate":"46%"}],"reinhardt":[],"pharah":[{"wins":"1","win_rate":"44%"}],"lucio":[{"wins":"4","win_rate":"64%"}],"symmetra":[],"winston":[],"roadhog":[],"junkrat":[],"zarya":[{"wins":"14","win_rate":"47%"}],"soldier:76":[{"wins":"23","win_rate":"60%"}],"orisa":[],"zenyatta":[{"wins":"01:32","win_rate":"01:32"}],"genji":[{"wins":"0","win_rate":"0"}],"mcCree":[{"wins":"00:05","win_rate":"00:05"}],"D.Va":[{"wins":"7","win_rate":"39%"}],"mei":[],"sombra":[],"ana":[{"wins":"4","win_rate":"56%"}],"widowmaker":[]}', NULL, NULL, NULL);
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (30, '2017-06-13 16:10:37', '2017-06-14 08:11:27', 32, '{"reaper":[{"wins":"6","win_rate":"48%"}],"bastion":[{"wins":"4","win_rate":"70%"}],"tracer":[{"wins":"1","win_rate":"23%"}],"mercy":[{"wins":"6","win_rate":"42%"}],"hanzo":[{"wins":"2","win_rate":"42%"}],"torbiorn":[{"wins":"1","win_rate":"63%"}],"reinhardt":[{"wins":"11","win_rate":"51%"}],"pharah":[{"wins":"11","win_rate":"47%"}],"lucio":[{"wins":"7","win_rate":"56%"}],"symmetra":[{"wins":"9","win_rate":"59%"}],"winston":[{"wins":"2","win_rate":"37%"}],"roadhog":[{"wins":"1","win_rate":"43%"}],"junkrat":[{"wins":"7","win_rate":"53%"}],"zarya":[{"wins":"1","win_rate":"46%"}],"soldier:76":[{"wins":"8","win_rate":"56%"}],"orisa":[],"zenyatta":[],"genji":[{"wins":"4","win_rate":"44%"}],"mcCree":[{"wins":"1","win_rate":"49%"}],"D.Va":[{"wins":"3","win_rate":"62%"}],"mei":[{"wins":"1","win_rate":"25%"}],"sombra":[{"wins":"00:40","win_rate":"00:40"}],"ana":[{"wins":"0","win_rate":"2%"}],"widowmaker":[{"wins":"0","win_rate":"57%"}]}', 'pharah', '23,13', '12 134');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (36, '2017-06-15 15:23:47', '2017-06-15 15:27:19', 38, '{"reaper":[],"bastion":[{"wins":"1","win_rate":"32%"}],"tracer":[{"wins":"0","win_rate":"2%"}],"mercy":[{"wins":"0","win_rate":"100%"}],"hanzo":[],"torbiorn":[{"wins":"0","win_rate":"00:00"}],"reinhardt":[{"wins":"2","win_rate":"52%"}],"pharah":[{"wins":"0","win_rate":"41%"}],"lucio":[],"symmetra":[{"wins":"00:08","win_rate":"00:20"}],"winston":[],"roadhog":[{"wins":"7","win_rate":"68%"}],"junkrat":[{"wins":"4","win_rate":"65%"}],"zarya":[{"wins":"0","win_rate":"43%"}],"soldier:76":[{"wins":"2","win_rate":"37%"}],"orisa":[{"wins":"00:39","win_rate":"00:42"}],"zenyatta":[],"genji":[],"mcCree":[{"wins":"2","win_rate":"58%"}],"D.Va":[{"wins":"1","win_rate":"45%"}],"mei":[],"sombra":[],"ana":[{"wins":"0","win_rate":"100%"}],"widowmaker":[]}', 'roadhog', '23,77', '13 731');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (37, '2017-06-16 08:42:27', '2017-06-16 08:42:27', 39, NULL, NULL, NULL, NULL);
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (35, '2017-06-13 20:21:31', '2017-06-13 20:22:44', 37, '{"reaper":[],"bastion":[],"tracer":[{"wins":"1","win_rate":"73%"}],"mercy":[{"wins":"7","win_rate":"64%"}],"hanzo":[],"torbiorn":[{"wins":"1"}],"reinhardt":[{"wins":"5","win_rate":"53%"}],"pharah":[],"lucio":[{"wins":"00:13","win_rate":"00:13"}],"symmetra":[{"wins":"0","win_rate":"100%"}],"winston":[],"roadhog":[{"wins":"1","win_rate":"14%"}],"junkrat":[],"zarya":[{"wins":"1","win_rate":"71%"}],"soldier:76":[{"wins":"0","win_rate":"24%"}],"orisa":[],"zenyatta":[{"wins":"00:29","win_rate":"00:29"}],"genji":[],"mcCree":[{"win_rate":"0"}],"D.Va":[{"wins":"00:42","win_rate":"00:42"}],"mei":[],"sombra":[],"ana":[{"wins":"6","win_rate":"54%"}],"widowmaker":[]}', 'mercy', '16,51', '7 600');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (25, '2017-06-10 20:48:58', '2017-06-10 20:48:58', 27, '{"reaper":[],"bastion":[{"wins":"6","win_rate":"81%"}],"tracer":[],"mercy":[{"wins":"1","win_rate":"54%"}],"hanzo":[],"torbiorn":[{"win_rate":"46%"}],"reinhardt":[],"pharah":[{"wins":"1","win_rate":"44%"}],"lucio":[{"wins":"4","win_rate":"64%"}],"symmetra":[],"winston":[],"roadhog":[],"junkrat":[],"zarya":[{"wins":"14","win_rate":"47%"}],"soldier:76":[{"wins":"23","win_rate":"60%"}],"orisa":[],"zenyatta":[{"wins":"01:32","win_rate":"01:32"}],"genji":[{"wins":"0","win_rate":"0"}],"mcCree":[{"wins":"00:05","win_rate":"00:05"}],"D.Va":[{"wins":"7","win_rate":"39%"}],"mei":[],"sombra":[],"ana":[{"wins":"4","win_rate":"56%"}],"widowmaker":[]}', NULL, NULL, NULL);
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (14, '2017-05-29 10:31:14', '2017-07-11 07:16:39', 7, '{"reaper":[{"wins":"33","win_rate":"47%"}],"bastion":[{"wins":"3","win_rate":"37%"}],"tracer":[{"wins":"1","win_rate":"32%"}],"mercy":[{"wins":"3","win_rate":"42%"}],"hanzo":[],"torbiorn":[{"wins":"1","win_rate":"71%"}],"reinhardt":[{"wins":"2","win_rate":"38%"}],"pharah":[{"wins":"19","win_rate":"55%"}],"lucio":[],"symmetra":[{"wins":"22","win_rate":"60%"}],"winston":[{"wins":"6","win_rate":"70%"}],"roadhog":[{"wins":"1","win_rate":"20%"}],"junkrat":[{"wins":"0","win_rate":"29%"}],"zarya":[{"wins":"0","win_rate":"32%"}],"soldier:76":[{"wins":"3","win_rate":"40%"}],"orisa":[{"wins":"1","win_rate":"85%"}],"zenyatta":[{"wins":"0","win_rate":"36%"}],"genji":[{"wins":"00:09","win_rate":"00:09"}],"mcCree":[],"D.Va":[{"wins":"01:00","win_rate":"01:00"}],"mei":[],"sombra":[{"wins":"0","win_rate":"25%"}],"ana":[],"widowmaker":[]}', 'reaper', '25,63', '17');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (15, '2017-05-29 10:31:31', '2017-07-11 08:33:16', 18, '{"reaper":[{"wins":"1","win_rate":"20%"}],"bastion":[{"wins":"1","win_rate":"25%"}],"tracer":[{"wins":"0","win_rate":"100%"}],"mercy":[{"wins":"5","win_rate":"49%"}],"hanzo":[{"wins":"0","win_rate":"14%"}],"torbiorn":[{"wins":"0","win_rate":"0"}],"reinhardt":[{"wins":"00:36","win_rate":"00:36"}],"pharah":[{"wins":"03:32","win_rate":"02:10"}],"lucio":[{"wins":"11","win_rate":"47%"}],"symmetra":[{"wins":"0","win_rate":"11%"}],"winston":[{"wins":"0","win_rate":"17%"}],"roadhog":[{"wins":"80","win_rate":"55%"}],"junkrat":[],"zarya":[{"wins":"00:45","win_rate":"00:45"}],"soldier:76":[{"wins":"2","win_rate":"35%"}],"orisa":[{"wins":"1","win_rate":"65%"}],"zenyatta":[{"wins":"00:42","win_rate":"01:22"}],"genji":[{"wins":"1","win_rate":"28%"}],"mcCree":[],"D.Va":[{"wins":"5","win_rate":"69%"}],"mei":[],"sombra":[],"ana":[{"wins":"00:10","win_rate":"00:10"}],"widowmaker":[]}', 'roadhog', '21,66', '16');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (38, '2017-06-16 13:43:29', '2017-06-16 13:57:38', 40, '{"reaper":[],"bastion":[{"win_rate":"0"}],"tracer":[],"mercy":[{"wins":"01:09","win_rate":"1"}],"hanzo":[],"torbiorn":[{"win_rate":"0"}],"reinhardt":[{"wins":"0","win_rate":"35%"}],"pharah":[{"wins":"56","win_rate":"59%"}],"lucio":[{"wins":"1","win_rate":"94%"}],"symmetra":[],"winston":[{"wins":"0","win_rate":"55%"}],"roadhog":[],"junkrat":[{"wins":"00:00","win_rate":"00:00"}],"zarya":[{"wins":"0","win_rate":"42%"}],"soldier:76":[{"wins":"4","win_rate":"47%"}],"orisa":[{"wins":"0","win_rate":"0"}],"zenyatta":[],"genji":[],"mcCree":[{"wins":"00:34","win_rate":"00:34"}],"D.Va":[{"wins":"0","win_rate":"47%"}],"mei":[],"sombra":[],"ana":[{"wins":"4","win_rate":"0"}],"widowmaker":[{"wins":"2","win_rate":"35%"}]}', 'pharah', '30,24', '16 205');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (39, '2017-06-16 20:24:49', '2017-06-16 20:30:15', 41, '{"reaper":[{"wins":"00:14","win_rate":"01:04"}],"bastion":[{"wins":"3","win_rate":"61%"}],"tracer":[{"wins":"3","win_rate":"38%"}],"mercy":[{"wins":"5","win_rate":"42%"}],"hanzo":[],"torbiorn":[{"wins":"3"}],"reinhardt":[{"wins":"1","win_rate":"63%"}],"pharah":[{"wins":"5","win_rate":"38%"}],"lucio":[{"wins":"1","win_rate":"49%"}],"symmetra":[{"wins":"4","win_rate":"73%"}],"winston":[{"wins":"2","win_rate":"37%"}],"roadhog":[{"wins":"3","win_rate":"77%"}],"junkrat":[{"wins":"00:13","win_rate":"00:13"}],"zarya":[{"wins":"03:48","win_rate":"01:21"}],"soldier:76":[{"wins":"27","win_rate":"59%"}],"orisa":[{"wins":"0","win_rate":"100%"}],"zenyatta":[{"wins":"11","win_rate":"58%"}],"genji":[{"wins":"6","win_rate":"42%"}],"mcCree":[{"wins":"00:02","win_rate":"00:02"}],"D.Va":[{"wins":"8","win_rate":"57%"}],"mei":[{"wins":"0","win_rate":"45%"}],"sombra":[{"wins":"0","win_rate":"61%"}],"ana":[{"wins":"4","win_rate":"32%"}],"widowmaker":[{"wins":"1","win_rate":"38%"}]}', 'soldier-76', '24,78', '11 659');
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (40, '2017-06-16 20:30:59', '2017-06-16 20:30:59', 42, NULL, NULL, NULL, NULL);
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (41, '2017-06-19 19:04:22', '2017-06-19 19:04:22', 43, NULL, NULL, NULL, NULL);
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (42, '2017-06-23 12:57:51', '2017-06-23 12:57:51', 44, NULL, NULL, NULL, NULL);
INSERT INTO "Fj6L8ZM_rating_heroes" (id, created_at, updated_at, user_id, rating_heroes, your_hero, best_kills, best_damage) VALUES (29, '2017-06-13 12:01:34', '2017-06-30 15:21:31', 31, '{"reaper":[{"wins":"0","win_rate":"0%"}],"bastion":[{"wins":"0","win_rate":"31%"}],"tracer":[{"wins":"00:00","win_rate":"00:00"}],"mercy":[{"wins":"9","win_rate":"34%"}],"hanzo":[{"win_rate":"0"}],"torbiorn":[{"wins":"00:00","win_rate":"8%"}],"reinhardt":[{"wins":"1","win_rate":"20%"}],"pharah":[{"wins":"0","win_rate":"26%"}],"lucio":[{"wins":"20","win_rate":"62%"}],"symmetra":[{"wins":"16","win_rate":"49%"}],"winston":[{"wins":"1","win_rate":"30%"}],"roadhog":[{"wins":"13","win_rate":"50%"}],"junkrat":[{"wins":"2","win_rate":"38%"}],"zarya":[{"win_rate":"0"}],"soldier:76":[{"wins":"0","win_rate":"14%"}],"orisa":[{"wins":"5","win_rate":"68%"}],"zenyatta":[{"wins":"2","win_rate":"34%"}],"genji":[{"wins":"0","win_rate":"74%"}],"mcCree":[{"wins":"00:24","win_rate":"00:24"}],"D.Va":[{"wins":"4","win_rate":"60%"}],"mei":[{"wins":"4","win_rate":"59%"}],"sombra":[{"wins":"0","win_rate":"23%"}],"ana":[{"wins":"0","win_rate":"56%"}],"widowmaker":[{"wins":"0","win_rate":"22%"}]}', 'lucio', '15,12', '7 380');
--
-- Data for Name: Fj6L8ZM_referal_users; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO "Fj6L8ZM_referal_users" (id, created_at, updated_at, ref_user_id, reg_user_id) VALUES (2, '2017-05-29 07:56:13', '2017-05-29 07:56:13', 11, 7);
INSERT INTO "Fj6L8ZM_referal_users" (id, created_at, updated_at, ref_user_id, reg_user_id) VALUES (3, '2017-05-29 07:57:19', '2017-05-29 07:57:19', 11, 18);
--
-- Name: Fj6L8ZM_referal_users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Fj6L8ZM_referal_users_id_seq"', 3, true);
--
-- Data for Name: Fj6L8ZM_tournaments; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO "Fj6L8ZM_tournaments" (id, created_at, updated_at, turnir_title, turnir_description, turnir_avatar, turnir_autor, turnir_prize_money, turnir_status, turnir_count_comands, turnir_data) VALUES (1, NULL, NULL, 'Hot summer', 'Первый турнир зависящий от наших игроков<br> Принять участие сможет любой жедающий', '/img/ClanLogos/7/justiceLogo.png', 'TERRA', 50000, false, 1, '01-08-2017 18:00');
--
-- Name: Fj6L8ZM_tournaments_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Fj6L8ZM_tournaments_id_seq"', 1, true);
--
-- Data for Name: Fj6L8ZM_user_payments; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (1, '2017-06-06 13:42:03', '2017-06-06 13:42:03', 62393591677, 1000, '$500.00', false, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (2, '2017-06-06 13:45:04', '2017-06-06 13:45:04', 34937518214, 1000, '$500.00', false, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (3, '2017-06-06 14:00:30', '2017-06-06 14:00:30', 93073015246, 10, '$5.00', false, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (4, '2017-06-06 14:07:18', '2017-06-06 14:07:18', 31818155157, 10, '$5.00', false, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (8, '2017-06-06 14:17:43', '2017-06-06 14:32:13', 69802842537, 6, '$3.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (18, '2017-06-06 17:58:16', '2017-06-06 18:13:13', 69030650705, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (13, '2017-06-06 17:42:09', '2017-06-06 17:57:13', 71360406569, 4, '$2.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (35, '2017-07-11 08:45:33', '2017-07-11 08:45:33', 97667544749, 10, '$5.00', false, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (14, '2017-06-06 17:43:09', '2017-06-06 17:58:13', 27224192519, 6, '$3.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (9, '2017-06-06 14:20:04', '2017-06-06 14:35:13', 89923208538, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (10, '2017-06-06 14:22:01', '2017-06-06 14:37:13', 83805211923, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (19, '2017-06-06 18:00:32', '2017-06-06 18:15:12', 63791472588, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (20, '2017-06-06 18:02:53', '2017-06-06 18:17:13', 31788592206, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (5, '2017-06-06 14:10:02', '2017-06-06 14:25:13', 91776338799, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (21, '2017-06-06 18:14:04', '2017-06-06 18:29:13', 45951505833, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (11, '2017-06-06 17:36:35', '2017-06-06 17:51:13', 61164592578, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (6, '2017-06-06 14:13:42', '2017-06-06 14:29:13', 66263616457, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (15, '2017-06-06 17:52:54', '2017-06-06 18:07:13', 63952048743, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (7, '2017-06-06 14:15:53', '2017-06-06 14:30:13', 49035832203, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (22, '2017-06-07 07:30:50', '2017-06-07 07:45:15', 90091069663, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (16, '2017-06-06 17:53:26', '2017-06-06 18:09:13', 31447739733, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (12, '2017-06-06 17:41:35', '2017-06-06 17:56:13', 94640232664, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (23, '2017-06-07 08:18:36', '2017-06-07 08:33:14', 45150981636, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (17, '2017-06-06 17:57:20', '2017-06-06 18:12:13', 12364717158, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (24, '2017-06-07 08:21:08', '2017-06-07 08:36:15', 78573758900, 10, '$5.00', true, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (25, '2017-06-08 07:16:51', '2017-06-08 07:16:51', 48906917042, 10, '$5.00', false, 18);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (26, '2017-06-09 09:14:10', '2017-06-09 09:14:10', 65481031354, 14, '$7.00', false, 18);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (27, '2017-06-09 09:14:51', '2017-06-09 09:14:51', 21365194063, 332, '$166.00', false, 18);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (28, '2017-06-09 09:15:00', '2017-06-09 09:15:00', 77746295018, 500, '$250.00', false, 18);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (29, '2017-06-09 09:15:39', '2017-06-09 09:15:39', 63625126663, 500, '$250.00', false, 18);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (30, '2017-06-09 09:15:58', '2017-06-09 09:15:58', 43090134072, 500, '$250.00', false, 18);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (31, '2017-06-09 09:16:08', '2017-06-09 09:16:08', 53661772111, 500, '$250.00', false, 18);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (32, '2017-06-09 10:37:59', '2017-06-09 10:37:59', 18834582840, 500, '$250.00', false, 18);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (33, '2017-06-09 18:43:34', '2017-06-09 18:43:34', 80169365058, 500, '$250.00', false, 7);
INSERT INTO "Fj6L8ZM_user_payments" (id, created_at, updated_at, pay_code_tranzaction, pay_coins, pay_money, pay_status, pay_user_id) VALUES (34, '2017-06-14 12:45:38', '2017-06-14 12:45:38', 20861543590, 500, '$250.00', false, 18);
--
-- Name: Fj6L8ZM_user_payments_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('"Fj6L8ZM_user_payments_id_seq"', 35, true);
--
-- Data for Name: Fj6L8ZM_users; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (39, NULL, NULL, NULL, 'bi12icnyCYa3MD3kmCwESyWOeMFXxhtrNSlzEUoVNdmPTGQVb8bVDMvpADrl', '2017-06-16 08:42:27', '2017-06-16 08:42:27', 437647261, 'daemon#22471', 'wckyyqm7vpgkpvvcz42mg7bw', NULL, 0, false, 'eu', 0, '89dSY', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (23, NULL, NULL, NULL, 'TxXtAuWyovs0CtLBIcvPENKpIlObI5mH3NpUijmZQGuUzdkK8DSLjXUlAHgL', '2017-06-09 19:37:56', '2017-06-10 13:10:05', 449983964, 'Kallannel#2538', 'drbm9uvkyc8mgfvrwngb6a5w', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x0250000000001155.png', 1752, false, 'eu', 0, 'fisoS', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (37, NULL, NULL, NULL, 'j3kxTIU37jhhhwy5hGbDpuE6PxJ0IpZiQP1SEyyXYjvLmX67qCsAJYovIm3Y', '2017-06-13 20:21:31', '2017-06-13 20:27:28', 134578104, 'EShubin#2407', 'z32gw6bd5t98z9ku8a9smwvz', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x02500000000010B6.png', 2200, true, 'eu', 7, '10KG1', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (31, NULL, NULL, NULL, 'U3AnTGXlHNUgcShj8hz7Y5haoEtdFFZBYBM8elz8iZ1NO9G8LcUFkzNj4sWt', '2017-06-13 12:01:34', '2017-06-30 15:21:31', 440339062, 'Danger#22260', 'w86gyxdcmayh7ezmc62aam4x', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x025000000000030F.png', 2153, true, 'eu', 7, '9MKLH', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (29, NULL, NULL, NULL, '6kREHix9CM2wqooT5sBiFLuuIzw4ur53w14Q4VAAgoGBa6VHRfJSnxOOcRCj', '2017-06-13 08:08:18', '2017-06-15 15:02:52', 415785564, 'FlameLeet#2545', 'f6gpy9rx3t2v6bhxudjf2zsw', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x0250000000000316.png', 1840, true, 'eu', 7, 'M7K0Y', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (27, NULL, NULL, NULL, '1jRPvw4qqVEu9J0BNoXO80QBCqRbdJRT5SOILH2vb7EaiXvTZcoUY9opRFY0', '2017-06-10 20:48:58', '2017-06-10 20:48:58', 448583696, 'Chiba#21315', 'hxupx45vt6h8mnvva9gzchfq', NULL, 0, false, 'eu', 0, 'WJTbo', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (25, NULL, NULL, NULL, 'ifZj8FWTeLQ4tdSGEXAYXCXnJtohLmWGSZ1IeC4cjZfY0XGpa45NciDEp877', '2017-06-09 19:45:42', '2017-06-09 19:54:27', 401806989, 'tennx#2801', 'q7hrzutrqyrrjfbn2uj8qnuu', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x025000000000115C.png', 1679, true, 'eu', 7, 'arTR6', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (28, NULL, NULL, NULL, 'C9SR8DdXoj6FWg5gf2XFcktOUpLKPi3LHf214g9z9jiIkepB0tmUOMrNJd1V', '2017-06-11 03:45:32', '2017-06-11 03:45:32', 401321984, 'Piarto#2449', 'zu925sg3n3wvryuy93zwb38x', NULL, 0, false, 'eu', 0, 'aW71B', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (22, NULL, NULL, NULL, NULL, NULL, '2017-06-09 11:46:21', 454438873, 'Lemura#21355', 'qvvh3sdfsdfsfsdffsdf6v7fgmd', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x0250000000000ABB.png', 1929, false, 'eu', 0, NULL, NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (44, NULL, NULL, NULL, 'MGK5qQ79ioRMet3GsjCvwjRsXR52UH2sQLdoNcxb4HHlVaeBIqpWT5aTcpe5', '2017-06-23 12:57:51', '2017-06-23 12:57:51', 417484351, 'Noki#2308', 'fct4ktewghpq9erqpr6jp2sh', NULL, 0, false, 'eu', 0, 'vNfHL', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (41, NULL, NULL, NULL, 'YOpyJBFzS8D3hW3oPyTdus3osZpNd8Eg2MmBhLh1Ov2UycVcOAzhmJohDJVb', '2017-06-16 20:24:49', '2017-06-16 20:30:29', 132717330, 'DevilStyle#2974', 'qghwz4ab4k6azkbkbpfurbbf', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x0250000000000577.png', 2164, true, 'eu', 7, '9q1Zt', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (30, NULL, NULL, NULL, 'ifN0CTM8qgTe35EhF9zSohEKrTqzb6uWYmY8pzBPtKyd23AhvYwWw2hkFC2X', '2017-06-13 10:16:01', '2017-06-13 10:27:50', 440411438, 'FactynskiY#2839', '7w2u4n8rcnpjag<PASSWORD>tuy', NULL, 0, true, 'eu', 7, 'JauDw', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (20, NULL, NULL, NULL, 'B6GTIaEqAdthFYFsdfsdfwsdfwerfwfvdgrhy9x4M9T0dkOcOabT', NULL, '2017-06-09 10:17:24', 23423423, 'Excelsior#2181', 'qvvh3qtwerwerb2ugrm6v7fgmd', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x0250000000000742.png', 2818, false, 'eu', 0, 'sdfdw2', NULL, '<PASSWORD>', 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (21, NULL, NULL, NULL, NULL, NULL, '2017-06-09 10:45:40', 34534534, 'Homikator#2894', '<PASSWORD>', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x025000000000109A.png', 1678, false, 'eu', 0, NULL, NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (40, NULL, NULL, NULL, 'eak2J3TsE7yu7UCySHMkH6bBWwPbGdvR8ZQ2zbDsjDcQ0UGqDzx5WnfFJ1PE', '2017-06-16 13:43:29', '2017-06-16 13:57:38', 414130205, 'AlexRkm#2542', 't4dntk4bhsp7m2ap4wyyq2ty', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x025000000000115F.png', 2543, false, 'eu', 0, '9cA0j', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (26, NULL, NULL, NULL, 'xuSBKbB5RgdZFZbwYX871ROkzQQwvVkfErRGkxupAgMTxYc3LZcyosR8GEAQ', '2017-06-10 16:46:06', '2017-06-13 16:19:18', 136227974, 'Scandi#2930', '7hzwu32ak3wed63fxrz2aam8', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x0250000000001195.png', 2426, true, 'eu', 7, 'XYM0i', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (24, NULL, NULL, NULL, '9chGWzkRhfKqVXbUTtS9M6mtMXRx5225maPB6zLjyFxDR3I4uHKNLULIy25U', '2017-06-09 19:43:07', '2017-06-09 19:44:31', 453865378, 'INKL17#2804', '2h96wmfea7vayj235djymf5d', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x02500000000008F3.png', 1947, false, 'eu', 0, 'w9AMm', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (38, NULL, NULL, NULL, 'JC4ZMwwH4SqXbvOm7qRBEJ2klH46hmWdYAlcTEk9W2dFMfOS7ZXfpMk5zBxv', '2017-06-15 15:23:47', '2017-06-15 15:27:19', 439853249, 'duck1337#21468', 'mzegfek4qhxkrbawpjmuhyxf', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x0250000000000C40.png', 2415, true, 'eu', 7, 'dcmMP', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (42, NULL, NULL, NULL, 'HCnkVrUjLgbgHeupyciazplwYKAfg62fd6paV918xloC5TBKbxHy7k8PG75C', '2017-06-16 20:30:59', '2017-06-16 20:30:59', 410159953, 'Gentleman#21569', 'zy6kfm9d34cfrc5n9wapkwgp', NULL, 0, false, 'eu', 0, 'xlMXK', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (32, NULL, NULL, NULL, 'pWTrNzt2qw0l3tTZS0f1igjxeIRhSvQcDbcFmWy27qrYSGCdbUtaYdGXxkMI', '2017-06-13 16:10:37', '2017-06-15 15:38:04', 446089027, 'CrashNort#2615', 'avvruqxnn8ja8bmjn3eh53uj', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x0250000000001154.png', 2662, true, 'eu', 7, 'gJwdz', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (43, NULL, NULL, NULL, 'IQhSJXUdHlGHxw1EjZRiYifFxbsQiJd1GzRE0tBln5o53oCI105vZwRny3AT', '2017-06-19 19:04:22', '2017-06-19 21:02:32', 430890946, 'Фаршмашина#21992', 'xngsfz9nx2f25ysvadfepuh9', NULL, 0, true, 'eu', 7, 'KYtA1', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (34, NULL, NULL, NULL, 'dDnLpgjiSatUtnAk9WDH7bdhAgsuxAD8bSNz16pOIoUP2G4djOwy7cvGSjKP', '2017-06-13 19:55:23', '2017-07-03 03:05:49', 438753951, 'DireRaven#212922', 'bf35h48ue788a37abd6vfmx7', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x025000000000115A.png', 2159, true, 'eu', 7, 'dYfg2', NULL, NULL, 0, false);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (18, NULL, '<EMAIL>', NULL, '02Sw1R9SimQVYz9lMEEXJLKkusMKl10Hqo3BMvCGoLicmpxoktyHrL2Pxwqx', '2017-05-29 10:31:31', '2017-07-11 08:33:16', 451585870, 'shanematte#2624', '6gwe59jr87fbe3eb6e2jvmhf', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x0250000000001155.png', 1966, true, 'eu', 48, 'O04CV', 5437, 'rty56tFBVFG453gh7hjggj', 4500, true);
INSERT INTO "Fj6L8ZM_users" (id, name, email, password, remember_token, created_at, updated_at, user_battle_id, user_battle_tag, user_battle_token, user_battle_avatar, user_battle_rating, user_clan_status, user_server, user_activ_clan_id, user_referal_code, user_email_code, user_api_token, user_money, update_info) VALUES (7, NULL, '<EMAIL>', NULL, '3ufbvBQ7ulycFHBjkl2JRlnt6VITe35r0fC8nJuhSjxSG2F6cnMLNoByc434', '2017-05-29 10:31:14', '2017-07-11 07:16:39', 450281373, 'TERRA#22123', 'zycc47uttsjgr22a5hg5wdpp', 'https://blzgdapipro-a.akamaihd.net/game/unlocks/0x0250000000001157.png', 2337, true, 'eu', 7, 'PJYwv', 9604, 'rty56tFBVFG453gsd45gfh7hjggj', 50500, true);
--
-- Name: applies_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('applies_id_seq', 94, true);
--
-- Name: clan_gamers_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('clan_gamers_id_seq', 6, true);
--
-- Name: clans_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('clans_id_seq', 48, true);
--
-- Name: heroes_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('heroes_id_seq', 24, true);
--
-- Name: migrations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('migrations_id_seq', 13, true);
--
-- Name: navigations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('navigations_id_seq', 3, true);
--
-- Name: rating_heroes_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('rating_heroes_id_seq', 42, true);
--
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('users_id_seq', 44, true);
--
-- Name: Fj6L8ZM_posts Fj6L8ZM_posts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_posts"
ADD CONSTRAINT "Fj6L8ZM_posts_pkey" PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_products Fj6L8ZM_products_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_products"
ADD CONSTRAINT "Fj6L8ZM_products_pkey" PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_referal_users Fj6L8ZM_referal_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_referal_users"
ADD CONSTRAINT "Fj6L8ZM_referal_users_pkey" PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_tournaments Fj6L8ZM_tournaments_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_tournaments"
ADD CONSTRAINT "Fj6L8ZM_tournaments_pkey" PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_user_payments Fj6L8ZM_user_payments_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_user_payments"
ADD CONSTRAINT "Fj6L8ZM_user_payments_pkey" PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_applies applies_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_applies"
ADD CONSTRAINT applies_pkey PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_clan_gamers clan_gamers_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_clan_gamers"
ADD CONSTRAINT clan_gamers_pkey PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_clans clans_clan_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_clans"
ADD CONSTRAINT clans_clan_name_key UNIQUE (clan_name);
--
-- Name: Fj6L8ZM_clans clans_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_clans"
ADD CONSTRAINT clans_pkey PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_heroes heroes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_heroes"
ADD CONSTRAINT heroes_pkey PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_migrations"
ADD CONSTRAINT migrations_pkey PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_navigations navigations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_navigations"
ADD CONSTRAINT navigations_pkey PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_rating_heroes rating_heroes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_rating_heroes"
ADD CONSTRAINT rating_heroes_pkey PRIMARY KEY (id);
--
-- Name: Fj6L8ZM_users users_email_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_users"
ADD CONSTRAINT users_email_unique UNIQUE (email);
--
-- Name: Fj6L8ZM_users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY "Fj6L8ZM_users"
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: password_resets_email_index; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX password_resets_email_index ON "Fj6L8ZM_password_resets" USING btree (email);
--
-- Name: password_resets_token_index; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX password_resets_token_index ON "Fj6L8ZM_password_resets" USING btree (token);
--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--
|
<gh_stars>0
CREATE PROCEDURE [dbo].[usp_sqlwatch_logger_xes_query_problems]
as
set nocount on
declare @snapshot_type_id tinyint = 31,
@snapshot_time datetime2(0),
@target_data_char nvarchar(max),
@target_data_xml xml
declare @execution_count bigint = 0,
@session_name nvarchar(64) = 'SQLWATCH_query_problems',
@address varbinary(8),
@filename varchar(8000),
@sql_instance varchar(32) = dbo.ufn_sqlwatch_get_servername();
--quit of the collector is switched off
if (select collect from [dbo].[sqlwatch_config_snapshot_type]
where snapshot_type_id = @snapshot_type_id) = 0
begin
return
end
if [dbo].[ufn_sqlwatch_get_product_version]('major') >= 11
begin
set @execution_count = [dbo].[ufn_sqlwatch_get_xes_exec_count] ( @session_name, 0 )
if @execution_count > [dbo].[ufn_sqlwatch_get_xes_exec_count] ( @session_name, 1 )
begin
set xact_abort on
begin transaction
--update execution count
exec [dbo].[usp_sqlwatch_internal_update_xes_query_count]
@session_name = @session_name
, @execution_count = @execution_count
--we shold build a safety check in here to make sure we dont blow the target table if there are many long queries.
--something to check how many new long queries we get per second or minute and bail out if too many.
--perhaps also disable XES if too many queries are being logged
declare @event_data table (
event_data xml
, [event_hashbytes] varbinary(20)
, occurence int
unique ([event_hashbytes], occurence)
)
--SQL Server logs is multiple occurences of the plan_affecting_convert event with the exact same data.
--I am not sure whethere this is a bug in SQL Server or my XES is somehow incorrect. I will look into this in the future or raise a bug with MS
insert into @event_data
select cast(event_data as xml)
, [event_hashbytes]=hashbytes('SHA1',event_data)
, occurence = ROW_NUMBER() over (partition by hashbytes('SHA1',event_data) order by (select null))
from sys.fn_xe_file_target_read_file ('SQLWATCH_query_problems*.xel', null, null, null) t
option (maxdop 1, keepfixed plan)
exec [dbo].[usp_sqlwatch_internal_insert_header]
@snapshot_time_new = @snapshot_time OUTPUT,
@snapshot_type_id = @snapshot_type_id
SELECT
[event_time]=xed.event_data.value('(@timestamp)[1]', 'datetime')
,[event_name]=xed.event_data.value('(@name)[1]', 'varchar(255)')
,[username]=xed.event_data.value('(action[@name="username"]/value)[1]', 'varchar(255)')
--,[sql_text]=xed.event_data.value('(action[@name="sql_text"]/value)[1]', 'varchar(max)')
,[client_hostname]=xed.event_data.value('(action[@name="client_hostname"]/value)[1]', 'varchar(255)')
,[client_app_name]=xed.event_data.value('(action[@name="client_app_name"]/value)[1]', 'varchar(255)')
,[problem_details] = t.event_data
,[event_hashbytes]
,occurence
into #t_queries
from @event_data t
cross apply t.event_data.nodes('event') as xed (event_data)
where xed.event_data.value('(@name)[1]', 'varchar(255)') <> 'query_post_execution_showplan'
insert into dbo.[sqlwatch_logger_xes_query_problems] (
[event_time], event_name, username
, client_hostname, client_app_name
, snapshot_time, snapshot_type_id, sql_instance, [problem_details], [event_hash], occurence)
select
tx.[event_time], tx.event_name, tx.username
, tx.client_hostname, tx.client_app_name
,[snapshot_time] = @snapshot_time
,[snapshot_type_id] = @snapshot_type_id
,sql_instance = @sql_instance
,tx.[problem_details]
,tx.[event_hashbytes]
,occurence = o.occurence
from #t_queries tx
-- do not load queries that we arleady have
left join dbo.[sqlwatch_logger_xes_query_problems] x
on x.[event_hash] = tx.[event_hashbytes]
and x.event_time = tx.event_time
and x.event_name = tx.event_name
outer apply (
select occurence=max(occurence)
from #t_queries
where [event_hashbytes] = tx.[event_hashbytes]
) o
where tx.occurence = 1
and x.[event_hash] is null
commit tran
end
end
else
print 'Product version must be 11 or higher'
|
INSERT INTO song (artist, album, title)
VALUES
('<NAME>', 'A Matter of Life and Death', 'For the Greater Good of God'),
('I<NAME>', 'Fear of the Dark', 'Fear of the Dark')
;
|
begin;
select * from no_plan();
SELECT schema_privs_are(
'api', 'webuser', ARRAY['USAGE'],
'authenticated users should have usage privilege of the api schema'
);
-- switch to a anonymous application user
/*
* set local role anonymous;
* set request.jwt.claim.role = 'anonymous';
*
* select set_eq(
* 'select id from api.todos',
* array[ 1, 3, 6 ],
* 'only public todos are visible to anonymous users'
* );
*/
-- switch to a specific application user
/*
* set local role webuser;
* set request.jwt.claim.role = 'webuser';
* set request.jwt.claim.user_id = '1'; --alice
*
* select set_eq(
* 'select id from api.todos where mine = true',
* array[ 1, 2, 3 ],
* 'can see all his todos'
* );
*
* select set_eq(
* 'select id from api.todos',
* array[ 1, 2, 3, 6 ],
* 'can see his todos and public ones'
* );
*/
select * from finish();
rollback;
|
SELECT steam_id_tbl.steam_id AS "steam_id",
player_name_tbl.name AS "name"
FROM steam_id_player_name_reference_tbl
INNER JOIN steam_id_tbl ON steam_id_tbl.id = steam_id_player_name_reference_tbl.steam_id_id
INNER JOIN player_name_tbl ON player_name_tbl.id = steam_id_player_name_reference_tbl.player_name_id
|
<reponame>dlliwei/es-example1<filename>src/main/resources/sql.sql
CREATE DATABASE IF NOT EXISTS `news` DEFAULT CHARACTER SET utf8;
USE `news`;
DROP TABLE IF EXISTS `news`;
CREATE TABLE `table1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(100) DEFAULT NULL,
`content` mediumtext,
`url` varchar(100) DEFAULT NULL,
`source` varchar(50) DEFAULT NULL,
`author` varchar(50) DEFAULT NULL,
`pubdate` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8;
|
<filename>public/assets/migrations/2017_07_17_084200_create_clinic_appointment_table.sql
create table clinic_appointment select * from patient_appointment//
|
<reponame>sxinger/grouse
/* cms_dx_by_enc_type -- CMS ETL Diagnosis report based on PCORNet CDM EDC Table IVA.
ref
Table IVA. Diagnosis Records Per Encounter and Per Patient, Overall and by Encounter Type
*/
select enc_type from pcornet_encounter where 'dep' = 'cms_enc_dstats.sql';
whenever sqlerror continue; drop table dx_meta; whenever sqlerror exit;
create table dx_meta as
select * from (
select c_basecode concept_cd, pcori_basecode dx
, substr(c_fullname, length('\PCORI\DIAGNOSIS\_'), 2) dx_type
-- , c_fullname
-- , m_applied_path
from grousemetadata.pcornet_diag diag
where pcori_basecode is not null
and c_synonym_cd = 'N'
and c_fullname like '\PCORI\DIAGNOSIS\%'
)
-- Skip ICD-9 V codes in 10 ontology, ICD-9 E codes in 10 ontology, ICD-10 numeric codes in 10 ontology
-- adapted from SCILHS/i2p-transform 543c561 Nov 15, 2016
-- Note: makes the assumption that ICD-9 Ecodes are not ICD-10 Ecodes; same with ICD-9 V codes. On inspection seems to be true.
where not (REGEXP_LIKE (dx, '^[VE0-9].*', 'i') and dx_type = '10')
;
select case when count(*) = 0 then 1 else 1/0 end unique_dx_type from (
select concept_cd, count(*) from dx_meta group by concept_cd having count(*) > 1
);
whenever sqlerror continue; drop table dx_source_meta; whenever sqlerror exit;
create table dx_source_meta as
with diag as (
select c_basecode, pcori_basecode, c_fullname, c_synonym_cd from grousemetadata.pcornet_diag
)
select c_basecode modifier_cd, SUBSTR(pcori_basecode, INSTR(pcori_basecode, ':') + 1, 2) dx_source
from diag
where pcori_basecode is not null
and c_synonym_cd = 'N'
and c_fullname like '\PCORI_MOD\CONDITION_OR_DX\%'
;
whenever sqlerror continue; drop table pdx_meta; whenever sqlerror exit;
create table pdx_meta as
with diag as (
select c_basecode, pcori_basecode, c_fullname, c_synonym_cd from grousemetadata.pcornet_diag
)
select c_basecode modifier_cd, SUBSTR(pcori_basecode, INSTR(pcori_basecode, ':') + 1, 2) pdx
from diag
where pcori_basecode is not null
and c_synonym_cd = 'N'
and c_fullname like '\PCORI_MOD\PDX\%'
;
create or replace view cdm_other_enum as
select 'NI' No_information
, 'UN' Unknown
, 'OT' Other
from dual;
create or replace view dx_origin_enum as
select 'OD' "Order"
, 'BI' Billing
, 'CL' Claim
, other.*
from cdm_other_enum other;
/** pcornet_diagnosis -- view observation_fact as CDM diagnosis
*
* Note: One i2b2 fact corresponds to one CDM diagnosis. Other
* than filtering, there are no cardinality changes
*/
create or replace view pcornet_diagnosis as
select rownum DIAGNOSISID
, obs.patient_num PATID
, obs.encounter_num ENCOUNTERID
, nvl(enc.ENC_TYPE, 'NI') ENC_TYPE
, enc.ADMIT_DATE
, obs.provider_id PROVIDERID
, dx_meta.DX
, dx_meta.DX_TYPE
, nvl(src.dx_source, 'NI') DX_SOURCE
, (select claim from dx_origin_enum) DX_ORIGIN
, nvl(px.pdx, 'NI') PDX
, obs.concept_Cd RAW_DX
, obs.upload_id RAW_DX_TYPE
, obs.sourcesystem_cd RAW_DX_SOURCE
, obs.instance_num raw_dx_origin
, null RAW_PDX
from "&&I2B2STAR".observation_fact obs
join dx_meta on dx_meta.concept_cd = obs.concept_cd
-- ISSUE: prove that these left-joins match at most once.
left join dx_source_meta src on src.modifier_cd = obs.modifier_cd
left join pdx_meta px on px.modifier_cd = obs.modifier_cd
left join encounter enc on obs.encounter_num = enc.encounterid
;
-- select * from pcornet_diagnosis
/*Check that the view is type-compatible with the table. */
-- insert into "&&PCORNET_CDM".diagnosis select * from pcornet_diagnosis where 1=0;
create or replace view dx_by_enc_type as
with qty as
(select enc_type
, count( *) count_dx
, count(distinct encounterid) count_enc
from diagnosis
group by enc_type
)
select enc_type
, count_dx
, count_enc
, round(count_dx / (greatest(1, count_enc)), 2) dx_per_enc
from qty
order by enc_type ;
-- select * from dx_by_enc_type;
/** Procedures
*/
whenever sqlerror continue; drop table px_meta; whenever sqlerror exit;
create table px_meta as
select c_basecode concept_cd
, SUBSTR(pr.pcori_basecode, INSTR(pr.pcori_basecode, ':') + 1, 11) px
-- C4 and HC got merged as CH in CDM 3.1
, replace(replace(SUBSTR(pr.c_fullname, length('\PCORI\PROCEDURE\%'), 2),
'C4', 'CH'), 'HC', 'CH') px_type
, c_name
from grousemetadata.pcornet_proc pr
where pr.c_fullname like '\PCORI\PROCEDURE\%'
and pr.c_synonym_cd = 'N'
and pcori_basecode is not null
and pr.c_basecode not like 'PROCEDURE:%'
and pr.m_applied_path = '@'
and pr.c_visualattributes like 'L%'
;
create unique index pdx_meta_concept on px_meta (concept_cd);
create or replace view px_source_enum as
select 'OD' "Order"
, 'BI' Billing
, 'CL' Claim
, other.*
from cdm_other_enum other;
create or replace view pcornet_procedures as
-- Instance num should be unique within patient_num and upload_id.
-- There isn't room for all three; since we can recover patient_num and upload_id
-- from other columns, hash them and truncate, hoping that's good enough.
select substr(obs.instance_num || ' ' || ora_hash(obs.upload_id || ' ' || obs.patient_num), 1, 18) PROCEDURESID
, obs.patient_num PATID
, obs.encounter_num ENCOUNTERID
, nvl(vd.inout_cd, 'NI') ENC_TYPE
, vd.start_date ADMIT_DATE
, vd.PROVIDERID
, obs.start_date PX_DATE
, px_meta.PX
, px_meta.PX_TYPE
, (select Claim from px_source_enum) PX_SOURCE
, substr(px_meta.c_name, 1, 50) RAW_PX
, obs.upload_id RAW_PX_TYPE
from "&&I2B2STAR".observation_fact obs
join px_meta on px_meta.concept_cd = obs.concept_cd
left join "&&I2B2STAR".visit_dimension vd on obs.patient_num = vd.patient_num
and obs.encounter_num = vd.encounter_num
;
/*Check that the view is type-compatible with the table. */
-- insert into "&&PCORNET_CDM".procedures select * from pcornet_procedures where 1=0;
explain plan for
select * from pcornet_procedures
where patid between 1 and 10000
;
/**
* ref Table IVB. Procedure Records Per Encounter and Per Patient, Overall and by Encounter Type
*/
create or replace view px_per_enc_by_type as
select enc_type
, to_char(count(*), '99G999G999G999') "PROCEDURES records"
, to_char(count(known_px_type), '99G999G999G999') "known PX_TYPE"
, to_char(count(distinct encounterid), '99G999G999G999') "ENCOUNTER records"
, round(count(*) / count(distinct encounterid), 2) "PX per encounter"
, round(count(known_px_type) / count(distinct encounterid), 2) "known PX_TYPE per encounter"
from (
select proceduresid
, case when px_type in ('09', '10', '11', 'CH', 'LC', 'ND', 'RE') then px_type else null end known_px_type
, encounterid
, case when enc_type in ('NI', 'UN', 'OT') then 'Missing / Other' else enc_type end enc_type
from procedures
) px
group by enc_type
;
-- select* from px_per_enc_by_type;
create or replace view cms_dx_dstats as
select &&design_digest design_digest from dual;
select 1 up_to_date
from cms_dx_dstats where design_digest = &&design_digest;
|
-- Table: extra_fantasy.playerstats_fantasy_yearly
-- DROP TABLE extra_fantasy.playerstats_fantasy_yearly;
CREATE TABLE extra_fantasy.playerstats_fantasy_yearly
(
playerstats_fantasy_yearly_id serial NOT NULL,
nflcom_player_id character varying(10),
source character varying NOT NULL,
source_player_id character varying NOT NULL,
source_player_name character varying NOT NULL,
source_player_position character varying NOT NULL,
source_team_code character varying NOT NULL,
season_year smallint NOT NULL,
g smallint NOT NULL,
gs smallint,
draftkings_points real,
fanduel_points real,
fantasy_points_std real,
fantasy_points_ppr real,
CONSTRAINT playerstats_fantasy_yearly_pkey PRIMARY KEY (playerstats_fantasy_yearly_id),
CONSTRAINT playerstats_fantasy_yearly_season_year_source_nflcom_player_key UNIQUE (season_year, source, nflcom_player_id),
CONSTRAINT playerstats_fantasy_yearly_season_year_source_source_player_key UNIQUE (season_year, source, source_player_id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE extra_fantasy.playerstats_fantasy_yearly
OWNER TO nfldb;
-- Trigger: pfyi_nflcom_player_id on extra_fantasy.playerstats_fantasy_yearly
-- DROP TRIGGER pfyi_nflcom_player_id ON extra_fantasy.playerstats_fantasy_yearly;
CREATE TRIGGER pfyi_nflcom_player_id
BEFORE INSERT
ON extra_fantasy.playerstats_fantasy_yearly
FOR EACH ROW
EXECUTE PROCEDURE extra_misc.nflcom_player_id();
|
CREATE procedure [CommonModuleTests].[test log4.ExceptionHandler hides error after handling exception]
as
begin
exec tSQLt.FakeTable @TableName = 'log4Private.SqlException', @Identity = 1 ;
exec tSQLt.SpyProcedure 'log4Private.SessionInfoOutput', 'select 1 / 0 as [ForcedError] into #tmp;';
exec tSQLt.ExpectNoException ;
exec log4.JournalWriter
@FunctionName = 'test'
, @MessageText = 'This is a unit test'
end;
|
<reponame>jermiy/services-core
-- Start transaction and plan the tests.
BEGIN;
SELECT plan(2);
-- throw error
PREPARE subject_force_any_of_roles AS select core.force_any_of_roles('{platform_user}');
set local role anonymous;
select throws_like(
'subject_force_any_of_roles',
'%insufficient_privilege',
'Should raise error when role is not in requested roles'
);
set local role platform_user;
select lives_ok(
'subject_force_any_of_roles',
'Should not raise error when role is in requested roles'
);
-- Finish the tests and clean up.
SELECT * FROM finish();
ROLLBACK;
|
CREATE TABLE IF NOT EXISTS `practice_order_info` (
id bigint(20) primary key auto_increment,
status varchar(10) not null default 'CREATED',
create_time datetime(3) not null default current_timestamp(3)
) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4 COMMENT='order 延迟任务表';
|
ALTER TABLE SUBAWARD_FUNDING_SOURCE
ADD CONSTRAINT FK_SUBAWARD_FUNDING_SOURCE
FOREIGN KEY (SUBAWARD_ID) REFERENCES SUBAWARD (SUBAWARD_ID)
/
|
/*
Warnings:
- A unique constraint covering the columns `[meiId]` on the table `Usuario` will be added. If there are existing duplicate values, this will fail.
*/
-- AlterTable
ALTER TABLE `Usuario` ADD COLUMN `meiId` INTEGER NULL;
-- CreateTable
CREATE TABLE `Mei` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`cnpj` VARCHAR(18) NOT NULL,
`nomeFantasia` VARCHAR(255) NOT NULL,
`razaoSocial` VARCHAR(255) NOT NULL,
UNIQUE INDEX `Mei_cnpj_key`(`cnpj`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateIndex
CREATE UNIQUE INDEX `Usuario_meiId_key` ON `Usuario`(`meiId`);
-- AddForeignKey
ALTER TABLE `Usuario` ADD CONSTRAINT `Usuario_meiId_fkey` FOREIGN KEY (`meiId`) REFERENCES `Mei`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
<reponame>Angeldxy/g12goods<gh_stars>0
-- MySQL dump 10.13 Distrib 8.0.22, for Linux (x86_64)
--
-- Host: 127.0.0.1 Database: oomall_log
-- ------------------------------------------------------
-- Server version 8.0.22
/*!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 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Dumping data for table `auth_log`
--
LOCK TABLES `auth_log` WRITE;
/*!40000 ALTER TABLE `auth_log` DISABLE KEYS */;
INSERT INTO `oomall`.`auth_log` (`id`, `user_id`,`depart_id`, `ip`, `descr`, `privilege_id`, `success`, `gmt_create`) VALUES ('1', '12', '1', '192.168.1.1', 'lalala', '12', '1', '2020/11/18 10:00');
INSERT INTO `oomall`.`auth_log` (`id`, `user_id`,`depart_id`, `ip`, `descr`, `privilege_id`, `success`, `gmt_create`) VALUES ('2', '1', '12','192.168.2.1', 'lalala', '1', '0', '2020/11/15 10:00');
/*!40000 ALTER TABLE `auth_log` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-11-18 8:59:19
|
SELECT * FROM contributions_small_count;
|
<reponame>goldmansachs/obevo-kata
CREATE FUNCTION func551() RETURNS integer
LANGUAGE plpgsql
AS $$ DECLARE val INTEGER; BEGIN val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE117);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE261);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE379);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW19);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW95);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW12);CALL FUNC562(MYVAR);CALL FUNC538(MYVAR);CALL FUNC626(MYVAR);CALL FUNC436(MYVAR);END $$;
GO
|
<reponame>goldmansachs/obevo-kata
CREATE FUNCTION func244() RETURNS integer
LANGUAGE plpgsql
AS $$ DECLARE val INTEGER; BEGIN val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE240);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE210);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE103);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW96);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW71);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW13);CALL FUNC128(MYVAR);CALL FUNC506(MYVAR);CALL FUNC874(MYVAR);CALL FUNC114(MYVAR);END $$;
GO
|
CALL zproc_validate_send_adminuser_otp('a');
|
create table Equipo(ci int(50) not null , nombre varchar(50))
INSERT INTO usuarios (ci,nombre) VALUES(12,'tomas')
SELECT * FROM usuarios
|
DROP TABLE IF EXISTS requested_grants;
|
<filename>burgercode_fini.sql
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: May 26, 2016 at 04:42 PM
-- Server version: 10.1.13-MariaDB
-- PHP Version: 7.0.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `burgercode_fini`
--
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`lang` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` (`id`, `name`,`lang`) VALUES
(1, 'Menus', 'en'),
(2, 'Burgers', 'en'),
(3, 'Snacks', 'en'),
(4, 'Salads', 'en'),
(5, 'Beverages', 'en'),
(6, 'Desserts', 'en'),
(7, 'Menu', 'es'),
(8, 'Hamburgesas', 'es'),
(9, 'Aperitivos', 'es'),
(10, 'Ensaladas', 'es'),
(11, 'Bebidas', 'es'),
(12, 'Postres', 'es');
-- --------------------------------------------------------
--
-- Table structure for table `items`
--
CREATE TABLE `items` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`description` varchar(255) NOT NULL,
`price` float NOT NULL,
`image` varchar(255) NOT NULL,
`category` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `items`
--
INSERT INTO `items` (`id`, `name`, `description`, `price`, `image`, `category`) VALUES
(1, 'Classic Menu', 'Sandwich: Burger, Salad, Tomato, Gherkin + Fries + Drink', 8.9, 'm1.png', 1),
(2, 'Bacon Menu', 'Sandwich: Burger, Cheese, Bacon, Salad, Tomato + Fries + Beverage', 9.5, 'm2.png', 1),
(3, 'Big Menu', 'Sandwich: Double Burger, Cheese, Gherkin, Salad + Fries + Beverage', 10.9, 'm3.png', 1),
(4, 'Menu Chicken', 'Sandwich: Fried Chicken, Tomato, Salad, Mayonnaise + Fries + Beverage', 9.9, 'm4.png', 1),
(5, 'Fish Menu', 'Sandwich: Fish, Salad, Mayonnaise, Gherkin + Fries + Beverage', 10.9, 'm5.png', 1),
(6, 'Double Steak Menu', 'Sandwich: Double Burger, Cheese, Bacon, Salad, Tomato + Fries + Beverage', 11.9, 'm6.png', 1),
(7, 'Classic', 'Sandwich: Burger, Salad, Tomato, Gherkin', 5.9, 'b1.png', 2),
(8, 'Bacon', 'Sandwich: Burger, Cheese, Bacon, Salad, Tomato', 6.5, 'b2.png', 2),
(9, 'Big', 'Sandwich: Double Burger, Cheese, Gherkin, Salad', 6.9, 'b3.png', 2),
(10, 'Chicken', 'Sandwich: Fried Chicken, Tomato, Salad, Mayonnaise', 5.9, 'b4.png', 2),
(11, 'Fish', 'Sandwich: Breaded Fish, Salad, Mayonnaise, Gherkin', 6.5, 'b5.png', 2),
(12, 'Double Steak', 'Sandwich: Double Burger, Cheese, Bacon, Salad, Tomato', 7.5, 'b6.png', 2),
(13, 'Fries', 'French fries', 3.9, 's1.png', 3),
(14, 'Onion Rings', 'Fried onion rings', 3.4, 's2.png', 3),
(15, 'Nuggets', 'Fried chicken nuggets', 5.9, 's3.png', 3),
(16, 'Nuggets Cheese', 'Fried Nuggets of Cheese', 3.5, 's4.png', 3),
(17, 'Chicken Wings', 'Barbecue Chicken Wings', 5.9, 's5.png', 3),
(18, 'Caesar Chicken Breaded', 'Breaded Chicken, Salad, Tomato and the famous Caesar sauce', 8.9, 'sa1.png', 4),
(19, 'Caesar Grilled Chicken', 'Grilled Chicken, Salad, Tomato and the famous Caesar sauce', 8.9, 'sa2.png', 4),
(20, 'Light Salad', 'Salad, Tomato, Cucumber, Maize and Balsamic Vinegar', 5.9, 'sa3.png', 4),
(21, 'Breaded Chicken', 'Breaded Chicken, Salad, Tomato and the sauce of your choice', 7.9, 'sa4.png', 4),
(22, 'Grilled chicken', 'Grilled chicken, Salad, Tomato and sauce of your choice', 7.9, 'sa5.png', 4),
(23, 'Coca-Cola', 'Choice: Small, Medium or Large', 1.9, 'bo1.png', 5),
(24, 'Coca-Cola Light', 'Choice: Small, Medium or Large', 1.9, 'bo2.png', 5),
(25, 'Coca-Cola Zero', 'Optional: Small, Medium or Large', 1.9, 'bo3.png', 5),
(26, 'Fanta', 'Choice: Small, Medium or Large', 1.9, 'bo4.png', 5),
(27, 'Sprite', 'Choice: Small, Medium or Large', 1.9, 'bo5.png', 5),
(28, 'Nestea', 'Choice: Small, Medium or Large', 1.9, 'bo6.png', 5),
(29, 'Chocolate fondant', 'To choose: White chocolate or milk', 4.9, 'd1.png', 6),
(30, 'Muffin', 'Choice: Fruit or chocolate', 2.9, 'd2.png', 6),
(31, 'Donut', 'Choice: Chocolate or vanilla', 2.9, 'd3.png', 6),
(32, 'Milkshake', 'Choice: Strawberry, Vanilla or Chocolate', 3.9, 'd4.png', 6),
(33, 'Sundae', 'Optional: Strawberry, Caramel or Chocolate', 4.9, 'd5.png', 6),
(34, 'Classic Menu', 'Sandwich: Burger, Salad, Tomato, Gherkin + Fries + Beverage', 8.9, 'm1.png', 7),
(35, 'Bacon Menu', 'Sandwich: Burger, Cheese, Bacon, Salad, Tomato + Fries + Beverage', 9.5, 'm2.png', 7),
(36, 'Big Menu', 'Sandwich: Double Burger, Cheese, Gherkin, Salad + Fries + Beverage', 10.9, 'm3.png', 7),
(37, 'Menu Chicken', 'Sandwich: Fried Chicken, Tomato, Salad, Mayonnaise + Fries + Beverage', 9.9, 'm4.png', 7),
(38, 'Fish Menu', 'Sandwich: Fish, Salad, Mayonnaise, Gherkin + Fries + Beverage', 10.9, 'm5.png', 7),
(39, 'Double Steak Menu', 'Sandwich: Double Burger, Cheese, Bacon, Salad, Tomato + Fries + Beverage', 11.9, 'm6.png', 7),
(40, 'Classic', 'Sandwich: Burger, Salad, Tomato, Gherkin', 5.9, 'b1.png', 8),
(41, 'Bacon', 'Sandwich: Burger, Cheese, Bacon, Salad, Tomato', 6.5, 'b2.png', 8),
(42, 'Big', 'Sandwich: Double Burger, Cheese, Gherkin, Salad', 6.9, 'b3.png', 8),
(43, 'Chicken', 'Sandwich: Fried Chicken, Tomato, Salad, Mayonnaise', 5.9, 'b4.png', 8),
(44, 'Fish', 'Sandwich: Breaded Fish, Salad, Mayonnaise, Gherkin', 6.5, 'b5.png', 8),
(45, 'Double Steak', 'Sandwich: Double Burger, Cheese, Bacon, Salad, Tomato', 7.5, 'b6.png', 8),
(46, 'Fries', 'French fries', 3.9, 's1.png', 9),
(47, 'Onion Rings', 'Fried onion rings', 3.4, 's2.png', 9),
(48, 'Nuggets', 'Fried chicken nuggets', 5.9, 's3.png', 9),
(49, 'Nuggets Cheese', 'Fried Nuggets of Cheese', 3.5, 's4.png', 9),
(50, 'Chicken Wings', 'Chicken Wings Barbecue', 5.9, 's5.png', 9),
(51, 'Caesar Chicken Breaded', 'Breaded Chicken, Salad, Tomato and the famous Caesar sauce', 8.9, 'sa1.png', 10),
(52, 'Caesar Grilled Chicken', 'Grilled Chicken, Salad, Tomato and the famous Caesar sauce', 8.9, 'sa2.png', 10),
(53, 'Light Salad', 'Salad, Tomato, Cucumber, Maize and Balsamic Vinegar', 5.9, 'sa3.png', 10),
(54, 'Breaded Chicken', 'Breaded Chicken, Salad, Tomato and the sauce of your choice', 7.9, 'sa4.png', 10),
(55, 'Grilled chicken', 'Grilled chicken, Salad, Tomato and the sauce of your choice', 7.9, 'sa5.png', 10),
(56, 'Coca-Cola', 'Choice: Small, Medium or Large', 1.9, 'bo1.png', 11),
(57, 'Coca-Cola Light', 'Choice: Small, Medium or Large', 1.9, 'bo2.png', 11),
(58, 'Coca-Cola Zero', 'Optional: Small, Medium or Large', 1.9, 'bo3.png', 11),
(59, 'Fanta', 'Choice: Small, Medium or Large', 1.9, 'bo4.png', 11),
(60, 'Sprite', 'Choice: Small, Medium or Large', 1.9, 'bo5.png', 11),
(61, 'Nestea', 'Choice: Small, Medium or Large', 1.9, 'bo6.png', 11),
(62, 'Chocolate fondant', 'Choose: White chocolate or milk', 4.9, 'd1.png', 12),
(63, 'Muffin', 'Choice: Fruit or chocolate', 2.9, 'd2.png', 12),
(64, 'Donut', 'Optional: Chocolate or vanilla', 2.9, 'd3.png', 12),
(65, 'Milkshake', 'Choice: Strawberry, Vanilla or Chocolate', 3.9, 'd4.png', 12),
(66, 'Sundae', 'Choice: Strawberry, Caramel or Chocolate', 4.9, 'd5.png', 12);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `items`
--
ALTER TABLE `items`
ADD PRIMARY KEY (`id`),
ADD KEY `category` (`category`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `items`
--
ALTER TABLE `items`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `items`
--
ALTER TABLE `items`
ADD CONSTRAINT `items_ibfk_1` FOREIGN KEY (`category`) REFERENCES `categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!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>WEBJU/fm
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 03, 2021 at 09:06 AM
-- Server version: 8.0.23
-- PHP Version: 8.0.6
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: `mithuns`
--
-- --------------------------------------------------------
--
-- Table structure for table `motivation_monday`
--
CREATE TABLE `motivation_monday` (
`id` bigint UNSIGNED NOT NULL,
`quote` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`posted_by` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`author` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Unknown',
`image` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`status` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'visible',
`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 `motivation_monday`
--
INSERT INTO `motivation_monday` (`id`, `quote`, `posted_by`, `author`, `image`, `status`, `created_at`, `updated_at`) VALUES
(1, 'Genius is one percent inspiration and ninety-nine percent perspiration.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(2, 'You can observe a lot just by watching.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(3, 'A house divided against itself cannot stand.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(4, 'Difficulties increase the nearer we get to the goal.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(5, 'Fate is in your hands and no one elses', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(6, 'Be the chief but never the lord.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(7, 'Nothing happens unless first we dream.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(8, 'Well begun is half done.', 'Michelle', 'Aristotle', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(9, 'Life is a learning experience, only if you learn.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(10, 'Self-complacency is fatal to progress.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(11, 'Peace comes from within. Do not seek it without.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(12, 'What you give is what you get.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(13, 'We can only learn to love by loving.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(14, 'Life is change. Growth is optional. Choose wisely.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(15, 'You\'ll see it when you believe it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(16, 'Today is the tomorrow we worried about yesterday.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(17, 'It\'s easier to see the mistakes on someone else\'s paper.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(18, 'Every man dies. Not every man really lives.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(19, 'To lead people walk behind them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(20, 'Having nothing, nothing can he lose.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(21, 'Trouble is only opportunity in work clothes.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(22, 'A rolling stone gathers no moss.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(23, 'Ideas are the beginning points of all fortunes.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(24, 'Everything in life is luck.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(25, 'Doing nothing is better than being busy doing nothing.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(26, 'Trust yourself. You know more than you think you do.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(27, 'Study the past, if you would divine the future.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(28, 'The day is already blessed, find peace within it.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(29, 'From error to error one discovers the entire truth.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(30, 'Well done is better than well said.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(31, 'Bite off more than you can chew, then chew it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(32, 'Work out your own salvation. Do not depend on others.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(33, 'One today is worth two tomorrows.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(34, 'Once you choose hope, anythings possible.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(35, 'God always takes the simplest way.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(36, 'One fails forward toward success.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(37, 'From small beginnings come great things.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(38, 'Learning is a treasure that will follow its owner everywhere', 'Michelle', 'Chinese proverb', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(39, 'Be as you wish to seem.', 'Michelle', 'Socrates', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(40, 'The world is always in movement.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(41, 'Never mistake activity for achievement.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(42, 'What worries you masters you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(43, 'One faces the future with ones past.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(44, 'Goals are the fuel in the furnace of achievement.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(45, 'Who sows virtue reaps honour.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(46, 'Be kind whenever possible. It is always possible.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(47, 'Talk doesn\'t cook rice.', 'Michelle', 'Chinese proverb', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(48, 'He is able who thinks he is able.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(49, 'A goal without a plan is just a wish.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(50, 'To succeed, we must first believe that we can.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(51, 'Learn from yesterday, live for today, hope for tomorrow.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(52, 'A weed is no more than a flower in disguise.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(53, 'Do, or do not. There is no try.', 'Michelle', 'Yoda', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(54, 'All serious daring starts from within.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(55, 'The best teacher is experience learned from failures.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(56, 'Think how hard physics would be if particles could think.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(57, 'Love is the flower you\'ve got to let grow.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(58, 'Don\'t wait. The time will never be just right.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(59, 'Time is the wisest counsellor of all.', 'Michelle', 'Pericles', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(60, 'You give before you get.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(61, 'Wisdom begins in wonder.', 'Michelle', 'Socrates', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(62, 'Without courage, wisdom bears no fruit.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(63, 'Change in all things is sweet.', 'Michelle', 'Aristotle', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(64, 'What you fear is that which requires action to overcome.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(65, 'When performance exceeds ambition, the overlap is called success.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(66, 'When deeds speak, words are nothing.', 'Michelle', 'African proverb', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(67, 'Real magic in relationships means an absence of judgement of others.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(68, 'I never think of the future. It comes soon enough.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(69, 'Skill to do comes of doing.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(70, 'Wisdom is the supreme part of happiness.', 'Michelle', 'Sophocles', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(71, 'I believe that every person is born with talent.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(72, 'Important principles may, and must, be inflexible.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(73, 'The undertaking of a new action brings new strength.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(74, 'The years teach much which the days never know.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(75, 'Our distrust is very expensive.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(76, 'All know the way; few actually walk it.', 'Michelle', 'Bodhidharma', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(77, 'Great talent finds happiness in execution.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(78, 'Faith in oneself is the best and safest course.', 'Michelle', 'Michelangelo', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(79, 'Courage is going from failure to failure without losing enthusiasm.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(80, 'The two most powerful warriors are patience and time.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(81, 'Anticipate the difficult by managing the easy.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(82, 'Those who are free of resentful thoughts surely find peace.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(83, 'A short saying often contains much wisdom.', 'Michelle', 'Sophocles', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(84, 'It takes both sunshine and rain to make a rainbow.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(85, 'A beautiful thing is never perfect.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(86, 'Only do what your heart tells you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(87, 'Life is movement-we breathe, we eat, we walk, we move!', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(88, 'No one can make you feel inferior without your consent.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(89, 'Argue for your limitations, and sure enough theyre yours.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(90, 'Luck is what happens when preparation meets opportunity.', 'Michelle', 'Seneca', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(91, 'Victory belongs to the most persevering.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(92, 'Love all, trust a few, do wrong to none.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(93, 'In order to win, you must expect to win.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(94, 'A goal is a dream with a deadline.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(95, 'You can do it if you believe you can!', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(96, 'Set your goals high, and don\'t stop till you get there.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(97, 'Every new day is another chance to change your life.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(98, 'Smile, breathe, and go slowly.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(99, 'Nobody will believe in you unless you believe in yourself.', 'Michelle', 'Liberace', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(100, 'Do more than dream: work.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(101, 'No man was ever wise by chance.', 'Michelle', 'Seneca', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(102, 'Some pursue happiness, others create it.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(103, 'He that is giddy thinks the world turns round.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(104, 'Don\'t ruin the present with the ruined past.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(105, 'Do something wonderful, people may imitate it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(106, 'We do what we do because we believe.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(107, 'Do one thing every day that scares you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(108, 'If you cannot be silent be brilliant and thoughtful.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(109, 'Who looks outside, dreams; who looks inside, awakes.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(110, 'What we think, we become.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(111, 'The shortest answer is doing.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(112, 'All our knowledge has its origins in our perceptions.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(113, 'The harder you fall, the higher you bounce.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(114, 'Trusting our intuition often saves us from disaster.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(115, 'Truth is powerful and it prevails.', 'Michelle', 'Sojourner Truth', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(116, 'Light tomorrow with today!', 'Michelle', '<NAME>ning', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(117, 'Silence is a fence around wisdom.', 'Michelle', 'German proverb', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(118, 'Society develops wit, but its contemplation alone forms genius.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(119, 'The simplest things are often the truest.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(120, 'Everyone smiles in the same language.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(121, 'Yesterday I dared to struggle. Today I dare to win.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(122, 'No alibi will save you from accepting the responsibility.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(123, 'If you can dream it, you can do it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(124, 'It is better to travel well than to arrive.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(125, 'Life shrinks or expands in proportion to one\'s courage.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(126, 'You have to believe in yourself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(127, 'Our intention creates our reality.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(128, 'Silence is a true friend who never betrays.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(129, 'Character develops itself in the stream of life.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(130, 'From little acorns mighty oaks do grow.', 'Michelle', 'American proverb', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(131, 'You can\'t stop the waves, but you can learn to surf.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(132, 'Reality does not conform to the ideal, but confirms it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(133, 'Speak low, if you speak love.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(134, 'A really great talent finds its happiness in execution.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(135, 'Reality leaves a lot to the imagination.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(136, 'The greatest remedy for anger is delay.', 'Michelle', 'Seneca', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(137, 'Growth itself contains the germ of happiness.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(138, 'You can do what\'s reasonable or you can decide what\'s possible.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(139, 'Nothing strengthens authority so much as silence.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(140, 'Wherever you go, go with all your heart.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(141, 'The only real valuable thing is intuition.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(142, 'Good luck is another name for tenacity of purpose.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(143, 'Rainbows apologize for angry skies.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(144, 'Friendship isn\'t a big thing. It\'s a million little things.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(145, 'Time is the most valuable thing a man can spend.', 'Michelle', 'Theophrastus', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(146, 'Whatever happens, take responsibility.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(147, 'Experience is simply the name we give our mistakes.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(148, 'I think and that is all that I am.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(149, 'A good plan today is better than a perfect plan tomorrow.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(150, 'If the shoe doesn\'t fit, must we change the foot?', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(151, 'Each day provides its own gifts.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(152, 'While we stop to think, we often miss our opportunity.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(153, 'Life isn\'t about finding yourself. Life is about creating yourself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(154, 'To bring anything into your life, imagine that it\'s already there.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(155, 'Begin to weave and God will give you the thread.', 'Michelle', 'German proverb', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(156, 'The more you know yourself, the more you forgive yourself.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(157, 'Someone remembers, someone cares; your name is whispered in someone\'s prayers.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(158, 'Without faith, nothing is possible. With it, nothing is impossible.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(159, 'Once we accept our limits, we go beyond them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(160, 'Don\'t be pushed by your problems; be led by your dreams.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(161, 'Whatever we expect with confidence becomes our own self-fulfilling prophecy.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(162, 'Everything you can imagine is real.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(163, 'Fear is a darkroom where negatives develop.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(164, 'The truest wisdom is a resolute determination.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(165, 'Life is the flower for which love is the honey.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(166, 'Freedom is the right to live as we wish.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(167, 'Change your thoughts, change your life!', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(168, 'Never ignore a gut feeling, but never believe that it\'s enough.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(169, 'Loss is nothing else but change,and change is Natures delight.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(170, 'Someone is special only if you tell them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(171, 'Today is the tomorrow you worried about yesterday.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(172, 'There is no way to happiness, happiness is the way.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(173, 'The day always looks brighter from behind a smile.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(174, 'A stumble may prevent a fall.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(175, 'He who talks more is sooner exhausted.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(176, 'He who is contented is rich.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(177, 'What we achieve inwardly will change outer reality.', 'Michelle', 'Plutarch', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(178, 'Our strength grows out of our weaknesses.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(179, 'We must become the change we want to see.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(180, 'Happiness is found in doing, not merely possessing.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(181, 'Put your future in good hands your own.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(182, 'We choose our destiny in the way we treat others.', 'Michelle', 'Wit', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(183, 'No snowflake in an avalanche ever feels responsible.', 'Michelle', 'Voltaire', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(184, 'Fortune favours the brave.', 'Michelle', 'Virgil', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(185, 'I believe in one thing only, the power of human will.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(186, 'The best way out is always through.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(187, 'The mind unlearns with difficulty what it has long learned.', 'Michelle', 'Seneca', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(188, 'I destroy my enemies when I make them my friends.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(189, 'No garden is without its weeds.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(190, 'There is no failure except in no longer trying.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(191, 'Kind words will unlock an iron door.', 'Michelle', 'Turkish proverb', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(192, 'Problems are only opportunities with thorns on them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(193, 'Life is just a chance to grow a soul.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(194, 'Mountains cannot be surmounted except by winding paths.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(195, 'May our hearts garden of awakening bloom with hundreds of flowers.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(196, 'Fortune befriends the bold.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(197, 'Keep true to the dreams of thy youth.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(198, 'You\'re never a loser until you quit trying.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(199, 'Science is organized knowledge. Wisdom is organized life.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(200, 'Knowing is not enough; we must apply!', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(201, 'Strong beliefs win strong men, and then make them stronger.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(202, 'Autumn is a second spring when every leaf is a flower.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(203, 'If you surrender to the wind, you can ride it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(204, 'Keep yourself to the sunshine and you cannot see the shadow.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(205, 'Write your plans in pencil and give God the eraser.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(206, 'Inspiration exists, but it has to find us working.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(207, 'Pick battles big enough to matter, small enough to win.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(208, 'Don\'t compromise yourself. You are all you\'ve got.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(209, 'A short saying oft contains much wisdom.', 'Michelle', 'Sophocles', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(210, 'Difficulties are things that show a person what they are.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(211, 'When you doubt your power, you give power to your doubt.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(212, 'The cause is hidden. The effect is visible to all.', 'Michelle', 'Ovid', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(213, 'A prudent question is one half of wisdom.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(214, 'The path to success is to take massive, determined action.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(215, 'I allow my intuition to lead my path.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(216, 'Nature takes away any faculty that is not used.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(217, 'If you wish to be a writer, write.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(218, 'There is no way to prosperity, prosperity is the way.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(219, 'Either you run the day or the day runs you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(220, 'Better be ignorant of a matter than half know it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(221, 'Follow your instincts. That is where true wisdom manifests itself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(222, 'There never was a good knife made of bad steel.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(223, 'To accomplish great things, we must dream as well as act.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(224, 'Patience is the companion of wisdom.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(225, 'The mind is everything. What you think you become.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(226, 'To enjoy life, we must touch much of it lightly.', 'Michelle', 'Voltaire', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(227, 'To fly, we have to have resistance.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(228, 'What you see depends on what you\'re looking for.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(229, 'The heart has its reasons which reason knows not of.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(230, 'Be great in act, as you have been in thought.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(231, 'Imagination rules the world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(232, 'Kind words do not cost much. Yet they accomplish much.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(233, 'There is no greater harm than that of time wasted.', 'Michelle', 'Michelangelo', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(234, 'Intuition will tell the thinking mind where to look next.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(235, 'Worry gives a small thing a big shadow.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(236, 'Fears are nothing more than a state of mind.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(237, 'The journey of a thousand miles begins with one step.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(238, 'Efficiency is doing things right; effectiveness is doing the right things.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(239, 'Blaze with the fire that is never extinguished.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(240, 'Don\'t cry because it\'s over. Smile because it happened.', 'Michelle', 'Dr. Seuss', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(241, 'No is easier to do. Yes is easier to say.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(242, 'To be wrong is nothing unless you continue to remember it.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(243, 'Yesterdays home runs don\'t win today\'s games.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(244, 'Silence is deep as Eternity, Speech is shallow as Time.', 'Michelle', 'Carlyle', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(245, 'Don\'t smother each other. No one can grow in the shade.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(246, 'An ant on the move does more than a dozing ox', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(247, 'You can\'t shake hands with a clenched fist.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(248, 'A good decision is based on knowledge and not on numbers.', 'Michelle', 'Plato', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(249, 'The cautious seldom err.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(250, 'If there is no struggle, there is no progress.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(251, 'Where there is great love, there are always miracles.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(252, 'Time you enjoy wasting, was not wasted.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(253, 'Every problem has a gift for you in its hands.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(254, 'Sadness flies away on the wings of time.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(255, 'I have often regretted my speech, never my silence.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(256, 'Never put off till tomorrow what you can do today.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(257, 'Minds are like parachutes. They only function when open.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(258, 'If a man does his best, what else is there?', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(259, 'The secret of success is constancy to purpose.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(260, 'Life is a progress, and not a station.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(261, 'All seasons are beautiful for the person who carries happiness within.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(262, 'To avoid criticism, do nothing, say nothing, be nothing.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(263, 'All things change; nothing perishes.', 'Michelle', 'Ovid', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(264, 'Absence makes the heart grow fonder.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(265, 'Imagination is the highest kite one can fly.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(266, 'The beginning of knowledge is the discovery of something we do not understand.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(267, 'Love doesn\'t make the world go round, love is what makes the ride worthwhile.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(268, 'Whenever you have eliminated the impossible, whatever remains, however improbable, must be the truth.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(269, 'Good timber does not grow with ease; the stronger the wind, the stronger the trees.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(270, 'I believe that we are fundamentally the same and have the same basic potential.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(271, 'The winds and waves are always on the side of the ablest navigators.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(272, 'The future belongs to those who believe in the beauty of their dreams.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(273, 'To get something you never had, you have to do something you never did.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(274, 'Be thankful when you don\'t know something for it gives you the opportunity to learn.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(275, 'Strength does not come from physical capacity. It comes from an indomitable will.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(276, 'Each misfortune you encounter will carry in it the seed of tomorrows good luck.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(277, 'To forgive is to set a prisoner free and realize that prisoner was you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(278, 'In separateness lies the world\'s great misery, in compassion lies the world\'s true strength.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(279, 'By believing passionately in something that does not yet exist, we create it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(280, 'Letting go is not the end of the world; it is the beginning of a new life.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(281, 'All the great performers I have worked with are fuelled by a personal dream.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(282, 'One of the advantages of being disorderly is that one is constantly making exciting discoveries.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(283, 'I never see what has been done; I only see what remains to be done.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(284, 'Begin at once to live and count each separate day as a separate life.', 'Michelle', 'Seneca', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(285, 'If you don\'t know where you are going, you will probably end up somewhere else.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(286, 'It is not so important to know everything as to appreciate what we learn.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(287, 'The bird of paradise alights only upon the hand that does not grasp.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(288, 'Think as a wise man but communicate in the language of the people.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(289, 'Practice yourself, for heavens sake in little things, and then proceed to greater.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(290, 'If one does not know to which port is sailing, no wind is favorable.', 'Michelle', 'Seneca', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(291, 'Our greatest glory is not in never failing but rising everytime we fall.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(292, 'Being right is highly overrated. Even a stopped clock is right twice a day.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(293, 'To be upset over what you don\'t have is to waste what you do have.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(294, 'If we did the things we are capable of, we would astound ourselves.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(295, 'Nothing in life is to be feared. It is only to be understood.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(296, 'Successful people ask better questions, and as a result, they get better answers.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(297, 'Love is not blind; it simply enables one to see things others fail to see.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(298, 'Life is a process. We are a process. The universe is a process.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(299, 'I think somehow we learn who we really are and then live with that decision.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(300, 'We learn what we have said from those who listen to our speaking.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(301, 'A little knowledge that acts is worth infinitely more than much knowledge that is idle.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(302, 'If you get up one more time than you fall, you will make it through.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(303, 'The doors we open and close each day decide the lives we live.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(304, 'The worst bankrupt in the world is the person who has lost his enthusiasm.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(305, 'Happiness comes when your work and words are of benefit to yourself and others.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(306, 'Don\'t focus on making the right decision, focus on making the decision the right one.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(307, 'Everything is perfect in the universe even your desire to improve it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(308, 'The universe is full of magical things, patiently waiting for our wits to grow sharper.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(309, 'Just as a candle cannot burn without fire, men cannot live without a spiritual life.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(310, 'A thing long expected takes the form of the unexpected when at last it comes.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(311, 'Action may not always bring happiness; but there is no happiness without action.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(312, 'I don\'t believe in failure. It is not failure if you enjoyed the process.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(313, 'What you do not want done to yourself, do not do to others.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(314, 'Short words are best and the old words when short are best of all.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32');
INSERT INTO `motivation_monday` (`id`, `quote`, `posted_by`, `author`, `image`, `status`, `created_at`, `updated_at`) VALUES
(315, 'If you light a lamp for somebody, it will also brighten your path.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(316, 'I have done my best: that is about all the philosophy of living one needs.', 'Michelle', 'Lin-yutang', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(317, 'Through perseverance many people win success out of what seemed destined to be certain failure.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(318, 'Give thanks for the rain of life that propels us to reach new horizons.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(319, 'Love is just a word until someone comes along and gives it meaning.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(320, 'We all have problems. The way we solve them is what makes us different.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(321, 'The secret to a rich life is to have more beginnings than endings.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(322, 'It is only when the mind and character slumber that the dress can be seen.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(323, 'If you don\'t like something, change it. If you can\'t change it, change your attitude.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(324, 'Reviewing what you have learned and learning anew, you are fit to be a teacher.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(325, 'The world is a book, and those who do not travel read only a page.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(326, 'So long as a person is capable of self-renewal they are a living being.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(327, 'I\'m not afraid of storms, for I\'m learning how to sail my ship.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(328, 'Think for yourselves and let others enjoy the privilege to do so too.', 'Michelle', 'Voltaire', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(329, 'How we spend our days is, of course, how we spend our lives.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(330, 'It has never been my object to record my dreams, just to realize them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(331, 'The most complicated achievements of thought are possible without the assistance of consciousness.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(332, 'Be miserable. Or motivate yourself. Whatever has to be done, it\'s always your choice.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(333, 'Most great people have attained their greatest success just one step beyond their greatest failure.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(334, 'If you think you can, you can. And if you think you can\'t, you\'re right.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(335, 'Better to have loved and lost, than to have never loved at all.', 'Michelle', 'St. Augustine', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(336, 'Everyone thinks of changing the world, but no one thinks of changing himself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(337, 'The best way to pay for a lovely moment is to enjoy it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(338, 'You have enemies? Good. That means you\'ve stood up for something, sometime in your life.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(339, 'Slow down and everything you are chasing will come around and catch you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(340, 'Your worst enemy cannot harm you as much as your own unguarded thoughts.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(341, 'I always wanted to be somebody, but I should have been more specific.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(342, 'Yeah we all shine on, like the moon, and the stars, and the sun.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(343, 'Knowledge is a process of piling up facts; wisdom lies in their simplification.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(344, 'Life is like riding a bicycle. To keep your balance you must keep moving.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(345, 'We should all be thankful for those people who rekindle the inner spirit.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(346, 'Opportunity is missed by most because it is dressed in overalls and looks like work.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(347, 'Feeling and longing are the motive forces behind all human endeavor and human creations.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(348, 'In the end we retain from our studies only that which we practically apply.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(349, 'If you correct your mind, the rest of your life will fall into place.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(350, 'The world makes way for the man who knows where he is going.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(351, 'When your desires are strong enough you will appear to possess superhuman powers to achieve.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(352, 'Patience and perseverance have a magical effect before which difficulties disappear and obstacles vanish.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(353, 'I cannot make my days longer so I strive to make them better.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(354, 'Tension is who you think you should be. Relaxation is who you are.', 'Michelle', 'Chinese proverb', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(355, 'Never bend your head. Always hold it high. Look the world right in the eye.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(356, 'One who gains strength by overcoming obstacles possesses the only strength which can overcome adversity.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(357, 'We cannot do everything at once, but we can do something at once.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(358, 'You have to do your own growing no matter how tall your grandfather was.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(359, 'Invent your world. Surround yourself with people, color, sounds, and work that nourish you.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:32', '2021-07-03 06:04:32'),
(360, 'It is fatal to enter any war without the will to win it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(361, 'Be what you are. This is the first step toward becoming better than you are.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(362, 'There is nothing in a caterpillar that tells you it\'s going to be a butterfly.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(363, 'Love and compassion open our own inner life, reducing stress, distrust and loneliness.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(364, 'Ideals are an imaginative understanding of that which is desirable in that which is possible.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(365, 'The superior man is satisfied and composed; the mean man is always full of distress.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(366, 'If you spend too much time thinking about a thing, you\'ll never get it done.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(367, 'The way is not in the sky. The way is in the heart.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(368, 'Most people are about as happy as they make up their minds to be', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(369, 'Three things cannot be long hidden: the sun, the moon, and the truth.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(370, 'More often than not, anger is actually an indication of weakness rather than of strength.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(371, 'Before you put on a frown, make absolutely sure there are no smiles available.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(372, 'A man of ability and the desire to accomplish something can do anything.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(373, 'You, yourself, as much as anybody in the entire universe, deserve your love and affection.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(374, 'It is not uncommon for people to spend their whole life waiting to start living.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(375, 'Don\'t be afraid to go out on a limb. That\'s where the fruit is.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(376, 'Wicked people are always surprised to find ability in those that are good.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(377, 'Life is so constructed that an event does not, cannot, will not, match the expectation.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(378, 'If you change the way you look at things, the things you look at change.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(379, 'No man can succeed in a line of endeavor which he does not like.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(380, 'You will not be punished for your anger, you will be punished by your anger.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(381, 'Don\'t judge each day by the harvest you reap but by the seeds you plant.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(382, 'They say that time changes things, but you actually have to change them yourself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(383, 'Never apologize for showing feelings. When you do so, you apologize for the truth.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(384, 'The truth you believe and cling to makes you unavailable to hear anything new.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(385, 'Adversity has the effect of eliciting talents, which in prosperous circumstances would have lain dormant.', 'Michelle', 'Horace', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(386, 'If you spend your whole life waiting for the storm, you\'ll never enjoy the sunshine.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(387, 'The only limit to our realization of tomorrow will be our doubts of today.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(388, 'Every action of our lives touches on some chord that will vibrate in eternity.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(389, 'Shoot for the moon. Even if you miss, you\'ll land among the stars.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(390, 'It does not matter how slowly you go as long as you do not stop.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(391, 'Every day may not be good, but there\'s something good in every day.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(392, 'Most folks are about as happy as they make up their minds to be.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(393, 'If you would take, you must first give, this is the beginning of intelligence.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(394, 'Some people think it\'s holding that makes one strong sometimes it\'s letting go.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(395, 'It is on our failures that we base a new and different and better success.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(396, 'Quality is never an accident; it is always the result of intelligent effort.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(397, 'To study and not think is a waste. To think and not study is dangerous.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(398, 'Life is a succession of lessons, which must be lived to be understood.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(399, 'Time changes everything except something within us which is always surprised by change.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(400, 'You are important enough to ask and you are blessed enough to receive back.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(401, 'If you cannot do great things, do small things in a great way.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(402, 'If you want your life to be more rewarding, you have to change the way you think.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(403, 'Transformation doesn\'t take place with a vacuum; instead, it occurs when we are indirectly and directly connected to all those around us.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(404, 'The only difference between your abilities and others is the ability to put yourself in their shoes and actually try.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(405, 'The free man is he who does not fear to go to the end of his thought.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(406, 'Great are they who see that spiritual is stronger than any material force, that thoughts rule the world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(407, 'A life spent making mistakes is not only more honourable but more useful than a life spent in doing nothing.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(408, 'The wise man does not lay up his own treasures. The more he gives to others, the more he has for his own.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(409, 'Don\'t leave a stone unturned. It\'s always something, to know you have done the most you could.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(410, 'By going beyond your own problems and taking care of others, you gain inner strength, self-confidence, courage, and a greater sense of calm.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(411, 'We come to love not by finding a perfect person, but by learning to see an imperfect person perfectly.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(412, 'What lies behind us and what lies before us are tiny matters compared to what lies within us.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(413, 'There are things so deep and complex that only intuition can reach it in our stage of development as human beings.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(414, 'A little more persistence, a little more effort, and what seemed hopeless failure may turn to glorious success.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(415, 'There is no retirement for an artist, it\'s your way of living so there is no end to it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(416, 'I will not be concerned at other men is not knowing me;I will be concerned at my own want of ability.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(417, 'Why worry about things you cannot control when you can keep yourself busy controlling the things that depend on you?', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(418, 'When you are content to be simply yourself and don\'t compare or compete, everybody will respect you.', 'Michelle', 'Laozi', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(419, 'Be not afraid of greatness: some are born great, some achieve greatness, and some have greatness thrust upon them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(420, 'Success means having the courage, the determination, and the will to become the person you believe you were meant to be.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(421, 'Do you want to know who you are? Don\'t ask. Act! Action will delineate and define you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(422, 'It is only with the heart that one can see rightly, what is essential is invisible to the eye.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(423, 'Let us be grateful to people who make us happy; they are the charming gardeners who make our souls blossom.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(424, 'Make the best use of what is in your power, and take the rest as it happens.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(425, 'The thoughts we choose to think are the tools we use to paint the canvas of our lives.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(426, 'No matter how carefully you plan your goals they will never be more that pipe dreams unless you pursue them with gusto.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(427, 'The reason most goals are not achieved is that we spend our time doing second things first.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(428, 'If your actions inspire others to dream more, learn more, do more and become more, you are a leader.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(429, 'I\'m a great believer in luck and I find the harder I work, the more I have of it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(430, 'Do not waste yourself in rejection, nor bark against the bad, but chant the beauty of the good.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(431, 'The person born with a talent they are meant to use will find their greatest happiness in using it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(432, 'Good people are good because they\'ve come to wisdom through failure. We get very little wisdom from success, you know.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(433, 'Your destiny isn\'t just fate; it is how you use your own developed abilities to get what you want.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(434, 'Iron rusts from disuse; water loses its purity from stagnation... even so does inaction sap the vigour of the mind.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(435, 'A subtle thought that is in error may yet give rise to fruitful inquiry that can establish truths of great value.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(436, 'Be glad of life because it gives you the chance to love, to work, to play, and to look up at the stars.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(437, 'You got to be careful if you don\'t know where you\'re going, because you might not get there.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(438, 'You can tell whether a man is clever by his answers. You can tell whether a man is wise by his questions.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(439, 'Life is a gift, and it offers us the privilege, opportunity, and responsibility to give something back by becoming more', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(440, 'You can\'t let praise or criticism get to you. It\'s a weakness to get caught up in either one.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(441, 'I will love the light for it shows me the way, yet I will endure the darkness because it shows me the stars.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(442, 'Our doubts are traitors and make us lose the good we often might win, by fearing to attempt.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(443, 'By nature man hates change; seldom will he quit his old home till it has actually fallen around his ears.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(444, 'Until you value yourself, you won\'t value your time. Until you value your time, you won\'t do anything with it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(445, 'The minute you settle for less than you deserve, you get even less than you settled for.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(446, 'The highest stage in moral ure at which we can arrive is when we recognize that we ought to control our thoughts.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(447, 'It is better to take many small steps in the right direction than to make a great leap forward only to stumble backward.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(448, 'If we have a positive mental attitude, then even when surrounded by hostility, we shall not lack inner peace.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(449, 'There is only one success to be able to spend your life in your own way.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(450, 'Promises are the uniquely human way of ordering the future, making it predictable and reliable to the extent that this is humanly possible.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(451, 'Appreciation is the highest form of prayer, for it acknowledges the presence of good wherever you shine the light of your thankful thoughts.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(452, 'There is only one corner of the universe you can be certain of improving, and that\'s your own self.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(453, 'You\'re not obligated to win. You\'re obligated to keep trying to do the best you can every day.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(454, 'Everyone can taste success when the going is easy, but few know how to taste victory when times get tough.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(455, 'Deep listening is miraculous for both listener and speaker.When someone receives us with open-hearted, non-judging, intensely interested listening, our spirits expand.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(456, 'You may be deceived if you trust too much, but you will live in torment if you don\'t trust enough.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(457, 'Great indeed is the sublimity of the Creative, to which all beings owe their beginning and which permeates all heaven.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(458, 'All that is necessary is to accept the impossible, do without the indispensable, and bear the intolerable.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(459, 'Choose a job you love, and you will never have to work a day in your life.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(460, 'You cannot find yourself by going into the past. You can find yourself by coming into the present.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(461, 'All our talents increase in the using, and the every faculty, both good and bad, strengthen by exercise.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(462, 'In order to live free and happily you must sacrifice boredom. It is not always an easy sacrifice.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(463, 'The fox has many tricks. The hedgehog has but one. But that is the best of all.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(464, 'Of course there is no formula for success except perhaps an unconditional acceptance of life and what it brings.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(465, 'Let me tell you the secret that has led me to my goal: my strength lies solely in my tenacity', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(466, 'Something opens our wings. Something makes boredom and hurt disappear. Someone fills the cup in front of us: We taste only sacredness.', 'Michelle', 'Rumi', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(467, 'We must never forget that it is through our actions, words, and thoughts that we have a choice.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(468, 'We see things not as they are, but as we are. Our perception is shaped by our previous experiences.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(469, 'True silence is the rest of the mind; it is to the spirit what sleep is to the body, nourishment and refreshment.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(470, 'All our knowledge begins with the senses, proceeds then to the understanding, and ends with reason. There is nothing higher than reason.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(471, 'The thought manifests as the word. The word manifests as the deed. The deed develops into habit. And the habit hardens into character.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(472, 'As the rest of the world is walking out the door, your best friends are the ones walking in.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(473, 'Patience is a virtue but you will never ever accomplish anything if you don\'t exercise action over patience.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(474, 'Any of us can achieve virtue, if by virtue we merely mean the avoidance of the vices that do not attract us.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(475, 'If the single man plant himself indomitably on his instincts, and there abide, the huge world will come round to him.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(476, 'Money was never a big motivation for me, except as a way to keep score. The real excitement is playing the game.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(477, 'Friendship with oneself is all important because without it one cannot be friends with anybody else in the world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(478, 'Peace is not something you wish for. It\'s something you make, something you do, something you are, and something you give away.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(479, 'A wise man can learn more from a foolish question than a fool can learn from a wise answer.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(480, 'Every man takes the limits of his own field of vision for the limits of the world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(481, 'One does not discover new lands without consenting to lose sight of the shore for a very long time.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(482, 'What is new in the world? Nothing. What is old in the world? Nothing. Everything has always been and will always be.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(483, 'Genuine love should first be directed at oneself if we do not love ourselves, how can we love others?', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(484, 'Life is like a sewer. What you get out of it depends on what you put into it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(485, 'Notice that the stiffest tree is most easily cracked, while the bamboo or willow survives by bending with the wind.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(486, 'Learn all you can from the mistakes of others. You won\'t have time to make them all yourself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(487, 'Judge nothing, you will be happy. Forgive everything, you will be happier. Love everything, you will be happiest.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(488, 'People are so constituted that everybody would rather undertake what they see others do, whether they have an aptitude for it or not.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(489, 'We are either progressing or retrograding all the while. There is no such thing as remaining stationary in this life.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(490, 'The possession of knowledge does not kill the sense of wonder and mystery. There is always more mystery.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(491, 'Everything that happens happens as it should, and if you observe carefully, you will find this to be so.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(492, 'What we think determines what happens to us, so if we want to change our lives, we need to stretch our minds.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(493, 'In a controversy the instant we feel anger we have already ceased striving for the truth, and have begun striving for ourselves.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(494, 'It is the greatest of all mistakes to do nothing because you can only do little do what you can.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(495, 'When you see a man of worth, think of how you may emulate him. When you see one who is unworthy, examine yourself.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(496, 'Aerodynamically the bumblebee shouldn\'t be able to fly, but the bumblebee doesn\'t know that so it goes on flying anyway.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(497, 'Those who try to do something and fail are infinitely better than those who try nothing and succeed.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(498, 'Snowflakes are one of natures most fragile things, but just look what they can do when they stick together.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(499, 'The first step to getting the things you want out of life is this: decide what you want.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(500, 'Why compare yourself with others? No one in the entire world can do a better job of being you than you.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(501, 'Experience is not what happens to a man. It is what a man does with what happens to him.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(502, 'A good teacher is like a candle it consumes itself to light the way for others.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(503, 'The only thing to do with good advice is to pass it on. It is never of any use to oneself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(504, 'Life is not measured by the breaths we take, but by the moments that take our breath.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(505, 'The smallest flower is a thought, a life answering to some feature of the Great Whole, of whom they have a persistent intuition.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(506, 'Consider how hard it is to change yourself and you\'ll understand what little chance you have in trying to change others.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(507, 'If you\'ll not settle for anything less than your best, you will be amazed at what you can accomplish in your lives.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(508, 'What lies behind us and what lies before us are small matters compared to what lies within us.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(509, 'With the realization of ones own potential and self-confidence in ones ability, one can build a better world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(510, 'There is nothing like returning to a place that remains unchanged to find the ways in which you yourself have altered.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(511, 'Forget about all the reasons why something may not work. You only need to find one good reason why it will.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(512, 'It is the mark of an educated mind to be able to entertain a thought without accepting it.', 'Michelle', 'Aristotle', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(513, 'Love is never lost. If not reciprocated, it will flow back and soften and purify the heart.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(514, 'We all live with the objective of being happy; our lives are all different and yet the same.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(515, 'Many people think of prosperity that concerns money only to forget that true prosperity is of the mind.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(516, 'To be beautiful means to be yourself. You do not need to be accepted by others. You need to accept yourself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(517, 'Do not overrate what you have received, nor envy others. He who envies others does not obtain peace of mind.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(518, 'It is very easy to forgive others their mistakes; it takes more grit to forgive them for having witnessed your own.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(519, 'Bodily exercise, when compulsory, does no harm to the body; but knowledge which is acquired under compulsion obtains no hold on the mind.', 'Michelle', 'Plato', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(520, 'Always be yourself, express yourself, have faith in yourself, do not go out and look for a successful personality and duplicate it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(521, 'Let us revere, let us worship, but erect and open-eyed, the highest, not the lowest; the future, not the past!', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(522, 'Every time you smile at someone, it is an action of love, a gift to that person, a beautiful thing.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(523, 'Silences make the real conversations between friends. Not the saying but the never needing to say is what counts.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(524, 'The key to transforming our hearts and minds is to have an understanding of how our thoughts and emotions work.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(525, 'If you must tell me your opinions, tell me what you believe in. I have plenty of douts of my own.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(526, 'Chance is always powerful. Let your hook be always cast; in the pool where you least expect it, there will be a fish.', 'Michelle', 'Ovid', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(527, 'I seek constantly to improve my manners and graces, for they are the sugar to which all are attracted.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(528, 'We never understand how little we need in this world until we know the loss of it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(529, 'The real measure of your wealth is how much youd be worth if you lost all your money.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(530, 'To keep the body in good health is a duty... otherwise we shall not be able to keep our mind strong and clear.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(531, 'Take no thought of who is right or wrong or who is better than. Be not for or against.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(532, 'I am a man of fixed and unbending principles, the first of which is to be flexible at all times.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(533, 'Today, give a stranger a smile without waiting for it may be the joy they need to have a great day.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(534, 'The moment one gives close attention to anything, even a blade of grass, it becomes a mysterious, awesome, indescribably magnificent world in itself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(535, 'At the center of your being you have the answer; you know who you are and you know what you want.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(536, 'How wonderful that we have met with a paradox. Now we have some hope of making progress.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(537, 'Everyone is a genius at least once a year. A real genius has his original ideas closer together.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(538, 'Dreams pass into the reality of action. From the actions stems the dream again; and this interdependence produces the highest form of living.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(539, 'Without leaps of imagination, or dreaming, we lose the excitement of possibilities. Dreaming, after all, is a form of planning.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(540, 'Sadness may be part of life but there is no need to let it dominate your entire life.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(541, 'Keeping a little ahead of conditions is one of the secrets of business, the trailer seldom goes far.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(542, 'Nature gave us one tongue and two ears so we could hear twice as much as we speak.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(543, 'Don\'t wait for your feelings to change to take the action. Take the action and your feelings will change.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(544, 'You are always free to change your mind and choose a different future, or a different past.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(545, 'You were not born a winner, and you were not born a loser. You are what you make yourself be.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(546, 'Cherish your visions and your dreams as they are the children of your soul, the blueprints of your ultimate achievements.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(547, 'Cherish your visions and your dreams as they are the children of your soul; the blueprints of your ultimate achievements.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(548, 'To be what we are, and to become what we are capable of becoming, is the only end of life.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(549, 'The road leading to a goal does not separate you from the destination; it is essentially a part of it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(550, 'Take things as they are. Punch when you have to punch. Kick when you have to kick.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(551, 'I believe that a simple and unassuming manner of life is best for everyone, best both for the body and the mind.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(552, 'Though no one can go back and make a brand new start, anyone can start from now and make a brand new ending.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(553, 'Mind is everything: muscle, pieces of rubber. All that I am, I am because of my mind.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(554, 'How wonderful it is that nobody need wait a single moment before starting to improve the world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(555, 'A friend is someone who understands your past, believes in your future, and accepts you just the way you are.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(556, 'It is one of the blessings of old friends that you can afford to be stupid with them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(557, 'He that never changes his opinions, never corrects his mistakes, and will never be wiser on the morrow than he is today.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(558, 'Give me six hours to chop down a tree and I will spend the first four sharpening the axe.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33');
INSERT INTO `motivation_monday` (`id`, `quote`, `posted_by`, `author`, `image`, `status`, `created_at`, `updated_at`) VALUES
(559, 'One must be fond of people and trust them if one is not to make a mess of life.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(560, 'We cannot change our memories, but we can change their meaning and the power they have over us.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(561, 'Being in humaneness is good. If we select other goodness and thus are far apart from humaneness, how can we be the wise?', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(562, 'To give hope to someone occurs when you teach them how to use the tools to do it for themselves.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(563, 'Id rather regret the things that I have done than the things that I have not done.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(564, 'The past has no power to stop you from being present now. Only your grievance about the past can do that.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(565, 'If the stars should appear but one night every thousand years how man would marvel and adore.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(566, 'There are two kinds of failures: those who thought and never did, and those who did and never thought.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(567, 'I\'m not interested in age. People who tell me their age are silly. You\'re as old as you feel.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(568, 'I find hope in the darkest of days, and focus in the brightest. I do not judge the universe.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(569, 'When it is obvious that the goals cannot be reached, don\'t adjust the goals, adjust the action steps.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(570, 'Our virtues and our failings are inseparable, like force and matter. When they separate, man is no more.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(571, 'Blessed is the person who is too busy to worry in the daytime, and too sleepy to worry at night.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(572, 'He can who thinks he can, and he can\'t who thinks he can\'t. This is an inexorable, indisputable law.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(573, 'These days people seek knowledge, not wisdom. Knowledge is of the past, wisdom is of the future.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(574, 'One secret of success in life is for a man to be ready for his opportunity when it comes.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(575, 'People take different roads seeking fulfilment and happiness. Just because theyre not on your road doesn\'t mean they\'ve gotten lost.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(576, 'The shoe that fits one person pinches another; there is no recipe for living that suits all cases.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(577, 'There are only two mistakes one can make along the road to truth; not going all the way, and not starting.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(578, 'Very little is needed to make a happy life; it is all within yourself, in your way of thinking.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(579, 'Giving up doesn\'t always mean you are weak. Sometimes it means that you are strong enough to let go.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(580, 'Treat people as if they were what they ought to be and you help them to become what they are capable of being.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(581, 'The most precious gift we can offer anyone is our attention. When mindfulness embraces those we love, they will bloom like flowers.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(582, 'If you focus on results, you will never change. If you focus on change, you will get results.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(583, 'I would maintain that thanks are the highest form of thought, and that gratitude is happiness doubled by wonder.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(584, 'There are two primary choices in life: to accept conditions as they exist, or accept the responsibility for changing them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(585, 'All difficult things have their origin in that which is easy, and great things in that which is small.', 'Michelle', 'Lao-Tzu', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(586, 'You can be what you want to be. You have the power within and we will help you always.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(587, 'To speak gratitude is courteous and pleasant, to enact gratitude is generous and noble, but to live gratitude is to touch Heaven.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(588, 'Wisdom is the reward you get for a lifetime of listening when you\'d have preferred to talk.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(589, 'The greatest pleasure I know is to do a good action by stealth, and to have it found out by accident.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(590, 'When one tugs at a single thing in nature, he finds it attached to the rest of the world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(591, 'Courage is what it takes to stand up and speak; courage is also what it takes to sit down and listen.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(592, 'The most beautiful things in the world cannot be seen or even touched. They must be felt with the heart.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(593, 'To live a pure unselfish life, one must count nothing as ones own in the midst of abundance.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(594, 'Many of life\'s failures are people who did not realize how close they were to success when they gave up.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(595, 'When we seek to discover the best in others, we somehow bring out the best in ourselves.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(596, 'If you accept the expectations of others, especially negative ones, then you never will change the outcome.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(597, 'A man may fulfil the object of his existence by asking a question he cannot answer, and attempting a task he cannot achieve.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(598, 'I am not bothered by the fact that I am unknown. I am bothered when I do not know others.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(599, 'He is a wise man who does not grieve for the things which he has not, but rejoices for those which he has.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(600, 'I am always doing that which I cannot do, in order that I may learn how to do it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(601, 'If you\'re walking down the right path and you\'re willing to keep walking, eventually you\'ll make progress.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(602, 'The world is round and the place which may seem like the end may also be the beginning.', 'Michelle', 'Ivy Baker Priest', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(603, 'Never miss an opportunity to make others happy, even if you have to leave them alone in order to do it.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(604, 'Give it all you\'ve got because you never know if there\'s going to be a next time.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(605, 'You have to take it as it happens, but you should try to make it happen the way you want to take it.', 'Michelle', 'Old German proverb', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(606, 'Nothing is predestined: The obstacles of your past can become the gateways that lead to new beginnings.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(607, 'I\'m not in this world to live up to your expectations and you\'re not in this world to live up to mine.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(608, 'Sometimes your joy is the source of your smile, but sometimes your smile can be the source of your joy.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(609, 'I can\'t imagine a person becoming a success who doesn\'t give this game of life everything hes got.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(610, 'The greatest way to live with honor in this world is to be what we pretend to be.', 'Michelle', 'Socrates', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(611, 'The conditions of conquest are always easy. We have but to toil awhile, endure awhile, believe always, and never turn back.', 'Michelle', 'Seneca', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(612, 'The grand essentials of happiness are: something to do, something to love, and something to hope for.', 'Michelle', 'Chalmers', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(613, 'By living deeply in the present moment we can understand the past better and we can prepare for a better future.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(614, 'Do not be too timid and squeamish about your reactions. All life is an experiment. The more experiments you make the better.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(615, 'Do not go where the path may lead, go instead where there is no path and leave a trail.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(616, 'There is no duty we so underrate as the duty of being happy. By being happy we sow anonymous benefits upon the world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(617, 'Edison failed 10,000 times before he made the electric light. Do not be discouraged if you fail a few times.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(618, 'Yesterday is history. Tomorrow is a mystery. And today? Today is a gift that\'s why they call it the present.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(619, 'The only way to tell the truth is to speak with kindness. Only the words of a loving man can be heard.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(620, 'The greatest good you can do for another is not just to share your riches but to reveal to him his own.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(621, 'You can only grow if you\'re willing to feel awkward and uncomfortable when you try something new.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(622, 'To free us from the expectations of others, to give us back to ourselves there lies the great, singular power of self-respect.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(623, 'It is more important to know where you are going than to get there quickly. Do not mistake activity for achievement.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(624, 'When you don\'t know what you believe, everything becomes an argument. Everything is debatable. But when you stand for something, decisions are obvious.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(625, 'Intuition is the supra-logic that cuts out all the routine processes of thought and leaps straight from the problem to the answer.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(626, 'The thing always happens that you really believe in; and the belief in a thing makes it happen.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(627, 'A true friend is the most precious of all possessions and the one we take the least thought about acquiring.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(628, 'There is only one way to happiness and that is to cease worrying about things which are beyond the power of our will.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(629, 'Appreciation can make a day, even change a life. Your willingness to put it into words is all that is necessary.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(630, 'Every sixty seconds you spend angry, upset or mad, is a full minute of happiness you will never get back.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(631, 'This world, after all our science and sciences, is still a miracle; wonderful, inscrutable, magical and more, to whosoever will think of it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(632, 'Every great mistake has a halfway moment, a split second when it can be recalled and perhaps remedied.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(633, 'You can adopt the attitude there is nothing you can do, or you can see the challenge as your call to action.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(634, 'The happiness of a man in this life does not consist in the absence but in the mastery of his passions.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(635, 'Never doubt that a small group of thoughtful, committed people can change the world. Indeed. It is the only thing that ever has.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(636, 'Let your hook always be cast; in the pool where you least expect it, there will be a fish.', 'Michelle', 'Ovid', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(637, 'You get peace of mind not by thinking about it or imagining it, but by quietening and relaxing the restless mind.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(638, 'Your friends will know you better in the first minute you meet than your acquaintances will know you in a thousand years.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(639, 'When you are content to be simply yourself and don\'t compare or compete, everybody will respect you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(640, 'When you begin to touch your heart or let your heart be touched, you begin to discover that it\'s bottomless.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(641, 'If you love someone, set them free. If they come back they\'re yours; if they don\'t they never were.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(642, 'Wisdom is knowing what to do next; Skill is knowing how ot do it, and Virtue is doing it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(643, 'Bad things are not the worst things that can happen to us. Nothing is the worst thing that can happen to us!', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(644, 'No valid plans for the future can be made by those who have no capacity for living now.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(645, 'The aim of life is self-development. To realize ones nature perfectly that is what each of us is here for.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(646, 'To accomplish great things, we must not only act, but also dream; not only plan, but also believe.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(647, 'The first requisite for success is the ability to apply your physical and mental energies to one problem incessantly without growing weary.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(648, 'If we could learn to like ourselves, even a little, maybe our cruelties and angers might melt away.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(649, 'If we are facing in the right direction, all we have to do is keep on walking.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(650, 'Remember always that you not only have the right to be an individual, you have an obligation to be one.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(651, 'There are two primary choices in life: to accept conditions as they exist, or accept responsibility for changing them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(652, 'If you seek truth you will not seek victory by dishonourable means, and if you find truth you will become invincible.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(653, 'Through meditation and by giving full attention to one thing at a time, we can learn to direct attention where we choose.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(654, 'We could never learn to be brave and patient if there were only joy in the world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(655, 'If it is not right do not do it; if it is not true do not say it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(656, 'The truth of the matter is that you always know the right thing to do. The hard part is doing it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(657, 'Some people thrive on huge, dramatic change. Some people prefer the slow and steady route. Do what\'s right for you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(658, 'Man is equally incapable of seeing the nothingness from which he emerges and the infinity in which he is engulfed.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(659, 'Arrogance and rudeness are training wheels on the bicycle of life for weak people who cannot keep their balance without them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(660, 'If you are patient in one moment of anger, you will escape one hundred days of sorrow.', 'Michelle', 'Chinese proverb', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(661, 'When you have got an elephant by the hind legs and he is trying to run away, it\'s best to let him run.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(662, 'Courage is not about taking risks unknowingly, but putting your own being in front of challenges that others may not be able to.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(663, 'Can miles truly separate you from friends... If you want to be with someone you love, aren\'t you already there?', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(664, 'The poor man is not he who is without a cent, but he who is without a dream.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(665, 'The greatest good you can do for another is not just share your riches, but reveal to them their own.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(666, 'Do not dwell in the past, do not dream of the future, concentrate the mind on the present moment.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(667, 'Peace of mind is not the absence of conflict from life, but the ability to cope with it.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(668, 'Face your deficiencies and acknowledge them; but do not let them master you. Let them teach you patience, sweetness, insight.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(669, 'Change is the law of life. And those who look only to the past or present are certain to miss the future.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(670, 'You have power over your mind not outside events. Realize this, and you will find strength.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(671, 'Let me tell you the secret that has led me to my goal: my strength lies solely in my tenacity.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(672, 'We are what we think. All that we are arises with our thoughts. With our thoughts, we make the world.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(673, 'He that respects himself is safe from others; he wears a coat of mail that none can pierce.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(674, 'I cannot always control what goes on outside. But I can always control what goes on inside.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(675, 'What matters is the value we\'ve created in our lives, the people we\'ve made happy and how much we\'ve grown as people.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(676, 'When you are offended at any man\'s fault, turn to yourself and study your own failings. Then you will forget your anger.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(677, 'Everyone has been made for some particular work, and the desire for that work has been put in every heart.', 'Michelle', 'Rumi', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(678, 'Take time to deliberate, but when the time for action has arrived, stop thinking and go in.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(679, 'With realization of ones own potential and self-confidence in ones ability, one can build a better world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(680, 'Happiness is not in the mere possession of money; it lies in the joy of achievement, in the thrill of creative effort.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(681, 'You cannot make yourself feel something you do not feel, but you can make yourself do right in spite of your feelings.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(682, 'Those who are blessed with the most talent don\'t necessarily outperform everyone else. It\'s the people with follow-through who excel.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(683, 'Try not to become a man of success, but rather try to become a man of value.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(684, 'All difficult things have their origin in that which is easy, and great things in that which is small.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(685, 'Men of perverse opinion do not know the excellence of what is in their hands, till some one dash it from them.', 'Michelle', 'Sophocles', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(686, 'It is not enough to have a good mind; the main thing is to use it well.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(687, 'Responsibility is not inherited, it is a choice that everyone needs to make at some point in their life.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(688, 'Never do things others can do and will do, if there are things others cannot do or will not do.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(689, 'I can\'t change the direction of the wind, but I can adjust my sails to always reach my destination.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(690, 'People of mediocre ability sometimes achieve outstanding success because they don\'t know when to quit. Most men succeed because they are determined to.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(691, 'A fine quotation is a diamond on the finger of a man of wit, and a pebble in the hand of a fool.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(692, 'Life\'s challenges are not supposed to paralyse you, they\'re supposed to help you discover who you are.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(693, 'The greatest way to live with honour in this world is to be what we pretend to be.', 'Michelle', 'Socrates', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(694, 'To exist is to change, to change is to mature, to mature is to go on creating oneself endlessly.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(695, 'Try not to become a man of success but rather try to become a man of value.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(696, 'You can\'t create in a vacuum. Life gives you the material and dreams can propel new beginnings.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(697, 'Your work is to discover your world and then with all your heart give yourself to it.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(698, 'The person who lives life fully, glowing with life\'s energy, is the person who lives a successful life.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(699, 'Don\'t turn away from possible futures before you\'re certain you don\'t have anything to learn from them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(700, 'A successful person is one who can lay a firm foundation with the bricks that others throw at him or her.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(701, 'All that we are is the result of what we have thought. The mind is everything. What we think we become.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(702, 'Work while you have the light. You are responsible for the talent that has been entrusted to you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(703, 'How far that little candle throws its beams! So shines a good deed in a naughty world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(704, 'Every adversity, every failure, every heartache carries with it the seed of an equal or greater benefit.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(705, 'It is in your moments of decision that your destiny is shaped.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(706, 'An obstacle may be either a stepping stone or a stumbling block.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(707, 'The pain passes, but the beauty remains.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(708, 'All I can say about life is, Oh God, enjoy it!', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(709, 'Creativity comes from trust. Trust your instincts. And never hope more than you work.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(710, 'Your outlook on life is a direct reflection on how much you like yourself.', 'Michelle', 'Lululemon', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(711, 'I have just three things to teach: simplicity, patience, compassion. These three are your greatest treasures.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(712, 'You won\'t skid if you stay in a rut.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(713, 'You block your dream when you allow your fear to grow bigger than your faith.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(714, 'Happiness depends upon ourselves.', 'Michelle', 'Aristotle', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(715, 'Wherever a man turns he can find someone who needs him.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(716, 'If one is lucky, a solitary fantasy can totally transform one million realities.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(717, 'Never idealize others. They will never live up to your expectations.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(718, 'When you realize there is nothing lacking, the whole world belongs to you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(719, 'Happiness is not something ready made. It comes from your own actions.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(720, 'Meaning is not what you start with but what you end up with.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(721, 'No one has ever become poor by giving.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(722, 'Be faithful in small things because it is in them that your strength lies.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(723, 'All is flux; nothing stays still.', 'Michelle', 'Heraclitus', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(724, 'He who is fixed to a star does not change his mind.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(725, 'He who lives in harmony with himself lives in harmony with the universe.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(726, 'Ignorant men don\'t know what good they hold in their hands until they\'ve flung it away.', 'Michelle', 'Sophocles', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(727, 'When the solution is simple, God is answering.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(728, 'All achievements, all earned riches, have their beginning in an idea.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(729, 'Do not turn back when you are just at the goal.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(730, 'You can\'t trust without risk but neither can you live in a cocoon.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(731, 'All perceiving is also thinking, all reasoning is also intuition, all observation is also invention.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(732, 'Error is discipline through which we advance.', 'Michelle', 'Channing', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(733, 'The truth is always exciting. Speak it, then. Life is dull without it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(734, 'The superior man is modest in his speech, but exceeds in his actions.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(735, 'The longer we dwell on our misfortunes, the greater is their power to harm us.', 'Michelle', 'Voltaire', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(736, 'Those who will play with cats must expect to be scratched.', 'Michelle', 'Cervantes', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(737, 'I\'ve never seen a smiling face that was not beautiful.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(738, 'In all things of nature there is something of the marvellous.', 'Michelle', 'Aristotle', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(739, 'The universe is transformation; our life is what our thoughts make it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(740, 'Memory is the mother of all wisdom.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(741, 'Silence is the true friend that never betrays.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(742, 'You might well remember that nothing can bring you success but yourself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(743, 'Watch the little things; a small leak will sink a great ship.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(744, 'God has given you one face, and you make yourself another.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(745, 'To be wronged is nothing unless you continue to remember it.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(746, 'Kindness is the greatest wisdom.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(747, 'Action will remove the doubts that theory cannot solve.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(748, 'Don\'t miss all the beautiful colors of the rainbow looking for that pot of gold.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(749, 'Your big opportunity may be right where you are now.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(750, 'People who say it cannot be done should not interrupt those who are doing it.', 'Michelle', 'Chinese proverb', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(751, 'The day you decide to do it is your lucky day.', 'Michelle', 'Japanese proverb', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(752, 'We must not say every mistake is a foolish one.', 'Michelle', 'Cicero', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(753, 'Accept challenges, so that you may feel the exhilaration of victory.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(754, 'It is better to understand a little than to misunderstand a lot.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(755, 'You don\'t drown by falling in water. You drown by staying there.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(756, 'Never be afraid to try, remember... Amateurs built the ark, Professionals built the Titanic.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(757, 'Correction does much, but encouragement does more.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(758, 'Know, first, who you are, and then adorn yourself accordingly.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(759, 'The biggest adventure you can ever take is to live the life of your dreams.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(760, 'Life is 10% what happens to you and 90% how you react to it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(761, 'To want to be what one can be is purpose in life.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(762, 'Remember that sometimes not getting what you want is a wonderful stroke of luck.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(763, 'History will be kind to me for I intend to write it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(764, 'Our lives are a sum total of the choices we have made.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(765, 'Time stays long enough for anyone who will use it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(766, 'You must welcome change as the rule but not as your ruler.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(767, 'Give whatever you are doing and whoever you are with the gift of your attention.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(768, 'Always be smarter than the people who hire you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(769, 'Formula for success: under promise and over deliver.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(770, 'The eye sees only what the mind is prepared to comprehend.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(771, 'People seldom notice old clothes if you wear a big smile.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(772, 'The more light you allow within you, the brighter the world you live in will be.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(773, 'Nothing diminishes anxiety faster than action.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(774, 'Man cannot discover new oceans unless he has the courage to lose sight of the shore.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(775, 'Everything that irritates us about others can lead us to an understanding about ourselves.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(776, 'Can you imagine what I would do if I could do all I can?', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(777, 'Ignorance never settle a question.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(778, 'The awareness of our own strength makes us modest.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(779, 'They must often change, who would be constant in happiness or wisdom.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(780, 'There are no failures. Just experiences and your reactions to them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(781, 'Your future depends on many things, but mostly on you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(782, 'Fear grows in darkness; if you think theres a bogeyman around, turn on the light.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(783, 'The most important point is to accept yourself and stand on your two feet.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(784, 'Do not expect the world to look bright, if you habitually wear gray-brown glasses.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(785, 'As long as your going to be thinking anyway, think big.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(786, 'Without some goals and some efforts to reach it, no man can live.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(787, 'He who obtains has little. He who scatters has much.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(788, 'Myths which are believed in tend to become true.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(789, 'The foot feels the foot when it feels the ground.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(790, 'Not what we have but what we enjoy constitutes our abundance.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(791, 'It is never too late to be what you might have been.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(792, 'The beginning is always today.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(793, 'In the long run we get no more than we have been willing to risk giving.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(794, 'Self-trust is the first secret of success.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(795, 'Don\'t look back. Something might be gaining on you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(796, 'Look back over the past, with its changing empires that rose and fell, and you can foresee the future, too.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(797, 'A life spent making mistakes is not only more honourable, but more useful than a life spent doing nothing.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(798, 'Men are disturbed not by things, but by the view which they take of them.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(799, 'Imagination disposes of everything; it creates beauty, justice, and happiness, which are everything in this world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(800, 'Happiness is a Swedish sunset it is there for all, but most of us look the other way and lose it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(801, 'A smile is a light in the window of your face to show your heart is at home.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(802, 'Look forward to spring as a time when you can start to see what nature has to offer once again.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(803, 'Trust your own instinct. Your mistakes might as well be your own, instead of someone elses.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(804, 'The least movement is of importance to all nature. The entire ocean is affected by a pebble.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(805, 'I am always doing that which I can not do, in order that I may learn how to do it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(806, 'Men in general judge more from appearances than from reality. All men have eyes, but few have the gift of penetration.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(807, 'You may only be someone in the world, but to someone else, you may be the world.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(808, 'Every artist dips his brush in his own soul, and paints his own nature into his pictures.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(809, 'If you take each challenge one step at a time, with faith in every footstep, your strength and understanding will increase.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(810, 'Happiness cannot be travelled to, owned, earned, worn or consumed. Happiness is the spiritual experience of living every minute with love, grace and gratitude.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33');
INSERT INTO `motivation_monday` (`id`, `quote`, `posted_by`, `author`, `image`, `status`, `created_at`, `updated_at`) VALUES
(811, 'Everyone should carefully observe which way his heart draws him, and then choose that way with all his strength.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(812, 'When we quit thinking primarily about ourselves and our own self-preservation, we undergo a truly heroic transformation of consciousness.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(813, 'Follow effective action with quiet reflection. From the quiet reflection will come even more effective action.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(814, 'Life\'s challenges are not supposed to paralyze you, they\'re supposed to help you discover who you are.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(815, 'There is one thing you have got to learn about our movement. Three people are better than no people.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(816, 'Happiness is a perfume you cannot pour on others without getting a few drops on yourself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(817, 'It is not the mistake that has the most power, instead, it is learning from the mistake to advance your own attributes.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(818, 'The amount of happiness that you have depends on the amount of freedom you have in your heart.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(819, 'Your vision will become clear only when you look into your heart. Who looks outside, dreams. Who looks inside, awakens.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(820, 'Yesterday is history. Tomorrow is a mystery. And today? Today is a gift. That is why we call it the present.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(821, 'The way we communicate with others and with ourselves ultimately determines the quality of our lives.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(822, 'Sometimes it is better to lose and do the right thing than to win and do the wrong thing.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(823, 'Let us always meet each other with smile, for the smile is the beginning of love.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(824, 'A bend in the road is not the end of the road...unless you fail to make the turn.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(825, 'We are what we repeatedly do. Excellence, then, is not an act, but a habit.', 'Michelle', 'Aristotle', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(826, 'Living at risk is jumping off the cliff and building your wings on the way down.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(827, 'In the depth of winter, I finally learned that there was within me an invincible summer.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(828, 'Wit lies in recognizing the resemblance among things which differ and the difference between things which are alike.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(829, 'A failure is a man who has blundered but is not capable of cashing in on the experience.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(830, 'I cannot give you the formula for success, but I can give you the formula for failure: which is: Try to please everybody.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(831, 'One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(832, 'The power of intuitive understanding will protect you from harm until the end of your days.', 'Michelle', 'Laozi', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(833, 'The best thing about the future is that it only comes one day at a time.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(834, 'We have two ears and one mouth so that we can listen twice as much as we speak.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(835, 'Fear of failure is one attitude that will keep you at the same point in your life.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(836, 'Friends are those rare people who ask how we are and then wait to hear the answer.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(837, 'If we learn to open our hearts, anyone, including the people who drive us crazy, can be our teacher.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(838, 'People grow through experience if they meet life honestly and courageously. This is how character is built.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(839, 'A hero is no braver than an ordinary man, but he is braver five minutes longer.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(840, 'While we try to teach our children all about life, our children teach us what life is all about.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(841, 'When you dance, your purpose is not to get to a certain place on the floor. It\'s to enjoy each step along the way.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(842, 'The Creator has not given you a longing to do that which you have no ability to do.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(843, 'It\'s so simple to be wise. Just think of something stupid to say and then don\'t say it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(844, 'Consider that not only do negative thoughts and emotions destroy our experience of peace, they also undermine our health.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(845, 'Until you make peace with who you are, you will never be content with what you have.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(846, 'No one saves us but ourselves. No one can and no one may. We ourselves must walk the path.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(847, 'The moment one gives close attention to anything, it becomes a mysterious, awesome, indescribably magnificent world in itself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(848, 'Happiness is when what you think, what you say, and what you do are in harmony.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(849, 'The greatest antidote to insecurity and the sense of fear is compassion it brings one back to the basis of one\'s inner strength', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(850, 'Courage is the discovery that you may not win, and trying when you know you can lose.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(851, 'To be thoughtful and kind only takes a few seconds compared to the timeless hurt caused by one rude gesture.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(852, 'The purpose of learning is growth, and our minds, unlike our bodies, can continue growing as we continue to live.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(853, 'When you realize how perfect everything is you will tilt your head back and laugh at the sky.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(854, 'For every failure, there\'s an alternative course of action. You just have to find it. When you come to a roadblock, take a detour.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(855, 'It is surprising what a man can do when he has to, and how little most men will do when they don\'t have to.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(856, 'To be aware of a single shortcoming in oneself is more useful than to be aware of a thousand in someone else.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(857, 'Nobody made a greater mistake than he who did nothing because he could do only a little.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(858, 'Constant kindness can accomplish much. As the sun makes ice melt, kindness causes misunderstanding, mistrust, and hostility to evaporate.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(859, 'The greatest minds are capable of the greatest vices as well as of the greatest virtues.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(860, 'A man should look for what is, and not for what he thinks should be.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(861, 'Difficulties are meant to rouse, not discourage. The human spirit is to grow strong by conflict.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(862, 'If you have no respect for your own values how can you be worthy of respect from others.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(863, 'Some people are always grumbling because roses have thorns; I am thankful that thorns have roses.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(864, 'To choose what is difficult all ones days, as if it were easy, that is faith.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(865, 'Ability is what you\'re capable of doing. Motivation determines what you do.Attitude determines how well you do it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(866, 'Do not be embarrassed by your mistakes. Nothing can teach us better than our understanding of them. This is one of the best ways of self-education.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(867, 'Thousands of candles can be lighted from a single candle, and the life of the candle will not be shortened. Happiness never decreases by being shared.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(868, 'I care not so much what I am to others as what I am to myself. I will be rich by myself, and not by borrowing.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(869, 'Know that although in the eternal scheme of things you are small, you are also unique and irreplaceable, as are all your fellow humans everywhere in the world.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(870, 'To do all that one is able to do, is to be a man; to do all that one would like to do, is to be a god.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(871, 'If you let go a little, you will have a little peace. If you let go a lot, you will have a lot of peace.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(872, 'There is no need for temples, no need for complicated philosophies. My brain and my heart are my temples; my philosophy is kindness.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(873, 'The spirit, the will to win, and the will to excel, are the things that endure. These qualities are so much more important than the events that occur.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(874, 'Man is not sum of what he has already, but rather the sum of what he does not yet have, of what he could have.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(875, 'Don\'t believe what your eyes are telling you. All they show is limitation. Look with your understanding, find out what you already know, and you\'ll see the way to fly.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(876, 'I believe that we are solely responsible for our choices, and we have to accept the consequences of every deed, word, and thought throughout our lifetime.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(877, 'Wishes can be your best avenue of getting what you want when you turn wishes into action. Action moves your wish to the forefront from thought to reality.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(878, 'To understand the heart and mind of a person, look not at what he has already achieved, but at what he aspires to do.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(879, 'I am of the opinion that my life belongs to the community, and as long as I live it is my privilege to do for it whatever I can.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(880, 'Imagination is more important than knowledge. For while knowledge defines all we currently know and understand, imagination points to all we might yet discover and create.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(881, 'When you see a good person, think of becoming like him. When you see someone not so good, reflect on your own weak points.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(882, 'If one is estranged from oneself, then one is estranged from others too. If one is out of touch with oneself, then one cannot touch others.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(883, 'Most of the important things in the world have been accomplished by people who have kept on trying when there seemed to be no hope at all.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(884, 'You may say I\'m a dreamer, but I\'m not the only one, I hope someday you will join us, and the world will live as one.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(885, 'Happiness is as a butterfly which, when pursued, is always beyond our grasp, but which if you will sit down quietly, may alight upon you.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(886, 'He who experiences the unity of life sees his own Self in all beings, and all beings in his own Self, and looks on everything with an impartial eye.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(887, 'In the sky, there is no distinction of east and west; people create distinctions out of their own minds and then believe them to be true.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(888, 'You cannot change anything in your life with intention alone, which can become a watered-down, occasional hope that you\'ll get to tomorrow. Intention without action is useless.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(889, 'Before you can inspire with emotion, you must be swamped with it yourself. Before you can move their tears, your own must flow. To convince them, you must yourself believe.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(890, 'The greatest discovery of our generation is that human beings can alter their lives by altering their attitudes of mind. As you think, so shall you be.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(891, 'If one advances confidently in the direction of his dream, and endeavours to live the life which he had imagines, he will meet with a success unexpected in common hours.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(892, 'The secret of joy in work is contained in one word excellence. To know how to do something well is to enjoy it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(893, 'When you meet someone better than yourself, turn your thoughts to becoming his equal. When you meet someone not as good as you are, look within and examine your own self.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(894, 'We must overcome the notion that we must be regular. It robs you of the chance to be extraordinary and leads you to the mediocre.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(895, 'Most of our obstacles would melt away if, instead of cowering before them, we should make up our minds to walk boldly through them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(896, 'Everything can be taken from a man but ... the last of the human freedoms to choose ones attitude in any given set of circumstances, to choose ones own way.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(897, 'It is better to have enough ideas for some of them to be wrong, than to be always right by having no ideas at all.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(898, 'Character is like a tree and reputation like a shadow. The shadow is what we think of it; the tree is the real thing.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(899, 'By letting it go it all gets done. The world is won by those who let it go. But when you try and try. The world is beyond the winning.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(900, 'I am like a falling star who has finally found her place next to another in a lovely constellation, where we will sparkle in the heavens forever.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(901, 'Not every difficult and dangerous thing is suitable for training, but only that which is conducive to success in achieving the object of our effort.', 'Michelle', 'Epictetus', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(902, 'We are not animals. We are not a product of what has happened to us in our past. We have the power of choice.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(903, 'The most dangerous way to lose time is not to spend it having fun, but to spend it doing fake work. When you spend time having fun, you know you\'re being self-indulgent.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(904, 'Thousands of candles can be lit from a single, and the life of the candle will not be shortened. Happiness never decreases by being shared.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(905, 'A lot of times people look at the negative side of what they feel they can\'t do. I always look on the positive side of what I can do.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(906, 'Without passion man is a mere latent force and possibility, like the flint which awaits the shock of the iron before it can give forth its spark.', 'Michelle', 'Amiel', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(907, 'Love at first sight is easy to understand; its when two people have been looking at each other for a lifetime that it becomes a miracle.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(908, 'With courage you will dare to take risks, have the strength to be compassionate, and the wisdom to be humble. Courage is the foundation of integrity.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(909, 'The right way is not always the popular and easy way. Standing for right when it is unpopular is a true test of moral character.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(910, 'I prefer to be true to myself, even at the hazard of incurring the ridicule of others, rather than to be false, and to incur my own abhorrence.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(911, 'No pessimist ever discovered the secrets of the stars, or sailed to an uncharted land, or opened a new heaven to the human spirit.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(912, 'When you arise in the morning, think of what a precious privilege it is to be alive to breathe, to think, to enjoy, to love.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(913, 'Character cannot be developed in ease and quiet. Only through experience of trial and suffering can the soul be strengthened, vision cleared, ambition inspired, and success achieved.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(914, 'Although there may be tragedy in your life, there\'s always a possibility to triumph. It doesn\'t matter who you are, where you come from. The ability to triumph begins with you. Always.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(915, 'You must train your intuition you must trust the small voice inside you which tells you exactly what to say, what to decide.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(916, 'Accept the things to which fate binds you, and love the people with whom fate brings you together, but do so with all your heart.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(917, 'Let us resolve to be masters, not the victims, of our history, controlling our own destiny without giving way to blind suspicions and emotions.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(918, 'Nothing in life is to be feared, it is only to be understood. Now is the time to understand more, so that we may fear less.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(919, 'Parents can only give good advice or put them on the right paths, but the final forming of a persons character lies in their own hands.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(920, 'Adversity isn\'t set against you to fail; adversity is a way to build your character so that you can succeed over and over again through perseverance.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(921, 'If you break your neck, if you have nothing to eat, if your house is on fire, then you got a problem. Everything else is inconvenience.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(922, 'Success is not the key to happiness. Happiness is the key to success. If you love what you are doing, you will be successful.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(923, 'If A is success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(924, 'My advice to you is not to inquire why or whither, but just enjoy your ice cream while its on your plate that\'s my philosophy.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(925, 'Conflict is the gadfly of thought. It stirs us to observation and memory. It instigates to invention. It shocks us out of sheeplike passivity, and sets us at noting and contriving.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(926, 'He who conquers others is strong; He who conquers himself is mighty.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(927, 'Anything you really want, you can attain, if you really go after it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(928, 'Arriving at one point is the starting point to another.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(929, 'The foolish man seeks happiness in the distance, the wise grows it under his feet.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(930, 'The greatest part of our happiness depends on our dispositions, not our circumstances.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(931, 'It is only possible to live happily ever after on a day to day basis.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(932, 'A man sees in the world what he carries in his heart.', 'Michelle', 'Goethe', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(933, 'Action may not always bring happiness, but there is no happiness without action.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(934, 'Believe deep down in your heart that you\'re destined to do great things.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(935, 'Sooner or later, those who win are those who think they can.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(936, 'The only limit to your impact is your imagination and commitment.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(937, 'You are special, you are unique, you are the best!', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(938, 'Four steps to achievement: Plan purposefully. Prepare prayerfully. Proceed positively. Pursue persistently.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(939, 'To know oneself is to study oneself in action with another person.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(940, 'We must not allow ourselves to become like the system we oppose.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(941, 'Smile, breathe and go slowly.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(942, 'Reality is merely an illusion, albeit a very persistent one.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(943, 'When you come to the end of your rope, tie a knot and hang on.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(944, 'Always be mindful of the kindness and not the faults of others.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(945, 'Everything that irritates us about others can lead us to an understanding of ourselves.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(946, 'When fate hands us a lemon, lets try to make lemonade.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(947, 'The weak can never forgive. Forgiveness is the attribute of the strong.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(948, 'A man is great by deeds, not by birth.', 'Michelle', 'Chanakya', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(949, 'Success is getting what you want. Happiness is wanting what you get.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(950, 'Truth isn\'t all about what actually happens but more about how what has happened is interpreted.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(951, 'A good rest is half the work.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(952, 'Don\'t judge each day by the harvest you reap but by the seeds that you plant.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(953, 'Small opportunities are often the beginning of great enterprises.', 'Michelle', 'Demosthenes', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(954, 'To be tested is good. The challenged life may be the best therapist.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(955, 'Take heed: you do not find what you do not seek.', 'Michelle', 'English proverb', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(956, 'Happiness is the reward we get for living to the highest right we know.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(957, 'Be slow of tongue and quick of eye.', 'Michelle', 'Cervantes', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(958, 'Freedom is not worth having if it does not connote freedom to err.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(959, 'I have always thought the actions of men the best interpreters of their thoughts.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(960, 'He who obtains has little. He who scatters has much.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(961, 'To dare is to lose ones footing momentarily. To not dare is to lose oneself.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(962, 'No day in which you learn something is a complete loss.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(963, 'Peace cannot be kept by force. It can only be achieved by understanding.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(964, 'Real success is finding your lifework in the work that you love.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(965, 'Better than a thousand hollow words, is one word that brings peace.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(966, 'All the flowers of all the tomorrows are in the seeds of today.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(967, 'Your sacred space is where you can find yourself again and again.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(968, 'As you think, so shall you become.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(969, 'In seed time learn, in harvest teach, in winter enjoy.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(970, 'Happiness does not come from having much, but from being attached to little.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(971, 'Every gift from a friend is a wish for your happiness.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(972, 'Go put your creed into the deed. Nor speak with double tongue.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(973, 'The wisest men follow their own direction.', 'Michelle', 'Euripides', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(974, 'Hope arouses, as nothing else can arouse, a passion for the possible.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(975, 'Everything has beauty, but not everyone sees it.', 'Michelle', 'Confucius', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(976, 'Nothing ever goes away until it has taught us what we need to know.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(977, 'When you learn, teach. When you get, give.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(978, 'Only when we are no longer afraid do we begin to live.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(979, 'If you smile when no one else is around, you really mean it.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(980, 'Love is the only force capable of transforming an enemy into friend.', 'Michelle', '<NAME>, Jr.', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(981, 'In all chaos there is a cosmos, in all disorder a secret order.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(982, 'A man is not where he lives but where he loves.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(983, 'The price of greatness is responsibility.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(984, 'Decision is a risk rooted in the courage of being free.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(985, 'Your mind will answer most questions if you learn to relax and wait for the answer.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(986, 'The world does not happen to you it happens from you.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(987, 'We cannot solve our problems with the same thinking we used when we created them.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(988, 'More powerful than the will to win is the courage to begin.', 'Michelle', 'Unknown', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(989, 'Learning is finding out what you already know.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(990, 'Saying thank you is more than good manners. It is good spirituality.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(991, 'Silence is a source of great strength.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(992, 'Joy is the best makeup.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(993, 'There is no great genius without some touch of madness.', 'Michelle', 'Seneca', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(994, 'A jug fills drop by drop.', 'Michelle', 'Buddha', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(995, 'Until you make peace with who you are, you\'ll never be content with what you have.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(996, 'We aim above the mark to hit the mark.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(997, 'Being angry never solves anything.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(998, 'All men who have achieved great things have been great dreamers.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(999, 'Mediocrity knows nothing higher than itself, but talent instantly recognizes genius.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(1000, 'Where all think alike, no one thinks very much.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33'),
(1001, 'Everything that exists is in a manner the seed of that which will be.', 'Michelle', '<NAME>', 'monday1.png', 'visible', '2021-07-03 06:04:33', '2021-07-03 06:04:33');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `motivation_monday`
--
ALTER TABLE `motivation_monday`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `motivation_monday`
--
ALTER TABLE `motivation_monday`
MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1002;
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>five3/python-sdet<filename>db.sql
/*
Navicat MySQL Data Transfer
Source Server : testqa
Source Server Version : 50725
Source Host : www.testqa.cn:3306
Source Database : sdet
Target Server Type : MYSQL
Target Server Version : 50725
File Encoding : 65001
Date: 2021-02-23 21:08:33
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for hook
-- ----------------------------
DROP TABLE IF EXISTS `hook`;
CREATE TABLE `hook` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`type` enum('RESPONSE','REQUEST') NOT NULL,
`source` varchar(30) NOT NULL,
`target` varchar(30) NOT NULL,
`content` text NOT NULL,
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `name_type_uniq_idx` (`name`,`type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for http_api
-- ----------------------------
DROP TABLE IF EXISTS `http_api`;
CREATE TABLE `http_api` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`url` varchar(1024) NOT NULL,
`method` varchar(10) NOT NULL,
`body` longtext,
`fileList` text,
`headers` varchar(2048) DEFAULT NULL,
`validate` enum('express','contain','equal') NOT NULL COMMENT '检查关键字',
`express` longtext COMMENT '检查规则内容',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0: 未执行,1: 通过,2: 失败, 3: 异常',
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for http_api_log
-- ----------------------------
DROP TABLE IF EXISTS `http_api_log`;
CREATE TABLE `http_api_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`api_id` int(11) NOT NULL COMMENT '用例id',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '运行结果, 1: 通过,2: 失败,3: 异常',
`content` longtext COMMENT '日志内容',
`created_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for http_mock
-- ----------------------------
DROP TABLE IF EXISTS `http_mock`;
CREATE TABLE `http_mock` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`key` varchar(255) DEFAULT NULL COMMENT 'Mock配置唯一键',
`code` int(11) DEFAULT NULL COMMENT 'Mock响应码',
`headers` varchar(1000) DEFAULT NULL COMMENT 'Mock响应头',
`data` longtext COMMENT 'Mock响应体',
`no_pattern_response` varchar(255) DEFAULT NULL COMMENT '无匹配内容时响应模式',
`type` varchar(25) NOT NULL DEFAULT '' COMMENT '响应体类型。text:纯文本,dynamic:参数化,express:Python表达式',
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `key` (`key`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for todo
-- ----------------------------
DROP TABLE IF EXISTS `todo`;
CREATE TABLE `todo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL COMMENT '任务名称',
`desc` varchar(255) DEFAULT NULL COMMENT '任务描述',
`start_time` date DEFAULT NULL COMMENT '执行开始时间',
`end_time` date DEFAULT NULL COMMENT '执行结束时间',
`assign` varchar(50) NOT NULL COMMENT '执行人',
`status` enum('DISCARD','FINISHED','INPROCESS','INIT') NOT NULL DEFAULT 'INIT' COMMENT '状态',
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`is_del` tinyint(1) DEFAULT '0' COMMENT '逻辑删除标识。0:未删除,1:已删除',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
|
<gh_stars>0
--select * from users order by id desc;
--delete from users where id >= 3
/*
1. READ
A user
- has many texts (because texts has a reference to user.id, so we get a 1-to-many from users to texts)
- has many groups (because we have a many-to-many relating users and groups, thanks to the link table)
We return
- all the fields in the user table +
- a json array of objects relative to all the texts of the user +
- a json array of objects relative to all the groups of the user
We use two CTEs to pre-compute these json array. The CTEs have 2 fields:
-the user id
-a json array of objects relative to all the texts that are related to the user (possibly empty)
-the user id
-a json array of objects relative to all the groups that are related to the user (possibly empty)
*/
DROP FUNCTION IF EXISTS users_read(json);
CREATE FUNCTION users_read(options json DEFAULT '[{}]')
-- return table uses the definition of the users table + extra data from the join
RETURNS TABLE(
id INT,
email TEXT,
first_name TEXT,
last_name TEXT,
pw_hash TEXT,
created_at timestamptz,
recover TEXT,
recover_valid_until timestamptz,
user_texts JSON, -- join with the users_texts CTE
user_groups JSON -- join with the users_groups CTE
)
AS
$BODY$
DECLARE
options_row json;
command text;
number_conditions INT;
users_texts_cte TEXT;
users_groups_cte TEXT;
-- fields to be used in WHERE clause
id INT;
email TEXT;
email_like TEXT;
recover TEXT;
BEGIN
-- convert the json argument from object to array of (one) objects
IF json_typeof(options) = 'object'::text THEN
options = ('[' || options::text || ']')::json;
END IF;
-- NOTE: using a CTE is not good for performance;
users_texts_cte := '
users_texts_cte AS (
SELECT
u.id AS user_id,
(CASE WHEN COUNT(t) = 0 THEN ''[]''::json ELSE json_agg(t.*) END ) AS user_texts
FROM users u
LEFT JOIN texts t
ON t.author_id = u.id
GROUP BY u.id
)
';
/*
NOTE: we have to make the CASE...END instead of simply "json_agg(g.*) AS user_groups" because if there is
no match in the LEFT JOIN, postgres returns [null] (instead of [])
*/
users_groups_cte := '
users_groups_cte AS (
SELECT
u.id as user_id,
(CASE WHEN COUNT(g) = 0 THEN ''[]''::json ELSE json_agg(g.*) END ) AS user_groups
FROM users u
LEFT JOIN users_groups ug
ON ug.user_id = u.id
LEFT JOIN groups g
ON g.code = ug.group_code
GROUP BY u.id
)
';
FOR options_row IN ( select json_array_elements(options) ) LOOP
command := 'WITH '
|| users_texts_cte || ', '
|| users_groups_cte
|| 'SELECT
u.*,
ut.user_texts,
ug.user_groups
FROM users u
INNER JOIN users_texts_cte ut
ON u.id = ut.user_id
INNER JOIN users_groups_cte ug
ON u.id = ug.user_id';
-- extract values to be (optionally) used in the WHERE clause
SELECT json_extract_path_text(options_row, 'id') INTO id;
SELECT json_extract_path_text(options_row, 'email') INTO email;
SELECT json_extract_path_text(options_row, 'email_like') INTO email_like;
SELECT json_extract_path_text(options_row, 'recover') INTO recover;
number_conditions := 0;
-- criteria: id
IF id IS NOT NULL THEN
IF number_conditions = 0 THEN command = command || ' WHERE';
ELSE command = command || ' AND';
END IF;
command = format(command || ' u.id = %L', id);
number_conditions := number_conditions + 1;
END IF;
-- criteria: email
IF email IS NOT NULL THEN
IF number_conditions = 0 THEN command = command || ' WHERE';
ELSE command = command || ' AND';
END IF;
command = format(command || ' u.email = %L', email);
number_conditions := number_conditions + 1;
END IF;
-- criteria: email_like
IF email_like IS NOT NULL THEN
IF number_conditions = 0 THEN command = command || ' WHERE';
ELSE command = command || ' AND';
END IF;
email_like := '%' || email_like || '%';
command = format(command || ' u.email ILIKE %L', email_like);
number_conditions := number_conditions + 1;
END IF;
-- criteria: recover token
IF recover IS NOT NULL THEN
IF number_conditions = 0 THEN command = command || ' WHERE';
ELSE command = command || ' AND';
END IF;
command = format(command || ' u.recover = %L', recover);
number_conditions := number_conditions + 1;
END IF;
command := command || ' ORDER BY u.id;';
RETURN QUERY EXECUTE command;
END LOOP;
RETURN;
END;
$BODY$
LANGUAGE plpgsql;
/*
EXAMPLES:
select * from users_read();
select * from users_read('[{"email":"<EMAIL>"}]');
select * from users_read('[{"id":2}, {"id":1}]');
select * from users_read('[{"email_like": "pau"}]');
*/
/*
2. CREATE
*/
DROP FUNCTION IF EXISTS users_create(json, json);
CREATE FUNCTION users_create(input_data json, options json DEFAULT '[{}]')
RETURNS SETOF users AS
$BODY$
DECLARE
new_row users%ROWTYPE;
input_row users%ROWTYPE;
current_row users%ROWTYPE;
new_id INT;
BEGIN
-- convert the json argument from object to array of (one) objects
IF json_typeof(input_data) = 'object'::text THEN
input_data = ('[' || input_data::text || ']')::json;
END IF;
FOR input_row IN (select * from json_populate_recordset(null::users, input_data)) LOOP
SELECT input_row.id INTO new_id;
IF new_id IS NULL OR NOT EXISTS (SELECT * FROM users WHERE id = new_id) THEN
INSERT INTO users(
id,
email,
first_name,
last_name,
pw_hash
)
VALUES (
COALESCE(new_id, nextval(pg_get_serial_sequence('users', 'id'))),
input_row.email,
input_row.first_name,
input_row.last_name,
input_row.pw_hash
)
RETURNING
*
INTO STRICT
new_row;
RETURN NEXT new_row;
ELSE
current_row.id = new_id;
current_row.email = '"WARNING: a row with the given id exists already present. Data will not be inserted."';
RAISE WARNING 'A row with the given id exists already present. Data will not be inserted (id=%)', current_row.id;
RETURN NEXT current_row;
END IF;
END LOOP;
RETURN;
END;
$BODY$
LANGUAGE plpgsql;
/*
EXAMPLES:
select * from users order by id desc
delete from users where id >= 244
select * from users_create('[{"first_name": "232", "email": "@232", "pw_hash": ""},{"first_name": "233", "email": "@233", "pw_hash": "dd"}]');
select * from users_create('[
{"email": "@500", "first_name": "", "pw_hash": ""},
{"email": "@501", "first_name": "", "pw_hash": ""},
{"email": "@502", "first_name": "", "pw_hash": ""},
{"email": "@503", "first_name": "", "pw_hash": ""},
{"email": "@504", "first_name": "", "pw_hash": ""}
]'
);
NOTES: some quick benchmarks
insert 5 rows: ~300ms
insert 10 rows: ~700ms
insert 20 rows: ~1400ms
insert 30 rows: ~2100ms (!)
The time is clearly growing linearly;
*/
/*
3. UPDATE
*/
DROP FUNCTION IF EXISTS users_update(json, json);
CREATE FUNCTION users_update(input_data json, options json DEFAULT '[{}]')
RETURNS SETOF users AS
$$
DECLARE
updated_row users%ROWTYPE;
input_row users%ROWTYPE;
command text;
BEGIN
-- convert the json argument from object to array of (one) objects
IF json_typeof(input_data) = 'object'::text THEN
input_data = ('[' || input_data::text || ']')::json;
END IF;
FOR input_row IN (select * from json_populate_recordset(null::users, input_data)) LOOP
-- generate a dynamic command: first the base query
command := 'UPDATE users SET ';
-- then add (cumulatively) the fields to be updated; those fields must be present in the input_data json;
IF input_row.email IS NOT NULL THEN
command = format(command || 'email = %L, ', input_row.email);
END IF;
IF input_row.first_name IS NOT NULL THEN
command = format(command || 'first_name = %L, ', input_row.first_name);
END IF;
IF input_row.last_name IS NOT NULL THEN
command = format(command || 'last_name = %L, ', input_row.last_name);
END IF;
IF input_row.pw_hash IS NOT NULL THEN
command = format(command || 'pw_hash = %L, ', input_row.pw_hash);
END IF;
IF input_row.recover IS NOT NULL THEN
command = format(command || 'recover = %L, recover_valid_until = %L, ', input_row.recover, now() + interval '1 day');
END IF;
/*
IF input_row.recover_valid_until IS NOT NULL THEN
command = format(command || 'recover_valid_until = %L, ', input_row.recover_valid_until);
END IF;
*/
-- remove the comma and space from the last if
command = left(command, -2);
command = format(command || ' WHERE id = %L RETURNING *;', input_row.id);
--RAISE NOTICE 'Dynamic command: %', command;
EXECUTE
command
INTO STRICT
updated_row;
RETURN NEXT
updated_row;
END LOOP;
RETURN;
END;
$$
LANGUAGE plpgsql;
/*
EXAMPLES:
select * from users order by id desc
select * from users_update('[{"id": "237", "email": "@237-2"}]');
select * from users_update('[{"id": "237", "email": "@237-5", "first_name": "237-3"}]');
select * from users_update('[{"id": "2370", "email": "@237-6", "recover": "zzz"}]');
select * from users_update('[{"id": "8", "recover": "zzz"}]');
select * from users_update('[
{"id": "400", "email": "@400-#8", "recover": "#8"},
{"id": "401", "email": "@401-#8", "recover": "#8"},
{"id": "402", "email": "@402-#8", "recover": "#8"},
{"id": "403", "email": "@403-#8", "recover": "#8"},
{"id": "404", "email": "@404-#8", "recover": "#8"},
]');
NOTES: results from a quick benchmark:
Update 5 rows: 30ms
Update 10 rows: 40ms
Update 20 rows: 40ms
Update 30 rows: 40ms
(the number of rows doesn't seem to matter much)
*/
/*
4. DELETE
*/
DROP FUNCTION IF EXISTS users_delete(json);
CREATE FUNCTION users_delete(options json DEFAULT '[{}]')
RETURNS TABLE(deleted_id int) AS
$$
DECLARE
deleted_row users%ROWTYPE;
options_row JSON;
-- fields to be used in WHERE clause
id_to_delete INT;
BEGIN
-- convert the json argument from object to array of (one) objects
IF json_typeof(options) = 'object'::text THEN
options = ('[' || options::text || ']')::json;
END IF;
FOR options_row IN ( select json_array_elements(options) ) LOOP
-- extract values to be (optionally) used in the WHERE clause
SELECT json_extract_path_text(options_row, 'id') INTO id_to_delete;
IF id_to_delete IS NOT NULL THEN
DELETE FROM users u
WHERE u.id = id_to_delete
RETURNING *
INTO deleted_row;
deleted_id := deleted_row.id;
IF deleted_id IS NOT NULL THEN
RETURN NEXT;
END IF;
END IF;
END LOOP;
RETURN;
END;
$$
LANGUAGE plpgsql;
/*
EXAMPLES:
select * from users order by id desc;
insert into users(first,email,pw_hash) values ('qwe', 'qwe', 'qwe'), ('qwe2', 'qwe2', 'qwe2')
select * from users_delete('[{"id": 253}, {"id": 253}]');
select * from users_delete('[{"id": 13}]');
*/
|
<filename>database/populate_extras.sql
use ALUC;
-- Administradores
INSERT INTO administrador (id) VALUES ('0105070353');
INSERT INTO administrador (id) VALUES ('1400967715');
-- Moderadores
INSERT INTO moderador (id, id_laboratorio) VALUES ('1400567572', '1');
INSERT INTO moderador (id, id_laboratorio) VALUES ('0105108336', '1');
INSERT INTO moderador (id, id_laboratorio) VALUES ('0104273131', '2');
INSERT INTO moderador (id, id_laboratorio) VALUES ('0105515472', '2');
INSERT INTO moderador (id, id_laboratorio) VALUES ('0104668009', '3');
INSERT INTO moderador (id, id_laboratorio) VALUES ('0103162038', '3');
INSERT INTO moderador (id, id_laboratorio) VALUES ('0604107607', '3');
INSERT INTO moderador (id, id_laboratorio) VALUES ('1400964001', '4');
INSERT INTO moderador (id, id_laboratorio) VALUES ('0105686737', '4');
INSERT INTO moderador (id, id_laboratorio) VALUES ('0104035514', '5');
INSERT INTO moderador (id, id_laboratorio) VALUES ('0105513402', '5');
INSERT INTO moderador (id, id_laboratorio) VALUES ('0106816952', '5');
-- Lectores
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:13:49:00:01:02','1','192.168.1.2','aSDFERTYFRsffge');
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:14:49:00:01:02','2','192.168.1.3','aSrFERTYFRsffge');
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:15:49:00:01:02','3','192.168.1.4','aSfFERTYFRsffge');
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:16:49:00:01:02','4','192.168.1.5','aSaFERTYFRsffge');
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:17:49:00:01:02','5','192.168.1.6','aSsfERTYFRsffge');
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:18:49:00:01:02','6','192.168.1.7','aSgbERTYFRsffge');
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:19:49:00:01:02','1','192.168.1.8','aSDhERTYFRsffge');
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:10:49:00:01:02','2','192.168.1.9','aSDkERTYFRsffge');
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:11:49:00:01:02','3','192.168.1.10','aSoFERTYFRsffge');
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:12:49:00:01:02','4','192.168.1.11','aSpFERTYFRsffge');
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:21:49:00:01:02','5','192.168.1.12','aSmFERTYFRsffge');
INSERT INTO lector(mac,id_laboratorio,ip,token) VALUES('00:22:49:00:01:02','6','192.168.1.13','aSgFERTYFRsffge');
-- Reservas
ALTER TABLE ALUC.reserva AUTO_INCREMENT=0;
ALTER TABLE ALUC.reservacion AUTO_INCREMENT=0;
-- clases
CALL ALUC.insertar_reserva('0604107607','1','Clases normales ','10','clases','reservado','2016-12-02','15:00:00','16:00:00','Ds3lO3TT1UtO6RO');
CALL ALUC.insertar_reserva('1400967715','2','Clases normales ','10','clases','reservado','2016-12-02','15:30:00','16:30:00','Ds3lO4TT1UtO6RO');
CALL ALUC.insertar_reserva('0105070353','3','Clases normales ','10','clases','reservado','2016-12-02','15:00:00','16:00:00','Ds3lO5TT1UtO6RO');
CALL ALUC.insertar_reserva('0104967864','4','Clases normales ','10','clases','reservado','2016-12-02','15:30:00','16:30:00','Ds3lO6TT1UtO6RO');
CALL ALUC.insertar_reserva('0105850945','5','Clases normales ','10','clases','reservado','2016-12-02','15:00:00','16:00:00','Ds3lO7TT1UtO6RO');
CALL ALUC.insertar_reserva('0104429527','6','Clases normales ','10','clases','reservado','2016-12-02','15:30:00','16:30:00','Ds3lO8TT1UtO6RO');
CALL ALUC.insertar_reserva('0604107607','1','Clases normales ','10','clases','reservado','2016-12-02','10:00:00','11:00:00','Ds3lO9TT1UtO6RO');
CALL ALUC.insertar_reserva('1400967715','2','Clases normales ','10','clases','reservado','2016-12-02','10:30:00','11:30:00','Ds3lO0TT1UtO6RO');
CALL ALUC.insertar_reserva('0105070353','3','Clases normales ','10','clases','reservado','2016-12-02','10:00:00','11:00:00','Ds3lO1TT1UtO6RO');
CALL ALUC.insertar_reserva('0104967864','4','Clases normales ','10','clases','reservado','2016-12-02','10:30:00','11:30:00','Ds3lO22TT1UtO6RO');
CALL ALUC.insertar_reserva('0105850945','5','Clases normales ','10','clases','reservado','2016-12-02','10:00:00','11:00:00','Ds3lO3TT2UtO6RO');
CALL ALUC.insertar_reserva('0104429527','6','Clases normales ','10','clases','reservado','2016-12-02','10:30:00','11:30:00','Ds3lO3TT6UtO6RO');
-- reservas para prácticas
CALL ALUC.insertar_reserva('0105513402','1','Prácticas realizadas para deberes','1','práctica','reservado','2016-12-02','07:00:00','08:00:00','Ds3lO3Ty1UtO6RO');
CALL ALUC.insertar_reserva('0105513402','2','Prácticas realizadas para deberes','5','práctica','reservado','2016-12-03','09:00:00','10:00:00','Ds3lO3Tu1UtO6RO');
CALL ALUC.insertar_reserva('1400567572','1','Prácticas realizadas para deberes','7','práctica','reservado','2016-12-02','07:00:00','08:00:00','Ds3lO3To1UtO6RO');
CALL ALUC.insertar_reserva('1400567572','2','Prácticas realizadas para deberes','2','práctica','reservado','2016-12-03','09:00:00','10:00:00','Ds3lO3Tp1UtO6RO');
CALL ALUC.insertar_reserva('0105108336','3','Prácticas realizadas para deberes','1','práctica','reservado','2016-12-02','09:00:00','10:00:00','Ds3lO3Ta1UtO6RO');
CALL ALUC.insertar_reserva('0105108336','4','Prácticas realizadas para deberes','5','práctica','reservado','2016-12-03','11:00:00','12:00:00','Ds3lO3Ts1UtO6RO');
CALL ALUC.insertar_reserva('0105515472','3','Prácticas realizadas para deberes','7','práctica','reservado','2016-12-02','09:00:00','10:00:00','Ds3lO3Td1UtO6RO');
CALL ALUC.insertar_reserva('0105515472','4','Prácticas realizadas para deberes','2','práctica','reservado','2016-12-03','11:00:00','12:00:00','Ds3lO3Tf1UtO6RO');
|
<reponame>s-a-zhd/Hospital-Management-Laravel
-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 14, 2020 at 08:00 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: `hms`
--
-- --------------------------------------------------------
--
-- Table structure for table `appointment`
--
CREATE TABLE `appointment` (
`id` int(10) NOT NULL,
`patient_name` varchar(255) NOT NULL,
`department` varchar(255) NOT NULL,
`doctor_name` varchar(255) NOT NULL,
`date` varchar(255) NOT NULL,
`time` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`phone` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `appointment`
--
INSERT INTO `appointment` (`id`, `patient_name`, `department`, `doctor_name`, `date`, `time`, `email`, `phone`) VALUES
(6, 'Test', 'Orthopedics', 'B.rabbit', '26/03/2020', '10:43 AM', '<EMAIL>', '7865641399'),
(10, 'Test123', 'Orthopedics', 'doc test', '18/03/2020', '1:41 AM', '<EMAIL>', '7865641399');
-- --------------------------------------------------------
--
-- Table structure for table `blood`
--
CREATE TABLE `blood` (
`id` int(10) NOT NULL,
`group` varchar(20) NOT NULL,
`quantity` varchar(15) NOT NULL,
`status` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `blood`
--
INSERT INTO `blood` (`id`, `group`, `quantity`, `status`) VALUES
(1, 'A+', '30', 'Available');
-- --------------------------------------------------------
--
-- Table structure for table `complain`
--
CREATE TABLE `complain` (
`id` int(10) NOT NULL,
`message` varchar(500) NOT NULL,
`name` varchar(50) NOT NULL,
`email` varchar(20) NOT NULL,
`subject` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `complain`
--
INSERT INTO `complain` (`id`, `message`, `name`, `email`, `subject`) VALUES
(1, 'wdawdws', 'awdawd', 'awdw', 'adwwd'),
(2, 'Definition of complain. intransitive verb. 1 : to express grief, pain, or discontent complaining about the weather. 2 : to make a formal accusation or charge He threatened to complain of him to the captain.', '<NAME>', '<EMAIL>', 'dafsgd'),
(3, 'redtfyguhijo', 'simanto', '<EMAIL>', 'ytguijopk['),
(4, 'abcabcbacbacbabc', '<NAME>', '<EMAIL>', 'dadsvfbgfng');
-- --------------------------------------------------------
--
-- Table structure for table `departments`
--
CREATE TABLE `departments` (
`id` int(11) NOT NULL,
`department_name` varchar(255) NOT NULL,
`department_desc` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `departments`
--
INSERT INTO `departments` (`id`, `department_name`, `department_desc`) VALUES
(11, 'Intensive Care Unit (ICU)', 'What is an intensive care unit (ICU)? Intensive care refers to the specialised treatment given to patients who are acutely unwell and require critical medical care. An intensive care unit (ICU) provides the critical care and life support for acutely ill a'),
(16, 'Neurology', 'Neurology is a branch of medicine dealing with disorders of the nervous system. Neurology deals with the diagnosis and treatment of all categories of conditions and disease involving the central and peripheral nervous systems, including their coverings'),
(19, 'Corona Department', 'awa');
-- --------------------------------------------------------
--
-- Table structure for table `doctor`
--
CREATE TABLE `doctor` (
`id` int(10) NOT NULL,
`first_name` varchar(255) NOT NULL,
`last_name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`dob` varchar(20) NOT NULL,
`gender` varchar(10) NOT NULL,
`address` varchar(255) NOT NULL,
`phone` varchar(20) NOT NULL,
`image` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `doctor`
--
INSERT INTO `doctor` (`id`, `first_name`, `last_name`, `email`, `dob`, `gender`, `address`, `phone`, `image`) VALUES
(50, 'Zihad', 'cgfvhj', '<EMAIL>', '20/03/2020', 'male', '3125 Elkview Drive, Miami,33169', '7865641399', '1666478166845710.jpg'),
(52, 'Isa', 'Eli', '<EMAIL>', '18/02/2020', 'female', '3125 Elkview Drive, Miami,33169', '7865641399', '1666478425444255.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `employee`
--
CREATE TABLE `employee` (
`id` int(10) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`contact` varchar(255) NOT NULL,
`join_date` varchar(255) NOT NULL,
`role` varchar(255) NOT NULL,
`salary` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `employee`
--
INSERT INTO `employee` (`id`, `name`, `email`, `contact`, `join_date`, `role`, `salary`) VALUES
(18, 'B.Rabbit', '<EMAIL>', '3649786453', '18/03/2020', 'Receptionist', '25000'),
(21, '<NAME>', '<EMAIL>', '7865641399', '17/03/2020', 'Nurse', '25000');
-- --------------------------------------------------------
--
-- Table structure for table `leaves`
--
CREATE TABLE `leaves` (
`id` int(10) NOT NULL,
`employee` varchar(255) NOT NULL,
`emp_id` int(10) NOT NULL,
`leave_type` varchar(255) NOT NULL,
`date_from` varchar(255) NOT NULL,
`date_to` varchar(255) NOT NULL,
`reason` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `leaves`
--
INSERT INTO `leaves` (`id`, `employee`, `emp_id`, `leave_type`, `date_from`, `date_to`, `reason`) VALUES
(7, '<NAME>', 4, 'Medical Leave', '26/03/2020', '31/03/2020', 'acdsvfbgnh');
-- --------------------------------------------------------
--
-- Table structure for table `login`
--
CREATE TABLE `login` (
`id` int(255) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `patient`
--
CREATE TABLE `patient` (
`id` int(10) NOT NULL,
`name` varchar(255) NOT NULL,
`age` int(255) NOT NULL,
`address` varchar(255) NOT NULL,
`phone` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`date` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `patient`
--
INSERT INTO `patient` (`id`, `name`, `age`, `address`, `phone`, `email`, `date`) VALUES
(1, '<NAME>', 26, 'lake view', '156326996633', '<EMAIL>', '17/03/2020'),
(2, 'B.Rabbit', 25, '3125 Elkview Drive, Miami,33169', '7865641399', 'gm<EMAIL>', '26/03/2020');
-- --------------------------------------------------------
--
-- Table structure for table `store`
--
CREATE TABLE `store` (
`id` int(10) NOT NULL,
`name` varchar(255) NOT NULL,
`p_date` varchar(255) NOT NULL,
`expire_end` varchar(255) NOT NULL,
`price` varchar(255) NOT NULL,
`quantity` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `store`
--
INSERT INTO `store` (`id`, `name`, `p_date`, `expire_end`, `price`, `quantity`) VALUES
(4, 'Napa', '20/03/2020', '19/03/2020', '8', '100'),
(8, 'Seclo', '24/03/2020', '24/03/2020', '10', '500'),
(10, 'max', '11/03/2020', '12/03/2020', '10', '100'),
(11, 'QZY', '18/03/2020', '19/03/2020', '20', '2000');
-- --------------------------------------------------------
--
-- Table structure for table `temp`
--
CREATE TABLE `temp` (
`id` int(10) NOT NULL,
`email` varchar(255) NOT NULL,
`token` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `temp`
--
INSERT INTO `temp` (`id`, `email`, `token`) VALUES
(19, '<EMAIL>', '<PASSWORD>'),
(19, '<EMAIL>', '<PASSWORD>'),
(21, '<EMAIL>', '9<PASSWORD>');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(255) NOT NULL,
`username` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(20) NOT NULL,
`email_status` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `email`, `password`, `email_status`) VALUES
(9, 'zihad', '<EMAIL>', '<PASSWORD>', 'verified'),
(19, 'test', '<EMAIL>', '12345', 'verified'),
(20, 'abc', '<EMAIL>', '12345', 'not_verified'),
(21, 'alamin', '<EMAIL>', 'abc', 'verified');
-- --------------------------------------------------------
--
-- Table structure for table `verify`
--
CREATE TABLE `verify` (
`id` int(10) NOT NULL,
`username` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`token` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `verify`
--
INSERT INTO `verify` (`id`, `username`, `email`, `token`) VALUES
(4, 'zihad', '<EMAIL>', '<PASSWORD>'),
(14, 'test', '<EMAIL>', '<PASSWORD>'),
(15, 'abc', '<EMAIL>', '<PASSWORD>'),
(16, 'alamin', '<EMAIL>', 'ix8enxdh');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `appointment`
--
ALTER TABLE `appointment`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `blood`
--
ALTER TABLE `blood`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `complain`
--
ALTER TABLE `complain`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `departments`
--
ALTER TABLE `departments`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `doctor`
--
ALTER TABLE `doctor`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `employee`
--
ALTER TABLE `employee`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `leaves`
--
ALTER TABLE `leaves`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `login`
--
ALTER TABLE `login`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `patient`
--
ALTER TABLE `patient`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `store`
--
ALTER TABLE `store`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `verify`
--
ALTER TABLE `verify`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `appointment`
--
ALTER TABLE `appointment`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `blood`
--
ALTER TABLE `blood`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `complain`
--
ALTER TABLE `complain`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `departments`
--
ALTER TABLE `departments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
--
-- AUTO_INCREMENT for table `doctor`
--
ALTER TABLE `doctor`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;
--
-- AUTO_INCREMENT for table `employee`
--
ALTER TABLE `employee`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `leaves`
--
ALTER TABLE `leaves`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `login`
--
ALTER TABLE `login`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `patient`
--
ALTER TABLE `patient`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `store`
--
ALTER TABLE `store`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `verify`
--
ALTER TABLE `verify`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
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
ticker,
currency,
date,
avg(rate) open,
avg(high) high,
avg(low) low,
min(dw_created_at) dw_created_at
from
dw.:table
where
currency = upper(':ticker')
and date = ':date'
group by
1, 2, 3
;
|
CREATE OR REPLACE FUNCTION reverse_geocode(latitude DOUBLE PRECISION, longitude DOUBLE PRECISION, OUT country_iso VARCHAR, OUT country VARCHAR, OUT city VARCHAR, OUT street VARCHAR, OUT housenumber VARCHAR, OUT distance DOUBLE PRECISION) STABLE AS $$
DECLARE
MAX_HOUSENUMBER_DISTANCE CONSTANT SMALLINT := 50;
MAX_STREET_DISTANCE CONSTANT SMALLINT := 200;
level SMALLINT;
loc geometry;
rec RECORD;
BEGIN
loc := ST_Transform(ST_SetSRID(ST_Point(longitude, latitude), 4326), 3857);
SELECT osm_id, "addr:housenumber" AS housenumber, tags, way, ST_Distance(loc, way) AS distance INTO rec FROM planet_osm_point WHERE ST_DWithin(loc, way, MAX_HOUSENUMBER_DISTANCE) AND "addr:housenumber" IS NOT NULL ORDER BY distance LIMIT 1;
IF FOUND THEN
housenumber := rec.housenumber;
street := rec.tags->'addr:street';
city := rec.tags->'addr:city';
distance := rec.distance;
loc := rec.way;
END IF;
IF street IS NULL THEN
SELECT osm_id, COALESCE(ref, name) AS name, ST_Distance(loc, way) AS distance INTO rec FROM planet_osm_line WHERE ST_DWithin(loc, way, MAX_STREET_DISTANCE) AND highway IS NOT NULL AND (ref IS NOT NULL OR name IS NOT NULL) ORDER BY distance LIMIT 1;
IF FOUND THEN
street := rec.name;
IF distance IS NULL THEN
distance := rec.distance;
END IF;
END IF;
END IF;
FOR rec IN
SELECT * FROM (SELECT regexp_replace(admin_level, E'\\D', '', 'g')::SMALLINT AS admin_level, name, tags FROM planet_osm_polygon WHERE ST_Intersects(way, loc) AND admin_level IS NOT NULL AND name IS NOT NULL AND boundary='administrative') AS s ORDER BY admin_level LIMIT 100
LOOP
IF (rec.admin_level = 2) THEN
country := rec.tags->'name:en';
country_iso := rec.tags->'ISO3166-1';
IF (city IS NOT NULL) THEN
EXIT;
END IF;
IF (country_iso = 'NL') THEN
level := 9;
ELSIF (country_iso = 'GB') THEN
level := 10;
ELSE
level := 8;
END IF;
ELSIF ((rec.admin_level > 2) AND (rec.admin_level <= level)) THEN
city := rec.name;
END IF;
END LOOP;
END;
$$ LANGUAGE plpgsql;
|
/*
Navicat Premium Data Transfer
Source Server : MySQL-本机-127.0.0.1
Source Server Type : MySQL
Source Server Version : 50717
Source Host : localhost:3306
Source Schema : lucky_log
Target Server Type : MySQL
Target Server Version : 50717
File Encoding : 65001
Date: 18/01/2021 10:32:27
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for sys_log
-- ----------------------------
DROP TABLE IF EXISTS `sys_log`;
CREATE TABLE `sys_log` (
`log_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`app_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目名',
`log_type` int(11) NOT NULL COMMENT '1-登录日志 2-操作日志 3-异常日志 4-调试信息',
`log_time` datetime(0) NOT NULL COMMENT '操作时间',
`process_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务主键',
`log_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '动作',
`log_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '源数据',
`module` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作模块',
`op_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '具体操作类型 如登录 删除 修改',
`host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主机 域名',
`ip_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'ip',
`ip_location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`device` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作系统 浏览器 设备信息',
`user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`is_enable` int(11) NOT NULL,
PRIMARY KEY (`log_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
|
USE users;
INSERT INTO user (timestamp,id,uid,name,gender,email,phone,dept,grade,language,region,role,preferTags,obtainedCredits) VALUES
("1506328859005", "u5", "5", "user5", "male", "email5", "phone5", "dept16", "grade4", "zh", "Beijing", "role2", "tags11", "16"),
("1506328859006", "u6", "6", "user6", "female", "email6", "phone6", "dept9", "grade2", "en", "Beijing", "role0", "tags4", "49"),
("1506328859007", "u7", "7", "user7", "male", "email7", "phone7", "dept6", "grade4", "zh", "Beijing", "role1", "tags23", "8"),
("1506328859008", "u8", "8", "user8", "male", "email8", "phone8", "dept5", "grade1", "zh", "Beijing", "role0", "tags3", "39"),
("1506328859009", "u9", "9", "user9", "female", "email9", "phone9", "dept9", "grade4", "zh", "Beijing", "role0", "tags9", "69"),
("1506328859010", "u10", "10", "user10", "female", "email10", "phone10", "dept17", "grade3", "zh", "Beijing", "role2", "tags48", "2"),
("1506328859011", "u11", "11", "user11", "female", "email11", "phone11", "dept14", "grade1", "en", "Hong Kong", "role0", "tags8", "56"),
("1506328859012", "u12", "12", "user12", "female", "email12", "phone12", "dept12", "grade2", "zh", "Hong Kong", "role0", "tags18", "3"),
("1506328859013", "u13", "13", "user13", "female", "email13", "phone13", "dept3", "grade4", "zh", "Hong Kong", "role0", "tags10", "63"),
("1506328859014", "u14", "14", "user14", "male", "email14", "phone14", "dept18", "grade1", "zh", "Hong Kong", "role2", "tags43", "10"),
("1506328859015", "u15", "15", "user15", "female", "email15", "phone15", "dept3", "grade2", "zh", "Beijing", "role0", "tags46", "60"),
("1506328859016", "u16", "16", "user16", "male", "email16", "phone16", "dept19", "grade3", "zh", "Hong Kong", "role1", "tags21", "55"),
("1506328859017", "u17", "17", "user17", "male", "email17", "phone17", "dept7", "grade4", "en", "Beijing", "role1", "tags20", "51"),
("1506328859018", "u18", "18", "user18", "female", "email18", "phone18", "dept12", "grade4", "zh", "Beijing", "role1", "tags1", "73"),
("1506328859019", "u19", "19", "user19", "male", "email19", "phone19", "dept11", "grade1", "zh", "Beijing", "role1", "tags21", "69"),
("1506328859020", "u20", "20", "user20", "male", "email20", "phone20", "dept4", "grade1", "zh", "Hong Kong", "role2", "tags18", "8");
|
--
-- pgwt.types
--
--------------------------------------------------------------------------------
CREATE TYPE pgwt.request_method AS ENUM (
'GET', 'POST', 'PATCH', 'PUT', 'DELETE', 'OPTIONS'
);
--------------------------------------------------------------------------------
|
<filename>scripts/List of computers that requested full zip.sql
--List of computers that requested full zip (thanks to Arjun2228)
-- https://www.symantec.com/connect/articles/handy-sql-queries-sepm-v14
-- symantec.com/connect/forums/sql-query-get-list-computers-requested-full-zip
USE [sem5]
SELECT SEM_COMPUTER.COMPUTER_NAME,
CONTENT_EVENTS.*
FROM CONTENT_EVENTS
INNER JOIN SEM_AGENT ON CONTENT_EVENTS.AGENT_ID = SEM_AGENT.AGENT_ID
INNER JOIN SEM_COMPUTER ON SEM_AGENT.COMPUTER_ID = SEM_COMPUTER.COMPUTER_ID
WHERE CONTENT_CATEGORY = 'AV_DEFS'
AND CONTENT_NAME LIKE '%Definitions%'
|
DROP FUNCTION IF EXISTS de_metas_endcustomer_fresh_reports.OpenItems_Report_Details(IN AD_Org_ID numeric, IN C_BPartner_ID numeric, IN IsSOTrx character varying, IN DaysDue numeric, IN InvoiceCollectionType character varying, IN StartDate date, In EndDate date, IN Reference_Date date, IN PassForPayment character varying, IN switchDate character varying);
CREATE OR REPLACE FUNCTION de_metas_endcustomer_fresh_reports.OpenItems_Report_Details(IN AD_Org_ID numeric, IN C_BPartner_ID numeric, IN IsSOTrx character varying, IN DaysDue numeric, IN InvoiceCollectionType character varying, IN StartDate date, In EndDate date, IN Reference_Date date, IN PassForPayment character varying, IN switchDate character varying)
RETURNS TABLE (
iso_code character(3),
DocumentNo character varying (30),
DateInvoiced date,
DateAcct date,
NetDays numeric,
DiscountDays numeric(10,0),
DueDate date,
DaysDue integer,
DiscountDate date,
GrandTotal numeric,
PaidAmt numeric,
OpenAmt numeric,
Value character varying (40),
Name character varying (60),
PassForPayment boolean,
GrandTotalConvert numeric,
OpenAmtConvert numeric,
main_currency character(3)
) AS
$$
SELECT
oi.CurrencyCode as iso_code,
oi.DocumentNo,
oi.DateInvoiced::date,
oi.DateAcct::date,
oi.NetDays,
oi.DiscountDays,
oi.DueDate::date,
oi.DaysDue,
oi.DiscountDate::date,
oi.GrandTotal,
oi.PaidAmt,
oi.OpenAmt,
oi.BPValue as Value,
oi.BPName as Name,
oi.IsInPaySelection as PassForPayment,
(CASE WHEN (cc.C_Currency_ID != c.C_Currency_ID) THEN currencyConvert(oi.GrandTotal
, cc.C_Currency_ID -- p_curfrom_id
, c.C_Currency_ID -- p_curto_id
, $8 -- p_convdate (Reference_Date)
, (SELECT C_ConversionType_ID FROM C_ConversionType where Value='P') -- p_conversiontype_id
, oi.AD_Client_ID
, oi.ad_org_id
)
ELSE NULL
END) AS GrandTotalConvert,
(CASE WHEN (cc.C_Currency_ID != c.C_Currency_ID) THEN currencyConvert(oi.OpenAmt
, cc.C_Currency_ID -- p_curfrom_id
, c.C_Currency_ID -- p_curto_id
, $8 -- p_convdate (Reference_Date)
, (SELECT C_ConversionType_ID FROM C_ConversionType where Value='P') -- p_conversiontype_id
, oi.AD_Client_ID
, oi.ad_org_id
)
ELSE NULL
END) AS OpenAmtConvert,
(CASE WHEN (cc.C_Currency_ID != c.C_Currency_ID) THEN c.iso_code
ELSE NULL
END) AS main_currency
FROM de_metas_endcustomer_fresh_reports.OpenItems_Report($8, $10) oi
LEFT OUTER JOIN AD_ClientInfo ci ON ci.AD_Client_ID=oi.ad_client_id
LEFT OUTER JOIN C_AcctSchema acs ON acs.C_AcctSchema_ID=ci.C_AcctSchema1_ID
LEFT OUTER JOIN C_Currency c ON acs.C_Currency_ID=c.C_Currency_ID
INNER JOIN C_Currency cc ON cc.iso_code=oi.CurrencyCode
WHERE
oi.AD_Org_ID = (CASE WHEN $1 IS NULL THEN oi.AD_Org_ID ELSE $1 END)
AND oi.IsSOTrx = (CASE WHEN $3 IS NULL THEN oi.IsSOTrx ELSE $3 END)
AND oi.C_BPartner_ID = (CASE WHEN $2 IS NULL THEN oi.C_BPartner_ID ELSE $2 END)
AND ($4 IS NULL OR $4 <= 0 OR oi.daysdue >= $4)
AND COALESCE( oi.InvoiceCollectionType, '') =
(CASE WHEN COALESCE($5, '') = '' THEN COALESCE( oi.InvoiceCollectionType, '' ) ELSE $5 END)
AND (
--09738 if flag is set then switches the given date to dateacct instead of dateinvoiced
CASE WHEN $10 = 'Y' THEN
(oi.DateAcct >= ( CASE WHEN $6::date IS NULL THEN oi.DateAcct ELSE $6::date END )
AND oi.DateAcct <= ( CASE WHEN $7::date IS NULL THEN oi.DateAcct ELSE $7::date END ))
ELSE
(oi.DateInvoiced >= ( CASE WHEN $6::date IS NULL THEN oi.DateInvoiced ELSE $6::date END )
AND oi.DateInvoiced <= ( CASE WHEN $7::date IS NULL THEN oi.DateInvoiced ELSE $7::date END ))
END
)
-- 08394: If Flag is not set, only display invoices that are not part of a processed PaySelection
AND ( $9 = 'Y' OR NOT oi.IsInPaySelection )
$$
LANGUAGE sql STABLE;
/*ORDER BY
oi.CurrencyCode,
oi.BPName,
oi.BPValue,
oi.DateInvoiced,
oi.DocumentNo
;*/
|
<filename>etc/schema/functions/eth_getBlockTransactionCountByNumber.sql
DROP FUNCTION IF EXISTS eth_getBlockTransactionCountByNumber(blockno) RESTRICT;
CREATE FUNCTION eth_getBlockTransactionCountByNumber(block_id blockno) RETURNS bigint AS $$
DECLARE
result bigint;
BEGIN
-- FIXME: return NULL for unknown blocks
SELECT COUNT(id)
FROM transaction
WHERE block = block_id
INTO STRICT result;
RETURN result;
END;
$$ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE;
|
<filename>flyway/flywaymigrations/V0.0014__add_municipalities.sql
INSERT INTO digilog.municipality (name_de, url, state_id)
SELECT m.name as name_de, '' as url, state.id as state_id
FROM (
VALUES ('Kappel am Albis', 'Zürich'),
('Knonau', 'Zürich'),
('Maschwanden', 'Zürich'),
('Mettmenstetten', 'Zürich'),
('Obfelden', 'Zürich'),
('Ottenbach', 'Zürich'),
('Rifferswil', 'Zürich'),
('Stallikon', 'Zürich'),
('Wettswil am Albis', 'Zürich'),
('Adlikon', 'Zürich'),
('Benken (ZH)', 'Zürich'),
('Berg am Irchel', 'Zürich'),
('Buch am Irchel', 'Zürich'),
('Dachsen', 'Zürich'),
('Dorf', 'Zürich'),
('Feuerthalen', 'Zürich'),
('Flaach', 'Zürich'),
('Flurlingen', 'Zürich'),
('Andelfingen', 'Zürich'),
('Henggart', 'Zürich'),
('Humlikon', 'Zürich'),
('Kleinandelfingen', 'Zürich'),
('Laufen-Uhwiesen', 'Zürich'),
('Marthalen', 'Zürich'),
('Ossingen', 'Zürich'),
('Rheinau', 'Zürich'),
('Thalheim an der Thur', 'Zürich'),
('Trüllikon', 'Zürich'),
('Truttikon', 'Zürich'),
('Volken', 'Zürich'),
('Bachenbülach', 'Zürich'),
('Bassersdorf', 'Zürich'),
('Bülach', 'Zürich'),
('Dietlikon', 'Zürich'),
('Eglisau', 'Zürich'),
('Embrach', 'Zürich'),
('Freienstein-Teufen', 'Zürich'),
('Glattfelden', 'Zürich'),
('Hochfelden', 'Zürich'),
('Höri', 'Zürich'),
('Hüntwangen', 'Zürich'),
('Kloten', 'Zürich'),
('Lufingen', 'Zürich'),
('Nürensdorf', 'Zürich'),
('Oberembrach', 'Zürich'),
('Opfikon', 'Zürich'),
('Rafz', 'Zürich'),
('Rorbas', 'Zürich'),
('Wallisellen', 'Zürich'),
('Wasterkingen', 'Zürich'),
('Wil (ZH)', 'Zürich'),
('Winkel', 'Zürich'),
('Bachs', 'Zürich'),
('Boppelsen', 'Zürich'),
('Buchs (ZH)', 'Zürich'),
('Dällikon', 'Zürich'),
('Dänikon', 'Zürich'),
('Dielsdorf', 'Zürich'),
('Hüttikon', 'Zürich'),
('Neerach', 'Zürich'),
('Niederglatt', 'Zürich'),
('Niederhasli', 'Zürich'),
('Niederweningen', 'Zürich'),
('Oberglatt', 'Zürich'),
('Oberweningen', 'Zürich'),
('Otelfingen', 'Zürich'),
('Regensberg', 'Zürich'),
('Regensdorf', 'Zürich'),
('Rümlang', 'Zürich'),
('Schleinikon', 'Zürich'),
('Schöfflisdorf', 'Zürich'),
('Stadel', 'Zürich'),
('Steinmaur', 'Zürich'),
('Weiach', 'Zürich'),
('Bäretswil', 'Zürich'),
('Bubikon', 'Zürich'),
('Dürnten', 'Zürich'),
('Fischenthal', 'Zürich'),
('Gossau (ZH)', 'Zürich'),
('Grüningen', 'Zürich'),
('Hinwil', 'Zürich'),
('Rüti (ZH)', 'Zürich'),
('Seegräben', 'Zürich'),
('Wald (ZH)', 'Zürich'),
('Wetzikon (ZH)', 'Zürich'),
('Adliswil', 'Zürich'),
('Kilchberg (ZH)', 'Zürich'),
('Langnau am Albis', 'Zürich'),
('Oberrieden', 'Zürich'),
('Richterswil', 'Zürich'),
('Rüschlikon', 'Zürich'),
('Thalwil', 'Zürich'),
('Erlenbach (ZH)', 'Zürich'),
('Herrliberg', 'Zürich'),
('Hombrechtikon', 'Zürich'),
('Küsnacht (ZH)', 'Zürich'),
('Männedorf', 'Zürich'),
('Meilen', 'Zürich'),
('Oetwil am See', 'Zürich'),
('Stäfa', 'Zürich'),
('Uetikon am See', 'Zürich'),
('Zumikon', 'Zürich'),
('Zollikon', 'Zürich'),
('Fehraltorf', 'Zürich'),
('Hittnau', 'Zürich'),
('Lindau', 'Zürich'),
('Pfäffikon', 'Zürich'),
('Russikon', 'Zürich'),
('Weisslingen', 'Zürich'),
('Wila', 'Zürich'),
('Wildberg', 'Zürich'),
('Dübendorf', 'Zürich'),
('Egg', 'Zürich'),
('Fällanden', 'Zürich'),
('Greifensee', 'Zürich'),
('Maur', 'Zürich'),
('Mönchaltorf', 'Zürich'),
('Schwerzenbach', 'Zürich'),
('Uster', 'Zürich'),
('Volketswil', 'Zürich'),
('Wangen-Brüttisellen', 'Zürich'),
('Altikon', 'Zürich'),
('Brütten', 'Zürich'),
('Dägerlen', 'Zürich'),
('Dättlikon', 'Zürich'),
('Dinhard', 'Zürich'),
('<NAME>', 'Zürich'),
('Elsau', 'Zürich'),
('Hagenbuch', 'Zürich'),
('Hettlingen', 'Zürich'),
('Neftenbach', 'Zürich'),
('Pfungen', 'Zürich'),
('Rickenbach (ZH)', 'Zürich'),
('Schlatt (ZH)', 'Zürich'),
('Seuzach', 'Zürich'),
('Turbenthal', 'Zürich'),
('Winterthur', 'Zürich'),
('Zell (ZH)', 'Zürich'),
('Aesch (ZH)', 'Zürich'),
('Birmensdorf (ZH)', 'Zürich'),
('Dietikon', 'Zürich'),
('Geroldswil', 'Zürich'),
('Oberengstringen', 'Zürich'),
('<NAME>', 'Zürich'),
('Schlieren', 'Zürich'),
('Uitikon', 'Zürich'),
('Unterengstringen', 'Zürich'),
('Urdorf', 'Zürich'),
('Weiningen (ZH)', 'Zürich'),
('Zürich', 'Zürich'),
('Stammheim', 'Zürich'),
('Wädenswil', 'Zürich'),
('Elgg', 'Zürich'),
('Horgen', 'Zürich'),
('Illnau-Effretikon', 'Zürich'),
('Bauma', 'Zürich'),
('Wiesendangen', 'Zürich'),
('Aarberg', 'Bern'),
('Bargen (BE)', 'Bern'),
('Grossaffoltern', 'Bern'),
('Kallnach', 'Bern'),
('Kappelen', 'Bern'),
('Lyss', 'Bern'),
('Meikirch', 'Bern'),
('Radelfingen', 'Bern'),
('Rapperswil (BE)', 'Bern'),
('Schüpfen', 'Bern'),
('Seedorf (BE)', 'Bern'),
('Aarwangen', 'Bern'),
('Auswil', 'Bern'),
('Bannwil', 'Bern'),
('Bleienbach', 'Bern'),
('Busswil bei Melchnau', 'Bern'),
('Gondiswil', 'Bern'),
('Langenthal', 'Bern'),
('Lotzwil', 'Bern'),
('Madiswil', 'Bern'),
('Melchnau', 'Bern'),
('Oeschenbach', 'Bern'),
('Reisiswil', 'Bern'),
('Roggwil (BE)', 'Bern'),
('Rohrbach', 'Bern'),
('Rohrbachgraben', 'Bern'),
('Rütschelen', 'Bern'),
('Schwarzhäusern', 'Bern'),
('Thunstetten', 'Bern'),
('Ursenbach', 'Bern'),
('Wynau', 'Bern'),
('Bern', 'Bern'),
('Bolligen', 'Bern'),
('Bremgarten bei Bern', 'Bern'),
('Kirchlindach', 'Bern'),
('Köniz', 'Bern'),
('Muri bei Bern', 'Bern'),
('Oberbalm', 'Bern'),
('Stettlen', 'Bern'),
('Vechigen', 'Bern'),
('Wohlen bei Bern', 'Bern'),
('Zollikofen', 'Bern'),
('Ittigen', 'Bern'),
('Ostermundigen', 'Bern'),
('Biel/Bienne', 'Bern'),
('Evilard', 'Bern'),
('Arch', 'Bern'),
('Büetigen', 'Bern'),
('Büren an der Aare', 'Bern'),
('Diessbach bei Büren', 'Bern'),
('Dotzigen', 'Bern'),
('Lengnau (BE)', 'Bern'),
('Leuzigen', 'Bern'),
('Meienried', 'Bern'),
('Meinisberg', 'Bern'),
('Oberwil bei Büren', 'Bern'),
('Pieterlen', 'Bern'),
('Rüti bei Büren', 'Bern'),
('Wengi', 'Bern'),
('Aefligen', 'Bern'),
('Alchenstorf', 'Bern'),
('Bäriswil', 'Bern'),
('Burgdorf', 'Bern'),
('Ersigen', 'Bern'),
('Hasle bei Burgdorf', 'Bern'),
('Heimiswil', 'Bern'),
('Hellsau', 'Bern'),
('Hindelbank', 'Bern'),
('Höchstetten', 'Bern'),
('Kernenried', 'Bern'),
('Kirchberg (BE)', 'Bern'),
('Koppigen', 'Bern'),
('Krauchthal', 'Bern'),
('Lyssach', 'Bern'),
('Oberburg', 'Bern'),
('Rüdtligen-Alchenflüh', 'Bern'),
('Rumendingen', 'Bern'),
('<NAME> Lyssach', 'Bern'),
('Willadingen', 'Bern'),
('Wynigen', 'Bern'),
('Corgémont', 'Bern'),
('Cormoret', 'Bern'),
('Cortébert', 'Bern'),
('Courtelary', 'Bern'),
('<NAME>', 'Bern'),
('Mont-Tramelan', 'Bern'),
('Orvin', 'Bern'),
('Renan (BE)', 'Bern'),
('Romont (BE)', 'Bern'),
('Saint-Imier', 'Bern'),
('Sonceboz-Sombeval', 'Bern'),
('Sonvilier', 'Bern'),
('Tramelan', 'Bern'),
('Villeret', 'Bern'),
('Sauge', 'Bern'),
('<NAME>', 'Bern'),
('Brüttelen', 'Bern'),
('Erlach', 'Bern'),
('Finsterhennen', 'Bern'),
('Gals', 'Bern'),
('Gampelen', 'Bern'),
('Ins', 'Bern'),
('Lüscherz', 'Bern'),
('Müntschemier', 'Bern'),
('Siselen', 'Bern'),
('Treiten', 'Bern'),
('Tschugg', 'Bern'),
('Vinelz', 'Bern'),
('Bätterkinden', 'Bern'),
('Deisswil bei Münchenbuchsee', 'Bern'),
('Diemerswil', 'Bern'),
('Fraubrunnen', 'Bern'),
('Jegenstorf', 'Bern'),
('Iffwil', 'Bern'),
('Mattstetten', 'Bern'),
('Moosseedorf', 'Bern'),
('Münchenbuchsee', 'Bern'),
('Urtenen-Schönbühl', 'Bern'),
('Utzenstorf', 'Bern'),
('Wiggiswil', 'Bern'),
('Wiler bei Utzenstorf', 'Bern'),
('Zielebach', 'Bern'),
('Zuzwil (BE)', 'Bern'),
('Adelboden', 'Bern'),
('<NAME> Spiez', 'Bern'),
('Frutigen', 'Bern'),
('Kandergrund', 'Bern'),
('Kandersteg', 'Bern'),
('Krattigen', 'Bern'),
('Reichenbach im Kandertal', 'Bern'),
('Beatenberg', 'Bern'),
('Bönigen', 'Bern'),
('Brienz (BE)', 'Bern'),
('Brienzwiler', 'Bern'),
('Därligen', 'Bern'),
('Grindelwald', 'Bern'),
('Gsteigwiler', 'Bern'),
('Gündlischwand', 'Bern'),
('Habkern', 'Bern'),
('Hofstetten bei Brienz', 'Bern'),
('Interlaken', 'Bern'),
('Iseltwald', 'Bern'),
('Lauterbrunnen', 'Bern'),
('Leissigen', 'Bern'),
('Lütschental', 'Bern'),
('Matten bei Interlaken', 'Bern'),
('Niederried bei Interlaken', 'Bern'),
('Oberried am Brienzersee', 'Bern'),
('Ringgenberg (BE)', 'Bern'),
('Saxeten', 'Bern'),
('Schwanden bei Brienz', 'Bern'),
('Unterseen', 'Bern'),
('Wilderswil', 'Bern'),
('Arni (BE)', 'Bern'),
('Biglen', 'Bern'),
('Bowil', 'Bern'),
('Brenzikofen', 'Bern'),
('Freimettigen', 'Bern'),
('Grosshöchstetten', 'Bern'),
('Häutligen', 'Bern'),
('Herbligen', 'Bern'),
('Kiesen', 'Bern'),
('Konolfingen', 'Bern'),
('Landiswil', 'Bern'),
('Linden', 'Bern'),
('Mirchel', 'Bern'),
('Münsingen', 'Bern'),
('Niederhünigen', 'Bern'),
('Oberdiessbach', 'Bern'),
('Oberthal', 'Bern'),
('Oppligen', 'Bern'),
('Rubigen', 'Bern'),
('Walkringen', 'Bern'),
('Worb', 'Bern'),
('Zäziwil', 'Bern'),
('Oberhünigen', 'Bern'),
('Allmendingen', 'Bern'),
('Wichtrach', 'Bern'),
('Ferenbalm', 'Bern'),
('Frauenkappelen', 'Bern'),
('Gurbrü', 'Bern'),
('Kriechenwil', 'Bern'),
('Laupen', 'Bern'),
('Mühleberg', 'Bern'),
('Münchenwiler', 'Bern'),
('Neuenegg', 'Bern'),
('Wileroltigen', 'Bern'),
('Belprahon', 'Bern'),
('Champoz', 'Bern'),
('Corcelles (BE)', 'Bern'),
('Court', 'Bern'),
('Crémines', 'Bern'),
('Eschert', 'Bern'),
('Grandval', 'Bern'),
('Loveresse', 'Bern'),
('Moutier', 'Bern'),
('Perrefitte', 'Bern'),
('Reconvilier', 'Bern'),
('Roches (BE)', 'Bern'),
('Saicourt', 'Bern'),
('Saules (BE)', 'Bern'),
('Schelten', 'Bern'),
('Seehof', 'Bern'),
('Sorvilier', 'Bern'),
('Tavannes', 'Bern'),
('Rebévelier', 'Bern'),
('Petit-Val', 'Bern'),
('Valbirse', 'Bern'),
('<NAME>', 'Bern'),
('Nods', 'Bern'),
('<NAME>', 'Bern'),
('Aegerten', 'Bern'),
('Bellmund', 'Bern'),
('Brügg', 'Bern'),
('Bühl', 'Bern'),
('Epsach', 'Bern'),
('Hagneck', 'Bern'),
('Hermrigen', 'Bern'),
('Jens', 'Bern'),
('Ipsach', 'Bern'),
('Ligerz', 'Bern'),
('Merzligen', 'Bern'),
('Mörigen', 'Bern'),
('Nidau', 'Bern'),
('Orpund', 'Bern'),
('Port', 'Bern'),
('Safnern', 'Bern'),
('Scheuren', 'Bern'),
('Schwadernau', 'Bern'),
('Studen (BE)', 'Bern'),
('Sutz-Lattrigen', 'Bern'),
('Täuffelen', 'Bern'),
('Walperswil', 'Bern'),
('Worben', 'Bern'),
('Twann-Tüscherz', 'Bern'),
('Därstetten', 'Bern'),
('Diemtigen', 'Bern'),
('Erlenbach im Simmental', 'Bern'),
('Oberwil im Simmental', 'Bern'),
('Reutigen', 'Bern'),
('Spiez', 'Bern'),
('Wimmis', 'Bern'),
('Stocken-Höfen', 'Bern'),
('Guttannen', 'Bern'),
('Hasliberg', 'Bern'),
('Innertkirchen', 'Bern'),
('Meiringen', 'Bern'),
('Schattenhalb', 'Bern'),
('Boltigen', 'Bern'),
('Lenk', 'Bern'),
('<NAME>', 'Bern'),
('Zweisimmen', 'Bern'),
('Gsteig', 'Bern'),
('Lauenen', 'Bern'),
('Saanen', 'Bern'),
('Guggisberg', 'Bern'),
('Rüschegg', 'Bern'),
('Schwarzenburg', 'Bern'),
('Belp', 'Bern'),
('Burgistein', 'Bern'),
('Gerzensee', 'Bern'),
('Gurzelen', 'Bern'),
('Jaberg', 'Bern'),
('Kaufdorf', 'Bern'),
('Kehrsatz', 'Bern'),
('Kirchdorf (BE)', 'Bern'),
('Niedermuhlern', 'Bern'),
('Riggisberg', 'Bern'),
('Rüeggisberg', 'Bern'),
('Seftigen', 'Bern'),
('Toffen', 'Bern'),
('Uttigen', 'Bern'),
('Wattenwil', 'Bern'),
('Wald (BE)', 'Bern'),
('Thurnen', 'Bern'),
('Eggiwil', 'Bern'),
('Langnau im Emmental', 'Bern'),
('Lauperswil', 'Bern'),
('Röthenbach im Emmental', 'Bern'),
('Rüderswil', 'Bern'),
('Schangnau', 'Bern'),
('Signau', 'Bern'),
('Trub', 'Bern'),
('Trubschachen', 'Bern'),
('Amsoldingen', 'Bern'),
('Blumenstein', 'Bern'),
('Buchholterberg', 'Bern'),
('Eriz', 'Bern'),
('Fahrni', 'Bern'),
('Heiligenschwendi', 'Bern'),
('Heimberg', 'Bern'),
('Hilterfingen', 'Bern'),
('Homberg', 'Bern'),
('Horrenbach-Buchen', 'Bern'),
('Oberhofen am Thunersee', 'Bern'),
('Oberlangenegg', 'Bern'),
('Pohlern', 'Bern'),
('Sigriswil', 'Bern'),
('Steffisburg', 'Bern'),
('Teuffenthal (BE)', 'Bern'),
('Thierachern', 'Bern'),
('Thun', 'Bern'),
('Uebeschi', 'Bern'),
('Uetendorf', 'Bern'),
('Unterlangenegg', 'Bern'),
('Wachseldorn', 'Bern'),
('Zwieselberg', 'Bern'),
('Forst-Längenbühl', 'Bern'),
('Affoltern im Emmental', 'Bern'),
('Dürrenroth', 'Bern'),
('Eriswil', 'Bern'),
('Huttwil', 'Bern'),
('Lützelflüh', 'Bern'),
('Rüegsau', 'Bern'),
('Sumiswald', 'Bern'),
('Trachselwald', 'Bern'),
('Walterswil (BE)', 'Bern'),
('Wyssachen', 'Bern'),
('Attiswil', 'Bern'),
('Berken', 'Bern'),
('Bettenhausen', 'Bern'),
('Farnern', 'Bern'),
('Graben', 'Bern'),
('Heimenhausen', 'Bern'),
('Herzogenbuchsee', 'Bern'),
('Inkwil', 'Bern'),
('Niederbipp', 'Bern'),
('Niederönz', 'Bern'),
('Oberbipp', 'Bern'),
('Ochlenberg', 'Bern'),
('Rumisberg', 'Bern'),
('Seeberg', 'Bern'),
('Thörigen', 'Bern'),
('Walliswil bei Niederbipp', 'Bern'),
('Walliswil bei Wangen', 'Bern'),
('<NAME>', 'Bern'),
('Wangenried', 'Bern'),
('Wiedlisbach', 'Bern'),
('Doppleschwand', 'Luzern'),
('Entlebuch', 'Luzern'),
('Flühli', 'Luzern'),
('Hasle (LU)', 'Luzern'),
('Romoos', 'Luzern'),
('Schüpfheim', 'Luzern'),
('Werthenstein', 'Luzern'),
('Escholzmatt-Marbach', 'Luzern'),
('Aesch (LU)', 'Luzern'),
('Ballwil', 'Luzern'),
('Emmen', 'Luzern'),
('Ermensee', 'Luzern'),
('Eschenbach (LU)', 'Luzern'),
('Hitzkirch', 'Luzern'),
('Hochdorf', 'Luzern'),
('Hohenrain', 'Luzern'),
('Inwil', 'Luzern'),
('Rain', 'Luzern'),
('Römerswil', 'Luzern'),
('Rothenburg', 'Luzern'),
('Schongau', 'Luzern'),
('Adligenswil', 'Luzern'),
('Buchrain', 'Luzern'),
('Dierikon', 'Luzern'),
('Ebikon', 'Luzern'),
('Gisikon', 'Luzern'),
('Greppen', 'Luzern'),
('Honau', 'Luzern'),
('Horw', 'Luzern'),
('Kriens', 'Luzern'),
('Luzern', 'Luzern'),
('Malters', 'Luzern'),
('Meggen', 'Luzern'),
('Meierskappel', 'Luzern'),
('Root', 'Luzern'),
('Schwarzenberg', 'Luzern'),
('Udligenswil', 'Luzern'),
('Vitznau', 'Luzern'),
('Weggis', 'Luzern'),
('Beromünster', 'Luzern'),
('Büron', 'Luzern'),
('Buttisholz', 'Luzern'),
('Eich', 'Luzern'),
('Geuensee', 'Luzern'),
('Grosswangen', 'Luzern'),
('Hildisrieden', 'Luzern'),
('Knutwil', 'Luzern'),
('Mauensee', 'Luzern'),
('Neuenkirch', 'Luzern'),
('Nottwil', 'Luzern'),
('Oberkirch', 'Luzern'),
('Rickenbach (LU)', 'Luzern'),
('Ruswil', 'Luzern'),
('Schenkon', 'Luzern'),
('Schlierbach', 'Luzern'),
('Sempach', 'Luzern'),
('Sursee', 'Luzern'),
('Triengen', 'Luzern'),
('Wolhusen', 'Luzern'),
('Alberswil', 'Luzern'),
('Altbüron', 'Luzern'),
('Altishofen', 'Luzern'),
('Dagmersellen', 'Luzern'),
('Egolzwil', 'Luzern'),
('Ettiswil', 'Luzern'),
('Fischbach', 'Luzern'),
('Grossdietwil', 'Luzern'),
('<NAME>', 'Luzern'),
('Luthern', 'Luzern'),
('Menznau', 'Luzern'),
('Nebikon', 'Luzern'),
('Pfaffnau', 'Luzern'),
('Reiden', 'Luzern'),
('Roggliswil', 'Luzern'),
('Schötz', 'Luzern'),
('Ufhusen', 'Luzern'),
('Wauwil', 'Luzern'),
('Wikon', 'Luzern'),
('Zell (LU)', 'Luzern'),
('Willisau', 'Luzern'),
('Altdorf (UR)', 'Uri'),
('Andermatt', 'Uri'),
('Attinghausen', 'Uri'),
('Bürglen (UR)', 'Uri'),
('Erstfeld', 'Uri'),
('Flüelen', 'Uri'),
('Göschenen', 'Uri'),
('Gurtnellen', 'Uri'),
('Hospental', 'Uri'),
('Isenthal', 'Uri'),
('Realp', 'Uri'),
('Schattdorf', 'Uri'),
('Seedorf (UR)', 'Uri'),
('Seelisberg', 'Uri'),
('Silenen', 'Uri'),
('Sisikon', 'Uri'),
('Spiringen', 'Uri'),
('Unterschächen', 'Uri'),
('Wassen', 'Uri'),
('Einsiedeln', 'Schwyz'),
('Gersau', 'Schwyz'),
('Feusisberg', 'Schwyz'),
('Freienbach', 'Schwyz'),
('Wollerau', 'Schwyz'),
('Küssnacht (SZ)', 'Schwyz'),
('Altendorf', 'Schwyz'),
('Galgenen', 'Schwyz'),
('Innerthal', 'Schwyz'),
('Lachen', 'Schwyz'),
('Reichenburg', 'Schwyz'),
('Schübelbach', 'Schwyz'),
('Tuggen', 'Schwyz'),
('Vorderthal', 'Schwyz'),
('Wangen (SZ)', 'Schwyz'),
('Alpthal', 'Schwyz'),
('Arth', 'Schwyz'),
('Illgau', 'Schwyz'),
('Ingenbohl', 'Schwyz'),
('Lauerz', 'Schwyz'),
('Morschach', 'Schwyz'),
('Muotathal', 'Schwyz'),
('Oberiberg', 'Schwyz'),
('Riemenstalden', 'Schwyz'),
('Rothenthurm', 'Schwyz'),
('Sattel', 'Schwyz'),
('Schwyz', 'Schwyz'),
('Steinen', 'Schwyz'),
('Steinerberg', 'Schwyz'),
('Unteriberg', 'Schwyz'),
('Alpnach', 'Obwalden'),
('Engelberg', 'Obwalden'),
('Giswil', 'Obwalden'),
('Kerns', 'Obwalden'),
('Lungern', 'Obwalden'),
('Sachseln', 'Obwalden'),
('Sarnen', 'Obwalden'),
('Beckenried', 'Nidwalden'),
('Buochs', 'Nidwalden'),
('Dallenwil', 'Nidwalden'),
('Emmetten', 'Nidwalden'),
('Ennetbürgen', 'Nidwalden'),
('Ennetmoos', 'Nidwalden'),
('Hergiswil (NW)', 'Nidwalden'),
('Oberdorf (NW)', 'Nidwalden'),
('Stans', 'Nidwalden'),
('Stansstad', 'Nidwalden'),
('Wolfenschiessen', 'Nidwalden'),
('<NAME>', 'Glarus'),
('<NAME>', 'Glarus'),
('Glarus', 'Glarus'),
('Baar', 'Zug'),
('Cham', 'Zug'),
('Hünenberg', 'Zug'),
('Menzingen', 'Zug'),
('Neuheim', 'Zug'),
('Oberägeri', 'Zug'),
('Risch', 'Zug'),
('Steinhausen', 'Zug'),
('Unterägeri', 'Zug'),
('Walchwil', 'Zug'),
('Zug', 'Zug'),
('Châtillon (FR)', 'Fribourg'),
('Cugy (FR)', 'Fribourg'),
('Fétigny', 'Fribourg'),
('Gletterens', 'Fribourg'),
('Lully (FR)', 'Fribourg'),
('Ménières', 'Fribourg'),
('Montagny (FR)', 'Fribourg'),
('Nuvilly', 'Fribourg'),
('Prévondavaux', 'Fribourg'),
('Saint-Aubin (FR)', 'Fribourg'),
('Sévaz', 'Fribourg'),
('Surpierre', 'Fribourg'),
('Vallon', 'Fribourg'),
('Les Montets', 'Fribourg'),
('Delley-Portalban', 'Fribourg'),
('Belmont-Broye', 'Fribourg'),
('Estavayer', 'Fribourg'),
('Cheyres-Châbles', 'Fribourg'),
('Auboranges', 'Fribourg'),
('Billens-Hennens', 'Fribourg'),
('Chapelle (Glâne)', 'Fribourg'),
('Le Châtelard', 'Fribourg'),
('Châtonnaye', 'Fribourg'),
('Ecublens (FR)', 'Fribourg'),
('Grangettes', 'Fribourg'),
('Massonnens', 'Fribourg'),
('Mézières (FR)', 'Fribourg'),
('Montet (Glâne)', 'Fribourg'),
('Romont (FR)', 'Fribourg'),
('Rue', 'Fribourg'),
('Siviriez', 'Fribourg'),
('Ursy', 'Fribourg'),
('Vuisternens-devant-Romont', 'Fribourg'),
('Villorsonnens', 'Fribourg'),
('Torny', 'Fribourg'),
('Villaz', 'Fribourg'),
('Haut-Intyamon', 'Fribourg'),
('Pont-en-Ogoz', 'Fribourg'),
('Botterens', 'Fribourg'),
('Broc', 'Fribourg'),
('Bulle', 'Fribourg'),
('Châtel-sur-Montsalvens', 'Fribourg'),
('Corbières', 'Fribourg'),
('Crésuz', 'Fribourg'),
('Echarlens', 'Fribourg'),
('Grandvillard', 'Fribourg'),
('Gruyères', 'Fribourg'),
('Hauteville', 'Fribourg'),
('Jaun', 'Fribourg'),
('Marsens', 'Fribourg'),
('Morlon', 'Fribourg'),
('Le Pâquier (FR)', 'Fribourg'),
('Pont-la-Ville', 'Fribourg'),
('Riaz', 'Fribourg'),
('La Roche', 'Fribourg'),
('Sâles', 'Fribourg'),
('Sorens', 'Fribourg'),
('Vaulruz', 'Fribourg'),
('Vuadens', 'Fribourg'),
('Bas-Intyamon', 'Fribourg'),
('Val-de-Charmey', 'Fribourg'),
('Autigny', 'Fribourg'),
('Avry', 'Fribourg'),
('Belfaux', 'Fribourg'),
('Chénens', 'Fribourg'),
('Corminboeuf', 'Fribourg'),
('Cottens (FR)', 'Fribourg'),
('Ferpicloz', 'Fribourg'),
('Fribourg', 'Fribourg'),
('Givisiez', 'Fribourg'),
('Granges-Paccot', 'Fribourg'),
('Grolley', 'Fribourg'),
('Marly', 'Fribourg'),
('Matran', 'Fribourg'),
('Neyruz (FR)', 'Fribourg'),
('Pierrafortscha', 'Fribourg'),
('Ponthaux', 'Fribourg'),
('Le Mouret', 'Fribourg'),
('Treyvaux', 'Fribourg'),
('Villars-sur-Glâne', 'Fribourg'),
('Villarsel-sur-Marly', 'Fribourg'),
('Hauterive (FR)', 'Fribourg'),
('La Brillaz', 'Fribourg'),
('La Sonnaz', 'Fribourg'),
('Gibloux', 'Fribourg'),
('Prez', 'Fribourg'),
('Bois-d''Amont', 'Fribourg'),
('Courgevaux', 'Fribourg'),
('Courtepin', 'Fribourg'),
('Cressier (FR)', 'Fribourg'),
('Fräschels', 'Fribourg'),
('Greng', 'Fribourg'),
('Gurmels', 'Fribourg'),
('Kerzers', 'Fribourg'),
('Kleinbösingen', 'Fribourg'),
('Meyriez', 'Fribourg'),
('Misery-Courtion', 'Fribourg'),
('Muntelier', 'Fribourg'),
('Murten', 'Fribourg'),
('Ried bei Kerzers', 'Fribourg'),
('Ulmiz', 'Fribourg'),
('Mont-Vully', 'Fribourg'),
('Brünisried', 'Fribourg'),
('Düdingen', 'Fribourg'),
('Giffers', 'Fribourg'),
('Bösingen', 'Fribourg'),
('Heitenried', 'Fribourg'),
('Plaffeien', 'Fribourg'),
('Plasselb', 'Fribourg'),
('Rechthalten', 'Fribourg'),
('St. Silvester', 'Fribourg'),
('St. Ursen', 'Fribourg'),
('Schmitten (FR)', 'Fribourg'),
('Tafers', 'Fribourg'),
('Tentlingen', 'Fribourg'),
('Ueberstorf', 'Fribourg'),
('Wünnewil-Flamatt', 'Fribourg'),
('Attalens', 'Fribourg'),
('Bossonnens', 'Fribourg'),
('Châtel-Saint-Denis', 'Fribourg'),
('Granges (Veveyse)', 'Fribourg'),
('Remaufens', 'Fribourg'),
('Saint-Martin (FR)', 'Fribourg'),
('Semsales', 'Fribourg'),
('Le Flon', 'Fribourg'),
('<NAME>', 'Fribourg'),
('Egerkingen', 'Solothurn'),
('Härkingen', 'Solothurn'),
('Kestenholz', 'Solothurn'),
('Neuendorf', 'Solothurn'),
('Niederbuchsiten', 'Solothurn'),
('Oberbuchsiten', 'Solothurn'),
('Oensingen', 'Solothurn'),
('Wolfwil', 'Solothurn'),
('Aedermannsdorf', 'Solothurn'),
('Balsthal', 'Solothurn'),
('Herbetswil', 'Solothurn'),
('Holderbank (SO)', 'Solothurn'),
('Laupersdorf', 'Solothurn'),
('Matzendorf', 'Solothurn'),
('Mümliswil-Ramiswil', 'Solothurn'),
('Welschenrohr-Gänsbrunnen', 'Solothurn'),
('Biezwil', 'Solothurn'),
('Lüterkofen-Ichertswil', 'Solothurn'),
('Lüterswil-Gächliwil', 'Solothurn'),
('Messen', 'Solothurn'),
('Schnottwil', 'Solothurn'),
('Unterramsern', 'Solothurn'),
('Lüsslingen-Nennigkofen', 'Solothurn'),
('Buchegg', 'Solothurn'),
('Bättwil', 'Solothurn'),
('Büren (SO)', 'Solothurn'),
('Dornach', 'Solothurn'),
('Gempen', 'Solothurn'),
('Hochwald', 'Solothurn'),
('Hofstetten-Flüh', 'Solothurn'),
('Metzerlen-Mariastein', 'Solothurn'),
('<NAME>', 'Solothurn'),
('Rodersdorf', 'Solothurn'),
('Seewen', 'Solothurn'),
('Witterswil', 'Solothurn'),
('Hauenstein-Ifenthal', 'Solothurn'),
('Kienberg', 'Solothurn'),
('Lostorf', 'Solothurn'),
('Niedergösgen', 'Solothurn'),
('Obergösgen', 'Solothurn'),
('Stüsslingen', 'Solothurn'),
('Trimbach', 'Solothurn'),
('Winznau', 'Solothurn'),
('Wisen (SO)', 'Solothurn'),
('Erlinsbach (SO)', 'Solothurn'),
('Aeschi (SO)', 'Solothurn'),
('Biberist', 'Solothurn'),
('Bolken', 'Solothurn'),
('Deitingen', 'Solothurn'),
('Derendingen', 'Solothurn'),
('Etziken', 'Solothurn'),
('Gerlafingen', 'Solothurn'),
('Halten', 'Solothurn'),
('Horriwil', 'Solothurn'),
('Hüniken', 'Solothurn'),
('Kriegstetten', 'Solothurn'),
('Lohn-Ammannsegg', 'Solothurn'),
('Luterbach', 'Solothurn'),
('Obergerlafingen', 'Solothurn'),
('Oekingen', 'Solothurn'),
('Recherswil', 'Solothurn'),
('Subingen', 'Solothurn'),
('Zuchwil', 'Solothurn'),
('<NAME>', 'Solothurn'),
('<NAME>', 'Solothurn'),
('Bellach', 'Solothurn'),
('Bettlach', 'Solothurn'),
('<NAME>', 'Solothurn'),
('Flumenthal', 'Solothurn'),
('Grenchen', 'Solothurn'),
('Günsberg', 'Solothurn'),
('Hubersdorf', 'Solothurn'),
('Kammersrohr', 'Solothurn'),
('Langendorf', 'Solothurn'),
('Lommiswil', 'Solothurn'),
('Oberdorf (SO)', 'Solothurn'),
('Riedholz', 'Solothurn'),
('Rüttenen', 'Solothurn'),
('Selzach', 'Solothurn'),
('Boningen', 'Solothurn'),
('Däniken', 'Solothurn'),
('Dulliken', 'Solothurn'),
('Eppenberg-Wöschnau', 'Solothurn'),
('Fulenbach', 'Solothurn'),
('Gretzenbach', 'Solothurn'),
('Gunzgen', 'Solothurn'),
('Hägendorf', 'Solothurn'),
('Kappel (SO)', 'Solothurn'),
('Olten', 'Solothurn'),
('Rickenbach (SO)', 'Solothurn'),
('Schönenwerd', 'Solothurn'),
('Starrkirch-Wil', 'Solothurn'),
('Walterswil (SO)', 'Solothurn'),
('<NAME>', 'Solothurn'),
('Solothurn', 'Solothurn'),
('Bärschwil', 'Solothurn'),
('Beinwil (SO)', 'Solothurn'),
('Breitenbach', 'Solothurn'),
('Büsserach', 'Solothurn'),
('Erschwil', 'Solothurn'),
('Fehren', 'Solothurn'),
('Grindel', 'Solothurn'),
('Himmelried', 'Solothurn'),
('Kleinlützel', 'Solothurn'),
('Meltingen', 'Solothurn'),
('Nunningen', 'Solothurn'),
('Zullwil', 'Solothurn'),
('Basel', 'Basel-Stadt'),
('Bettingen', 'Basel-Stadt'),
('Riehen', 'Basel-Stadt'),
('Aesch (BL)', 'Basel-Landschaft'),
('Allschwil', 'Basel-Landschaft'),
('Arlesheim', 'Basel-Landschaft'),
('Biel-Benken', 'Basel-Landschaft'),
('Binningen', 'Basel-Landschaft'),
('Birsfelden', 'Basel-Landschaft'),
('Bottmingen', 'Basel-Landschaft'),
('Ettingen', 'Basel-Landschaft'),
('Münchenstein', 'Basel-Landschaft'),
('Muttenz', 'Basel-Landschaft'),
('Oberwil (BL)', 'Basel-Landschaft'),
('Pfeffingen', 'Basel-Landschaft'),
('Reinach (BL)', 'Basel-Landschaft'),
('Schönenbuch', 'Basel-Landschaft'),
('Therwil', 'Basel-Landschaft'),
('Blauen', 'Basel-Landschaft'),
('Brislach', 'Basel-Landschaft'),
('Burg im Leimental', 'Basel-Landschaft'),
('Dittingen', 'Basel-Landschaft'),
('Duggingen', 'Basel-Landschaft'),
('Grellingen', 'Basel-Landschaft'),
('Laufen', 'Basel-Landschaft'),
('Liesberg', 'Basel-Landschaft'),
('Nenzlingen', 'Basel-Landschaft'),
('Roggenburg', 'Basel-Landschaft'),
('Röschenz', 'Basel-Landschaft'),
('Wahlen', 'Basel-Landschaft'),
('Zwingen', 'Basel-Landschaft'),
('Arisdorf', 'Basel-Landschaft'),
('Augst', 'Basel-Landschaft'),
('Bubendorf', 'Basel-Landschaft'),
('Frenkendorf', 'Basel-Landschaft'),
('Füllinsdorf', 'Basel-Landschaft'),
('Giebenach', 'Basel-Landschaft'),
('Hersberg', 'Basel-Landschaft'),
('Lausen', 'Basel-Landschaft'),
('Liestal', 'Basel-Landschaft'),
('Lupsingen', 'Basel-Landschaft'),
('Pratteln', 'Basel-Landschaft'),
('Ramlinsburg', 'Basel-Landschaft'),
('Seltisberg', 'Basel-Landschaft'),
('Ziefen', 'Basel-Landschaft'),
('Anwil', 'Basel-Landschaft'),
('Böckten', 'Basel-Landschaft'),
('Buckten', 'Basel-Landschaft'),
('Buus', 'Basel-Landschaft'),
('Diepflingen', 'Basel-Landschaft'),
('Gelterkinden', 'Basel-Landschaft'),
('Häfelfingen', 'Basel-Landschaft'),
('Hemmiken', 'Basel-Landschaft'),
('Itingen', 'Basel-Landschaft'),
('Känerkinden', 'Basel-Landschaft'),
('Kilchberg (BL)', 'Basel-Landschaft'),
('Läufelfingen', 'Basel-Landschaft'),
('Maisprach', 'Basel-Landschaft'),
('Nusshof', 'Basel-Landschaft'),
('Oltingen', 'Basel-Landschaft'),
('Ormalingen', 'Basel-Landschaft'),
('Rickenbach (BL)', 'Basel-Landschaft'),
('Rothenfluh', 'Basel-Landschaft'),
('Rümlingen', 'Basel-Landschaft'),
('Rünenberg', 'Basel-Landschaft'),
('Sissach', 'Basel-Landschaft'),
('Tecknau', 'Basel-Landschaft'),
('Tenniken', 'Basel-Landschaft'),
('Thürnen', 'Basel-Landschaft'),
('Wenslingen', 'Basel-Landschaft'),
('Wintersingen', 'Basel-Landschaft'),
('Wittinsburg', 'Basel-Landschaft'),
('Zeglingen', 'Basel-Landschaft'),
('Zunzgen', 'Basel-Landschaft'),
('Arboldswil', 'Basel-Landschaft'),
('Bennwil', 'Basel-Landschaft'),
('Bretzwil', 'Basel-Landschaft'),
('Diegten', 'Basel-Landschaft'),
('Eptingen', 'Basel-Landschaft'),
('Hölstein', 'Basel-Landschaft'),
('Lampenberg', 'Basel-Landschaft'),
('Langenbruck', 'Basel-Landschaft'),
('Lauwil', 'Basel-Landschaft'),
('Liedertswil', 'Basel-Landschaft'),
('Niederdorf', 'Basel-Landschaft'),
('Oberdorf (BL)', 'Basel-Landschaft'),
('Reigoldswil', 'Basel-Landschaft'),
('Titterten', 'Basel-Landschaft'),
('Waldenburg', 'Basel-Landschaft'),
('Gächlingen', 'Schaffhausen'),
('Löhningen', 'Schaffhausen'),
('Neunkirch', 'Schaffhausen'),
('Büttenhardt', 'Schaffhausen'),
('Dörflingen', 'Schaffhausen'),
('Lohn (SH)', 'Schaffhausen'),
('Stetten (SH)', 'Schaffhausen'),
('Thayngen', 'Schaffhausen'),
('Bargen (SH)', 'Schaffhausen'),
('Beringen', 'Schaffhausen'),
('Buchberg', 'Schaffhausen'),
('Merishausen', 'Schaffhausen'),
('Neuhausen am Rheinfall', 'Schaffhausen'),
('Rüdlingen', 'Schaffhausen'),
('Schaffhausen', 'Schaffhausen'),
('Beggingen', 'Schaffhausen'),
('Schleitheim', 'Schaffhausen'),
('Siblingen', 'Schaffhausen'),
('Buch (SH)', 'Schaffhausen'),
('Hemishofen', 'Schaffhausen'),
('Ramsen', 'Schaffhausen'),
('Stein am Rhein', 'Schaffhausen'),
('Hallau', 'Schaffhausen'),
('Oberhallau', 'Schaffhausen'),
('Trasadingen', 'Schaffhausen'),
('Wilchingen', 'Schaffhausen'),
('Herisau', 'Appenzell Ausserrhoden'),
('Hundwil', 'Appenzell Ausserrhoden'),
('Schönengrund', 'Appenzell Ausserrhoden'),
('Schwellbrunn', 'Appenzell Ausserrhoden'),
('Stein (AR)', 'Appenzell Ausserrhoden'),
('Urnäsch', 'Appenzell Ausserrhoden'),
('Waldstatt', 'Appenzell Ausserrhoden'),
('Bühler', 'Appenzell Ausserrhoden'),
('Gais', 'Appenzell Ausserrhoden'),
('Speicher', 'Appenzell Ausserrhoden'),
('Teufen (AR)', 'Appenzell Ausserrhoden'),
('Trogen', 'Appenzell Ausserrhoden'),
('Grub (AR)', 'Appenzell Ausserrhoden'),
('Heiden', 'Appenzell Ausserrhoden'),
('Lutzenberg', 'Appenzell Ausserrhoden'),
('Rehetobel', 'Appenzell Ausserrhoden'),
('Reute (AR)', 'Appenzell Ausserrhoden'),
('Wald (AR)', 'Appenzell Ausserrhoden'),
('Walzenhausen', 'Appenzell Ausserrhoden'),
('Wolfhalden', 'Appenzell Ausserrhoden'),
('Appenzell', 'Appenzell Innerrhoden'),
('Gonten', 'Appenzell Innerrhoden'),
('Rüte', 'Appenzell Innerrhoden'),
('Schlatt-Haslen', 'Appenzell Innerrhoden'),
('Schwende', 'Appenzell Innerrhoden'),
('Oberegg', 'Appenzell Innerrhoden'),
('Häggenschwil', 'St. Gallen'),
('Muolen', 'St. Gallen'),
('St. Gallen', 'St. Gallen'),
('Wittenbach', 'St. Gallen'),
('Berg (SG)', 'St. Gallen'),
('Eggersriet', 'St. Gallen'),
('Goldach', 'St. Gallen'),
('Mörschwil', 'St. Gallen'),
('Rorschach', 'St. Gallen'),
('Rorschacherberg', 'St. Gallen'),
('Steinach', 'St. Gallen'),
('Tübach', 'St. Gallen'),
('Untereggen', 'St. Gallen'),
('Au (SG)', 'St. Gallen'),
('Balgach', 'St. Gallen'),
('Berneck', 'St. Gallen'),
('Diepoldsau', 'St. Gallen'),
('Rheineck', 'St. Gallen'),
('St. Margrethen', 'St. Gallen'),
('Thal', 'St. Gallen'),
('Widnau', 'St. Gallen'),
('Altstätten', 'St. Gallen'),
('Eichberg', 'St. Gallen'),
('Marbach (SG)', 'St. Gallen'),
('Oberriet (SG)', 'St. Gallen'),
('Rebstein', 'St. Gallen'),
('Rüthi (SG)', 'St. Gallen'),
('Buchs (SG)', 'St. Gallen'),
('Gams', 'St. Gallen'),
('Grabs', 'St. Gallen'),
('Sennwald', 'St. Gallen'),
('Sevelen', 'St. Gallen'),
('Wartau', 'St. Gallen'),
('<NAME>', 'St. Gallen'),
('Flums', 'St. Gallen'),
('Mels', 'St. Gallen'),
('Pfäfers', 'St. Gallen'),
('Quarten', 'St. Gallen'),
('Sargans', 'St. Gallen'),
('Vilters-Wangs', 'St. Gallen'),
('Walenstadt', 'St. Gallen'),
('Amden', 'St. Gallen'),
('Benken (SG)', 'St. Gallen'),
('Kaltbrunn', 'St. Gallen'),
('Schänis', 'St. Gallen'),
('Weesen', 'St. Gallen'),
('Schmerikon', 'St. Gallen'),
('Uznach', 'St. Gallen'),
('Rapperswil-Jona', 'St. Gallen'),
('Gommiswald', 'St. Gallen'),
('Eschenbach (SG)', 'St. Gallen'),
('Ebnat-Kappel', 'St. Gallen'),
('Wildhaus-Alt St. Johann', 'St. Gallen'),
('Nesslau', 'St. Gallen'),
('Hemberg', 'St. Gallen'),
('Lichtensteig', 'St. Gallen'),
('Oberhelfenschwil', 'St. Gallen'),
('Neckertal', 'St. Gallen'),
('Wattwil', 'St. Gallen'),
('Kirchberg (SG)', 'St. Gallen'),
('Lütisburg', 'St. Gallen'),
('Mosnang', 'St. Gallen'),
('Bütschwil-Ganterschwil', 'St. Gallen'),
('Degersheim', 'St. Gallen'),
('Flawil', 'St. Gallen'),
('Jonschwil', 'St. Gallen'),
('Oberuzwil', 'St. Gallen'),
('Uzwil', 'St. Gallen'),
('Niederbüren', 'St. Gallen'),
('Niederhelfenschwil', 'St. Gallen'),
('Oberbüren', 'St. Gallen'),
('Zuzwil (SG)', 'St. Gallen'),
('Wil (SG)', 'St. Gallen'),
('Andwil (SG)', 'St. Gallen'),
('Gaiserwald', 'St. Gallen'),
('Gossau (SG)', 'St. Gallen'),
('Waldkirch', 'St. Gallen'),
('Vaz/Obervaz', 'Graubünden'),
('Lantsch/Lenz', 'Graubünden'),
('Schmitten (GR)', 'Graubünden'),
('Albula/Alvra', 'Graubünden'),
('Surses', 'Graubünden'),
('<NAME>', 'Graubünden'),
('Brusio', 'Graubünden'),
('Poschiavo', 'Graubünden'),
('Falera', 'Graubünden'),
('Laax', 'Graubünden'),
('Sagogn', 'Graubünden'),
('Schluein', 'Graubünden'),
('Vals', 'Graubünden'),
('Lumnezia', 'Graubünden'),
('Ilanz/Glion', 'Graubünden'),
('Fürstenau', 'Graubünden'),
('Rothenbrunnen', 'Graubünden'),
('Scharans', 'Graubünden'),
('<NAME>', 'Graubünden'),
('Cazis', 'Graubünden'),
('Flerden', 'Graubünden'),
('Masein', 'Graubünden'),
('Thusis', 'Graubünden'),
('Tschappina', 'Graubünden'),
('Urmein', 'Graubünden'),
('Safiental', 'Graubünden'),
('Domleschg', 'Graubünden'),
('Avers', 'Graubünden'),
('Sufers', 'Graubünden'),
('Andeer', 'Graubünden'),
('Rongellen', 'Graubünden'),
('Zillis-Reischen', 'Graubünden'),
('Ferrera', 'Graubünden'),
('Rheinwald', 'Graubünden'),
('<NAME>', 'Graubünden'),
('Bonaduz', 'Graubünden'),
('Domat/Ems', 'Graubünden'),
('Rhäzüns', 'Graubünden'),
('Felsberg', 'Graubünden'),
('Flims', 'Graubünden'),
('Tamins', 'Graubünden'),
('Trin', 'Graubünden'),
('Zernez', 'Graubünden'),
('Samnaun', 'Graubünden'),
('Scuol', 'Graubünden'),
('Valsot', 'Graubünden'),
('Bever', 'Graubünden'),
('Celerina/Schlarigna', 'Graubünden'),
('Madulain', 'Graubünden'),
('Pontresina', 'Graubünden'),
('<NAME>', 'Graubünden'),
('Samedan', 'Graubünden'),
('<NAME>', 'Graubünden'),
('S-chanf', 'Graubünden'),
('Sils im Engadin/Segl', 'Graubünden'),
('Silvaplana', 'Graubünden'),
('Zuoz', 'Graubünden'),
('Bregaglia', 'Graubünden'),
('Buseno', 'Graubünden'),
('Castaneda', 'Graubünden'),
('Rossa', 'Graubünden'),
('Santa Maria IN Calanca', 'Graubünden'),
('Lostallo', 'Graubünden'),
('Mesocco', 'Graubünden'),
('Soazza', 'Graubünden'),
('Cama', 'Graubünden'),
('Grono', 'Graubünden'),
('Roveredo (GR)', 'Graubünden'),
('<NAME>', 'Graubünden'),
('Calanca', 'Graubünden'),
('<NAME>', 'Graubünden'),
('Davos', 'Graubünden'),
('Fideris', 'Graubünden'),
('Furna', 'Graubünden'),
('Jenaz', 'Graubünden'),
('Klosters', 'Graubünden'),
('Conters im Prättigau', 'Graubünden'),
('Küblis', 'Graubünden'),
('Luzein', 'Graubünden'),
('Chur', 'Graubünden'),
('Churwalden', 'Graubünden'),
('Arosa', 'Graubünden'),
('Tschiertschen-Praden', 'Graubünden'),
('Trimmis', 'Graubünden'),
('Untervaz', 'Graubünden'),
('Zizers', 'Graubünden'),
('Fläsch', 'Graubünden'),
('Jenins', 'Graubünden'),
('Maienfeld', 'Graubünden'),
('Malans', 'Graubünden'),
('Landquart', 'Graubünden'),
('Grüsch', 'Graubünden'),
('Schiers', 'Graubünden'),
('Seewis im Prättigau', 'Graubünden'),
('Breil/Brigels', 'Graubünden'),
('Disentis/Mustér', 'Graubünden'),
('Medel (Lucmagn)', 'Graubünden'),
('Sumvitg', 'Graubünden'),
('Tujetsch', 'Graubünden'),
('Trun', 'Graubünden'),
('<NAME>', 'Graubünden'),
('Aarau', 'Aargau'),
('Biberstein', 'Aargau'),
('Buchs (AG)', 'Aargau'),
('Densbüren', 'Aargau'),
('Erlinsbach (AG)', 'Aargau'),
('Gränichen', 'Aargau'),
('Hirschthal', 'Aargau'),
('Küttigen', 'Aargau'),
('Muhen', 'Aargau'),
('Oberentfelden', 'Aargau'),
('Suhr', 'Aargau'),
('Unterentfelden', 'Aargau'),
('Baden', 'Aargau'),
('Bellikon', 'Aargau'),
('Bergdietikon', 'Aargau'),
('Birmenstorf (AG)', 'Aargau'),
('Ennetbaden', 'Aargau'),
('Fislisbach', 'Aargau'),
('Freienwil', 'Aargau'),
('Gebenstorf', 'Aargau'),
('Killwangen', 'Aargau'),
('Künten', 'Aargau'),
('Mägenwil', 'Aargau'),
('Mellingen', 'Aargau'),
('Neuenhof', 'Aargau'),
('Niederrohrdorf', 'Aargau'),
('Oberrohrdorf', 'Aargau'),
('Obersiggenthal', 'Aargau'),
('Remetschwil', 'Aargau'),
('Spreitenbach', 'Aargau'),
('Stetten (AG)', 'Aargau'),
('Turgi', 'Aargau'),
('Untersiggenthal', 'Aargau'),
('Wettingen', 'Aargau'),
('Wohlenschwil', 'Aargau'),
('Würenlingen', 'Aargau'),
('Würenlos', 'Aargau'),
('Ehrendingen', 'Aargau'),
('Arni (AG)', 'Aargau'),
('Berikon', 'Aargau'),
('Bremgarten (AG)', 'Aargau'),
('Büttikon', 'Aargau'),
('Dottikon', 'Aargau'),
('Eggenwil', 'Aargau'),
('Fischbach-Göslikon', 'Aargau'),
('Hägglingen', 'Aargau'),
('Jonen', 'Aargau'),
('Niederwil (AG)', 'Aargau'),
('Oberlunkhofen', 'Aargau'),
('Oberwil-Lieli', 'Aargau'),
('Rudolfstetten-Friedlisberg', 'Aargau'),
('Sarmenstorf', 'Aargau'),
('Tägerig', 'Aargau'),
('Uezwil', 'Aargau'),
('Unterlunkhofen', 'Aargau'),
('Villmergen', 'Aargau'),
('Widen', 'Aargau'),
('Wohlen (AG)', 'Aargau'),
('Zufikon', 'Aargau'),
('Islisberg', 'Aargau'),
('Auenstein', 'Aargau'),
('Birr', 'Aargau'),
('Birrhard', 'Aargau'),
('Brugg', 'Aargau'),
('Habsburg', 'Aargau'),
('Hausen (AG)', 'Aargau'),
('Lupfig', 'Aargau'),
('Mandach', 'Aargau'),
('Mönthal', 'Aargau'),
('Mülligen', 'Aargau'),
('Remigen', 'Aargau'),
('Riniken', 'Aargau'),
('Rüfenach', 'Aargau'),
('Thalheim (AG)', 'Aargau'),
('Veltheim (AG)', 'Aargau'),
('Villigen', 'Aargau'),
('Villnachern', 'Aargau'),
('Windisch', 'Aargau'),
('Bözberg', 'Aargau'),
('Schinznach', 'Aargau'),
('<NAME>', 'Aargau'),
('Birrwil', 'Aargau'),
('Burg (AG)', 'Aargau'),
('Dürrenäsch', 'Aargau'),
('Gontenschwil', 'Aargau'),
('Holziken', 'Aargau'),
('Leimbach (AG)', 'Aargau'),
('Leutwil', 'Aargau'),
('Menziken', 'Aargau'),
('Oberkulm', 'Aargau'),
('Reinach (AG)', 'Aargau'),
('Schlossrued', 'Aargau'),
('Schmiedrued', 'Aargau'),
('Schöftland', 'Aargau'),
('Teufenthal (AG)', 'Aargau'),
('Unterkulm', 'Aargau'),
('Zetzwil', 'Aargau'),
('Eiken', 'Aargau'),
('Frick', 'Aargau'),
('Gansingen', 'Aargau'),
('Gipf-Oberfrick', 'Aargau'),
('Herznach', 'Aargau'),
('Kaisten', 'Aargau'),
('Laufenburg', 'Aargau'),
('Münchwilen (AG)', 'Aargau'),
('Oberhof', 'Aargau'),
('Oeschgen', 'Aargau'),
('Schwaderloch', 'Aargau'),
('Sisseln', 'Aargau'),
('Ueken', 'Aargau'),
('Wittnau', 'Aargau'),
('Wölflinswil', 'Aargau'),
('Zeihen', 'Aargau'),
('Mettauertal', 'Aargau'),
('Böztal', 'Aargau'),
('Ammerswil', 'Aargau'),
('Boniswil', 'Aargau'),
('Brunegg', 'Aargau'),
('Dintikon', 'Aargau'),
('Egliswil', 'Aargau'),
('Fahrwangen', 'Aargau'),
('Hallwil', 'Aargau'),
('Hendschiken', 'Aargau'),
('Holderbank (AG)', 'Aargau'),
('Hunzenschwil', 'Aargau'),
('Lenzburg', 'Aargau'),
('Meisterschwanden', 'Aargau'),
('Möriken-Wildegg', 'Aargau'),
('Niederlenz', 'Aargau'),
('Othmarsingen', 'Aargau'),
('Rupperswil', 'Aargau'),
('Schafisheim', 'Aargau'),
('Seengen', 'Aargau'),
('Seon', 'Aargau'),
('Staufen', 'Aargau'),
('Abtwil', 'Aargau'),
('Aristau', 'Aargau'),
('Auw', 'Aargau'),
('Beinwil (Freiamt)', 'Aargau'),
('Besenbüren', 'Aargau'),
('Bettwil', 'Aargau'),
('Boswil', 'Aargau'),
('Bünzen', 'Aargau'),
('Buttwil', 'Aargau'),
('Dietwil', 'Aargau'),
('Geltwil', 'Aargau'),
('Kallern', 'Aargau'),
('Merenschwand', 'Aargau'),
('Mühlau', 'Aargau'),
('Muri (AG)', 'Aargau'),
('Oberrüti', 'Aargau'),
('Rottenschwil', 'Aargau'),
('Sins', 'Aargau'),
('Waltenschwil', 'Aargau'),
('Hellikon', 'Aargau'),
('Kaiseraugst', 'Aargau'),
('Magden', 'Aargau'),
('Möhlin', 'Aargau'),
('Mumpf', 'Aargau'),
('Obermumpf', 'Aargau'),
('Olsberg', 'Aargau'),
('Rheinfelden', 'Aargau'),
('Schupfart', 'Aargau'),
('Stein (AG)', 'Aargau'),
('Wallbach', 'Aargau'),
('Wegenstetten', 'Aargau'),
('Zeiningen', 'Aargau'),
('Zuzgen', 'Aargau'),
('Aarburg', 'Aargau'),
('Bottenwil', 'Aargau'),
('Brittnau', 'Aargau'),
('Kirchleerau', 'Aargau'),
('Kölliken', 'Aargau'),
('Moosleerau', 'Aargau'),
('Murgenthal', 'Aargau'),
('Oftringen', 'Aargau'),
('Reitnau', 'Aargau'),
('Rothrist', 'Aargau'),
('Safenwil', 'Aargau'),
('Staffelbach', 'Aargau'),
('Strengelbach', 'Aargau'),
('Uerkheim', 'Aargau'),
('Vordemwald', 'Aargau'),
('Wiliberg', 'Aargau'),
('Zofingen', 'Aargau'),
('Böttstein', 'Aargau'),
('Döttingen', 'Aargau'),
('Endingen', 'Aargau'),
('Fisibach', 'Aargau'),
('FULL-Reuenthal', 'Aargau'),
('Klingnau', 'Aargau'),
('Koblenz', 'Aargau'),
('Leibstadt', 'Aargau'),
('Lengnau (AG)', 'Aargau'),
('Leuggern', 'Aargau'),
('Mellikon', 'Aargau'),
('Schneisingen', 'Aargau'),
('Siglistorf', 'Aargau'),
('Tegerfelden', 'Aargau'),
('Zurzach', 'Aargau'),
('Arbon', 'Thurgau'),
('Dozwil', 'Thurgau'),
('Egnach', 'Thurgau'),
('Hefenhofen', 'Thurgau'),
('Horn', 'Thurgau'),
('Kesswil', 'Thurgau'),
('Roggwil (TG)', 'Thurgau'),
('Romanshorn', 'Thurgau'),
('Salmsach', 'Thurgau'),
('Sommeri', 'Thurgau'),
('Uttwil', 'Thurgau'),
('Amriswil', 'Thurgau'),
('Bischofszell', 'Thurgau'),
('Erlen', 'Thurgau'),
('Hauptwil-Gottshaus', 'Thurgau'),
('Hohentannen', 'Thurgau'),
('Kradolf-Schönenberg', 'Thurgau'),
('Sulgen', 'Thurgau'),
('Zihlschlacht-Sitterdorf', 'Thurgau'),
('Basadingen-Schlattingen', 'Thurgau'),
('Diessenhofen', 'Thurgau'),
('Schlatt (TG)', 'Thurgau'),
('Aadorf', 'Thurgau'),
('Felben-Wellhausen', 'Thurgau'),
('Frauenfeld', 'Thurgau'),
('Gachnang', 'Thurgau'),
('Hüttlingen', 'Thurgau'),
('Matzingen', 'Thurgau'),
('Neunforn', 'Thurgau'),
('Stettfurt', 'Thurgau'),
('Thundorf', 'Thurgau'),
('Uesslingen-Buch', 'Thurgau'),
('Warth-Weiningen', 'Thurgau'),
('Altnau', 'Thurgau'),
('Bottighofen', 'Thurgau'),
('Ermatingen', 'Thurgau'),
('Gottlieben', 'Thurgau'),
('Güttingen', 'Thurgau'),
('Kemmental', 'Thurgau'),
('Kreuzlingen', 'Thurgau'),
('Langrickenbach', 'Thurgau'),
('Lengwil', 'Thurgau'),
('Münsterlingen', 'Thurgau'),
('Tägerwilen', 'Thurgau'),
('Wäldi', 'Thurgau'),
('Affeltrangen', 'Thurgau'),
('Bettwiesen', 'Thurgau'),
('Bichelsee-Balterswil', 'Thurgau'),
('Braunau', 'Thurgau'),
('Eschlikon', 'Thurgau'),
('Fischingen', 'Thurgau'),
('Lommis', 'Thurgau'),
('Münchwilen (TG)', 'Thurgau'),
('Rickenbach (TG)', 'Thurgau'),
('Schönholzerswilen', 'Thurgau'),
('Sirnach', 'Thurgau'),
('Tobel-Tägerschen', 'Thurgau'),
('Wängi', 'Thurgau'),
('Wilen (TG)', 'Thurgau'),
('Wuppenau', 'Thurgau'),
('Berlingen', 'Thurgau'),
('Eschenz', 'Thurgau'),
('Herdern', 'Thurgau'),
('Homburg', 'Thurgau'),
('Hüttwilen', 'Thurgau'),
('Mammern', 'Thurgau'),
('Müllheim', 'Thurgau'),
('Pfyn', 'Thurgau'),
('Raperswilen', 'Thurgau'),
('Salenstein', 'Thurgau'),
('Steckborn', 'Thurgau'),
('Wagenhausen', 'Thurgau'),
('Amlikon-Bissegg', 'Thurgau'),
('Berg (TG)', 'Thurgau'),
('Birwinken', 'Thurgau'),
('Bürglen (TG)', 'Thurgau'),
('Bussnang', 'Thurgau'),
('Märstetten', 'Thurgau'),
('Weinfelden', 'Thurgau'),
('Wigoltingen', 'Thurgau'),
('Arbedo-Castione', 'Ticino'),
('Bellinzona', 'Ticino'),
('Cadenazzo', 'Ticino'),
('Isone', 'Ticino'),
('Lumino', 'Ticino'),
('Sant''Antonino', 'Ticino'),
('Acquarossa', 'Ticino'),
('Blenio', 'Ticino'),
('Serravalle', 'Ticino'),
('Airolo', 'Ticino'),
('Bedretto', 'Ticino'),
('Bodio', 'Ticino'),
('Dalpe', 'Ticino'),
('Faido', 'Ticino'),
('Giornico', 'Ticino'),
('Personico', 'Ticino'),
('Pollegio', 'Ticino'),
('Prato (Leventina)', 'Ticino'),
('Quinto', 'Ticino'),
('Ascona', 'Ticino'),
('Brione sopra Minusio', 'Ticino'),
('Brissago', 'Ticino'),
('Gordola', 'Ticino'),
('Lavertezzo', 'Ticino'),
('Locarno', 'Ticino'),
('Losone', 'Ticino'),
('Mergoscia', 'Ticino'),
('Minusio', 'Ticino'),
('Muralto', 'Ticino'),
('Orselina', 'Ticino'),
('Ronco sopra Ascona', 'Ticino'),
('Tenero-Contra', 'Ticino'),
('Onsernone', 'Ticino'),
('Cugnasco-Gerra', 'Ticino'),
('Agno', 'Ticino'),
('Aranno', 'Ticino'),
('Arogno', 'Ticino'),
('Astano', 'Ticino'),
('Bedano', 'Ticino'),
('Bedigliora', 'Ticino'),
('Bioggio', 'Ticino'),
('Bissone', 'Ticino'),
('Brusino Arsizio', 'Ticino'),
('Cademario', 'Ticino'),
('Cadempino', 'Ticino'),
('Canobbio', 'Ticino'),
('Caslano', 'Ticino'),
('Comano', 'Ticino'),
('Cureglia', 'Ticino'),
('Curio', 'Ticino'),
('Grancia', 'Ticino'),
('Gravesano', 'Ticino'),
('Lamone', 'Ticino'),
('Lugano', 'Ticino'),
('Magliaso', 'Ticino'),
('Manno', 'Ticino'),
('Maroggia', 'Ticino'),
('Massagno', 'Ticino'),
('Melano', 'Ticino'),
('Melide', 'Ticino'),
('Mezzovico-Vira', 'Ticino'),
('Miglieglia', 'Ticino'),
('Morcote', 'Ticino'),
('Muzzano', 'Ticino'),
('Neggio', 'Ticino'),
('Novaggio', 'Ticino'),
('Origlio', 'Ticino'),
('Paradiso', 'Ticino'),
('<NAME>', 'Ticino'),
('Porza', 'Ticino'),
('Pura', 'Ticino'),
('Rovio', 'Ticino'),
('Savosa', 'Ticino'),
('Sorengo', 'Ticino'),
('Capriasca', 'Ticino'),
('Torricella-Taverne', 'Ticino'),
('Vernate', 'Ticino'),
('Vezia', 'Ticino'),
('<NAME>', 'Ticino'),
('<NAME>', 'Ticino'),
('<NAME>', 'Ticino'),
('Monteceneri', 'Ticino'),
('Tresa', 'Ticino'),
('Balerna', 'Ticino'),
('<NAME>', 'Ticino'),
('Chiasso', 'Ticino'),
('Coldrerio', 'Ticino'),
('Mendrisio', 'Ticino'),
('<NAME>', 'Ticino'),
('Novazzano', 'Ticino'),
('<NAME>', 'Ticino'),
('Stabio', 'Ticino'),
('Vacallo', 'Ticino'),
('Breggia', 'Ticino'),
('Biasca', 'Ticino'),
('Riviera', 'Ticino'),
('Bosco/Gurin', 'Ticino'),
('Campo (Vallemaggia)', 'Ticino'),
('Cerentino', 'Ticino'),
('Cevio', 'Ticino'),
('Linescio', 'Ticino'),
('Maggia', 'Ticino'),
('Lavizzara', 'Ticino'),
('<NAME>', 'Ticino'),
('<NAME> Pedemonte', 'Ticino'),
('Centovalli', 'Ticino'),
('Gambarogno', 'Ticino'),
('Verzasca', 'Ticino'),
('Aigle', 'Vaud'),
('Bex', 'Vaud'),
('Chessel', 'Vaud'),
('Corbeyrier', 'Vaud'),
('Gryon', 'Vaud'),
('Lavey-Morcles', 'Vaud'),
('Leysin', 'Vaud'),
('Noville', 'Vaud'),
('Ollon', 'Vaud'),
('Ormont-Dessous', 'Vaud'),
('Ormont-Dessus', 'Vaud'),
('Rennaz', 'Vaud'),
('Roche (VD)', 'Vaud'),
('Villeneuve (VD)', 'Vaud'),
('Yvorne', 'Vaud'),
('Aubonne', 'Vaud'),
('Ballens', 'Vaud'),
('Berolle', 'Vaud'),
('Bière', 'Vaud'),
('Bougy-Villars', 'Vaud'),
('Féchy', 'Vaud'),
('Gimel', 'Vaud'),
('Longirod', 'Vaud'),
('Marchissy', 'Vaud'),
('Mollens (VD)', 'Vaud'),
('Saint-George', 'Vaud'),
('Saint-Livres', 'Vaud'),
('Saint-Oyens', 'Vaud'),
('Saubraz', 'Vaud'),
('Avenches', 'Vaud'),
('Cudrefin', 'Vaud'),
('Faoug', 'Vaud'),
('Vully-les-Lacs', 'Vaud'),
('Bettens', 'Vaud'),
('Bournens', 'Vaud'),
('Boussens', 'Vaud'),
('<NAME> (Cossonay)', 'Vaud'),
('Chavannes-le-Veyron', 'Vaud'),
('Chevilly', 'Vaud'),
('Cossonay', 'Vaud'),
('Cuarnens', 'Vaud'),
('Daillens', 'Vaud'),
('Dizy', 'Vaud'),
('Eclépens', 'Vaud'),
('Ferreyres', 'Vaud'),
('Gollion', 'Vaud'),
('Grancy', 'Vaud'),
('L''Isle', 'Vaud'),
('Lussery-Villars', 'Vaud'),
('Mauraz', 'Vaud'),
('Mex (VD)', 'Vaud'),
('Moiry', 'Vaud'),
('Mont-la-Ville', 'Vaud'),
('Montricher', 'Vaud'),
('Orny', 'Vaud'),
('Penthalaz', 'Vaud'),
('Penthaz', 'Vaud'),
('Pompaples', 'Vaud'),
('<NAME>', 'Vaud'),
('Senarclens', 'Vaud'),
('Sullens', 'Vaud'),
('Vufflens-la-Ville', 'Vaud'),
('Assens', 'Vaud'),
('Bercher', 'Vaud'),
('Bottens', 'Vaud'),
('Bretigny-sur-Morrens', 'Vaud'),
('Cugy (VD)', 'Vaud'),
('Echallens', 'Vaud'),
('Essertines-sur-Yverdon', 'Vaud'),
('Etagnières', 'Vaud'),
('Fey', 'Vaud'),
('Froideville', 'Vaud'),
('Morrens (VD)', 'Vaud'),
('Oulens-sous-Echallens', 'Vaud'),
('Pailly', 'Vaud'),
('Penthéréaz', 'Vaud'),
('Poliez-Pittet', 'Vaud'),
('Rueyres', 'Vaud'),
('Saint-Barthélemy (VD)', 'Vaud'),
('Villars-le-Terroir', 'Vaud'),
('Vuarrens', 'Vaud'),
('Montilliez', 'Vaud'),
('Goumoëns', 'Vaud'),
('Bonvillars', 'Vaud'),
('Bullet', 'Vaud'),
('Champagne', 'Vaud'),
('Concise', 'Vaud'),
('Corcelles-près-Concise', 'Vaud'),
('Fiez', 'Vaud'),
('Fontaines-sur-Grandson', 'Vaud'),
('Giez', 'Vaud'),
('Grandevent', 'Vaud'),
('Grandson', 'Vaud'),
('Mauborget', 'Vaud'),
('Mutrux', 'Vaud'),
('Novalles', 'Vaud'),
('Onnens (VD)', 'Vaud'),
('Provence', 'Vaud'),
('Sainte-Croix', 'Vaud'),
('Tévenon', 'Vaud'),
('Belmont-sur-Lausanne', 'Vaud'),
('Cheseaux-sur-Lausanne', 'Vaud'),
('Crissier', 'Vaud'),
('Epalinges', 'Vaud'),
('Jouxtens-Mézery', 'Vaud'),
('Lausanne', 'Vaud'),
('Le Mont-sur-Lausanne', 'Vaud'),
('Paudex', 'Vaud'),
('Prilly', 'Vaud'),
('Pully', 'Vaud'),
('Renens (VD)', 'Vaud'),
('Romanel-sur-Lausanne', 'Vaud'),
('Chexbres', 'Vaud'),
('Forel (Lavaux)', 'Vaud'),
('Lutry', 'Vaud'),
('Puidoux', 'Vaud'),
('Rivaz', 'Vaud'),
('Saint-Saphorin (Lavaux)', 'Vaud'),
('Savigny', 'Vaud'),
('Bourg-en-Lavaux', 'Vaud'),
('Aclens', 'Vaud'),
('Bremblens', 'Vaud'),
('Buchillon', 'Vaud'),
('Bussigny', 'Vaud'),
('Chavannes-près-Renens', 'Vaud'),
('Chigny', 'Vaud'),
('Clarmont', 'Vaud'),
('Denens', 'Vaud'),
('Denges', 'Vaud'),
('Echandens', 'Vaud'),
('Echichens', 'Vaud'),
('Ecublens (VD)', 'Vaud'),
('Etoy', 'Vaud'),
('Lavigny', 'Vaud'),
('Lonay', 'Vaud'),
('Lully (VD)', 'Vaud'),
('Lussy-sur-Morges', 'Vaud'),
('Morges', 'Vaud'),
('Préverenges', 'Vaud'),
('Romanel-sur-Morges', 'Vaud'),
('Saint-Prex', 'Vaud'),
('Saint-Sulpice (VD)', 'Vaud'),
('Tolochenaz', 'Vaud'),
('Vaux-sur-Morges', 'Vaud'),
('Villars-Sainte-Croix', 'Vaud'),
('Villars-sous-Yens', 'Vaud'),
('Vufflens-le-Château', 'Vaud'),
('Vullierens', 'Vaud'),
('Yens', 'Vaud'),
('Hautemorges', 'Vaud'),
('Boulens', 'Vaud'),
('Bussy-sur-Moudon', 'Vaud'),
('Chavannes-sur-Moudon', 'Vaud'),
('Curtilles', 'Vaud'),
('Dompierre (VD)', 'Vaud'),
('Hermenches', 'Vaud'),
('Lovatens', 'Vaud'),
('Lucens', 'Vaud'),
('Moudon', 'Vaud'),
('Ogens', 'Vaud'),
('Prévonloup', 'Vaud'),
('Rossenges', 'Vaud'),
('Syens', 'Vaud'),
('Villars-le-Comte', 'Vaud'),
('Vucherens', 'Vaud'),
('Montanaire', 'Vaud'),
('Arnex-sur-Nyon', 'Vaud'),
('<NAME>', 'Vaud'),
('Bassins', 'Vaud'),
('Begnins', 'Vaud'),
('Bogis-Bossey', 'Vaud'),
('Borex', 'Vaud'),
('Chavannes-de-Bogis', 'Vaud'),
('Chavannes-des-Bois', 'Vaud'),
('Chéserex', 'Vaud'),
('Coinsins', 'Vaud'),
('Commugny', 'Vaud'),
('Coppet', 'Vaud'),
('Crans (VD)', 'Vaud'),
('Crassier', 'Vaud'),
('Duillier', 'Vaud'),
('Eysins', 'Vaud'),
('Founex', 'Vaud'),
('Genolier', 'Vaud'),
('Gingins', 'Vaud'),
('Givrins', 'Vaud'),
('Gland', 'Vaud'),
('Grens', 'Vaud'),
('Mies', 'Vaud'),
('Nyon', 'Vaud'),
('Prangins', 'Vaud'),
('<NAME>', 'Vaud'),
('Saint-Cergue', 'Vaud'),
('Signy-Avenex', 'Vaud'),
('Tannay', 'Vaud'),
('Trélex', 'Vaud'),
('Le Vaud', 'Vaud'),
('Vich', 'Vaud'),
('L''Abergement', 'Vaud'),
('Agiez', 'Vaud'),
('Arnex-sur-Orbe', 'Vaud'),
('Ballaigues', 'Vaud'),
('Baulmes', 'Vaud'),
('Bavois', 'Vaud'),
('Bofflens', 'Vaud'),
('Bretonnières', 'Vaud'),
('Chavornay', 'Vaud'),
('<NAME>', 'Vaud'),
('Croy', 'Vaud'),
('Juriens', 'Vaud'),
('Lignerolle', 'Vaud'),
('Montcherand', 'Vaud'),
('Orbe', 'Vaud'),
('<NAME>', 'Vaud'),
('Premier', 'Vaud'),
('Rances', 'Vaud'),
('Romainmôtier-Envy', 'Vaud'),
('Sergey', 'Vaud'),
('Valeyres-sous-Rances', 'Vaud'),
('Vallorbe', 'Vaud'),
('Vaulion', 'Vaud'),
('Vuiteboeuf', 'Vaud'),
('Corcelles-le-Jorat', 'Vaud'),
('Maracon', 'Vaud'),
('Montpreveyres', 'Vaud'),
('Ropraz', 'Vaud'),
('Servion', 'Vaud'),
('Vulliens', 'Vaud'),
('Jorat-Menthue', 'Vaud'),
('Oron', 'Vaud'),
('Jorat-Mézières', 'Vaud'),
('Champtauroz', 'Vaud'),
('Chevroux', 'Vaud'),
('Corcelles-près-Payerne', 'Vaud'),
('Grandcour', 'Vaud'),
('Henniez', 'Vaud'),
('Missy', 'Vaud'),
('Payerne', 'Vaud'),
('Trey', 'Vaud'),
('Treytorrens (Payerne)', 'Vaud'),
('Villarzel', 'Vaud'),
('Valbroye', 'Vaud'),
('Château-D''Oex', 'Vaud'),
('Rossinière', 'Vaud'),
('Rougemont', 'Vaud'),
('Allaman', 'Vaud'),
('Bursinel', 'Vaud'),
('Bursins', 'Vaud'),
('Burtigny', 'Vaud'),
('Dully', 'Vaud'),
('Essertines-sur-Rolle', 'Vaud'),
('Gilly', 'Vaud'),
('Luins', 'Vaud'),
('Mont-sur-Rolle', 'Vaud'),
('Perroy', 'Vaud'),
('Rolle', 'Vaud'),
('Tartegnin', 'Vaud'),
('Vinzel', 'Vaud'),
('L''Abbaye', 'Vaud'),
('<NAME>', 'Vaud'),
('<NAME>', 'Vaud'),
('Chardonne', 'Vaud'),
('Corseaux', 'Vaud'),
('Corsier-sur-Vevey', 'Vaud'),
('Jongny', 'Vaud'),
('Montreux', 'Vaud'),
('<NAME>', 'Vaud'),
('Vevey', 'Vaud'),
('Veytaux', 'Vaud'),
('<NAME>', 'Vaud'),
('Belmont-sur-Yverdon', 'Vaud'),
('Bioley-Magnoux', 'Vaud'),
('Chamblon', 'Vaud'),
('Champvent', 'Vaud'),
('Chavannes-le-Chêne', 'Vaud'),
('Chêne-Pâquier', 'Vaud'),
('Cheseaux-Noréaz', 'Vaud'),
('Cronay', 'Vaud'),
('Cuarny', 'Vaud'),
('Démoret', 'Vaud'),
('Donneloye', 'Vaud'),
('Ependes (VD)', 'Vaud'),
('Mathod', 'Vaud'),
('Molondin', 'Vaud'),
('Montagny-près-Yverdon', 'Vaud'),
('Oppens', 'Vaud'),
('Orges', 'Vaud'),
('Orzens', 'Vaud'),
('Pomy', 'Vaud'),
('Rovray', 'Vaud'),
('Suchy', 'Vaud'),
('Suscévaz', 'Vaud'),
('Treycovagnes', 'Vaud'),
('Ursins', 'Vaud'),
('Valeyres-sous-Montagny', 'Vaud'),
('Valeyres-sous-Ursins', 'Vaud'),
('Villars-Epeney', 'Vaud'),
('<NAME>', 'Vaud'),
('Yverdon-les-Bains', 'Vaud'),
('Yvonand', 'Vaud'),
('Brig-Glis', 'Valais'),
('Eggerberg', 'Valais'),
('Naters', 'Valais'),
('Ried-Brig', 'Valais'),
('Simplon', 'Valais'),
('Termen', 'Valais'),
('Zwischbergen', 'Valais'),
('Ardon', 'Valais'),
('Chamoson', 'Valais'),
('Conthey', 'Valais'),
('Nendaz', 'Valais'),
('Vétroz', 'Valais'),
('Bourg-Saint-Pierre', 'Valais'),
('Liddes', 'Valais'),
('Orsières', 'Valais'),
('Sembrancher', 'Valais'),
('<NAME>', 'Valais'),
('Bellwald', 'Valais'),
('Binn', 'Valais'),
('Ernen', 'Valais'),
('Fiesch', 'Valais'),
('Fieschertal', 'Valais'),
('Lax', 'Valais'),
('Obergoms', 'Valais'),
('Goms', 'Valais'),
('Ayent', 'Valais'),
('Evolène', 'Valais'),
('Hérémence', 'Valais'),
('Saint-Martin (VS)', 'Valais'),
('Vex', 'Valais'),
('Mont-Noble', 'Valais'),
('Agarn', 'Valais'),
('Albinen', 'Valais'),
('Ergisch', 'Valais'),
('Inden', 'Valais'),
('Leuk', 'Valais'),
('Leukerbad', 'Valais'),
('Oberems', 'Valais'),
('Salgesch', 'Valais'),
('Varen', 'Valais'),
('Guttet-Feschel', 'Valais'),
('Gampel-Bratsch', 'Valais'),
('Turtmann-Unterems', 'Valais'),
('Bovernier', 'Valais'),
('Fully', 'Valais'),
('Isérables', 'Valais'),
('Leytron', 'Valais'),
('Martigny', 'Valais'),
('Martigny-Combe', 'Valais'),
('Riddes', 'Valais'),
('Saillon', 'Valais'),
('Saxon', 'Valais'),
('Trient', 'Valais'),
('Champéry', 'Valais'),
('Collombey-Muraz', 'Valais'),
('Monthey', 'Valais'),
('Port-Valais', 'Valais'),
('Saint-Gingolph', 'Valais'),
('Troistorrents', 'Valais'),
('Val-D''Illiez', 'Valais'),
('Vionnaz', 'Valais'),
('Vouvry', 'Valais'),
('Bister', 'Valais'),
('Bitsch', 'Valais'),
('Grengiols', 'Valais'),
('Riederalp', 'Valais'),
('Ausserberg', 'Valais'),
('Blatten', 'Valais'),
('Bürchen', 'Valais'),
('Eischoll', 'Valais'),
('Ferden', 'Valais'),
('Kippel', 'Valais'),
('Niedergesteln', 'Valais'),
('Raron', 'Valais'),
('Unterbäch', 'Valais'),
('<NAME>)', 'Valais'),
('Mörel-Filet', 'Valais'),
('Steg-Hohtenn', 'Valais'),
('Bettmeralp', 'Valais'),
('Collonges', 'Valais'),
('Dorénaz', 'Valais'),
('Evionnaz', 'Valais'),
('Finhaut', 'Valais'),
('Massongex', 'Valais'),
('Saint-Maurice', 'Valais'),
('Salvan', 'Valais'),
('Vernayaz', 'Valais'),
('Vérossaz', 'Valais'),
('Chalais', 'Valais'),
('Chippis', 'Valais'),
('Grône', 'Valais'),
('Icogne', 'Valais'),
('Lens', 'Valais'),
('Saint-Léonard', 'Valais'),
('Sierre', 'Valais'),
('Anniviers', 'Valais'),
('Crans-Montana', 'Valais'),
('Noble-Contrée', 'Valais'),
('Arbaz', 'Valais'),
('Grimisuat', 'Valais'),
('Savièse', 'Valais'),
('Sion', 'Valais'),
('Veysonnaz', 'Valais'),
('Baltschieder', 'Valais'),
('Eisten', 'Valais'),
('Embd', 'Valais'),
('Grächen', 'Valais'),
('Lalden', 'Valais'),
('Randa', 'Valais'),
('Saas-Almagell', 'Valais'),
('Saas-Balen', 'Valais'),
('Saas-Fee', 'Valais'),
('Saas-Grund', 'Valais'),
('<NAME>', 'Valais'),
('Stalden (VS)', 'Valais'),
('Staldenried', 'Valais'),
('Täsch', 'Valais'),
('Törbel', 'Valais'),
('Visp', 'Valais'),
('Visperterminen', 'Valais'),
('Zeneggen', 'Valais'),
('Zermatt', 'Valais'),
('Boudry', 'Neuchâtel'),
('Cortaillod', 'Neuchâtel'),
('Rochefort', 'Neuchâtel'),
('Milvignes', 'Neuchâtel'),
('La Grande Béroche', 'Neuchâtel'),
('La Chaux-de-Fonds', 'Neuchâtel'),
('Les Planchettes', 'Neuchâtel'),
('La Sagne', 'Neuchâtel'),
('La Brévine', 'Neuchâtel'),
('Brot-Plamboz', 'Neuchâtel'),
('Le Cerneux-Péquignot', 'Neuchâtel'),
('La Chaux-du-Milieu', 'Neuchâtel'),
('Le Locle', 'Neuchâtel'),
('Les Ponts-de-Martel', 'Neuchâtel'),
('Cornaux', 'Neuchâtel'),
('Cressier (NE)', 'Neuchâtel'),
('Enges', 'Neuchâtel'),
('Hauterive (NE)', 'Neuchâtel'),
('Le Landeron', 'Neuchâtel'),
('Lignières', 'Neuchâtel'),
('Neuchâtel', 'Neuchâtel'),
('Saint-Blaise', 'Neuchâtel'),
('La Tène', 'Neuchâtel'),
('Val-de-Ruz', 'Neuchâtel'),
('La Côte-aux-Fées', 'Neuchâtel'),
('Les Verrières', 'Neuchâtel'),
('Val-de-Travers', 'Neuchâtel'),
('Aire-la-Ville', 'Genève'),
('Anières', 'Genève'),
('Avully', 'Genève'),
('Avusy', 'Genève'),
('Bardonnex', 'Genève'),
('Bellevue', 'Genève'),
('Bernex', 'Genève'),
('Carouge (GE)', 'Genève'),
('Cartigny', 'Genève'),
('Céligny', 'Genève'),
('Chancy', 'Genève'),
('Chêne-Bougeries', 'Genève'),
('Chêne-Bourg', 'Genève'),
('Choulex', 'Genève'),
('Collex-Bossy', 'Genève'),
('Collonge-Bellerive', 'Genève'),
('Cologny', 'Genève'),
('Confignon', 'Genève'),
('Corsier (GE)', 'Genève'),
('Dardagny', 'Genève'),
('Genève', 'Genève'),
('Genthod', 'Genève'),
('Le Grand-Saconnex', 'Genève'),
('Gy', 'Genève'),
('Hermance', 'Genève'),
('Jussy', 'Genève'),
('Laconnex', 'Genève'),
('Lancy', 'Genève'),
('Meinier', 'Genève'),
('Meyrin', 'Genève'),
('Onex', 'Genève'),
('Perly-Certoux', 'Genève'),
('Plan-les-Ouates', 'Genève'),
('Pregny-Chambésy', 'Genève'),
('Presinge', 'Genève'),
('Puplinge', 'Genève'),
('Russin', 'Genève'),
('Satigny', 'Genève'),
('Soral', 'Genève'),
('Thônex', 'Genève'),
('Troinex', 'Genève'),
('Vandoeuvres', 'Genève'),
('Vernier', 'Genève'),
('Versoix', 'Genève'),
('Veyrier', 'Genève'),
('Boécourt', 'Jura'),
('Bourrignon', 'Jura'),
('Châtillon (JU)', 'Jura'),
('Courchapoix', 'Jura'),
('Courrendlin', 'Jura'),
('Courroux', 'Jura'),
('Courtételle', 'Jura'),
('Delémont', 'Jura'),
('Develier', 'Jura'),
('Ederswiler', 'Jura'),
('Mervelier', 'Jura'),
('Mettembert', 'Jura'),
('Movelier', 'Jura'),
('Pleigne', 'Jura'),
('Rossemaison', 'Jura'),
('Saulcy', 'Jura'),
('Soyhières', 'Jura'),
('Haute-Sorne', 'Jura'),
('<NAME>', 'Jura'),
('Le Bémont (JU)', 'Jura'),
('Les Bois', 'Jura'),
('Les Breuleux', 'Jura'),
('La Chaux-des-Breuleux', 'Jura'),
('Les Enfers', 'Jura'),
('Les Genevez (JU)', 'Jura'),
('Lajoux (JU)', 'Jura'),
('Montfaucon', 'Jura'),
('Muriaux', 'Jura'),
('Le Noirmont', 'Jura'),
('Saignelégier', 'Jura'),
('Saint-Brais', 'Jura'),
('Soubey', 'Jura'),
('Alle', 'Jura'),
('Beurnevésin', 'Jura'),
('Boncourt', 'Jura'),
('Bonfol', 'Jura'),
('Bure', 'Jura'),
('Coeuve', 'Jura'),
('Cornol', 'Jura'),
('Courchavon', 'Jura'),
('Courgenay', 'Jura'),
('Courtedoux', 'Jura'),
('Damphreux', 'Jura'),
('Fahy', 'Jura'),
('Fontenais', 'Jura'),
('Grandfontaine', 'Jura'),
('Lugnez', 'Jura'),
('Porrentruy', 'Jura'),
('Vendlincourt', 'Jura'),
('Basse-Allaine', 'Jura'),
('<NAME>', 'Jura'),
('Haute-Ajoie', 'Jura'),
('<NAME>', 'Jura')
) AS m (name, state)
JOIN state ON state.name = m.state;
|
/*
* Copyright 2020 johnny850807 (Waterball)
*
* 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.
*/
DROP TABLE IF EXISTS wordgroup_word;
DROP TABLE IF EXISTS dictionary_wordgroup;
DROP TABLE IF EXISTS member_favorite_dictionary;
DROP TABLE IF EXISTS word, wordgroup, dictionary;
DROP TABLE IF EXISTS member;
CREATE TABLE member
(
id INTEGER PRIMARY KEY AUTO_INCREMENT,
first_name NVARCHAR(18) NOT NULL,
last_name NVARCHAR(18) NOT NULL,
age TINYINT NOT NULL,
email VARCHAR(30) NOT NULL UNIQUE,
password <PASSWORD>(<PASSWORD>) NOT NULL,
exp INTEGER DEFAULT 0,
level INTEGER DEFAULT 1,
role ENUM ('MEMBER', 'ADMIN') DEFAULT 'MEMBER'
);
CREATE TABLE dictionary
(
id INTEGER PRIMARY KEY AUTO_INCREMENT,
title NVARCHAR(80) NOT NULL,
description NVARCHAR(300) NOT NULL,
type ENUM ('PUBLIC', 'OWN') NOT NULL,
owner_id INTEGER,
FOREIGN KEY (owner_id) REFERENCES member (id) ON DELETE CASCADE,
CHECK (type = 'PUBLIC' AND owner_id IS NULL
OR type = 'OWN' AND owner_id IS NOT NULL)
);
CREATE TABLE wordgroup
(
id INTEGER PRIMARY KEY AUTO_INCREMENT,
title NVARCHAR(50) UNIQUE
);
CREATE TABLE word
(
id INTEGER PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(30) UNIQUE,
synonyms VARCHAR(80) DEFAULT '' COMMENT 'a list of synonym separated by comma',
image_url VARCHAR(1000)
);
CREATE TABLE dictionary_wordgroup
(
dictionary_id INTEGER,
wordgroup_id INTEGER,
CONSTRAINT PK_dictionary_wordgroup PRIMARY KEY (dictionary_id, wordgroup_id),
FOREIGN KEY (dictionary_id) REFERENCES dictionary (id),
FOREIGN KEY (wordgroup_id) REFERENCES wordgroup (id)
);
CREATE TABLE wordgroup_word
(
wordgroup_id INTEGER,
word_id INTEGER,
CONSTRAINT PK_wordgroup_word PRIMARY KEY (wordgroup_id, word_id),
FOREIGN KEY (wordgroup_id) REFERENCES wordgroup (id),
FOREIGN KEY (word_id) REFERENCES word (id)
);
CREATE TABLE member_favorite_dictionary
(
member_id INTEGER,
dictionary_id INTEGER,
CONSTRAINT PK_member_favorite_dictionary PRIMARY KEY (member_id, dictionary_id),
FOREIGN KEY (member_id) REFERENCES member (id),
FOREIGN KEY (dictionary_id) REFERENCES dictionary (id)
);
|
/*
INSERT INTO authority (id,name) VALUES (NEXT VALUE FOR authority_seq,'Cadastro');
INSERT INTO role (id,name) VALUES (NEXT VALUE FOR role_seq,'ROLE_ADMIN');
INSERT INTO role (id,name) VALUES (NEXT VALUE FOR role_seq,'ROLE_DEFAULT');
INSERT INTO user (id,username,password, first_name,last_name,email,enabled,last_password_reset_date)
VALUES (NEXT VALUE FOR user_seq, 'admin', 'admin', 'Admin', 'Admin', '<EMAIL>', TRUE, CURRENT_TIMESTAMP);
INSERT INTO user_role (USER_ID, ROLE_ID) VALUES ('1', '1');
--INSERT INTO role_authority (ROLE_ID, AUTHORITY_ID) VALUES ('1', '1');
*/
|
<reponame>danilomendes12/Learn2Play
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table comentario (
id bigint auto_increment not null,
title varchar(255),
creator_id bigint,
tutorial_id bigint,
constraint pk_comentario primary key (id))
;
create table distribution (
id bigint auto_increment not null,
game_id bigint,
console_id bigint,
constraint pk_distribution primary key (id))
;
create table game (
id bigint auto_increment not null,
name varchar(255),
constraint pk_game primary key (id))
;
create table plataforma (
id bigint auto_increment not null,
name varchar(255),
constraint pk_plataforma primary key (id))
;
create table tutorial (
id bigint auto_increment not null,
text varchar(255),
tutorial_image longblob,
recomendation_number integer,
user_id bigint,
distribution_id bigint,
constraint pk_tutorial primary key (id))
;
create table user (
id bigint auto_increment not null,
name varchar(255),
nickname varchar(255),
email varchar(255),
password varchar(255),
profile_image longblob,
constraint pk_user primary key (id))
;
alter table comentario add constraint fk_comentario_creator_1 foreign key (creator_id) references user (id) on delete restrict on update restrict;
create index ix_comentario_creator_1 on comentario (creator_id);
alter table comentario add constraint fk_comentario_tutorial_2 foreign key (tutorial_id) references tutorial (id) on delete restrict on update restrict;
create index ix_comentario_tutorial_2 on comentario (tutorial_id);
alter table distribution add constraint fk_distribution_game_3 foreign key (game_id) references game (id) on delete restrict on update restrict;
create index ix_distribution_game_3 on distribution (game_id);
alter table distribution add constraint fk_distribution_console_4 foreign key (console_id) references plataforma (id) on delete restrict on update restrict;
create index ix_distribution_console_4 on distribution (console_id);
alter table tutorial add constraint fk_tutorial_user_5 foreign key (user_id) references user (id) on delete restrict on update restrict;
create index ix_tutorial_user_5 on tutorial (user_id);
alter table tutorial add constraint fk_tutorial_distribution_6 foreign key (distribution_id) references distribution (id) on delete restrict on update restrict;
create index ix_tutorial_distribution_6 on tutorial (distribution_id);
# --- !Downs
SET FOREIGN_KEY_CHECKS=0;
drop table comentario;
drop table distribution;
drop table game;
drop table plataforma;
drop table tutorial;
drop table user;
SET FOREIGN_KEY_CHECKS=1;
|
<filename>intents/data/spider_eval/spider/database/concert_singer/schema.sql
version https://git-lfs.github.com/spec/v1
oid sha256:0668dd3eb03d4122b0319ad87ad6c062a21b5a0a8e4383604377f17693844971
size 3021
|
<filename>migrations/frontend/1528395751_add_unique_constraint_to_external_service_repos.up.sql<gh_stars>1-10
BEGIN;
LOCK TABLE external_service_repos;
-- Drop trigger as we don't want it to fire
DROP TRIGGER IF EXISTS trig_soft_delete_orphan_repo_by_external_service_repo
ON external_service_repos;
WITH dups AS (SELECT external_service_id, repo_id, min(ctid)
FROM external_service_repos
GROUP BY external_service_id, repo_id
HAVING count(*) > 1
)
DELETE FROM external_service_repos
USING dups
WHERE (external_service_repos.external_service_id, external_service_repos.repo_id) = (dups.external_service_id, dups.repo_id)
AND external_service_repos.ctid <> dups.min;
-- Add unique constraint
ALTER TABLE external_service_repos
ADD CONSTRAINT external_service_repos_repo_id_external_service_id_unique
UNIQUE (repo_id, external_service_id);
-- Recreate trigger
CREATE TRIGGER trig_soft_delete_orphan_repo_by_external_service_repo
AFTER DELETE ON external_service_repos
FOR EACH ROW EXECUTE PROCEDURE soft_delete_orphan_repo_by_external_service_repos();
COMMIT;
|
-- MySQL dump 10.13 Distrib 5.7.23, for Linux (x86_64)
--
-- Host: localhost Database: great_edu
-- ------------------------------------------------------
-- Server version 5.7.23-0ubuntu0.18.04.1
/*!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 utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `Авторы`
--
DROP TABLE IF EXISTS `Авторы`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Авторы` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`фамилия` varchar(30) COLLATE utf8_bin NOT NULL,
`имя` varchar(30) COLLATE utf8_bin NOT NULL,
`отчество` varchar(30) COLLATE utf8_bin NOT NULL,
`страна_принадлежности` varchar(50) COLLATE utf8_bin NOT NULL,
`сферы_деятельности` int(11) NOT NULL,
`период` int(11) NOT NULL,
`биография` varchar(30) COLLATE utf8_bin DEFAULT NULL,
`дата_добавления` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_Авторы_1_idx` (`сферы_деятельности`),
KEY `fk_Авторы_1_idx1` (`период`),
CONSTRAINT `fk_Авторы_1` FOREIGN KEY (`период`) REFERENCES `Периоды` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `Авторы_fk2` FOREIGN KEY (`сферы_деятельности`) REFERENCES `Сферы_деятельности` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Авторы`
--
LOCK TABLES `Авторы` WRITE;
/*!40000 ALTER TABLE `Авторы` DISABLE KEYS */;
INSERT INTO `Авторы` VALUES (1,'Пушкин','Александр','Сергеевич','Российская империя',14,6,'bio1','2019-02-11 16:01:44'),(2,'Достоевский','Федор','Михайлович','Российская империя',13,5,'bio2','2019-02-13 16:01:44'),(3,'Маяковский','Владимир','Владимирович','СССР',14,7,'bio3','2019-02-15 16:01:44'),(5,'Булгаков','Михаил','Афанасьевич','СССР',13,7,'bio5','2019-02-01 16:01:44'),(6,'Толстой','Лев','Николаевич','Российская империя',13,6,'bio6','2019-03-11 16:01:44'),(7,'Бальзак','Оноре де','','Франция',15,6,'bio7','2019-03-13 03:08:07');
/*!40000 ALTER TABLE `Авторы` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Цитаты`
--
DROP TABLE IF EXISTS `Цитаты`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Цитаты` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`автор` int(11) DEFAULT NULL,
`текст` text COLLATE utf8_bin NOT NULL,
`источник` int(11) DEFAULT NULL,
`тема` int(11) DEFAULT NULL,
`автор_публикации` int(11) DEFAULT NULL,
`дата_публикации` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `Цитаты_fk0` (`автор`),
KEY `Цитаты_fk2` (`источник`),
KEY `fk_Цитаты_1_idx` (`тема`),
KEY `fk_Цитаты_2_idx` (`автор_публикации`),
CONSTRAINT `fk_Цитаты_1` FOREIGN KEY (`тема`) REFERENCES `Темы_произведений` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Цитаты_2` FOREIGN KEY (`автор_публикации`) REFERENCES `Пользователи` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `Цитаты_fk0` FOREIGN KEY (`автор`) REFERENCES `Авторы` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `Цитаты_fk2` FOREIGN KEY (`источник`) REFERENCES `Произведения` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Цитаты`
--
LOCK TABLES `Цитаты` WRITE;
/*!40000 ALTER TABLE `Цитаты` DISABLE KEYS */;
INSERT INTO `Цитаты` VALUES (1,1,'Господи, Как же так получается, \nЧто мы путешествуем, \nУдивляясь и восхищаясь Высотой гор, \nПросторами морей, Течением рек, \nУстрашающей силой океанов \nИ движением звезд, \nА когда мы смотрим внутрь себя, \nТо не замечаем великого чуда?',1,4,1,'2019-03-01 18:25:31'),(2,1,'Любовь - это когда люди не соединяют души или тела, это когда они объединяют судьбы!',1,2,1,'2019-03-01 18:25:31'),(3,2,'Когда дети будут смотреть на великих ученых так же, как они смотрят на знаменитых актёров и музыкантов, человечество совершит большой прорыв.',2,1,2,'2019-03-01 18:25:35'),(4,3,'Я стал другим, новым человеком; а те, для кого существовал только старый «я», смеялись надо мной. Единственно разумный человек был мой портной: он каждый раз снимал заново с меня мерку, тогда как все остальные подходили ко мне со старой и воображали, что она все еще отражает мои действительные размеры.',3,2,3,'2019-03-01 20:25:35');
/*!40000 ALTER TABLE `Цитаты` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Группы_пользователей`
--
DROP TABLE IF EXISTS `Группы_пользователей`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Группы_пользователей` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`название` varchar(45) COLLATE utf8_bin NOT NULL,
`разрешения` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_Группы_пользователей_1_idx` (`разрешения`),
CONSTRAINT `fk_Группы_пользователей_1` FOREIGN KEY (`разрешения`) REFERENCES `Список_разрешений` (`id_списка`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Группы_пользователей`
--
LOCK TABLES `Группы_пользователей` WRITE;
/*!40000 ALTER TABLE `Группы_пользователей` DISABLE KEYS */;
INSERT INTO `Группы_пользователей` VALUES (1,'пользователь',1),(2,'администратор',2);
/*!40000 ALTER TABLE `Группы_пользователей` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Комментарии`
--
DROP TABLE IF EXISTS `Комментарии`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Комментарии` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`автор` int(11) DEFAULT NULL,
`сообщение` text COLLATE utf8_bin NOT NULL,
`статья` int(11) NOT NULL,
`дата_публикации` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `Комментарии_fk0` (`автор`),
KEY `fk_Комментарии_1_idx` (`статья`),
CONSTRAINT `fk_Комментарии_1` FOREIGN KEY (`статья`) REFERENCES `Статьи` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `Комментарии_fk0` FOREIGN KEY (`автор`) REFERENCES `Пользователи` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Комментарии`
--
LOCK TABLES `Комментарии` WRITE;
/*!40000 ALTER TABLE `Комментарии` DISABLE KEYS */;
INSERT INTO `Комментарии` VALUES (1,1,'тестовый месседж',3,'2019-02-18 16:01:44'),(2,1,'тест2',2,'2019-02-18 16:01:44'),(3,1,'тест',2,'2019-02-18 16:01:44'),(4,2,'тест3',1,'2019-02-18 16:01:44'),(5,2,'тест',2,'2019-02-18 16:01:44'),(6,1,'тест',1,'2019-02-18 16:01:44'),(7,2,'тест',3,'2019-02-18 16:01:44'),(8,2,'тест',1,'2019-02-18 16:01:44'),(9,2,'тест',2,'2019-02-18 16:01:44'),(10,1,'тест',2,'2019-02-18 16:01:44'),(11,1,'ну смотри сюда короче',3,'2019-03-07 12:45:01'),(12,1,'ну так и живем',4,'2019-03-08 18:30:08'),(13,1,'давай еще один',3,'2019-03-10 21:50:35'),(14,1,'ну и еще один - почему нет? <br> <p>fdfsdf</p>',3,'2019-03-10 21:55:02');
/*!40000 ALTER TABLE `Комментарии` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Периоды`
--
DROP TABLE IF EXISTS `Периоды`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Периоды` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`название` varchar(30) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Периоды`
--
LOCK TABLES `Периоды` WRITE;
/*!40000 ALTER TABLE `Периоды` DISABLE KEYS */;
INSERT INTO `Периоды` VALUES (1,'Античная литература'),(2,'Средневековая литература'),(3,'Литература эпохи Возрождения'),(4,'XVII век'),(5,'XVIII век'),(6,'XIX век'),(7,'XX век'),(8,'XXI век'),(9,'XIX векtest'),(10,'sdfg'),(11,'Крутой период'),(12,'Крутой период ghfghfg');
/*!40000 ALTER TABLE `Периоды` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Пользователи`
--
DROP TABLE IF EXISTS `Пользователи`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Пользователи` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`никнейм` varchar(50) COLLATE utf8_bin NOT NULL,
`почта` varchar(45) COLLATE utf8_bin NOT NULL,
`хэш_пароля` varchar(100) COLLATE utf8_bin NOT NULL,
`статус` int(11) NOT NULL,
`группа` int(11) DEFAULT NULL,
`дата_регистрации` datetime DEFAULT NULL,
`дата_изменения` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_Пользователи_1_idx` (`статус`),
KEY `fk_Пользователи_2_idx` (`группа`),
CONSTRAINT `fk_Пользователи_1` FOREIGN KEY (`статус`) REFERENCES `Статусы` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Пользователи_2` FOREIGN KEY (`группа`) REFERENCES `Группы_пользователей` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Пользователи`
--
LOCK TABLES `Пользователи` WRITE;
/*!40000 ALTER TABLE `Пользователи` DISABLE KEYS */;
INSERT INTO `Пользователи` VALUES (1,'test','<EMAIL>','test',1,2,'2019-02-18 16:01:44','2019-02-18 16:01:44'),(2,'test2','<EMAIL>','test',1,1,'2019-02-18 16:01:44','2019-02-18 16:01:44'),(3,'tiranid','<EMAIL>','fkgokfdmgvfd',2,2,'2019-02-18 16:01:44','2019-02-18 16:01:44'),(7,'test123','<EMAIL>','12',1,2,'2019-03-06 15:52:46','2019-03-06 15:52:46'),(9,'test2','<EMAIL>','123',1,2,'2019-03-06 15:53:44','2019-03-06 15:53:44'),(11,'test-admin','<EMAIL>','1234',1,2,'2019-03-06 15:56:59','2019-03-06 15:56:59'),(13,'new_user','<EMAIL>','555',1,1,'2019-03-07 13:41:24','2019-03-07 13:41:24'),(14,'tester_user1','<EMAIL>','123',1,1,'2019-03-07 13:48:35','2019-03-07 13:48:35'),(15,'tester_user12','<EMAIL>','12',1,1,'2019-03-07 13:50:21','2019-03-07 13:50:21'),(16,'да','мда','бда',1,1,'2019-03-06 15:52:45','2019-03-06 15:52:45'),(17,'tester_user123','<EMAIL>','12',1,1,'2019-03-07 13:54:50','2019-03-07 13:54:50'),(18,'testwerewrwe','ewrweqr','123',1,1,'2019-03-07 13:56:06','2019-03-07 13:56:06'),(19,'MonsterBoomerACDC','<EMAIL>','123',1,1,'2019-03-07 13:56:34','2019-03-07 13:56:34'),(20,'wqewe','wqewqe','123',1,1,'2019-03-07 13:57:12','2019-03-07 13:57:12'),(21,'wqewe213','wqewqe','123',1,1,'2019-03-07 13:58:33','2019-03-07 13:58:33'),(22,'213213','12321','123',1,1,'2019-03-07 14:00:43','2019-03-07 14:00:43'),(23,'tiranid99','<EMAIL>','12',1,2,'2019-03-11 10:22:43','2019-03-11 10:22:43');
/*!40000 ALTER TABLE `Пользователи` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Произведения`
--
DROP TABLE IF EXISTS `Произведения`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Произведения` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`название` varchar(100) COLLATE utf8_bin NOT NULL,
`год` int(11) NOT NULL,
`автор` int(11) NOT NULL,
`тематика` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_Произведения_1_idx` (`автор`),
KEY `fk_Произведения_2_idx` (`тематика`),
CONSTRAINT `fk_Произведения_1` FOREIGN KEY (`автор`) REFERENCES `Авторы` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Произведения_2` FOREIGN KEY (`тематика`) REFERENCES `Список_тем_произведений` (`id_списка`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Произведения`
--
LOCK TABLES `Произведения` WRITE;
/*!40000 ALTER TABLE `Произведения` DISABLE KEYS */;
INSERT INTO `Произведения` VALUES (1,'<NAME>',1825,1,1),(2,'Идиот',1868,2,1),(3,'Мастер и Маргарита',1966,5,1);
/*!40000 ALTER TABLE `Произведения` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Разрешения`
--
DROP TABLE IF EXISTS `Разрешения`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Разрешения` (
`id` int(11) NOT NULL,
`название` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Разрешения`
--
LOCK TABLES `Разрешения` WRITE;
/*!40000 ALTER TABLE `Разрешения` DISABLE KEYS */;
INSERT INTO `Разрешения` VALUES (1,'комментирование'),(2,'добавление статей'),(3,'модерация комментариев'),(4,'модерация статей'),(5,'добавление цитат');
/*!40000 ALTER TABLE `Разрешения` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Сферы_деятельности`
--
DROP TABLE IF EXISTS `Сферы_деятельности`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Сферы_деятельности` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`название` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Сферы_деятельности`
--
LOCK TABLES `Сферы_деятельности` WRITE;
/*!40000 ALTER TABLE `Сферы_деятельности` DISABLE KEYS */;
INSERT INTO `Сферы_деятельности` VALUES (1,'Экономика'),(2,'Экология'),(3,'Управление'),(4,'Педагогика'),(5,'Медицина'),(6,'Физкультура'),(7,'Наука'),(8,'Искусство'),(9,'kek'),(10,'Искусствоtest'),(11,'dfgs'),(12,'Крутые сферы'),(13,'Писатель'),(14,'Поэт'),(15,'Прозаик');
/*!40000 ALTER TABLE `Сферы_деятельности` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Список_разрешений`
--
DROP TABLE IF EXISTS `Список_разрешений`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Список_разрешений` (
`id_списка` int(11) NOT NULL,
`id_элемента` int(11) NOT NULL,
PRIMARY KEY (`id_списка`,`id_элемента`),
KEY `fk1_idx` (`id_элемента`),
CONSTRAINT `fk1` FOREIGN KEY (`id_элемента`) REFERENCES `Разрешения` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Список_разрешений`
--
LOCK TABLES `Список_разрешений` WRITE;
/*!40000 ALTER TABLE `Список_разрешений` DISABLE KEYS */;
INSERT INTO `Список_разрешений` VALUES (1,1),(2,1),(2,2),(2,3),(2,4),(1,5),(2,5);
/*!40000 ALTER TABLE `Список_разрешений` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Список_тегов`
--
DROP TABLE IF EXISTS `Список_тегов`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Список_тегов` (
`id_списка` int(11) NOT NULL,
`id_элемента` int(11) NOT NULL,
PRIMARY KEY (`id_списка`,`id_элемента`),
KEY `fk10_idx` (`id_элемента`),
CONSTRAINT `fk10` FOREIGN KEY (`id_элемента`) REFERENCES `Теги` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Список_тегов`
--
LOCK TABLES `Список_тегов` WRITE;
/*!40000 ALTER TABLE `Список_тегов` DISABLE KEYS */;
INSERT INTO `Список_тегов` VALUES (1,1),(1,2),(2,3),(3,4);
/*!40000 ALTER TABLE `Список_тегов` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Список_тем_произведений`
--
DROP TABLE IF EXISTS `Список_тем_произведений`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Список_тем_произведений` (
`id_списка` int(11) NOT NULL,
`id_элемента` int(11) NOT NULL,
PRIMARY KEY (`id_списка`,`id_элемента`),
KEY `Список_тем_статьи_fk0` (`id_элемента`),
CONSTRAINT `fk_Список_тем_произведений_1` FOREIGN KEY (`id_элемента`) REFERENCES `Темы_произведений` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Список_тем_произведений`
--
LOCK TABLES `Список_тем_произведений` WRITE;
/*!40000 ALTER TABLE `Список_тем_произведений` DISABLE KEYS */;
INSERT INTO `Список_тем_произведений` VALUES (1,1),(1,2);
/*!40000 ALTER TABLE `Список_тем_произведений` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Список_тем_статьи`
--
DROP TABLE IF EXISTS `Список_тем_статьи`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Список_тем_статьи` (
`id_списка` int(11) NOT NULL,
`id_элемента` int(11) NOT NULL,
PRIMARY KEY (`id_списка`,`id_элемента`),
KEY `Список_тем_статьи_fk0` (`id_элемента`),
CONSTRAINT `fk_Список_тем_статьи_1` FOREIGN KEY (`id_элемента`) REFERENCES `Темы_статей` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Список_тем_статьи`
--
LOCK TABLES `Список_тем_статьи` WRITE;
/*!40000 ALTER TABLE `Список_тем_статьи` DISABLE KEYS */;
INSERT INTO `Список_тем_статьи` VALUES (1,1),(3,1),(1,2),(2,3);
/*!40000 ALTER TABLE `Список_тем_статьи` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Статьи`
--
DROP TABLE IF EXISTS `Статьи`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Статьи` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`темы` int(11) DEFAULT NULL,
`автор` int(11) DEFAULT NULL,
`теги` int(11) DEFAULT NULL,
`дата_публикации` datetime DEFAULT NULL,
`заголовок` varchar(350) COLLATE utf8_bin DEFAULT NULL,
`файл_контент` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`изображение` varchar(100) COLLATE utf8_bin DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_Статьи_1_idx` (`автор`),
KEY `fk_Статьи_1` (`темы`),
KEY `fk_Статьи_2_idx` (`теги`),
CONSTRAINT `fk_Статьи_1` FOREIGN KEY (`темы`) REFERENCES `Список_тем_статьи` (`id_списка`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Статьи_2` FOREIGN KEY (`теги`) REFERENCES `Список_тегов` (`id_списка`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Статьи_3` FOREIGN KEY (`автор`) REFERENCES `Пользователи` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Статьи`
--
LOCK TABLES `Статьи` WRITE;
/*!40000 ALTER TABLE `Статьи` DISABLE KEYS */;
INSERT INTO `Статьи` VALUES (1,1,1,1,'2019-03-15 19:08:14','Литературный анализ художественного произведения как один из способов развития мыслительной способности студентов','post_1.txt','25736083.jpg'),(2,2,1,2,'2019-03-15 19:04:18','Что такое материализм?','post_2.txt','atheism25.jpeg'),(3,3,1,3,'2019-03-15 18:26:53','Теория познания у Шопенгауэра','post_3.txt','shpopengoger.jpg'),(4,1,1,1,'2019-03-15 18:33:45','Иррационализм','post_4.txt','Снимок экрана в 2019-03-15 18-32-11.jpg'),(6,1,1,2,'2019-03-15 19:01:23','Идеализм (Новиков, 1987)','post_6.txt','slide-0.jpg'),(7,1,23,2,'2019-03-15 18:25:27','Как любили древние греки','post_7.txt','f4aca8a59f25d8675f_800x489.jpg'),(8,1,23,2,'2019-03-16 15:19:20','Платон: анализ диалога \"Государство\"','post_8.txt','platon.jpg');
/*!40000 ALTER TABLE `Статьи` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Статусы`
--
DROP TABLE IF EXISTS `Статусы`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Статусы` (
`id` int(11) NOT NULL,
`название` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Статусы`
--
LOCK TABLES `Статусы` WRITE;
/*!40000 ALTER TABLE `Статусы` DISABLE KEYS */;
INSERT INTO `Статусы` VALUES (1,'registered'),(2,'pending'),(3,'empty'),(4,'repass');
/*!40000 ALTER TABLE `Статусы` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Теги`
--
DROP TABLE IF EXISTS `Теги`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Теги` (
`id` int(11) NOT NULL,
`название` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Теги`
--
LOCK TABLES `Теги` WRITE;
/*!40000 ALTER TABLE `Теги` DISABLE KEYS */;
INSERT INTO `Теги` VALUES (1,'философия'),(2,'любовь'),(3,'анализ'),(4,'проза'),(5,'авторское');
/*!40000 ALTER TABLE `Теги` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Темы_произведений`
--
DROP TABLE IF EXISTS `Темы_произведений`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Темы_произведений` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`название` varchar(100) CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Темы_произведений`
--
LOCK TABLES `Темы_произведений` WRITE;
/*!40000 ALTER TABLE `Темы_произведений` DISABLE KEYS */;
INSERT INTO `Темы_произведений` VALUES (1,'Вечные темы'),(2,'Культурно-историческая тематика'),(3,'Революция'),(4,'Человек'),(5,'Любовь');
/*!40000 ALTER TABLE `Темы_произведений` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Темы_статей`
--
DROP TABLE IF EXISTS `Темы_статей`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Темы_статей` (
`id` int(11) NOT NULL,
`название` varchar(30) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Темы_статей`
--
LOCK TABLES `Темы_статей` WRITE;
/*!40000 ALTER TABLE `Темы_статей` DISABLE KEYS */;
INSERT INTO `Темы_статей` VALUES (1,'Анализ'),(2,'Эссе'),(3,'Этюд');
/*!40000 ALTER TABLE `Темы_статей` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-03-16 19:20:25
|
<gh_stars>100-1000
create table widetable (col1 float(10), col2 float) as select * from test
|
<reponame>Energinet-DataHub/geh-metering-point<filename>source/Energinet.DataHub.MeteringPoints.ApplyDBMigrationsApp/Scripts/Model/202109270930 Add MessageHubMessages table.sql
CREATE TABLE [dbo].[MessageHubMessages]
(
[Id] UNIQUEIDENTIFIER NOT NULL,
[RecordId] INT IDENTITY(1,1) NOT NULL,
[Correlation] NVARCHAR(500) NOT NULL,
[Type] NVARCHAR(500) NOT NULL,
[Content] NVARCHAR(MAX) NOT NULL
CONSTRAINT [PK_MessageHubMessages] PRIMARY KEY NONCLUSTERED ([Id])
)
CREATE UNIQUE CLUSTERED INDEX CIX_MessageHubMessages ON MessageHubMessages([RecordId])
|
<gh_stars>10-100
-- Now supports creating GIN, GiST, and other expression indexes on the destination table as they exist on the source table. Previously, all indexes were recreated as b-tree (if at all) no matter what kind of index they were on the source.
-- Above change led to major rewriting of the underlying code for the maker functions. Previously they all used the refresh_snap() function as the basis for doing initial, full data pull of the source. This lead to indexes being named a bit oddly (they all had "snap1" in the name). This is no longer the case and destination table index names should match closely to what they were on the source. This is only applied to newly created replication sets and no existing indexes on the destination will be changed.
-- Logdel refresh function now has a "repull" option to do a complete refresh of data from the source. Note that it will NOT delete the rows on the destination that were previously deleted from the source (only deletes rows on the destination where mimeo_source_deleted column is null). Since a TRUNCATE cannot be done as is done with the other replication repulls, it is highly recommended to do a manual VACUUM of destination table after this is done, possibly even a VACUUM FULL to reclaim disk space.
-- To help the above repull process be more efficient, an index is now created on the "mimeo_source_deleted" destination column of all newly created logdel replication tables. Existing replication tables will not have this index added. Recommend adding one if you need to do this repull method on old setups.
-- DML & Logdel replication source queue tables now have indexes created on the "processed" and "processed, mimeo_source_deleted" columns respectively. This should help replication be more efficient for higher traffic tables that create larger queues. Existing replication sets will not have their source queue table modified to add this index. Recommend going back and manually adding it if you notice performance problems.
-- Exception messages if dml/logdel maker functions fail are clearer about what has happened reguarding objects created on the source.
-- Added p_debug option to maker functions. Also made debugging a little cleaner and have it provide more information in many cases.
-- Bug Fix: WHERE condition of logdel replication wasn't working properly.
-- Preserve dropped function privileges. Re-applied at the end of this update.
CREATE TEMP TABLE mimeo_preserve_privs_temp (statement text);
INSERT INTO mimeo_preserve_privs_temp
SELECT 'GRANT EXECUTE ON FUNCTION @extschema@.snapshot_maker(text, int, text, boolean, text[], text, boolean, boolean) TO '||array_to_string(array_agg(grantee::text), ',')||';'
FROM information_schema.routine_privileges
WHERE routine_schema = '@extschema@'
AND routine_name = 'snapshot_maker';
INSERT INTO mimeo_preserve_privs_temp
SELECT 'GRANT EXECUTE ON FUNCTION @extschema@.dml_maker(text, int, text, boolean, text[], text, boolean, text[], text[], boolean) TO '||array_to_string(array_agg(grantee::text), ',')||';'
FROM information_schema.routine_privileges
WHERE routine_schema = '@extschema@'
AND routine_name = 'dml_maker';
INSERT INTO mimeo_preserve_privs_temp
SELECT 'GRANT EXECUTE ON FUNCTION @extschema@.logdel_maker(text, int, text, boolean, text[], text, boolean, text[], text[], boolean) TO '||array_to_string(array_agg(grantee::text), ',')||';'
FROM information_schema.routine_privileges
WHERE routine_schema = '@extschema@'
AND routine_name = 'logdel_maker';
INSERT INTO mimeo_preserve_privs_temp
SELECT 'GRANT EXECUTE ON FUNCTION @extschema@.inserter_maker(text, text, int, interval, text, boolean, text[], text, boolean, boolean) TO '||array_to_string(array_agg(grantee::text), ',')||';'
FROM information_schema.routine_privileges
WHERE routine_schema = '@extschema@'
AND routine_name = 'inserter_maker';
INSERT INTO mimeo_preserve_privs_temp
SELECT 'GRANT EXECUTE ON FUNCTION @extschema@.updater_maker(text, text, int, interval, text, boolean, text[], text, boolean, text[], text[], boolean) TO '||array_to_string(array_agg(grantee::text), ',')||';'
FROM information_schema.routine_privileges
WHERE routine_schema = '@extschema@'
AND routine_name = 'updater_maker';
INSERT INTO mimeo_preserve_privs_temp
SELECT 'GRANT EXECUTE ON FUNCTION @extschema@.table_maker(text, int, text, boolean, text[], text, text[], boolean, boolean) TO '||array_to_string(array_agg(grantee::text), ',')||';'
FROM information_schema.routine_privileges
WHERE routine_schema = '@extschema@'
AND routine_name = 'table_maker';
INSERT INTO mimeo_preserve_privs_temp
SELECT 'GRANT EXECUTE ON FUNCTION @extschema@.refresh_logdel(text, int, boolean, boolean) TO '||array_to_string(array_agg(grantee::text), ',')||';'
FROM information_schema.routine_privileges
WHERE routine_schema = '@extschema@'
AND routine_name = 'refresh_logdel';
CREATE FUNCTION replay_preserved_privs() RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
v_row record;
BEGIN
FOR v_row IN SELECT statement FROM mimeo_preserve_privs_temp LOOP
IF v_row.statement IS NOT NULL THEN
EXECUTE v_row.statement;
END IF;
END LOOP;
END
$$;
DROP FUNCTION @extschema@.snapshot_maker(text, int, text, boolean, text[], text, boolean);
DROP FUNCTION @extschema@.dml_maker(text, int, text, boolean, text[], text, boolean, text[], text[]);
DROP FUNCTION @extschema@.logdel_maker(text, int, text, boolean, text[], text, boolean, text[], text[]);
DROP FUNCTION @extschema@.inserter_maker(text, text, int, interval,text, boolean,text[], text, boolean);
DROP FUNCTION @extschema@.updater_maker(text, text, int, interval, text, boolean, text[], text, boolean, text[], text[]);
DROP FUNCTION @extschema@.table_maker(text, int, text, boolean, text[], text, text[], boolean);
DROP FUNCTION @extschema@.refresh_logdel(text, int, boolean);
/*
* Manages creating destination table and/or returning data about the columns.
* v_snap parameter is passed if snap table is being managed. Should be equal to either _snap1 or _snap2.
*/
CREATE FUNCTION manage_dest_table (p_destination text, p_snap text, p_debug boolean DEFAULT false, OUT p_table_exists boolean, OUT p_cols text[], OUT p_cols_n_types text[]) RETURNS record
LANGUAGE plpgsql SECURITY DEFINER
AS $$
DECLARE
v_col_exists int;
v_condition text;
v_create_sql text;
v_dblink int;
v_dblink_name text;
v_dblink_schema text;
v_dest_table text;
v_filter text[];
v_link_exists boolean;
v_remote_sql text;
v_old_search_path text;
v_source_table text;
v_type text;
BEGIN
SELECT nspname INTO v_dblink_schema FROM pg_namespace n, pg_extension e WHERE e.extname = 'dblink' AND e.extnamespace = n.oid;
v_dblink_name := 'manage_dest_table_dblink_'||p_destination;
SELECT current_setting('search_path') INTO v_old_search_path;
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_dblink_schema||',public'',''false'')';
SELECT dest_table
, type
, dblink
, filter
, condition
INTO v_dest_table
, v_type
, v_dblink
, v_filter
, v_condition
FROM refresh_config
WHERE dest_table = p_destination;
IF NOT FOUND THEN
RAISE EXCEPTION 'ERROR: This table is not set up for replication: %', p_destination;
END IF;
EXECUTE 'SELECT source_table FROM refresh_config_'||v_type||' WHERE dest_table = '||quote_literal(v_dest_table) INTO v_source_table;
IF p_snap IS NOT NULL AND p_snap NOT IN ('snap1', 'snap2') THEN
RAISE EXCEPTION 'Invalid value for p_snap parameter given to manage_dest_table() function';
END IF;
PERFORM dblink_connect(v_dblink_name, @extschema@.auth(v_dblink));
-- Always return source column info in case extra columns were added to destination. Source columns should not be changed before destination.
v_remote_sql := 'SELECT array_agg(attname) as cols, array_agg(attname||'' ''||format_type(atttypid, atttypmod)::text) as cols_n_types FROM pg_attribute WHERE attrelid = '||quote_literal(v_source_table)||'::regclass AND attnum > 0 AND attisdropped is false';
IF v_filter IS NOT NULL THEN -- Apply column filters if used
v_remote_sql := v_remote_sql || ' AND ARRAY[attname::text] <@ '||quote_literal(v_filter);
END IF;
v_remote_sql := 'SELECT cols, cols_n_types FROM dblink('||quote_literal(v_dblink_name)||', ' || quote_literal(v_remote_sql) || ') t (cols text[], cols_n_types text[])';
PERFORM gdb(p_debug,'v_remote_sql: '||v_remote_sql);
EXECUTE v_remote_sql INTO p_cols, p_cols_n_types;
PERFORM gdb(p_debug,'p_cols: {'|| array_to_string(p_cols, ',') ||'}');
PERFORM gdb(p_debug,'p_cols_n_types: {'|| array_to_string(p_cols_n_types, ',') ||'}');
SELECT
CASE
WHEN count(1) > 0 THEN true
ELSE false
END
INTO p_table_exists FROM pg_tables WHERE schemaname ||'.'|| tablename = v_dest_table || COALESCE('_'||p_snap, '');
IF p_table_exists = false THEN
v_create_sql := 'CREATE TABLE ' || v_dest_table || COALESCE('_'||p_snap, '') || ' (' || array_to_string(p_cols_n_types, ',') || ')';
perform gdb(p_debug,'v_create_sql: '||v_create_sql::text);
EXECUTE v_create_sql;
END IF;
IF v_type = 'logdel' THEN
SELECT count(*) INTO v_col_exists FROM pg_attribute
WHERE attrelid = v_dest_table::regclass AND attname = 'mimeo_source_deleted' AND attisdropped = false;
IF v_col_exists < 1 THEN
EXECUTE 'ALTER TABLE '||v_dest_table||' ADD COLUMN mimeo_source_deleted timestamptz';
ELSE
RAISE WARNING 'Special column (mimeo_source_deleted) already exists on destination table (%)', v_dest_table;
END IF;
END IF;
PERFORM dblink_disconnect(v_dblink_name);
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
EXCEPTION
WHEN QUERY_CANCELED OR OTHERS THEN
EXECUTE 'SELECT '||v_dblink_schema||'.dblink_get_connections() @> ARRAY['||quote_literal(v_dblink_name)||']' INTO v_link_exists;
IF v_link_exists THEN
EXECUTE 'SELECT '||v_dblink_schema||'.dblink_disconnect('||quote_literal(v_dblink_name)||')';
END IF;
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RAISE EXCEPTION '%', SQLERRM;
END
$$;
/*
* Create index(es) on destination table
*/
CREATE FUNCTION create_index(p_destination text, p_snap text DEFAULT NULL, p_debug boolean DEFAULT false) RETURNS void
LANGUAGE plpgsql SECURITY DEFINER
AS $$
DECLARE
v_dblink int;
v_dblink_name text;
v_dblink_schema text;
v_dest_table text;
v_dest_table_name text;
v_filter text;
v_link_exists boolean;
v_old_search_path text;
v_repl_index oid;
v_remote_index_sql text;
v_row record;
v_source_table text;
v_statement text;
v_type text;
BEGIN
SELECT nspname INTO v_dblink_schema FROM pg_namespace n, pg_extension e WHERE e.extname = 'dblink' AND e.extnamespace = n.oid;
v_dblink_name := 'create_index_dblink_'||p_destination;
SELECT current_setting('search_path') INTO v_old_search_path;
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_dblink_schema||',public'',''false'')';
SELECT dest_table
, type
, dblink
, filter
INTO v_dest_table
, v_type
, v_dblink
, v_filter
FROM refresh_config
WHERE dest_table = p_destination;
IF NOT FOUND THEN
RAISE EXCEPTION 'ERROR: This table is not set up for replication: %', p_destination;
END IF;
EXECUTE 'SELECT source_table FROM refresh_config_'||v_type||' WHERE dest_table = '||quote_literal(v_dest_table) INTO v_source_table;
IF p_snap IS NOT NULL AND p_snap NOT IN ('snap1', 'snap2') THEN
RAISE EXCEPTION 'Invalid value for p_snap parameter given to create_index() function';
END IF;
PERFORM dblink_connect(v_dblink_name, @extschema@.auth(v_dblink));
v_dest_table := v_dest_table;
v_dest_table_name := split_part(v_dest_table, '.', 2);
-- Gets primary key or unique index used by updater/dml/logdel replication.
-- Ordering by statement should produce the same order as maker function since ALTER comes before CREATE.
-- Maker function already checks that columns needed by this index aren't filtered out.
v_remote_index_sql := 'SELECT indexrelid AS repl_index,
relname AS src_table,
CASE WHEN indisprimary THEN
''ALTER TABLE '||v_dest_table || COALESCE('_'||p_snap, '')||' ADD CONSTRAINT '||
COALESCE(p_snap||'_', '')|| v_dest_table_name ||'_''||array_to_string(indkey_names, ''_'')||''_pk
PRIMARY KEY (''||array_to_string(indkey_names, '','')||'')''
WHEN indisunique THEN
pg_get_indexdef(indexrelid)
END AS statement
FROM (
SELECT i.indexrelid, i.indisprimary, i.indisunique, c.relname, (
SELECT array_agg( a.attname ORDER by x.r )
FROM pg_catalog.pg_attribute a
JOIN ( SELECT k, row_number() over () as r
FROM unnest(i.indkey) k ) as x
ON a.attnum = x.k AND a.attrelid = i.indrelid
WHERE a.attnotnull
) AS indkey_names
FROM pg_catalog.pg_index i
JOIN pg_catalog.pg_class c ON i.indrelid = c.oid
WHERE i.indrelid = '||quote_literal(v_source_table)||'::regclass
AND (i.indisprimary OR i.indisunique)
AND i.indisvalid
) AS x
ORDER BY statement
LIMIT 1';
PERFORM gdb(p_debug, 'v_remote_index_sql: '||v_remote_index_sql);
FOR v_row IN EXECUTE 'SELECT repl_index, src_table, statement FROM dblink('||quote_literal(v_dblink_name)||', '||quote_literal(v_remote_index_sql)||') t (repl_index oid, src_table text, statement text)' LOOP
v_statement := v_row.statement;
-- Replace source table name with destination
v_statement := replace(v_statement, ' ON '||v_source_table, ' ON '||v_dest_table || COALESCE('_'||p_snap, ''));
-- If source index name contains the table name, replace it with the destination table. Not perfect, but good enough for now.
v_statement := replace(v_statement, v_row.src_table, v_dest_table_name);
-- If it's a snap table, prepend to ensure unique index name.
-- This is done separately from above replace because it must always be done even if the index name doesn't contain the source table
IF p_snap IS NOT NULL THEN
v_statement := replace(v_statement, 'UNIQUE INDEX ' , 'UNIQUE INDEX '||p_snap||'_');
END IF;
PERFORM gdb(p_debug, 'statement: ' || v_statement);
v_repl_index := v_row.repl_index;
EXECUTE v_statement;
END LOOP;
-- Get all indexes other than one obtained above.
-- Cannot set these indexes when column filters are in use because there's no easy way to check columns in expression indexes.
IF v_filter IS NULL THEN
v_remote_index_sql := 'select c.relname AS src_table, pg_get_indexdef(i.indexrelid) as statement
FROM pg_catalog.pg_index i
JOIN pg_catalog.pg_class c ON i.indrelid = c.oid
WHERE i.indrelid = '||quote_literal(v_source_table)||'::regclass
AND i.indisprimary IS false
AND i.indisvalid';
IF v_repl_index IS NOT NULL THEN
v_remote_index_sql := v_remote_index_sql ||' AND i.indexrelid <> '||v_repl_index;
END IF;
FOR v_row IN EXECUTE 'SELECT src_table, statement FROM dblink('||quote_literal(v_dblink_name)||', '||quote_literal(v_remote_index_sql)||') t (src_table text, statement text)' LOOP
v_statement := v_row.statement;
-- Replace source table name with destination
v_statement := replace(v_statement, ' ON '||v_source_table, ' ON '||v_dest_table || COALESCE('_'||p_snap, ''));
-- If source index name contains the table name, replace it with the destination table. Not perfect, but good enough for now.
v_statement := replace(v_statement, v_row.src_table, v_dest_table_name);
-- If it's a snap table, prepend to ensure unique index name.
-- This is done separately from above replace because it must always be done even if the index name doesn't contain the source table
IF p_snap IS NOT NULL THEN
v_statement := replace(v_statement, 'E INDEX ' , 'E INDEX '||p_snap||'_');
END IF;
PERFORM gdb(p_debug, 'statement: ' || v_statement);
EXECUTE v_statement;
END LOOP;
END IF;
PERFORM dblink_disconnect(v_dblink_name);
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
EXCEPTION
WHEN QUERY_CANCELED OR OTHERS THEN
EXECUTE 'SELECT '||v_dblink_schema||'.dblink_get_connections() @> ARRAY['||quote_literal(v_dblink_name)||']' INTO v_link_exists;
IF v_link_exists THEN
EXECUTE 'SELECT '||v_dblink_schema||'.dblink_disconnect('||quote_literal(v_dblink_name)||')';
END IF;
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RAISE EXCEPTION '%', SQLERRM;
END
$$;
/*
* Snap refresh to repull all table data
*/
CREATE OR REPLACE FUNCTION refresh_snap(p_destination text, p_index boolean DEFAULT true, p_debug boolean DEFAULT false, p_pulldata boolean DEFAULT true) RETURNS void
LANGUAGE plpgsql SECURITY DEFINER
AS $$
DECLARE
v_adv_lock boolean;
v_cols_n_types text[];
v_cols text[];
v_condition text;
v_create_sql text;
v_dblink int;
v_dblink_name text;
v_dblink_schema text;
v_dest_table text;
v_exists int;
v_fetch_sql text;
v_filter text[];
v_insert_sql text;
v_job_id int;
v_jobmon_schema text;
v_job_name text;
v_lcols_array text[];
v_local_sql text;
v_l text;
v_match boolean = true;
v_old_grant record;
v_old_owner text;
v_old_search_path text;
v_old_snap text;
v_old_snap_table text;
v_parts record;
v_post_script text[];
v_refresh_snap text;
v_remote_index_sql text;
v_remote_sql text;
v_row record;
v_rowcount bigint;
v_r text;
v_snap text;
v_source_table text;
v_step_id int;
v_table_exists boolean;
v_total bigint := 0;
v_tup_del bigint;
v_tup_ins bigint;
v_tup_upd bigint;
v_tup_del_new bigint;
v_tup_ins_new bigint;
v_tup_upd_new bigint;
v_view_definition text;
BEGIN
IF p_debug IS DISTINCT FROM true THEN
PERFORM set_config( 'client_min_messages', 'notice', true );
END IF;
v_job_name := 'Refresh Snap: '||p_destination;
v_dblink_name := 'mimeo_snap_refresh_'||p_destination;
SELECT nspname INTO v_dblink_schema FROM pg_namespace n, pg_extension e WHERE e.extname = 'dblink' AND e.extnamespace = n.oid;
SELECT nspname INTO v_jobmon_schema FROM pg_namespace n, pg_extension e WHERE e.extname = 'pg_jobmon' AND e.extnamespace = n.oid;
-- Set custom search path to allow easier calls to other functions, especially job logging
SELECT current_setting('search_path') INTO v_old_search_path;
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||','||v_dblink_schema||',public'',''false'')';
v_job_id := add_job(v_job_name);
PERFORM gdb(p_debug,'Job ID: '||v_job_id::text);
-- Take advisory lock to prevent multiple calls to function overlapping and causing possible deadlock
v_adv_lock := pg_try_advisory_lock(hashtext('refresh_snap'), hashtext(v_job_name));
IF v_adv_lock = 'false' THEN
v_step_id := add_step(v_job_id,'Obtaining advisory lock for job: '||v_job_name);
PERFORM gdb(p_debug,'Obtaining advisory lock FAILED for job: '||v_job_name);
PERFORM update_step(v_step_id, 'WARNING','Found concurrent job. Exiting gracefully');
PERFORM fail_job(v_job_id, 2);
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RETURN;
END IF;
v_step_id := add_step(v_job_id,'Grabbing Mapping, Building SQL');
SELECT source_table
, dest_table
, dblink
, filter
, condition
, n_tup_ins
, n_tup_upd
, n_tup_del
, post_script
INTO v_source_table
, v_dest_table
, v_dblink
, v_filter
, v_condition
, v_tup_ins
, v_tup_upd
, v_tup_del
, v_post_script
FROM refresh_config_snap
WHERE dest_table = p_destination;
IF NOT FOUND THEN
RAISE EXCEPTION 'ERROR: This table is not set up for snapshot replication: %',v_job_name;
END IF;
-- checking for current view
SELECT definition INTO v_view_definition FROM pg_views where
((schemaname || '.') || viewname)=v_dest_table;
PERFORM dblink_connect(v_dblink_name, @extschema@.auth(v_dblink));
PERFORM update_step(v_step_id, 'OK','Done');
v_step_id := add_step(v_job_id,'Truncate non-active snap table');
v_exists := strpos(v_view_definition, 'snap1');
IF v_exists > 0 THEN
v_snap := 'snap2';
v_old_snap := 'snap1';
ELSE
v_snap := 'snap1';
v_old_snap := 'snap2';
END IF;
v_refresh_snap := v_dest_table||'_'||v_snap;
v_old_snap_table := v_dest_table||'_'||v_old_snap;
PERFORM gdb(p_debug,'v_refresh_snap: '||v_refresh_snap::text);
-- Create snap table if it doesn't exist
PERFORM gdb(p_debug, 'Getting table columns and creating destination table if it doesn''t exist');
SELECT p_table_exists, p_cols, p_cols_n_types FROM manage_dest_table(v_dest_table, v_snap, p_debug) INTO v_table_exists, v_cols, v_cols_n_types;
IF v_table_exists THEN
/* Check local column definitions against remote and recreate table if different. Allows automatic recreation of
snap tables if columns change (add, drop type change) */
v_local_sql := 'SELECT array_agg(attname||'' ''||format_type(atttypid, atttypmod)::text) as cols_n_types FROM pg_attribute WHERE attnum > 0 AND attisdropped is false AND attrelid = ' || quote_literal(v_refresh_snap) || '::regclass';
PERFORM gdb(p_debug, v_local_sql);
EXECUTE v_local_sql INTO v_lcols_array;
-- Check to see if there's a change in the column structure on the remote
FOREACH v_r IN ARRAY v_cols_n_types LOOP
v_match := false;
FOREACH v_l IN ARRAY v_lcols_array LOOP
IF v_r = v_l THEN
v_match := true;
EXIT;
END IF;
END LOOP;
END LOOP;
IF v_match = false THEN
-- Grab old table & view privileges. They are applied later after the view is recreated/swapped
CREATE TEMP TABLE mimeo_snapshot_grants_tmp (statement text);
FOR v_old_grant IN
SELECT table_schema ||'.'|| table_name AS tablename
, array_agg(privilege_type::text) AS types
, grantee
FROM information_schema.table_privileges
WHERE table_schema ||'.'|| table_name IN (v_refresh_snap, v_dest_table)
GROUP BY grantee, table_schema, table_name
LOOP
INSERT INTO mimeo_snapshot_grants_tmp VALUES (
'GRANT '||array_to_string(v_old_grant.types, ',')||' ON '||v_old_grant.tablename||' TO '||v_old_grant.grantee
);
END LOOP;
SELECT viewowner INTO v_old_owner FROM pg_views WHERE schemaname ||'.'|| viewname = v_dest_table;
EXECUTE 'DROP TABLE ' || v_refresh_snap;
EXECUTE 'DROP VIEW ' || v_dest_table;
PERFORM manage_dest_table(v_dest_table, v_snap, p_debug);
v_step_id := add_step(v_job_id,'Source table structure changed.');
PERFORM update_step(v_step_id, 'OK','Tables and view dropped and recreated. Please double-check snap table attributes (permissions, indexes, etc');
PERFORM gdb(p_debug,'Source table structure changed. Tables and view dropped and recreated. Please double-check snap table attributes (permissions, indexes, etc)');
END IF;
-- truncate non-active snap table
EXECUTE 'TRUNCATE TABLE ' || v_refresh_snap;
PERFORM update_step(v_step_id, 'OK','Done');
END IF;
-- Only check the remote data if there have been no column changes and snap table actually exists.
-- Otherwise maker functions won't work if source is empty & view switch won't happen properly.
IF v_table_exists AND v_match THEN
v_remote_sql := 'SELECT n_tup_ins, n_tup_upd, n_tup_del FROM pg_catalog.pg_stat_all_tables WHERE relid::regclass = '||quote_literal(v_source_table)||'::regclass';
v_remote_sql := 'SELECT n_tup_ins, n_tup_upd, n_tup_del FROM dblink('||quote_literal(v_dblink_name)||', ' || quote_literal(v_remote_sql) || ') t (n_tup_ins bigint, n_tup_upd bigint, n_tup_del bigint)';
perform gdb(p_debug,'v_remote_sql: '||v_remote_sql);
EXECUTE v_remote_sql INTO v_tup_ins_new, v_tup_upd_new, v_tup_del_new;
IF v_tup_ins_new = v_tup_ins AND v_tup_upd_new = v_tup_upd AND v_tup_del_new = v_tup_del THEN
PERFORM gdb(p_debug,'Remote table has not had any writes. Skipping data pull');
PERFORM update_step(v_step_id, 'OK', 'Remote table has not had any writes. Skipping data pull');
UPDATE refresh_config_snap SET last_run = CURRENT_TIMESTAMP WHERE dest_table = p_destination;
PERFORM dblink_disconnect(v_dblink_name);
PERFORM close_job(v_job_id);
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
PERFORM pg_advisory_unlock(hashtext('refresh_snap'), hashtext(v_job_name));
RETURN;
END IF;
END IF;
v_remote_sql := 'SELECT '|| array_to_string(v_cols, ',') ||' FROM '||v_source_table;
-- Used by p_pulldata parameter in maker function
IF p_pulldata = false THEN
v_remote_sql := v_remote_sql || ' LIMIT 0';
ELSIF v_condition IS NOT NULL THEN
v_remote_sql := v_remote_sql || ' ' || v_condition;
END IF;
v_step_id := add_step(v_job_id,'Inserting records into local table');
PERFORM dblink_open(v_dblink_name, 'mimeo_cursor', v_remote_sql);
v_rowcount := 0;
LOOP
v_fetch_sql := 'INSERT INTO '|| v_refresh_snap ||' ('|| array_to_string(v_cols, ',') ||')
SELECT '||array_to_string(v_cols, ',')||' FROM dblink_fetch('||quote_literal(v_dblink_name)||', ''mimeo_cursor'', 50000) AS ('||array_to_string(v_cols_n_types, ',')||')';
EXECUTE v_fetch_sql;
GET DIAGNOSTICS v_rowcount = ROW_COUNT;
EXIT WHEN v_rowcount = 0;
v_total := v_total + coalesce(v_rowcount, 0);
PERFORM gdb(p_debug,'Fetching rows in batches: '||v_total||' done so far.');
PERFORM update_step(v_step_id, 'PENDING', 'Fetching rows in batches: '||v_total||' done so far.');
END LOOP;
PERFORM dblink_close(v_dblink_name, 'mimeo_cursor');
PERFORM update_step(v_step_id, 'OK','Inserted '||v_total||' rows');
-- Create indexes if new table was created
IF (v_table_exists = false OR v_match = 'f') AND p_index = true THEN
PERFORM gdb(p_debug, 'Creating indexes');
PERFORM create_index(v_dest_table, v_snap, p_debug);
END IF;
EXECUTE 'ANALYZE ' ||v_refresh_snap;
-- swap view
v_step_id := add_step(v_job_id,'Swap view to '||v_refresh_snap);
PERFORM gdb(p_debug,'Swapping view to '||v_refresh_snap);
EXECUTE 'CREATE OR REPLACE VIEW '||v_dest_table||' AS SELECT * FROM '||v_refresh_snap;
PERFORM update_step(v_step_id, 'OK','View Swapped');
IF v_match = false THEN
-- Actually apply the original privileges if the table was recreated
FOR v_old_grant IN SELECT statement FROM mimeo_snapshot_grants_tmp
LOOP
EXECUTE v_old_grant.statement;
END LOOP;
DROP TABLE IF EXISTS mimeo_snapshot_grants_tmp;
EXECUTE 'ALTER VIEW '||v_dest_table||' OWNER TO '||v_old_owner;
EXECUTE 'ALTER TABLE '||v_refresh_snap||' OWNER TO '||v_old_owner;
-- Run any special sql to fix anything that was done to destination tables (extra indexes, etc)
IF v_post_script IS NOT NULL THEN
v_step_id := add_step(v_job_id,'Applying post_script sql commands due to schema change');
PERFORM @extschema@.post_script(v_dest_table);
PERFORM update_step(v_step_id, 'OK','Done');
END IF;
END IF;
SELECT
CASE
WHEN count(1) > 0 THEN true
ELSE false
END
INTO v_table_exists FROM pg_tables WHERE schemaname ||'.'|| tablename = v_old_snap_table;
IF v_table_exists THEN
v_step_id := add_step(v_job_id,'Truncating old snap table');
EXECUTE 'TRUNCATE TABLE '||v_old_snap_table;
PERFORM update_step(v_step_id, 'OK','Done');
END IF;
v_step_id := add_step(v_job_id,'Updating last_run & tuple change values');
UPDATE refresh_config_snap SET
last_run = CURRENT_TIMESTAMP
, n_tup_ins = v_tup_ins_new
, n_tup_upd = v_tup_upd_new
, n_tup_del = v_tup_del_new
WHERE dest_table = p_destination;
PERFORM update_step(v_step_id, 'OK','Done');
PERFORM dblink_disconnect(v_dblink_name);
PERFORM close_job(v_job_id);
-- Ensure old search path is reset for the current session
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
PERFORM pg_advisory_unlock(hashtext('refresh_snap'), hashtext(v_job_name));
EXCEPTION
WHEN QUERY_CANCELED THEN
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||','||v_dblink_schema||''',''false'')';
IF dblink_get_connections() @> ARRAY[v_dblink_name] THEN
PERFORM dblink_disconnect(v_dblink_name);
END IF;
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
PERFORM pg_advisory_unlock(hashtext('refresh_snap'), hashtext(v_job_name));
RAISE EXCEPTION '%', SQLERRM;
WHEN OTHERS THEN
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||','||v_dblink_schema||''',''false'')';
IF v_job_id IS NULL THEN
v_job_id := add_job('Refresh Snap: '||p_destination);
v_step_id := add_step(v_job_id, 'EXCEPTION before job logging started');
END IF;
IF v_step_id IS NULL THEN
v_step_id := add_step(v_job_id, 'EXCEPTION before first step logged');
END IF;
PERFORM update_step(v_step_id, 'CRITICAL', 'ERROR: '||coalesce(SQLERRM,'unknown'));
PERFORM fail_job(v_job_id);
IF dblink_get_connections() @> ARRAY[v_dblink_name] THEN
PERFORM dblink_disconnect(v_dblink_name);
END IF;
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
PERFORM pg_advisory_unlock(hashtext('refresh_snap'), hashtext(v_job_name));
RAISE EXCEPTION '%', SQLERRM;
END
$$;
/*
* Refresh based on DML (Insert, Update, Delete), but logs all deletes on the destination table
* Destination table requires extra column: mimeo_source_deleted timestamptz
*/
CREATE FUNCTION refresh_logdel(p_destination text, p_limit int DEFAULT NULL, p_repull boolean DEFAULT false, p_debug boolean DEFAULT false) RETURNS void
LANGUAGE plpgsql SECURITY DEFINER
AS $$
DECLARE
v_adv_lock boolean;
v_batch_limit_reached boolean := false;
v_cols_n_types text;
v_cols text;
v_condition text;
v_control text;
v_dblink int;
v_dblink_name text;
v_dblink_schema text;
v_delete_d_sql text;
v_delete_f_sql text;
v_dest_table text;
v_exec_status text;
v_fetch_sql text;
v_field text;
v_filter text[];
v_insert_deleted_sql text;
v_insert_sql text;
v_job_id int;
v_jobmon_schema text;
v_job_name text;
v_limit int;
v_old_search_path text;
v_pk_counter int;
v_pk_name text[];
v_pk_name_csv text;
v_pk_name_type_csv text := '';
v_pk_type text[];
v_pk_where text := '';
v_remote_d_sql text;
v_remote_f_sql text;
v_remote_q_sql text;
v_rowcount bigint := 0;
v_source_table text;
v_step_id int;
v_tmp_table text;
v_total bigint := 0;
v_trigger_delete text;
v_trigger_update text;
v_truncate_remote_q text;
v_with_update text;
BEGIN
IF p_debug IS DISTINCT FROM true THEN
PERFORM set_config( 'client_min_messages', 'warning', true );
END IF;
v_job_name := 'Refresh Log Del: '||p_destination;
v_dblink_name := 'mimeo_logdel_refresh_'||p_destination;
SELECT nspname INTO v_dblink_schema FROM pg_namespace n, pg_extension e WHERE e.extname = 'dblink' AND e.extnamespace = n.oid;
SELECT nspname INTO v_jobmon_schema FROM pg_namespace n, pg_extension e WHERE e.extname = 'pg_jobmon' AND e.extnamespace = n.oid;
-- Set custom search path to allow easier calls to other functions, especially job logging
SELECT current_setting('search_path') INTO v_old_search_path;
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||','||v_dblink_schema||',public'',''false'')';
SELECT source_table
, dest_table
, 'tmp_'||replace(dest_table,'.','_')
, dblink
, control
, pk_name
, pk_type
, filter
, condition
, batch_limit
FROM refresh_config_logdel
WHERE dest_table = p_destination INTO
v_source_table
, v_dest_table
, v_tmp_table
, v_dblink
, v_control
, v_pk_name
, v_pk_type
, v_filter
, v_condition
, v_limit;
IF NOT FOUND THEN
RAISE EXCEPTION 'ERROR: no configuration found for %',v_job_name;
END IF;
v_job_id := add_job(v_job_name);
PERFORM gdb(p_debug,'Job ID: '||v_job_id::text);
-- Take advisory lock to prevent multiple calls to function overlapping
v_adv_lock := pg_try_advisory_lock(hashtext('refresh_logdel'), hashtext(v_job_name));
IF v_adv_lock = 'false' THEN
v_step_id := add_step(v_job_id,'Obtaining advisory lock for job: '||v_job_name);
PERFORM gdb(p_debug,'Obtaining advisory lock FAILED for job: '||v_job_name);
PERFORM update_step(v_step_id, 'WARNING','Found concurrent job. Exiting gracefully');
PERFORM fail_job(v_job_id, 2);
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RETURN;
END IF;
v_step_id := add_step(v_job_id,'Sanity check primary/unique key values');
IF v_pk_name IS NULL OR v_pk_type IS NULL THEN
RAISE EXCEPTION 'ERROR: primary key fields in refresh_config_logdel must be defined';
END IF;
-- determine column list, column type list
IF v_filter IS NULL THEN
SELECT array_to_string(array_agg(attname),','), array_to_string(array_agg(attname||' '||format_type(atttypid, atttypmod)::text),',')
INTO v_cols, v_cols_n_types
FROM pg_attribute WHERE attnum > 0 AND attisdropped is false AND attrelid = p_destination::regclass AND attname != 'mimeo_source_deleted';
ELSE
-- ensure all primary key columns are included in any column filters
FOREACH v_field IN ARRAY v_pk_name LOOP
IF v_field = ANY(v_filter) THEN
CONTINUE;
ELSE
RAISE EXCEPTION 'ERROR: filter list did not contain all columns that compose primary key for %',v_job_name;
END IF;
END LOOP;
SELECT array_to_string(array_agg(attname),','), array_to_string(array_agg(attname||' '||format_type(atttypid, atttypmod)::text),',')
INTO v_cols, v_cols_n_types
FROM pg_attribute WHERE attrelid = p_destination::regclass AND ARRAY[attname::text] <@ v_filter AND attnum > 0 AND attisdropped is false AND attname != 'mimeo_source_deleted' ;
END IF;
IF p_limit IS NOT NULL THEN
v_limit := p_limit;
END IF;
v_pk_name_csv := array_to_string(v_pk_name,',');
v_pk_counter := 1;
WHILE v_pk_counter <= array_length(v_pk_name,1) LOOP
IF v_pk_counter > 1 THEN
v_pk_name_type_csv := v_pk_name_type_csv || ', ';
v_pk_where := v_pk_where ||' AND ';
END IF;
v_pk_name_type_csv := v_pk_name_type_csv ||v_pk_name[v_pk_counter]||' '||v_pk_type[v_pk_counter];
v_pk_where := v_pk_where || ' a.'||v_pk_name[v_pk_counter]||' = b.'||v_pk_name[v_pk_counter];
v_pk_counter := v_pk_counter + 1;
END LOOP;
PERFORM update_step(v_step_id, 'OK','Done');
PERFORM dblink_connect(v_dblink_name, auth(v_dblink));
-- update remote entries
v_step_id := add_step(v_job_id,'Updating remote trigger table');
v_with_update := 'WITH a AS (SELECT '||v_pk_name_csv||' FROM '|| v_control ||' ORDER BY '||v_pk_name_csv||' LIMIT '|| COALESCE(v_limit::text, 'ALL') ||') UPDATE '||v_control||' b SET processed = true FROM a WHERE '|| v_pk_where;
v_trigger_update := 'SELECT dblink_exec('||quote_literal(v_dblink_name)||','|| quote_literal(v_with_update)||')';
PERFORM gdb(p_debug,v_trigger_update);
EXECUTE v_trigger_update INTO v_exec_status;
PERFORM update_step(v_step_id, 'OK','Result was '||v_exec_status);
-- create temp table for recording deleted rows
EXECUTE 'CREATE TEMP TABLE '||v_tmp_table||'_deleted ('||v_cols_n_types||', mimeo_source_deleted timestamptz)';
v_remote_d_sql := 'SELECT '||v_cols||', mimeo_source_deleted FROM '||v_control||' WHERE processed = true and mimeo_source_deleted IS NOT NULL';
PERFORM dblink_open(v_dblink_name, 'mimeo_cursor', v_remote_d_sql);
v_step_id := add_step(v_job_id, 'Creating local queue temp table for deleted rows on source');
v_rowcount := 0;
v_total := 0;
LOOP
v_fetch_sql := 'INSERT INTO '||v_tmp_table||'_deleted ('||v_cols||', mimeo_source_deleted)
SELECT '||v_cols||', mimeo_source_deleted FROM dblink_fetch('||quote_literal(v_dblink_name)||', ''mimeo_cursor'', 50000) AS ('||v_cols_n_types||', mimeo_source_deleted timestamptz)';
EXECUTE v_fetch_sql;
GET DIAGNOSTICS v_rowcount = ROW_COUNT;
EXIT WHEN v_rowcount = 0;
v_total := v_total + coalesce(v_rowcount, 0);
PERFORM gdb(p_debug,'Fetching rows in batches: '||v_total||' done so far.');
PERFORM update_step(v_step_id, 'PENDING', 'Fetching rows in batches: '||v_total||' done so far.');
END LOOP;
PERFORM dblink_close(v_dblink_name, 'mimeo_cursor');
EXECUTE 'CREATE INDEX ON '||v_tmp_table||'_deleted ('||v_pk_name_csv||')';
EXECUTE 'ANALYZE '||v_tmp_table||'_deleted';
PERFORM update_step(v_step_id, 'OK','Number of rows inserted: '||v_total);
PERFORM gdb(p_debug,'Temp deleted queue table row count '||v_total::text);
IF p_repull THEN
-- Do delete instead of truncate like refresh_dml to avoid missing rows between the above deleted queue fetch and here.
PERFORM update_step(v_step_id, 'OK','Request to repull ALL data from source. This could take a while...');
PERFORM gdb(p_debug, 'Request to repull ALL data from source. This could take a while...');
v_truncate_remote_q := 'SELECT dblink_exec('||quote_literal(v_dblink_name)||','||quote_literal('DELETE FROM '||v_control||' WHERE processed = true')||')';
PERFORM gdb(p_debug, v_truncate_remote_q);
EXECUTE v_truncate_remote_q;
v_step_id := add_step(v_job_id,'Removing local, undeleted rows');
PERFORM gdb(p_debug,'Removing local, undeleted rows');
EXECUTE 'DELETE FROM '||v_dest_table||' WHERE mimeo_source_deleted IS NULL';
PERFORM update_step(v_step_id, 'OK','Done');
-- Define cursor query
v_remote_f_sql := 'SELECT '||v_cols||' FROM '||v_source_table;
IF v_condition IS NOT NULL THEN
v_remote_f_sql := v_remote_f_sql || ' ' || v_condition;
END IF;
ELSE
-- Do normal stuff here
EXECUTE 'CREATE TEMP TABLE '||v_tmp_table||'_queue ('||v_pk_name_type_csv||')';
v_remote_q_sql := 'SELECT DISTINCT '||v_pk_name_csv||' FROM '||v_control||' WHERE processed = true and mimeo_source_deleted IS NULL';
PERFORM dblink_open(v_dblink_name, 'mimeo_cursor', v_remote_q_sql);
v_step_id := add_step(v_job_id, 'Creating local queue temp table for inserts/updates');
v_rowcount := 0;
LOOP
v_fetch_sql := 'INSERT INTO '||v_tmp_table||'_queue ('||v_pk_name_csv||')
SELECT '||v_pk_name_csv||' FROM dblink_fetch('||quote_literal(v_dblink_name)||', ''mimeo_cursor'', 50000) AS ('||v_pk_name_type_csv||')';
EXECUTE v_fetch_sql;
GET DIAGNOSTICS v_rowcount = ROW_COUNT;
EXIT WHEN v_rowcount = 0;
v_total := v_total + coalesce(v_rowcount, 0);
PERFORM gdb(p_debug,'Fetching rows in batches: '||v_total||' done so far.');
PERFORM update_step(v_step_id, 'PENDING', 'Fetching rows in batches: '||v_total||' done so far.');
END LOOP;
PERFORM dblink_close(v_dblink_name, 'mimeo_cursor');
EXECUTE 'CREATE INDEX ON '||v_tmp_table||'_queue ('||v_pk_name_csv||')';
EXECUTE 'ANALYZE '||v_tmp_table||'_queue';
PERFORM update_step(v_step_id, 'OK','Number of rows inserted: '||v_total);
PERFORM gdb(p_debug,'Temp inserts/updates queue table row count '||v_total::text);
-- remove records from local table (inserts/updates)
v_step_id := add_step(v_job_id,'Removing insert/update records from local table');
v_delete_f_sql := 'DELETE FROM '||v_dest_table||' a USING '||v_tmp_table||'_queue b WHERE '|| v_pk_where;
PERFORM gdb(p_debug,v_delete_f_sql);
EXECUTE v_delete_f_sql;
GET DIAGNOSTICS v_rowcount = ROW_COUNT;
PERFORM gdb(p_debug,'Insert/Update rows removed from local table before applying changes: '||v_rowcount::text);
PERFORM update_step(v_step_id, 'OK','Removed '||v_rowcount||' records');
-- remove records from local table (deleted rows)
v_step_id := add_step(v_job_id,'Removing deleted records from local table');
v_delete_d_sql := 'DELETE FROM '||v_dest_table||' a USING '||v_tmp_table||'_deleted b WHERE '|| v_pk_where;
PERFORM gdb(p_debug,v_delete_d_sql);
EXECUTE v_delete_d_sql;
GET DIAGNOSTICS v_rowcount = ROW_COUNT;
PERFORM gdb(p_debug,'Deleted rows removed from local table before applying changes: '||v_rowcount::text);
PERFORM update_step(v_step_id, 'OK','Removed '||v_rowcount||' records');
-- Remote full query for normal replication
v_remote_f_sql := 'SELECT '||v_cols||' FROM '||v_source_table||' JOIN ('||v_remote_q_sql||') x USING ('||v_pk_name_csv||')';
IF v_condition IS NOT NULL THEN
v_remote_f_sql := v_remote_f_sql || ' ' || v_condition;
END IF;
END IF;
-- insert records to local table (inserts/updates). Have to do temp table in case destination table is partitioned (returns 0 when inserting to parent)
PERFORM dblink_open(v_dblink_name, 'mimeo_cursor', v_remote_f_sql);
v_step_id := add_step(v_job_id, 'Inserting new/updated records into local table');
EXECUTE 'CREATE TEMP TABLE '||v_tmp_table||'_full ('||v_cols_n_types||')';
v_rowcount := 0;
v_total := 0;
LOOP
v_fetch_sql := 'INSERT INTO '||v_tmp_table||'_full ('||v_cols||')
SELECT '||v_cols||' FROM dblink_fetch('||quote_literal(v_dblink_name)||', ''mimeo_cursor'', 50000) AS ('||v_cols_n_types||')';
EXECUTE v_fetch_sql;
GET DIAGNOSTICS v_rowcount = ROW_COUNT;
v_total := v_total + coalesce(v_rowcount, 0);
EXECUTE 'INSERT INTO '||v_dest_table||' ('||v_cols||') SELECT '||v_cols||' FROM '||v_tmp_table||'_full';
EXECUTE 'TRUNCATE '||v_tmp_table||'_full';
EXIT WHEN v_rowcount = 0;
PERFORM gdb(p_debug,'Fetching rows in batches: '||v_total||' done so far.');
PERFORM update_step(v_step_id, 'PENDING', 'Fetching rows in batches: '||v_total||' done so far.');
END LOOP;
PERFORM dblink_close(v_dblink_name, 'mimeo_cursor');
PERFORM update_step(v_step_id, 'OK','New/updated rows inserted: '||v_total);
-- insert records to local table (deleted rows to be kept)
v_step_id := add_step(v_job_id,'Inserting deleted records into local table');
v_insert_deleted_sql := 'INSERT INTO '||v_dest_table||'('||v_cols||', mimeo_source_deleted) SELECT '||v_cols||', mimeo_source_deleted FROM '||v_tmp_table||'_deleted';
PERFORM gdb(p_debug,v_insert_deleted_sql);
EXECUTE v_insert_deleted_sql;
GET DIAGNOSTICS v_rowcount = ROW_COUNT;
PERFORM gdb(p_debug,'Deleted rows inserted: '||v_rowcount::text);
PERFORM update_step(v_step_id, 'OK','Inserted '||v_rowcount||' records');
IF (v_total + v_rowcount) > (v_limit * .75) THEN
v_step_id := add_step(v_job_id, 'Row count warning');
PERFORM update_step(v_step_id, 'WARNING','Row count fetched ('||v_total||') greater than 75% of batch limit ('||v_limit||'). Recommend increasing batch limit if possible.');
v_batch_limit_reached := true;
END IF;
-- clean out rows from txn table
v_step_id := add_step(v_job_id,'Cleaning out rows from txn table');
v_trigger_delete := 'SELECT dblink_exec('||quote_literal(v_dblink_name)||','||quote_literal('DELETE FROM '||v_control||' WHERE processed = true')||')';
PERFORM gdb(p_debug,v_trigger_delete);
EXECUTE v_trigger_delete INTO v_exec_status;
PERFORM update_step(v_step_id, 'OK','Result was '||v_exec_status);
-- update activity status
v_step_id := add_step(v_job_id,'Updating last_run in config table');
UPDATE refresh_config_logdel SET last_run = CURRENT_TIMESTAMP WHERE dest_table = p_destination;
PERFORM update_step(v_step_id, 'OK','Last Value was '||current_timestamp);
PERFORM dblink_disconnect(v_dblink_name);
EXECUTE 'DROP TABLE IF EXISTS '||v_tmp_table||'_full';
EXECUTE 'DROP TABLE IF EXISTS '||v_tmp_table||'_queue';
EXECUTE 'DROP TABLE IF EXISTS '||v_tmp_table||'_deleted';
IF v_batch_limit_reached = false THEN
PERFORM close_job(v_job_id);
ELSE
-- Set final job status to level 2 (WARNING) to bring notice that the batch limit was reached and may need adjusting.
-- Preventive warning to keep replication from falling behind.
PERFORM fail_job(v_job_id, 2);
END IF;
-- Ensure old search path is reset for the current session
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
PERFORM pg_advisory_unlock(hashtext('refresh_logdel'), hashtext(v_job_name));
EXCEPTION
WHEN QUERY_CANCELED THEN
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||','||v_dblink_schema||''',''false'')';
IF dblink_get_connections() @> ARRAY[v_dblink_name] THEN
PERFORM dblink_disconnect(v_dblink_name);
END IF;
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
PERFORM pg_advisory_unlock(hashtext('refresh_logdel'), hashtext(v_job_name));
RAISE EXCEPTION '%', SQLERRM;
WHEN OTHERS THEN
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_jobmon_schema||','||v_dblink_schema||''',''false'')';
IF v_job_id IS NULL THEN
v_job_id := add_job('Refresh Log Del: '||p_destination);
v_step_id := add_step(v_job_id, 'EXCEPTION before job logging started');
END IF;
IF v_step_id IS NULL THEN
v_step_id := add_step(v_job_id, 'EXCEPTION before first step logged');
END IF;
IF dblink_get_connections() @> ARRAY[v_dblink_name] THEN
PERFORM dblink_disconnect(v_dblink_name);
END IF;
PERFORM update_step(v_step_id, 'CRITICAL', 'ERROR: '||coalesce(SQLERRM,'unknown'));
PERFORM fail_job(v_job_id);
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
PERFORM pg_advisory_unlock(hashtext('refresh_logdel'), hashtext(v_job_name));
RAISE EXCEPTION '%', SQLERRM;
END
$$;
/*
* Snapshot maker function.
*/
CREATE FUNCTION snapshot_maker(
p_src_table text
, p_dblink_id int
, p_dest_table text DEFAULT NULL
, p_index boolean DEFAULT true
, p_filter text[] DEFAULT NULL
, p_condition text DEFAULT NULL
, p_pulldata boolean DEFAULT true
, p_debug boolean DEFAULT false)
RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
v_data_source text;
v_insert_refresh_config text;
BEGIN
SELECT data_source INTO v_data_source FROM @extschema@.dblink_mapping WHERE data_source_id = p_dblink_id;
IF NOT FOUND THEN
RAISE EXCEPTION 'ERROR: Database link ID does not exist in @extschema@.dblink_mapping: %', p_dblink_id;
END IF;
IF p_dest_table IS NULL THEN
p_dest_table := p_src_table;
END IF;
IF position('.' in p_dest_table) = 0 AND position('.' in p_src_table) = 0 THEN
RAISE EXCEPTION 'Source (and destination) table must be schema qualified';
END IF;
v_insert_refresh_config := 'INSERT INTO @extschema@.refresh_config_snap(source_table, dest_table, dblink, filter, condition) VALUES('||quote_literal(p_src_table)||', '||quote_literal(p_dest_table)||','||p_dblink_id||','||COALESCE(quote_literal(p_filter), 'NULL')||','||COALESCE(quote_literal(p_condition), 'NULL')||')';
EXECUTE v_insert_refresh_config;
RAISE NOTICE 'attempting first snapshot';
EXECUTE 'SELECT @extschema@.refresh_snap('||quote_literal(p_dest_table)||', p_index := '||p_index||', p_pulldata := '||p_pulldata||', p_debug := '||p_debug||')';
RAISE NOTICE 'attempting second snapshot';
EXECUTE 'SELECT @extschema@.refresh_snap('||quote_literal(p_dest_table)||', p_index := '||p_index||', p_pulldata := '||p_pulldata||', p_debug := '||p_debug||')';
RAISE NOTICE 'Done';
RETURN;
END
$$;
/*
* DML maker function.
*/
CREATE FUNCTION dml_maker(
p_src_table text
, p_dblink_id int
, p_dest_table text DEFAULT NULL
, p_index boolean DEFAULT true
, p_filter text[] DEFAULT NULL
, p_condition text DEFAULT NULL
, p_pulldata boolean DEFAULT true
, p_pk_name text[] DEFAULT NULL
, p_pk_type text[] DEFAULT NULL
, p_debug boolean DEFAULT false)
RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
v_create_trig text;
v_data_source text;
v_dblink_schema text;
v_dest_schema_name text;
v_dest_table_name text;
v_exists int := 0;
v_field text;
v_insert_refresh_config text;
v_key_type text;
v_old_search_path text;
v_pk_counter int := 1;
v_pk_name text[] := p_pk_name;
v_pk_name_n_type text[];
v_pk_type text[] := p_pk_type;
v_pk_value text := '';
v_remote_exists int := 0;
v_remote_grants_sql text;
v_remote_key_sql text;
v_remote_q_index text;
v_remote_q_table text;
v_row record;
v_src_table_name text;
v_table_exists boolean;
v_trigger_func text;
BEGIN
SELECT nspname INTO v_dblink_schema FROM pg_namespace n, pg_extension e WHERE e.extname = 'dblink' AND e.extnamespace = n.oid;
SELECT current_setting('search_path') INTO v_old_search_path;
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_dblink_schema||',public'',''false'')';
IF (p_pk_name IS NULL AND p_pk_type IS NOT NULL) OR (p_pk_name IS NOT NULL AND p_pk_type IS NULL) THEN
RAISE EXCEPTION 'Cannot manually set primary/unique key field(s) without defining type(s) or vice versa';
END IF;
SELECT data_source INTO v_data_source FROM @extschema@.dblink_mapping WHERE data_source_id = p_dblink_id;
IF NOT FOUND THEN
RAISE EXCEPTION 'Database link ID is incorrect %', p_dblink_id;
END IF;
IF p_dest_table IS NULL THEN
p_dest_table := p_src_table;
END IF;
IF position('.' in p_dest_table) > 0 AND position('.' in p_src_table) > 0 THEN
v_dest_schema_name := split_part(p_dest_table, '.', 1);
v_dest_table_name := split_part(p_dest_table, '.', 2);
ELSE
RAISE EXCEPTION 'Source (and destination) table must be schema qualified';
END IF;
-- Substring avoids some issues with tables near max length
v_src_table_name := substring(replace(p_src_table, '.', '_') for 61);
PERFORM dblink_connect('mimeo_dml', @extschema@.auth(p_dblink_id));
IF p_pk_name IS NULL AND p_pk_type IS NULL THEN
-- Either gets the primary key or it gets the first unique index in alphabetical order by index name.
v_remote_key_sql := 'SELECT
CASE
WHEN i.indisprimary IS true THEN ''primary''
WHEN i.indisunique IS true THEN ''unique''
END AS key_type,
( SELECT array_agg( a.attname ORDER by x.r )
FROM pg_attribute a
JOIN ( SELECT k, row_number() over () as r
FROM unnest(i.indkey) k ) as x
ON a.attnum = x.k AND a.attrelid = i.indrelid
WHERE a.attnotnull
) AS indkey_names,
( SELECT array_agg( a.atttypid::regtype::text ORDER by x.r )
FROM pg_attribute a
JOIN ( SELECT k, row_number() over () as r
FROM unnest(i.indkey) k ) as x
ON a.attnum = x.k AND a.attrelid = i.indrelid
WHERE a.attnotnull
) AS indkey_types
FROM pg_index i
WHERE i.indrelid = '||quote_literal(p_src_table)||'::regclass
AND (i.indisprimary OR i.indisunique)
ORDER BY key_type LIMIT 1';
EXECUTE 'SELECT key_type, indkey_names, indkey_types FROM dblink(''mimeo_dml'', '||quote_literal(v_remote_key_sql)||') t (key_type text, indkey_names text[], indkey_types text[])'
INTO v_key_type, v_pk_name, v_pk_type;
END IF;
PERFORM gdb(p_debug, 'v_key_type: '||v_key_type);
PERFORM gdb(p_debug, 'v_pk_name: '||array_to_string(v_pk_name, ','));
PERFORM gdb(p_debug, 'v_pk_type: '||array_to_string(v_pk_type, ','));
IF v_pk_name IS NULL OR v_pk_type IS NULL THEN
RAISE EXCEPTION 'Source table has no valid primary key or unique index';
END IF;
IF p_filter IS NOT NULL THEN
FOREACH v_field IN ARRAY v_pk_name LOOP
IF v_field = ANY(p_filter) THEN
CONTINUE;
ELSE
RAISE EXCEPTION 'ERROR: filter list did not contain all columns that compose primary/unique key for source table %',p_src_table;
END IF;
END LOOP;
END IF;
v_remote_q_table := 'CREATE TABLE @extschema@.'||v_src_table_name||'_q (';
WHILE v_pk_counter <= array_length(v_pk_name,1) LOOP
v_remote_q_table := v_remote_q_table || v_pk_name[v_pk_counter]||' '||v_pk_type[v_pk_counter];
v_pk_counter := v_pk_counter + 1;
IF v_pk_counter <= array_length(v_pk_name,1) THEN
v_remote_q_table := v_remote_q_table || ', ';
END IF;
END LOOP;
v_remote_q_table := v_remote_q_table || ', processed boolean)';
v_remote_q_index := 'CREATE INDEX '||v_src_table_name||'_q_'||array_to_string(v_pk_name, '_')||'_idx ON @extschema@.'||v_src_table_name||'_q ('||array_to_string(v_pk_name, ',')||')';
v_pk_counter := 1;
v_trigger_func := 'CREATE FUNCTION @extschema@.'||v_src_table_name||'_mimeo_queue() RETURNS trigger LANGUAGE plpgsql AS $_$ ';
v_trigger_func := v_trigger_func || '
BEGIN IF TG_OP = ''INSERT'' THEN ';
v_pk_value := array_to_string(v_pk_name, ', NEW.');
v_pk_value := 'NEW.'||v_pk_value;
v_trigger_func := v_trigger_func || '
INSERT INTO @extschema@.'||v_src_table_name||'_q ('||array_to_string(v_pk_name, ',')||') VALUES ('||v_pk_value||'); ';
v_trigger_func := v_trigger_func || '
ELSIF TG_OP = ''UPDATE'' THEN ';
-- UPDATE needs to insert the NEW values so reuse v_pk_value from INSERT operation
v_trigger_func := v_trigger_func || '
INSERT INTO @extschema@.'||v_src_table_name||'_q ('||array_to_string(v_pk_name, ',')||') VALUES ('||v_pk_value||'); ';
-- Only insert the old row if the new key doesn't match the old key. This handles edge case when only one column of a composite key is updated
v_trigger_func := v_trigger_func || '
IF ';
FOREACH v_field IN ARRAY v_pk_name LOOP
IF v_pk_counter > 1 THEN
v_trigger_func := v_trigger_func || ' OR ';
END IF;
v_trigger_func := v_trigger_func || ' NEW.'||v_field||' != OLD.'||v_field||' ';
v_pk_counter := v_pk_counter + 1;
END LOOP;
v_trigger_func := v_trigger_func || ' THEN ';
v_pk_value := array_to_string(v_pk_name, ', OLD.');
v_pk_value := 'OLD.'||v_pk_value;
v_trigger_func := v_trigger_func || '
INSERT INTO @extschema@.'||v_src_table_name||'_q ('||array_to_string(v_pk_name, ',')||') VALUES ('||v_pk_value||'); ';
v_trigger_func := v_trigger_func || '
END IF;';
v_trigger_func := v_trigger_func || '
ELSIF TG_OP = ''DELETE'' THEN ';
-- DELETE needs to insert the OLD values so reuse v_pk_value from UPDATE operation
v_trigger_func := v_trigger_func || '
INSERT INTO @extschema@.'||v_src_table_name||'_q ('||array_to_string(v_pk_name, ',')||') VALUES ('||v_pk_value||'); ';
v_trigger_func := v_trigger_func || '
END IF; RETURN NULL; END $_$;';
v_create_trig := 'CREATE TRIGGER '||v_src_table_name||'_mimeo_trig AFTER INSERT OR DELETE OR UPDATE';
IF p_filter IS NOT NULL THEN
v_create_trig := v_create_trig || ' OF '||array_to_string(p_filter, ',');
END IF;
v_create_trig := v_create_trig || ' ON '||p_src_table||' FOR EACH ROW EXECUTE PROCEDURE @extschema@.'||v_src_table_name||'_mimeo_queue()';
RAISE NOTICE 'Creating objects on source database (function, trigger & queue table)...';
PERFORM gdb(p_debug, 'v_remote_q_table: '||v_remote_q_table);
PERFORM dblink_exec('mimeo_dml', v_remote_q_table);
PERFORM gdb(p_debug, 'v_remote_q_index: '||v_remote_q_index);
PERFORM dblink_exec('mimeo_dml', v_remote_q_index);
PERFORM gdb(p_debug, 'v_trigger_func: '||v_trigger_func);
PERFORM dblink_exec('mimeo_dml', v_trigger_func);
-- Grant any current role with write privileges on source table INSERT on the queue table before the trigger is actually created
v_remote_grants_sql := 'SELECT DISTINCT grantee FROM information_schema.table_privileges WHERE table_schema ||''.''|| table_name = '||quote_literal(p_dest_table)||' and privilege_type IN (''INSERT'',''UPDATE'',''DELETE'')';
FOR v_row IN SELECT grantee FROM dblink('mimeo_dml', v_remote_grants_sql) t (grantee text)
LOOP
PERFORM dblink_exec('mimeo_dml', 'GRANT USAGE ON SCHEMA @extschema@ TO '||v_row.grantee);
PERFORM dblink_exec('mimeo_dml', 'GRANT INSERT ON TABLE @extschema@.'||v_src_table_name||'_q TO '||v_row.grantee);
PERFORM dblink_exec('mimeo_dml', 'GRANT EXECUTE ON FUNCTION @extschema@.'||v_src_table_name||'_mimeo_queue() TO '||v_row.grantee);
END LOOP;
PERFORM gdb(p_debug, 'v_create_trig: '||v_create_trig);
PERFORM dblink_exec('mimeo_dml', v_create_trig);
v_insert_refresh_config := 'INSERT INTO @extschema@.refresh_config_dml(source_table, dest_table, dblink, control, pk_name, pk_type, last_run, filter, condition) VALUES('
||quote_literal(p_src_table)||', '||quote_literal(p_dest_table)||', '|| p_dblink_id||', '||quote_literal('@extschema@.'||v_src_table_name||'_q')||', '
||quote_literal(v_pk_name)||', '||quote_literal(v_pk_type)||', '||quote_literal(CURRENT_TIMESTAMP)||','||COALESCE(quote_literal(p_filter), 'NULL')||','
||COALESCE(quote_literal(p_condition), 'NULL')||')';
PERFORM gdb(p_debug, 'v_insert_refresh_config: '||v_insert_refresh_config);
EXECUTE v_insert_refresh_config;
SELECT p_table_exists FROM manage_dest_table(p_dest_table, NULL, p_debug) INTO v_table_exists;
IF p_pulldata AND v_table_exists = false THEN
RAISE NOTICE 'Pulling data from source...';
EXECUTE 'SELECT refresh_dml('||quote_literal(p_dest_table)||', p_repull := true, p_debug := '||p_debug||')';
END IF;
IF p_index AND v_table_exists = false THEN
PERFORM create_index(p_dest_table, NULL, p_debug);
ELSIF v_table_exists = false THEN
-- Ensure destination indexes that are needed for efficient replication are created even if p_index is set false
PERFORM gdb(p_debug, 'Creating indexes needed for replication');
IF v_key_type = 'primary' THEN
EXECUTE 'ALTER TABLE '||p_dest_table||' ADD PRIMARY KEY('||array_to_string(v_pk_name, ',')||')';
ELSE
EXECUTE 'CREATE UNIQUE INDEX ON '||p_dest_table||' ('||array_to_string(v_pk_name, ',')||')';
END IF;
END IF;
IF v_table_exists THEN
RAISE NOTICE 'Destination table % already exists. No data or indexes were pulled from source', p_src_table;
END IF;
PERFORM dblink_disconnect('mimeo_dml');
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RAISE NOTICE 'Done';
RETURN;
EXCEPTION
WHEN OTHERS THEN
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_dblink_schema||''',''false'')';
-- Only cleanup remote objects if replication doesn't exist at all for source table
EXECUTE 'SELECT count(*) FROM @extschema@.refresh_config_dml WHERE source_table = '||quote_literal(p_src_table) INTO v_exists;
IF dblink_get_connections() @> '{mimeo_dml}' THEN
IF v_exists = 0 THEN
PERFORM dblink_exec('mimeo_dml', 'DROP TABLE IF EXISTS @extschema@.'||v_src_table_name||'_q');
PERFORM dblink_exec('mimeo_dml', 'DROP TRIGGER IF EXISTS '||v_src_table_name||'_mimeo_trig ON '||p_src_table);
PERFORM dblink_exec('mimeo_dml', 'DROP FUNCTION IF EXISTS @extschema@.'||v_src_table_name||'_mimeo_queue()');
END IF;
PERFORM dblink_disconnect('mimeo_dml');
END IF;
IF v_exists = 0 AND dblink_get_connections() @> '{mimeo_dml}' THEN
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RAISE EXCEPTION 'dml_maker() failure. Cleaned up source table mimeo objects (queue table, function & trigger) if they existed. SQLERRM: %', SQLERRM;
ELSE
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RAISE EXCEPTION 'dml_maker() failure. Unable to clean up source database objects (trigger/queue table) if they were made. SQLERRM: % ', SQLERRM;
END IF;
END
$$;
/*
* Logdel maker function.
*/
CREATE FUNCTION logdel_maker(
p_src_table text
, p_dblink_id int
, p_dest_table text DEFAULT NULL
, p_index boolean DEFAULT true
, p_filter text[] DEFAULT NULL
, p_condition text DEFAULT NULL
, p_pulldata boolean DEFAULT true
, p_pk_name text[] DEFAULT NULL
, p_pk_type text[] DEFAULT NULL
, p_debug boolean DEFAULT false)
RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
v_col_exists int;
v_cols text[];
v_cols_n_types text[];
v_counter int := 1;
v_create_trig text;
v_data_source text;
v_dblink_schema text;
v_dest_schema_name text;
v_dest_table_name text;
v_exists int := 0;
v_field text;
v_insert_refresh_config text;
v_key_type text;
v_old_search_path text;
v_pk_name text[] := p_pk_name;
v_pk_type text[] := p_pk_type;
v_q_value text := '';
v_remote_grants_sql text;
v_remote_key_sql text;
v_remote_sql text;
v_remote_q_index text;
v_remote_q_table text;
v_row record;
v_src_table_name text;
v_table_exists boolean;
v_trigger_func text;
v_types text[];
BEGIN
SELECT nspname INTO v_dblink_schema FROM pg_namespace n, pg_extension e WHERE e.extname = 'dblink' AND e.extnamespace = n.oid;
SELECT current_setting('search_path') INTO v_old_search_path;
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_dblink_schema||',public'',''false'')';
IF (p_pk_name IS NULL AND p_pk_type IS NOT NULL) OR (p_pk_name IS NOT NULL AND p_pk_type IS NULL) THEN
RAISE EXCEPTION 'Cannot manually set primary/unique key field(s) without defining type(s) or vice versa';
END IF;
SELECT data_source INTO v_data_source FROM @extschema@.dblink_mapping WHERE data_source_id = p_dblink_id;
IF NOT FOUND THEN
RAISE EXCEPTION 'Database link ID is incorrect %', p_dblink_id;
END IF;
IF p_dest_table IS NULL THEN
p_dest_table := p_src_table;
END IF;
IF position('.' in p_dest_table) > 0 AND position('.' in p_src_table) > 0 THEN
v_dest_schema_name := split_part(p_dest_table, '.', 1);
v_dest_table_name := split_part(p_dest_table, '.', 2);
ELSE
RAISE EXCEPTION 'Source (and destination) table must be schema qualified';
END IF;
-- Substring avoids some issues with tables near max length
v_src_table_name := substring(replace(p_src_table, '.', '_') for 61);
PERFORM dblink_connect('mimeo_logdel', @extschema@.auth(p_dblink_id));
IF p_pk_name IS NULL AND p_pk_type IS NULL THEN
-- Either gets the primary key or it gets the first unique index in alphabetical order by index name
v_remote_key_sql := 'SELECT
CASE
WHEN i.indisprimary IS true THEN ''primary''
WHEN i.indisunique IS true THEN ''unique''
END AS key_type,
( SELECT array_agg( a.attname ORDER by x.r )
FROM pg_attribute a
JOIN ( SELECT k, row_number() over () as r
FROM unnest(i.indkey) k ) as x
ON a.attnum = x.k AND a.attrelid = i.indrelid
WHERE a.attnotnull
) AS indkey_names,
( SELECT array_agg( a.atttypid::regtype::text ORDER by x.r )
FROM pg_attribute a
JOIN ( SELECT k, row_number() over () as r
FROM unnest(i.indkey) k ) as x
ON a.attnum = x.k AND a.attrelid = i.indrelid
WHERE a.attnotnull
) AS indkey_types
FROM pg_index i
WHERE i.indrelid = '||quote_literal(p_src_table)||'::regclass
AND (i.indisprimary OR i.indisunique)
ORDER BY key_type LIMIT 1';
EXECUTE 'SELECT key_type, indkey_names, indkey_types FROM dblink(''mimeo_logdel'', '||quote_literal(v_remote_key_sql)||') t (key_type text, indkey_names text[], indkey_types text[])'
INTO v_key_type, v_pk_name, v_pk_type;
END IF;
PERFORM gdb(p_debug, 'v_key_type: '||v_key_type);
PERFORM gdb(p_debug, 'v_pk_name: '||array_to_string(v_pk_name, ','));
PERFORM gdb(p_debug, 'v_pk_type: '||array_to_string(v_pk_type, ','));
IF v_pk_name IS NULL OR v_pk_type IS NULL THEN
RAISE EXCEPTION 'Source table has no valid primary key or unique index';
END IF;
IF p_filter IS NOT NULL THEN
FOREACH v_field IN ARRAY v_pk_name LOOP
IF v_field = ANY(p_filter) THEN
CONTINUE;
ELSE
RAISE EXCEPTION 'ERROR: filter list did not contain all columns that compose primary/unique key for source table %', p_src_table;
END IF;
END LOOP;
END IF;
v_insert_refresh_config := 'INSERT INTO @extschema@.refresh_config_logdel(source_table, dest_table, dblink, control, pk_name, pk_type, last_run, filter, condition) VALUES('
||quote_literal(p_src_table)||', '||quote_literal(p_dest_table)||', '|| p_dblink_id||', '||quote_literal('@extschema@.'||v_src_table_name||'_q')||', '
||quote_literal(v_pk_name)||', '||quote_literal(v_pk_type)||', '||quote_literal(CURRENT_TIMESTAMP)||','||COALESCE(quote_literal(p_filter), 'NULL')||','
||COALESCE(quote_literal(p_condition), 'NULL')||')';
RAISE NOTICE 'Inserting data into config table';
PERFORM gdb(p_debug, 'v_insert_refresh_config: '||v_insert_refresh_config);
EXECUTE v_insert_refresh_config;
SELECT p_table_exists, p_cols, p_cols_n_types FROM manage_dest_table(p_dest_table, NULL, p_debug) INTO v_table_exists, v_cols, v_cols_n_types;
v_remote_q_table := 'CREATE TABLE @extschema@.'||v_src_table_name||'_q ('||array_to_string(v_cols_n_types, ',')||', mimeo_source_deleted timestamptz, processed boolean)';
-- Indexes on queue table created below so the variable can be reused
v_trigger_func := 'CREATE FUNCTION @extschema@.'||v_src_table_name||'_mimeo_queue() RETURNS trigger LANGUAGE plpgsql AS $_$ DECLARE ';
v_trigger_func := v_trigger_func || '
v_del_time timestamptz := clock_timestamp(); ';
v_trigger_func := v_trigger_func || '
BEGIN IF TG_OP = ''INSERT'' THEN ';
v_q_value := array_to_string(v_pk_name, ', NEW.');
v_q_value := 'NEW.'||v_q_value;
v_trigger_func := v_trigger_func || '
INSERT INTO @extschema@.'||v_src_table_name||'_q ('||array_to_string(v_pk_name, ',')||') VALUES ('||v_q_value||');';
v_trigger_func := v_trigger_func || '
ELSIF TG_OP = ''UPDATE'' THEN ';
-- UPDATE needs to insert the NEW values so reuse v_q_value from INSERT operation
v_trigger_func := v_trigger_func || '
INSERT INTO @extschema@.'||v_src_table_name||'_q ('||array_to_string(v_pk_name, ',')||') VALUES ('||v_q_value||');';
-- Only insert the old row if the new key doesn't match the old key. This handles edge case when only one column of a composite key is updated
v_trigger_func := v_trigger_func || '
IF ';
FOREACH v_field IN ARRAY v_pk_name LOOP
IF v_counter > 1 THEN
v_trigger_func := v_trigger_func || ' OR ';
END IF;
v_trigger_func := v_trigger_func || ' NEW.'||v_field||' != OLD.'||v_field||' ';
v_counter := v_counter + 1;
END LOOP;
v_trigger_func := v_trigger_func || ' THEN ';
v_q_value := array_to_string(v_pk_name, ', OLD.');
v_q_value := 'OLD.'||v_q_value;
v_trigger_func := v_trigger_func || '
INSERT INTO @extschema@.'||v_src_table_name||'_q ('||array_to_string(v_pk_name, ',')||') VALUES ('||v_q_value||'); ';
v_trigger_func := v_trigger_func || '
END IF;';
v_trigger_func := v_trigger_func || '
ELSIF TG_OP = ''DELETE'' THEN ';
v_q_value := array_to_string(v_cols, ', OLD.');
v_q_value := 'OLD.'||v_q_value;
v_trigger_func := v_trigger_func || '
INSERT INTO @extschema@.'||v_src_table_name||'_q ('||array_to_string(v_cols, ',')||', mimeo_source_deleted) VALUES ('||v_q_value||', v_del_time);';
v_trigger_func := v_trigger_func ||'
END IF; RETURN NULL; END $_$;';
v_create_trig := 'CREATE TRIGGER '||v_src_table_name||'_mimeo_trig AFTER INSERT OR DELETE OR UPDATE';
IF p_filter IS NOT NULL THEN
v_create_trig := v_create_trig || ' OF '||array_to_string(p_filter, ',');
END IF;
v_create_trig := v_create_trig || ' ON '||p_src_table||' FOR EACH ROW EXECUTE PROCEDURE @extschema@.'||v_src_table_name||'_mimeo_queue()';
RAISE NOTICE 'Creating objects on source database (function, trigger & queue table)...';
PERFORM gdb(p_debug, 'v_remote_q_table: '||v_remote_q_table);
PERFORM dblink_exec('mimeo_logdel', v_remote_q_table);
v_remote_q_index := 'CREATE INDEX '||v_src_table_name||'_q_'||array_to_string(v_pk_name, '_')||'_idx ON @extschema@.'||v_src_table_name||'_q ('||array_to_string(v_pk_name, ',')||')';
PERFORM gdb(p_debug, 'v_remote_q_index: '||v_remote_q_index);
PERFORM dblink_exec('mimeo_logdel', v_remote_q_index);
v_remote_q_index := 'CREATE INDEX '||v_src_table_name||'_q_processed_deleted'||'_idx ON @extschema@.'||v_src_table_name||'_q (processed, mimeo_source_deleted)';
PERFORM gdb(p_debug, 'v_remote_q_index: '||v_remote_q_index);
PERFORM dblink_exec('mimeo_logdel', v_remote_q_index);
PERFORM gdb(p_debug, 'v_trigger_func: '||v_trigger_func);
PERFORM dblink_exec('mimeo_logdel', v_trigger_func);
-- Grant any current role with write privileges on source table INSERT on the queue table before the trigger is actually created
v_remote_grants_sql := 'SELECT DISTINCT grantee FROM information_schema.table_privileges WHERE table_schema ||''.''|| table_name = '||quote_literal(p_dest_table)||' and privilege_type IN (''INSERT'',''UPDATE'',''DELETE'')';
FOR v_row IN SELECT grantee FROM dblink('mimeo_logdel', v_remote_grants_sql) t (grantee text)
LOOP
PERFORM dblink_exec('mimeo_logdel', 'GRANT USAGE ON SCHEMA @extschema@ TO '||v_row.grantee);
PERFORM dblink_exec('mimeo_logdel', 'GRANT INSERT ON TABLE @extschema@.'||v_src_table_name||'_q TO '||v_row.grantee);
PERFORM dblink_exec('mimeo_logdel', 'GRANT EXECUTE ON FUNCTION @extschema@.'||v_src_table_name||'_mimeo_queue() TO '||v_row.grantee);
END LOOP;
PERFORM gdb(p_debug, 'v_create_trig: '||v_create_trig);
PERFORM dblink_exec('mimeo_logdel', v_create_trig);
IF p_pulldata AND v_table_exists = false THEN
RAISE NOTICE 'Pulling all data from source...';
EXECUTE 'SELECT refresh_logdel('||quote_literal(p_dest_table)||', p_repull := true, p_debug := '||p_debug||')';
END IF;
IF p_index AND v_table_exists = false THEN
PERFORM create_index(p_dest_table, NULL, p_debug);
-- Create index on special column for logdel
EXECUTE 'CREATE INDEX '||v_dest_table_name||'_mimeo_source_deleted ON '||p_dest_table||' (mimeo_source_deleted)';
ELSIF v_table_exists = false THEN
-- Ensure destination indexes that are needed for efficient replication are created even if p_index is set false
RAISE NOTICE 'Adding primary/unique key to table...';
IF v_key_type = 'primary' THEN
EXECUTE 'ALTER TABLE '||p_dest_table||' ADD PRIMARY KEY('||array_to_string(v_pk_name, ',')||')';
ELSE
EXECUTE 'CREATE UNIQUE INDEX ON '||p_dest_table||' ('||array_to_string(v_pk_name, ',')||')';
END IF;
END IF;
IF v_table_exists THEN
RAISE NOTICE 'Destination table % already exists. No data or indexes were pulled from source: %. Recommend making index on special column mimeo_source_deleted if it doesn''t have one', p_dest_table;
END IF;
PERFORM dblink_disconnect('mimeo_logdel');
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RAISE NOTICE 'Done';
RETURN;
EXCEPTION
WHEN OTHERS THEN
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_dblink_schema||''',''false'')';
-- Only cleanup remote objects if replication doesn't exist at all for source table
EXECUTE 'SELECT count(*) FROM @extschema@.refresh_config_logdel WHERE source_table = '||quote_literal(p_src_table) INTO v_exists;
IF dblink_get_connections() @> '{mimeo_logdel}' THEN
IF v_exists = 0 THEN
PERFORM dblink_exec('mimeo_logdel', 'DROP TABLE IF EXISTS @extschema@.'||v_src_table_name||'_q');
PERFORM dblink_exec('mimeo_logdel', 'DROP TRIGGER IF EXISTS '||v_src_table_name||'_mimeo_trig ON '||p_src_table);
PERFORM dblink_exec('mimeo_logdel', 'DROP FUNCTION IF EXISTS @extschema@.'||v_src_table_name||'_mimeo_queue()');
END IF;
PERFORM dblink_disconnect('mimeo_logdel');
END IF;
IF v_exists = 0 AND dblink_get_connections() @> '{mimeo_logdel}' THEN
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RAISE EXCEPTION 'logdel_maker() failure. Cleaned up source table mimeo objects (queue table, function & trigger) if they existed. SQLERRM: %', SQLERRM;
ELSE
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RAISE EXCEPTION 'logdel_maker() failure. Unable to clean up source database objects (trigger/queue table) if they were made. SQLERRM: % ', SQLERRM;
END IF;
END
$$;
/*
* Inserter maker function.
*/
CREATE FUNCTION inserter_maker(
p_src_table text
, p_control_field text
, p_dblink_id int
, p_boundary interval DEFAULT '00:10:00'
, p_dest_table text DEFAULT NULL
, p_index boolean DEFAULT true
, p_filter text[] DEFAULT NULL
, p_condition text DEFAULT NULL
, p_pulldata boolean DEFAULT true
, p_debug boolean DEFAULT false)
RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
v_data_source text;
v_dest_schema_name text;
v_dest_table_name text;
v_dst_active boolean;
v_insert_refresh_config text;
v_max_timestamp timestamptz;
v_table_exists boolean;
BEGIN
SELECT data_source INTO v_data_source FROM @extschema@.dblink_mapping WHERE data_source_id = p_dblink_id;
IF NOT FOUND THEN
RAISE EXCEPTION 'ERROR: database link ID is incorrect %', p_dblink_id;
END IF;
IF p_dest_table IS NULL THEN
p_dest_table := p_src_table;
END IF;
IF position('.' in p_dest_table) > 0 AND position('.' in p_src_table) > 0 THEN
v_dest_schema_name := split_part(p_dest_table, '.', 1);
v_dest_table_name := split_part(p_dest_table, '.', 2);
ELSE
RAISE EXCEPTION 'Source (and destination) table must be schema qualified';
END IF;
v_dst_active := @extschema@.dst_utc_check();
v_insert_refresh_config := 'INSERT INTO @extschema@.refresh_config_inserter(source_table, dest_table, dblink, control, boundary, last_value, last_run, dst_active, filter, condition) VALUES('
||quote_literal(p_src_table)||','||quote_literal(p_dest_table)||','|| p_dblink_id||','||quote_literal(p_control_field)||','
||quote_literal(p_boundary)||',''0001-01-01''::date,'||quote_literal(CURRENT_TIMESTAMP)||','||v_dst_active||','
||COALESCE(quote_literal(p_filter), 'NULL')||','||COALESCE(quote_literal(p_condition), 'NULL')||');';
PERFORM @extschema@.gdb(p_debug, 'v_insert_refresh_config: '||v_insert_refresh_config);
EXECUTE v_insert_refresh_config;
SELECT p_table_exists FROM @extschema@.manage_dest_table(p_dest_table, NULL, p_debug) INTO v_table_exists;
IF p_pulldata AND v_table_exists = false THEN
RAISE NOTICE 'Pulling all data from source...';
EXECUTE 'SELECT @extschema@.refresh_inserter('||quote_literal(p_dest_table)||', p_repull := true, p_debug := '||p_debug||')';
END IF;
IF p_index AND v_table_exists = false THEN
PERFORM @extschema@.create_index(p_dest_table, NULL, p_debug);
END IF;
IF v_table_exists THEN
RAISE NOTICE 'Destination table % already exists. No data or indexes were pulled from source', p_dest_table;
END IF;
RAISE NOTICE 'Getting the maximum destination timestamp...';
EXECUTE 'SELECT max('||p_control_field||') FROM '||p_dest_table||';' INTO v_max_timestamp;
EXECUTE 'UPDATE @extschema@.refresh_config_inserter SET last_value = '||quote_literal(COALESCE(v_max_timestamp, CURRENT_TIMESTAMP))||' WHERE dest_table = '||quote_literal(p_dest_table);
RAISE NOTICE 'Done';
END
$$;
/*
* Updater maker function.
*/
CREATE FUNCTION updater_maker(
p_src_table text
, p_control_field text
, p_dblink_id int
, p_boundary interval DEFAULT '00:10:00'
, p_dest_table text DEFAULT NULL
, p_index boolean DEFAULT true
, p_filter text[] DEFAULT NULL
, p_condition text DEFAULT NULL
, p_pulldata boolean DEFAULT true
, p_pk_name text[] DEFAULT NULL
, p_pk_type text[] DEFAULT NULL
, p_debug boolean DEFAULT false)
RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
v_data_source text;
v_dblink_schema text;
v_dest_schema_name text;
v_dest_table_name text;
v_dst_active boolean;
v_field text;
v_insert_refresh_config text;
v_key_type text;
v_link_exists boolean;
v_max_timestamp timestamptz;
v_old_search_path text;
v_pk_name text[] := p_pk_name;
v_pk_type text[] := p_pk_type;
v_remote_key_sql text;
v_table_exists boolean;
v_update_refresh_config text;
BEGIN
SELECT nspname INTO v_dblink_schema FROM pg_namespace n, pg_extension e WHERE e.extname = 'dblink' AND e.extnamespace = n.oid;
SELECT current_setting('search_path') INTO v_old_search_path;
EXECUTE 'SELECT set_config(''search_path'',''@extschema@,'||v_dblink_schema||',public'',''false'')';
IF (p_pk_name IS NULL AND p_pk_type IS NOT NULL) OR (p_pk_name IS NOT NULL AND p_pk_type IS NULL) THEN
RAISE EXCEPTION 'Cannot manually set primary/unique key field(s) without defining type(s) or vice versa';
END IF;
SELECT data_source INTO v_data_source FROM @extschema@.dblink_mapping WHERE data_source_id = p_dblink_id;
IF NOT FOUND THEN
RAISE EXCEPTION 'ERROR: database link ID is incorrect %', p_dblink_id;
END IF;
IF p_dest_table IS NULL THEN
p_dest_table := p_src_table;
END IF;
IF position('.' in p_dest_table) > 0 AND position('.' in p_src_table) > 0 THEN
v_dest_schema_name := split_part(p_dest_table, '.', 1);
v_dest_table_name := split_part(p_dest_table, '.', 2);
ELSE
RAISE EXCEPTION 'Source (and destination) table must be schema qualified';
END IF;
PERFORM dblink_connect('mimeo_updater', @extschema@.auth(p_dblink_id));
IF p_pk_name IS NULL AND p_pk_type IS NULL THEN
-- Either gets the primary key or it gets the first unique index in alphabetical order by index name
v_remote_key_sql := 'SELECT
CASE
WHEN i.indisprimary IS true THEN ''primary''
WHEN i.indisunique IS true THEN ''unique''
END AS key_type,
( SELECT array_agg( a.attname ORDER by x.r )
FROM pg_attribute a
JOIN ( SELECT k, row_number() over () as r
FROM unnest(i.indkey) k ) as x
ON a.attnum = x.k AND a.attrelid = i.indrelid
WHERE a.attnotnull
) AS indkey_names,
( SELECT array_agg( a.atttypid::regtype::text ORDER by x.r )
FROM pg_attribute a
JOIN ( SELECT k, row_number() over () as r
FROM unnest(i.indkey) k ) as x
ON a.attnum = x.k AND a.attrelid = i.indrelid
WHERE a.attnotnull
) AS indkey_types
FROM pg_index i
WHERE i.indrelid = '||quote_literal(p_src_table)||'::regclass
AND (i.indisprimary OR i.indisunique)
ORDER BY key_type LIMIT 1';
EXECUTE 'SELECT key_type, indkey_names, indkey_types FROM dblink(''mimeo_updater'', '||quote_literal(v_remote_key_sql)||') t (key_type text, indkey_names text[], indkey_types text[])'
INTO v_key_type, v_pk_name, v_pk_type;
END IF;
IF v_pk_name IS NULL OR v_pk_type IS NULL THEN
RAISE EXCEPTION 'Source table has no valid primary key or unique index';
END IF;
IF p_filter IS NOT NULL THEN
FOREACH v_field IN ARRAY v_pk_name LOOP
IF v_field = ANY(p_filter) THEN
CONTINUE;
ELSE
RAISE EXCEPTION 'ERROR: filter list did not contain all columns that compose primary/unique key for source table %', p_src_table;
END IF;
END LOOP;
END IF;
v_dst_active := @extschema@.dst_utc_check();
v_insert_refresh_config := 'INSERT INTO @extschema@.refresh_config_updater(source_table, dest_table, dblink, control, boundary, pk_name, pk_type, last_value, last_run, dst_active, filter, condition) VALUES('
||quote_literal(p_src_table)||', '||quote_literal(p_dest_table)||', '|| p_dblink_id||', '||quote_literal(p_control_field)||', '''
||p_boundary||'''::interval, '||quote_literal(v_pk_name)||', '||quote_literal(v_pk_type)||', ''0001-01-01''::date,'||quote_literal(CURRENT_TIMESTAMP)||','
||v_dst_active||','||COALESCE(quote_literal(p_filter), 'NULL')||','||COALESCE(quote_literal(p_condition), 'NULL')||')';
PERFORM gdb(p_debug, 'v_insert_refresh_config: '||v_insert_refresh_config);
EXECUTE v_insert_refresh_config;
SELECT p_table_exists FROM @extschema@.manage_dest_table(p_dest_table, NULL, p_debug) INTO v_table_exists;
IF p_pulldata AND v_table_exists = false THEN
RAISE NOTICE 'Pulling all data from source...';
EXECUTE 'SELECT @extschema@.refresh_updater('||quote_literal(p_dest_table)||', p_repull := true, p_debug := '||p_debug||')';
END IF;
IF p_index AND v_table_exists = false THEN
PERFORM create_index(p_dest_table, NULL, p_debug);
ELSIF v_table_exists = false THEN
-- Ensure destination indexes that are needed for efficient replication are created even if p_index is set false
PERFORM gdb(p_debug, 'Creating indexes needed for replication');
IF v_key_type = 'primary' THEN
EXECUTE 'ALTER TABLE '||p_dest_table||' ADD PRIMARY KEY('||array_to_string(v_pk_name, ',')||')';
ELSE
EXECUTE 'CREATE UNIQUE INDEX ON '||p_dest_table||' ('||array_to_string(v_pk_name, ',')||')';
END IF;
END IF;
IF v_table_exists THEN
RAISE NOTICE 'Destination table % already exists. No data or indexes was pulled from source', p_dest_table;
END IF;
PERFORM dblink_disconnect('mimeo_updater');
RAISE NOTICE 'Getting the maximum destination timestamp...';
EXECUTE 'SELECT max('||p_control_field||') FROM '||p_dest_table||';' INTO v_max_timestamp;
EXECUTE 'UPDATE @extschema@.refresh_config_updater SET last_value = '||quote_literal(COALESCE(v_max_timestamp, CURRENT_TIMESTAMP))||' WHERE dest_table = '||quote_literal(p_dest_table);
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RAISE NOTICE 'Done';
RETURN;
EXCEPTION
WHEN QUERY_CANCELED OR OTHERS THEN
EXECUTE 'SELECT '||v_dblink_schema||'.dblink_get_connections() @> ARRAY['||quote_literal(v_dblink_name)||']' INTO v_link_exists;
IF v_link_exists THEN
EXECUTE 'SELECT '||v_dblink_schema||'.dblink_disconnect('||quote_literal(v_dblink_name)||')';
END IF;
EXECUTE 'SELECT set_config(''search_path'','''||v_old_search_path||''',''false'')';
RAISE EXCEPTION '%', SQLERRM;
END
$$;
/*
* Plain table refresh maker function.
*/
CREATE FUNCTION table_maker(
p_src_table text
, p_dblink_id int
, p_dest_table text DEFAULT NULL
, p_index boolean DEFAULT true
, p_filter text[] DEFAULT NULL
, p_condition text DEFAULT NULL
, p_sequences text[] DEFAULT NULL
, p_pulldata boolean DEFAULT true
, p_debug boolean DEFAULT false)
RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
v_data_source text;
v_dest_schema_name text;
v_dest_table_name text;
v_dst_active boolean;
v_insert_refresh_config text;
v_max_timestamp timestamptz;
v_seq text;
v_seq_max bigint;
v_table_exists boolean;
BEGIN
SELECT data_source INTO v_data_source FROM @extschema@.dblink_mapping WHERE data_source_id = p_dblink_id;
IF NOT FOUND THEN
RAISE EXCEPTION 'ERROR: database link ID is incorrect %', p_dblink_id;
END IF;
IF p_dest_table IS NULL THEN
p_dest_table := p_src_table;
END IF;
IF position('.' in p_dest_table) > 0 AND position('.' in p_src_table) > 0 THEN
v_dest_schema_name := split_part(p_dest_table, '.', 1);
v_dest_table_name := split_part(p_dest_table, '.', 2);
ELSE
RAISE EXCEPTION 'Source (and destination) table must be schema qualified';
END IF;
v_insert_refresh_config := 'INSERT INTO @extschema@.refresh_config_table(source_table, dest_table, dblink, last_run, filter, condition, sequences) VALUES('
||quote_literal(p_src_table)||','||quote_literal(p_dest_table)||','|| p_dblink_id||','
||quote_literal(CURRENT_TIMESTAMP)||','||COALESCE(quote_literal(p_filter), 'NULL')||','||COALESCE(quote_literal(p_condition), 'NULL')||','||COALESCE(quote_literal(p_sequences), 'NULL')||');';
PERFORM @extschema@.gdb(p_debug, 'v_insert_refresh_config: '||v_insert_refresh_config);
EXECUTE v_insert_refresh_config;
SELECT p_table_exists FROM @extschema@.manage_dest_table(p_dest_table, NULL, p_debug) INTO v_table_exists;
IF p_pulldata AND v_table_exists = false THEN
RAISE NOTICE 'Pulling all data from source...';
EXECUTE 'SELECT @extschema@.refresh_table('||quote_literal(p_dest_table)||', p_debug := '||p_debug||')';
END IF;
IF p_index AND v_table_exists = false THEN
PERFORM @extschema@.create_index(p_dest_table, NULL, p_debug);
END IF;
IF v_table_exists THEN
RAISE NOTICE 'Destination table % already exists. No data or indexes were pulled from source', p_dest_table;
END IF;
RAISE NOTICE 'Done';
END
$$;
-- Restore original privileges to objects that were dropped
SELECT @extschema@.replay_preserved_privs();
DROP FUNCTION @extschema@.replay_preserved_privs();
DROP TABLE mimeo_preserve_privs_temp;
|
with `cross_items` as (select `i_item_sk` as `ss_item_sk`
from (select `iss`.`i_brand_id` as `brand_id`, `iss`.`i_class_id` as `class_id`, `iss`.`i_category_id` as `category_id`
from `store_sales`
where `ss_item_sk` = `iss`.`i_item_sk` and `ss_sold_date_sk` = `d1`.`d_date_sk` and `d1`.`d_year` between asymmetric 1999 and 1999 + 2
intersect
select `ics`.`i_brand_id`, `ics`.`i_class_id`, `ics`.`i_category_id`
from `catalog_sales`
where `cs_item_sk` = `ics`.`i_item_sk` and `cs_sold_date_sk` = `d2`.`d_date_sk` and `d2`.`d_year` between asymmetric 1999 and 1999 + 2
intersect
select `iws`.`i_brand_id`, `iws`.`i_class_id`, `iws`.`i_category_id`
from `web_sales`
where `ws_item_sk` = `iws`.`i_item_sk` and `ws_sold_date_sk` = `d3`.`d_date_sk` and `d3`.`d_year` between asymmetric 1999 and 1999 + 2) as `x`
where `i_brand_id` = `brand_id` and `i_class_id` = `class_id` and `i_category_id` = `category_id`), `avg_sales` as (select avg(`quantity` * `list_price`) as `average_sales`
from (select `ss_quantity` as `quantity`, `ss_list_price` as `list_price`
from `store_sales`
where `ss_sold_date_sk` = `d_date_sk` and `d_year` between asymmetric 1999 and 1999 + 2
union all
select `cs_quantity` as `quantity`, `cs_list_price` as `list_price`
from `catalog_sales`
where `cs_sold_date_sk` = `d_date_sk` and `d_year` between asymmetric 1999 and 1999 + 2
union all
select `ws_quantity` as `quantity`, `ws_list_price` as `list_price`
from `web_sales`
where `ws_sold_date_sk` = `d_date_sk` and `d_year` between asymmetric 1999 and 1999 + 2)) (select *
from (select 'store' as `channel`, `i_brand_id`, `i_class_id`, `i_category_id`, sum(`ss_quantity` * `ss_list_price`) as `sales`, count(*) as `number_sales`
from `store_sales`
where `ss_item_sk` in (select `ss_item_sk`
from `cross_items`) and `ss_item_sk` = `i_item_sk` and `ss_sold_date_sk` = `d_date_sk` and `d_week_seq` = (select `d_week_seq`
from `date_dim`
where `d_year` = 1999 + 1 and `d_moy` = 12 and `d_dom` = 11)
group by `i_brand_id`, `i_class_id`, `i_category_id`
having sum(`ss_quantity` * `ss_list_price`) > (select `average_sales`
from `avg_sales`))
where `this_year`.`i_brand_id` = `last_year`.`i_brand_id` and `this_year`.`i_class_id` = `last_year`.`i_class_id` and `this_year`.`i_category_id` = `last_year`.`i_category_id`
order by `this_year`.`channel`, `this_year`.`i_brand_id`, `this_year`.`i_class_id`, `this_year`.`i_category_id`
fetch next 100 rows only)
|
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.3
-- Dumped by pg_dump version 12.3
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: auth_group; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.auth_group (
id integer NOT NULL,
name character varying(150) NOT NULL
);
ALTER TABLE public.auth_group OWNER TO density;
--
-- Name: auth_group_id_seq; Type: SEQUENCE; Schema: public; Owner: density
--
CREATE SEQUENCE public.auth_group_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.auth_group_id_seq OWNER TO density;
--
-- Name: auth_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: density
--
ALTER SEQUENCE public.auth_group_id_seq OWNED BY public.auth_group.id;
--
-- Name: auth_group_permissions; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.auth_group_permissions (
id integer NOT NULL,
group_id integer NOT NULL,
permission_id integer NOT NULL
);
ALTER TABLE public.auth_group_permissions OWNER TO density;
--
-- Name: auth_group_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: density
--
CREATE SEQUENCE public.auth_group_permissions_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.auth_group_permissions_id_seq OWNER TO density;
--
-- Name: auth_group_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: density
--
ALTER SEQUENCE public.auth_group_permissions_id_seq OWNED BY public.auth_group_permissions.id;
--
-- Name: auth_permission; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.auth_permission (
id integer NOT NULL,
name character varying(255) NOT NULL,
content_type_id integer NOT NULL,
codename character varying(100) NOT NULL
);
ALTER TABLE public.auth_permission OWNER TO density;
--
-- Name: auth_permission_id_seq; Type: SEQUENCE; Schema: public; Owner: density
--
CREATE SEQUENCE public.auth_permission_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.auth_permission_id_seq OWNER TO density;
--
-- Name: auth_permission_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: density
--
ALTER SEQUENCE public.auth_permission_id_seq OWNED BY public.auth_permission.id;
--
-- Name: auth_user; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.auth_user (
id integer NOT NULL,
password character varying(128) NOT NULL,
last_login timestamp with time zone,
is_superuser boolean NOT NULL,
username character varying(150) NOT NULL,
first_name character varying(30) NOT NULL,
last_name character varying(150) NOT NULL,
email character varying(254) NOT NULL,
is_staff boolean NOT NULL,
is_active boolean NOT NULL,
date_joined timestamp with time zone NOT NULL
);
ALTER TABLE public.auth_user OWNER TO density;
--
-- Name: auth_user_groups; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.auth_user_groups (
id integer NOT NULL,
user_id integer NOT NULL,
group_id integer NOT NULL
);
ALTER TABLE public.auth_user_groups OWNER TO density;
--
-- Name: auth_user_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: density
--
CREATE SEQUENCE public.auth_user_groups_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.auth_user_groups_id_seq OWNER TO density;
--
-- Name: auth_user_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: density
--
ALTER SEQUENCE public.auth_user_groups_id_seq OWNED BY public.auth_user_groups.id;
--
-- Name: auth_user_id_seq; Type: SEQUENCE; Schema: public; Owner: density
--
CREATE SEQUENCE public.auth_user_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.auth_user_id_seq OWNER TO density;
--
-- Name: auth_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: density
--
ALTER SEQUENCE public.auth_user_id_seq OWNED BY public.auth_user.id;
--
-- Name: auth_user_user_permissions; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.auth_user_user_permissions (
id integer NOT NULL,
user_id integer NOT NULL,
permission_id integer NOT NULL
);
ALTER TABLE public.auth_user_user_permissions OWNER TO density;
--
-- Name: auth_user_user_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: density
--
CREATE SEQUENCE public.auth_user_user_permissions_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.auth_user_user_permissions_id_seq OWNER TO density;
--
-- Name: auth_user_user_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: density
--
ALTER SEQUENCE public.auth_user_user_permissions_id_seq OWNED BY public.auth_user_user_permissions.id;
--
-- Name: django_admin_log; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.django_admin_log (
id integer NOT NULL,
action_time timestamp with time zone NOT NULL,
object_id text,
object_repr character varying(200) NOT NULL,
action_flag smallint NOT NULL,
change_message text NOT NULL,
content_type_id integer,
user_id integer NOT NULL,
CONSTRAINT django_admin_log_action_flag_check CHECK ((action_flag >= 0))
);
ALTER TABLE public.django_admin_log OWNER TO density;
--
-- Name: django_admin_log_id_seq; Type: SEQUENCE; Schema: public; Owner: density
--
CREATE SEQUENCE public.django_admin_log_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.django_admin_log_id_seq OWNER TO density;
--
-- Name: django_admin_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: density
--
ALTER SEQUENCE public.django_admin_log_id_seq OWNED BY public.django_admin_log.id;
--
-- Name: django_content_type; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.django_content_type (
id integer NOT NULL,
app_label character varying(100) NOT NULL,
model character varying(100) NOT NULL
);
ALTER TABLE public.django_content_type OWNER TO density;
--
-- Name: django_content_type_id_seq; Type: SEQUENCE; Schema: public; Owner: density
--
CREATE SEQUENCE public.django_content_type_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.django_content_type_id_seq OWNER TO density;
--
-- Name: django_content_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: density
--
ALTER SEQUENCE public.django_content_type_id_seq OWNED BY public.django_content_type.id;
--
-- Name: django_migrations; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.django_migrations (
id integer NOT NULL,
app character varying(255) NOT NULL,
name character varying(255) NOT NULL,
applied timestamp with time zone NOT NULL
);
ALTER TABLE public.django_migrations OWNER TO density;
--
-- Name: django_migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: density
--
CREATE SEQUENCE public.django_migrations_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.django_migrations_id_seq OWNER TO density;
--
-- Name: django_migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: density
--
ALTER SEQUENCE public.django_migrations_id_seq OWNED BY public.django_migrations.id;
--
-- Name: django_session; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.django_session (
session_key character varying(40) NOT NULL,
session_data text NOT NULL,
expire_date timestamp with time zone NOT NULL
);
ALTER TABLE public.django_session OWNER TO density;
--
-- Name: dpu_doorway; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.dpu_doorway (
id uuid NOT NULL,
created timestamp with time zone NOT NULL,
modified timestamp with time zone NOT NULL,
name character varying(100) NOT NULL
);
ALTER TABLE public.dpu_doorway OWNER TO density;
--
-- Name: dpu_dpu; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.dpu_dpu (
id uuid NOT NULL,
created timestamp with time zone NOT NULL,
modified timestamp with time zone NOT NULL,
dpu_id integer NOT NULL,
doorway_id uuid,
entry_space_id uuid,
exit_space_id uuid,
CONSTRAINT dpu_dpu_dpu_id_check CHECK ((dpu_id >= 0))
);
ALTER TABLE public.dpu_dpu OWNER TO density;
--
-- Name: dpu_dpuevent; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.dpu_dpuevent (
id uuid NOT NULL,
created timestamp with time zone NOT NULL,
modified timestamp with time zone NOT NULL,
"timestamp" timestamp with time zone NOT NULL,
direction smallint NOT NULL,
dpu_id uuid NOT NULL
);
ALTER TABLE public.dpu_dpuevent OWNER TO density;
--
-- Name: dpu_space; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.dpu_space (
id uuid NOT NULL,
created timestamp with time zone NOT NULL,
modified timestamp with time zone NOT NULL,
name character varying(100) NOT NULL
);
ALTER TABLE public.dpu_space OWNER TO density;
--
-- Name: dpu_spaceoccupancy; Type: TABLE; Schema: public; Owner: density
--
CREATE TABLE public.dpu_spaceoccupancy (
id uuid NOT NULL,
created timestamp with time zone NOT NULL,
modified timestamp with time zone NOT NULL,
status character varying(30) NOT NULL,
occupancy integer NOT NULL,
dpu_event_id uuid NOT NULL,
space_id uuid NOT NULL
);
ALTER TABLE public.dpu_spaceoccupancy OWNER TO density;
--
-- Name: auth_group id; Type: DEFAULT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_group ALTER COLUMN id SET DEFAULT nextval('public.auth_group_id_seq'::regclass);
--
-- Name: auth_group_permissions id; Type: DEFAULT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_group_permissions ALTER COLUMN id SET DEFAULT nextval('public.auth_group_permissions_id_seq'::regclass);
--
-- Name: auth_permission id; Type: DEFAULT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_permission ALTER COLUMN id SET DEFAULT nextval('public.auth_permission_id_seq'::regclass);
--
-- Name: auth_user id; Type: DEFAULT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user ALTER COLUMN id SET DEFAULT nextval('public.auth_user_id_seq'::regclass);
--
-- Name: auth_user_groups id; Type: DEFAULT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user_groups ALTER COLUMN id SET DEFAULT nextval('public.auth_user_groups_id_seq'::regclass);
--
-- Name: auth_user_user_permissions id; Type: DEFAULT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user_user_permissions ALTER COLUMN id SET DEFAULT nextval('public.auth_user_user_permissions_id_seq'::regclass);
--
-- Name: django_admin_log id; Type: DEFAULT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.django_admin_log ALTER COLUMN id SET DEFAULT nextval('public.django_admin_log_id_seq'::regclass);
--
-- Name: django_content_type id; Type: DEFAULT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.django_content_type ALTER COLUMN id SET DEFAULT nextval('public.django_content_type_id_seq'::regclass);
--
-- Name: django_migrations id; Type: DEFAULT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.django_migrations ALTER COLUMN id SET DEFAULT nextval('public.django_migrations_id_seq'::regclass);
--
-- Name: auth_group auth_group_name_key; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_group
ADD CONSTRAINT auth_group_name_key UNIQUE (name);
--
-- Name: auth_group_permissions auth_group_permissions_group_id_permission_id_0cd325b0_uniq; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_group_permissions
ADD CONSTRAINT auth_group_permissions_group_id_permission_id_0cd325b0_uniq UNIQUE (group_id, permission_id);
--
-- Name: auth_group_permissions auth_group_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_group_permissions
ADD CONSTRAINT auth_group_permissions_pkey PRIMARY KEY (id);
--
-- Name: auth_group auth_group_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_group
ADD CONSTRAINT auth_group_pkey PRIMARY KEY (id);
--
-- Name: auth_permission auth_permission_content_type_id_codename_01ab375a_uniq; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_permission
ADD CONSTRAINT auth_permission_content_type_id_codename_01ab375a_uniq UNIQUE (content_type_id, codename);
--
-- Name: auth_permission auth_permission_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_permission
ADD CONSTRAINT auth_permission_pkey PRIMARY KEY (id);
--
-- Name: auth_user_groups auth_user_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user_groups
ADD CONSTRAINT auth_user_groups_pkey PRIMARY KEY (id);
--
-- Name: auth_user_groups auth_user_groups_user_id_group_id_94350c0c_uniq; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user_groups
ADD CONSTRAINT auth_user_groups_user_id_group_id_94350c0c_uniq UNIQUE (user_id, group_id);
--
-- Name: auth_user auth_user_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user
ADD CONSTRAINT auth_user_pkey PRIMARY KEY (id);
--
-- Name: auth_user_user_permissions auth_user_user_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user_user_permissions
ADD CONSTRAINT auth_user_user_permissions_pkey PRIMARY KEY (id);
--
-- Name: auth_user_user_permissions auth_user_user_permissions_user_id_permission_id_14a6b632_uniq; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user_user_permissions
ADD CONSTRAINT auth_user_user_permissions_user_id_permission_id_14a6b632_uniq UNIQUE (user_id, permission_id);
--
-- Name: auth_user auth_user_username_key; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user
ADD CONSTRAINT auth_user_username_key UNIQUE (username);
--
-- Name: django_admin_log django_admin_log_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.django_admin_log
ADD CONSTRAINT django_admin_log_pkey PRIMARY KEY (id);
--
-- Name: django_content_type django_content_type_app_label_model_76bd3d3b_uniq; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.django_content_type
ADD CONSTRAINT django_content_type_app_label_model_76bd3d3b_uniq UNIQUE (app_label, model);
--
-- Name: django_content_type django_content_type_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.django_content_type
ADD CONSTRAINT django_content_type_pkey PRIMARY KEY (id);
--
-- Name: django_migrations django_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.django_migrations
ADD CONSTRAINT django_migrations_pkey PRIMARY KEY (id);
--
-- Name: django_session django_session_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.django_session
ADD CONSTRAINT django_session_pkey PRIMARY KEY (session_key);
--
-- Name: dpu_doorway dpu_doorway_name_key; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_doorway
ADD CONSTRAINT dpu_doorway_name_key UNIQUE (name);
--
-- Name: dpu_doorway dpu_doorway_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_doorway
ADD CONSTRAINT dpu_doorway_pkey PRIMARY KEY (id);
--
-- Name: dpu_dpu dpu_dpu_doorway_id_key; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_dpu
ADD CONSTRAINT dpu_dpu_doorway_id_key UNIQUE (doorway_id);
--
-- Name: dpu_dpu dpu_dpu_dpu_id_key; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_dpu
ADD CONSTRAINT dpu_dpu_dpu_id_key UNIQUE (dpu_id);
--
-- Name: dpu_dpu dpu_dpu_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_dpu
ADD CONSTRAINT dpu_dpu_pkey PRIMARY KEY (id);
--
-- Name: dpu_dpuevent dpu_dpuevent_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_dpuevent
ADD CONSTRAINT dpu_dpuevent_pkey PRIMARY KEY (id);
--
-- Name: dpu_space dpu_space_name_key; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_space
ADD CONSTRAINT dpu_space_name_key UNIQUE (name);
--
-- Name: dpu_space dpu_space_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_space
ADD CONSTRAINT dpu_space_pkey PRIMARY KEY (id);
--
-- Name: dpu_spaceoccupancy dpu_spaceoccupancy_pkey; Type: CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_spaceoccupancy
ADD CONSTRAINT dpu_spaceoccupancy_pkey PRIMARY KEY (id);
--
-- Name: auth_group_name_a6ea08ec_like; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX auth_group_name_a6ea08ec_like ON public.auth_group USING btree (name varchar_pattern_ops);
--
-- Name: auth_group_permissions_group_id_b120cbf9; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX auth_group_permissions_group_id_b120cbf9 ON public.auth_group_permissions USING btree (group_id);
--
-- Name: auth_group_permissions_permission_id_84c5c92e; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX auth_group_permissions_permission_id_84c5c92e ON public.auth_group_permissions USING btree (permission_id);
--
-- Name: auth_permission_content_type_id_2f476e4b; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX auth_permission_content_type_id_2f476e4b ON public.auth_permission USING btree (content_type_id);
--
-- Name: auth_user_groups_group_id_97559544; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX auth_user_groups_group_id_97559544 ON public.auth_user_groups USING btree (group_id);
--
-- Name: auth_user_groups_user_id_6a12ed8b; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX auth_user_groups_user_id_6a12ed8b ON public.auth_user_groups USING btree (user_id);
--
-- Name: auth_user_user_permissions_permission_id_1fbb5f2c; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX auth_user_user_permissions_permission_id_1fbb5f2c ON public.auth_user_user_permissions USING btree (permission_id);
--
-- Name: auth_user_user_permissions_user_id_a95ead1b; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX auth_user_user_permissions_user_id_a95ead1b ON public.auth_user_user_permissions USING btree (user_id);
--
-- Name: auth_user_username_6821ab7c_like; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX auth_user_username_6821ab7c_like ON public.auth_user USING btree (username varchar_pattern_ops);
--
-- Name: django_admin_log_content_type_id_c4bce8eb; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX django_admin_log_content_type_id_c4bce8eb ON public.django_admin_log USING btree (content_type_id);
--
-- Name: django_admin_log_user_id_c564eba6; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX django_admin_log_user_id_c564eba6 ON public.django_admin_log USING btree (user_id);
--
-- Name: django_session_expire_date_a5c62663; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX django_session_expire_date_a5c62663 ON public.django_session USING btree (expire_date);
--
-- Name: django_session_session_key_c0390e0f_like; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX django_session_session_key_c0390e0f_like ON public.django_session USING btree (session_key varchar_pattern_ops);
--
-- Name: dpu_doorway_name_ae9c6cee_like; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX dpu_doorway_name_ae9c6cee_like ON public.dpu_doorway USING btree (name varchar_pattern_ops);
--
-- Name: dpu_dpu_entry_space_id_7a0472db; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX dpu_dpu_entry_space_id_7a0472db ON public.dpu_dpu USING btree (entry_space_id);
--
-- Name: dpu_dpu_exit_space_id_c14ed78f; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX dpu_dpu_exit_space_id_c14ed78f ON public.dpu_dpu USING btree (exit_space_id);
--
-- Name: dpu_dpuevent_dpu_id_5836a78f; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX dpu_dpuevent_dpu_id_5836a78f ON public.dpu_dpuevent USING btree (dpu_id);
--
-- Name: dpu_dpuevent_timestamp_53322000; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX dpu_dpuevent_timestamp_53322000 ON public.dpu_dpuevent USING btree ("timestamp");
--
-- Name: dpu_space_name_f5dc9a94_like; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX dpu_space_name_f5dc9a94_like ON public.dpu_space USING btree (name varchar_pattern_ops);
--
-- Name: dpu_spaceoccupancy_dpu_event_id_e93ba269; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX dpu_spaceoccupancy_dpu_event_id_e93ba269 ON public.dpu_spaceoccupancy USING btree (dpu_event_id);
--
-- Name: dpu_spaceoccupancy_space_id_4b8a290a; Type: INDEX; Schema: public; Owner: density
--
CREATE INDEX dpu_spaceoccupancy_space_id_4b8a290a ON public.dpu_spaceoccupancy USING btree (space_id);
--
-- Name: auth_group_permissions auth_group_permissio_permission_id_84c5c92e_fk_auth_perm; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_group_permissions
ADD CONSTRAINT auth_group_permissio_permission_id_84c5c92e_fk_auth_perm FOREIGN KEY (permission_id) REFERENCES public.auth_permission(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_group_permissions auth_group_permissions_group_id_b120cbf9_fk_auth_group_id; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_group_permissions
ADD CONSTRAINT auth_group_permissions_group_id_b120cbf9_fk_auth_group_id FOREIGN KEY (group_id) REFERENCES public.auth_group(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_permission auth_permission_content_type_id_2f476e4b_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_permission
ADD CONSTRAINT auth_permission_content_type_id_2f476e4b_fk_django_co FOREIGN KEY (content_type_id) REFERENCES public.django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_groups auth_user_groups_group_id_97559544_fk_auth_group_id; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user_groups
ADD CONSTRAINT auth_user_groups_group_id_97559544_fk_auth_group_id FOREIGN KEY (group_id) REFERENCES public.auth_group(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_groups auth_user_groups_user_id_6a12ed8b_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user_groups
ADD CONSTRAINT auth_user_groups_user_id_6a12ed8b_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES public.auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_user_permissions auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user_user_permissions
ADD CONSTRAINT auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm FOREIGN KEY (permission_id) REFERENCES public.auth_permission(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_user_permissions auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.auth_user_user_permissions
ADD CONSTRAINT auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES public.auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: django_admin_log django_admin_log_content_type_id_c4bce8eb_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.django_admin_log
ADD CONSTRAINT django_admin_log_content_type_id_c4bce8eb_fk_django_co FOREIGN KEY (content_type_id) REFERENCES public.django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: django_admin_log django_admin_log_user_id_c564eba6_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.django_admin_log
ADD CONSTRAINT django_admin_log_user_id_c564eba6_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES public.auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dpu_dpu dpu_dpu_doorway_id_3d231bb5_fk_dpu_doorway_id; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_dpu
ADD CONSTRAINT dpu_dpu_doorway_id_3d231bb5_fk_dpu_doorway_id FOREIGN KEY (doorway_id) REFERENCES public.dpu_doorway(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dpu_dpu dpu_dpu_entry_space_id_7a0472db_fk_dpu_space_id; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_dpu
ADD CONSTRAINT dpu_dpu_entry_space_id_7a0472db_fk_dpu_space_id FOREIGN KEY (entry_space_id) REFERENCES public.dpu_space(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dpu_dpu dpu_dpu_exit_space_id_c14ed78f_fk_dpu_space_id; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_dpu
ADD CONSTRAINT dpu_dpu_exit_space_id_c14ed78f_fk_dpu_space_id FOREIGN KEY (exit_space_id) REFERENCES public.dpu_space(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dpu_dpuevent dpu_dpuevent_dpu_id_5836a78f_fk_dpu_dpu_id; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_dpuevent
ADD CONSTRAINT dpu_dpuevent_dpu_id_5836a78f_fk_dpu_dpu_id FOREIGN KEY (dpu_id) REFERENCES public.dpu_dpu(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dpu_spaceoccupancy dpu_spaceoccupancy_dpu_event_id_e93ba269_fk_dpu_dpuevent_id; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_spaceoccupancy
ADD CONSTRAINT dpu_spaceoccupancy_dpu_event_id_e93ba269_fk_dpu_dpuevent_id FOREIGN KEY (dpu_event_id) REFERENCES public.dpu_dpuevent(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dpu_spaceoccupancy dpu_spaceoccupancy_space_id_4b8a290a_fk_dpu_space_id; Type: FK CONSTRAINT; Schema: public; Owner: density
--
ALTER TABLE ONLY public.dpu_spaceoccupancy
ADD CONSTRAINT dpu_spaceoccupancy_space_id_4b8a290a_fk_dpu_space_id FOREIGN KEY (space_id) REFERENCES public.dpu_space(id) DEFERRABLE INITIALLY DEFERRED;
--
-- PostgreSQL database dump complete
--
|
<filename>src/main/sql/upgrades/0.4.4-oracle.sql
-- Extend the length of the 'content_type' column:
alter table vortex_resource modify
(
content_type varchar2(128)
);
|
<filename>examples/write-1.sql
INSERT INTO test DEFAULT VALUES RETURNING id
|
--TEST: test with columns with a foreign key
create table var_samp_pk(
col1 date not null,
col2 time default '10:10:10',
col3 timestamp default SYS_TIMESTAMP primary key,
col4 datetime,
col5 int
);
--create a table with a column referncing a column in another table
create table var_samp_fk(
col1 bigint default 2000000,
col2 char(20) not null,
col3 timestamp,
constraint pk_col3 primary key(col3),
constraint fk_col3 foreign key(col3) references var_samp_pk(col3)
on delete cascade on update restrict
);
--insert into the table with pk
insert into var_samp_pk values('2000-12-12', '11:11:11', '1990-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 111.111);
insert into var_samp_pk values('2000-12-12', '12:12:12', '1991-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 222.222);
insert into var_samp_pk values('2000-12-12', '11:11:11', '1992-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 333.333);
insert into var_samp_pk values('2000-12-12', '12:12:12', '1993-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 444.444);
insert into var_samp_pk values('2000-12-12', '11:11:11', '1994-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 555.555);
insert into var_samp_pk values(date'1999-11-11', '12:12:12', '1995-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 111.111);
insert into var_samp_pk values(date'1999-11-11', '11:11:11', '1996-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 666.666);
insert into var_samp_pk values(date'1999-11-11', '11:11:11', '1997-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 777.777);
insert into var_samp_pk values(date'1999-11-11', '13:13:13', '1998-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 888.888);
insert into var_samp_pk values('10/10/2001', '11:11:11', '1999-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 999.999);
insert into var_samp_pk values('10/10/2001', '11:11:11', '2000-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 222.222);
insert into var_samp_pk values('10/10/2001', '13:13:13', '2001-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 333.333);
insert into var_samp_pk values('2011-11-23', '11:11:11', '2002-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 444.444);
insert into var_samp_pk values(date'1888-09-09', '11:11:11', '2003-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 555.555);
insert into var_samp_pk values(date'1888-09-09', '12:12:12', '2004-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 333.333);
insert into var_samp_pk values(date'1888-09-09', '11:11:11', '2005-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 666.666);
insert into var_samp_pk values(date'1888-09-09', '11:11:11', '2006-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 777.777);
insert into var_samp_pk values(date'1888-09-09', '13:13:13', '2007-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 888.888);
insert into var_samp_pk values(date'1888-09-09', '11:11:11', '2008-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 999.999);
insert into var_samp_pk values(date'1888-09-09', '11:11:11', '2009-1-1 11:11:11', datetime'2011-11-11 11:11:11.111', 555.555);
--insert into the table with fk
insert into var_samp_fk values(100000, 'fk1', '2009-1-1 11:11:11');
insert into var_samp_fk values(100000, 'fk2', '2007-1-1 11:11:11');
insert into var_samp_fk values(null, 'fk3', '2005-1-1 11:11:11');
insert into var_samp_fk values(100000, 'fk4', '2003-1-1 11:11:11');
insert into var_samp_fk values(null, 'fk1', '2001-1-1 11:11:11');
insert into var_samp_fk values(300000, 'fk2', '2000-1-1 11:11:11');
insert into var_samp_fk values(100000, 'fk3', '1999-1-1 11:11:11');
insert into var_samp_fk values(null, 'fk4', '1997-1-1 11:11:11');
insert into var_samp_fk values(100000, 'fk1', '1995-1-1 11:11:11');
insert into var_samp_fk values(300000, 'fk5', '1993-1-1 11:11:11');
insert into var_samp_fk values(200000, 'fk4', '1991-1-1 11:11:11');
--TEST: OVER() clause, table with pk
--TEST: date
select col1, col2, var_samp(col5) over() from var_samp_pk order by 1, 2;
--TEST: time, with alias+all
select col2, col3, var_samp(all col5) over() var_samp from var_samp_pk order by 1, 2;
--TEST: timestamp, with where clause
select col3, col4, var_samp(col5) over() var_samp from var_samp_pk where col1 > '2000-12-12' order by col3, col4;
--TEST: datetime, distinct
select col4, col1, var_samp(distinct col5) over() var_samp from var_samp_pk order by 1, 2;
--TEST: syntax error
select col1, col3, col4, var_samp(col5) over var_samp from var_samp_pk;
select col1, col3, col2, var_samp(col5) over(1) var_samp from var_samp_pk;
--TEST: OVER() clause, table with fk
--TEST: int
select col1, col2, var_samp(col1) over() from var_samp_fk order by 1, 2;
--TEST: char(n), with alias+all
select col2, col3, var_samp(all col1) over() var_samp from var_samp_fk order by 1, 2;
--TEST: timestamp, with where clause
select col3, col1, var_samp(unique col1) over() var_samp from var_samp_fk where col1 > 200000 order by col3, col1;
--TEST: syntax error
select col1, col3, var_samp(col1) over var_samp from var_samp_fk;
select col1, col3, col2, var_samp(col1) over(1) var_samp from var_samp_fk;
--TEST: OVER(PARTITION BY) clause, table with pk
--TEST: partition by date
select col1, col2, col3, col4, var_samp(unique col5) over(partition by col1) var_samp from var_samp_pk order by 1, 2, 3, 4;
--TEST: partition by time
select col1, col2, col3, col4, var_samp(distinctrow col5) over(partition by col2) var_samp from var_samp_pk order by 2, 1, 3, 4;
--TEST: partition by timestamp
select col1, col2, col3, col4, var_samp(col5) over(partition by col3) var_samp from var_samp_pk order by 3, 1, 2, 4;
--TEST: partition by datetime
select col1, col2, col3, col4, var_samp(all col5) over(partition by col4) var_samp from var_samp_pk order by 4, 1, 2, 3, 5;
--TEST: OVER(PARTITION BY) clause, table with fk
--TEST: partition by int
select col1, col2, col3, var_samp(col1) over(partition by col1) var_samp from var_samp_fk order by 1, 2, 3, 4;
--TEST: partition by char(n)
select col1, col2, col3, var_samp(distinctrow col1) over(partition by col2) var_samp from var_samp_fk order by 2, 1, 3, 4;
--TEST: partition by timestamp
select col1, col2, col3, var_samp(unique col1) over(partition by col3) var_samp from var_samp_fk order by 3, 1, 2, 4;
--TEST: OVER(ORDER BY) clause, table with pk
--TEST: order by 1 column name
select col1, var_samp(col5) over(order by col1) var_samp from var_samp_pk order by 1, 2;
--TEST: order by 2 column names
select col2, col3, var_samp(all col5) over(order by col2, col3 asc) var_samp from var_samp_pk order by 1, 2, 3;
--TEST: order by more than 2 column names
select col1, col2, col3, col4, var_samp(unique col5) over(order by col1, col2 desc, col3, col4 asc) var_samp from var_samp_pk order by 1, 2, 3, 4, 5;
--TEST: order by columns not selected
select col3, var_samp(distinct col5) over(order by col4 desc, col2, col1 asc) var_samp from var_samp_pk order by 1, 2;
--TEST: order by 1 position
select col4, var_samp(all col5) over(order by 1) var_samp from var_samp_pk order by 1, 2;
--TEST: order by 3 positions
select col3, col2, var_samp(distinctrow col5) over(order by 1, 2 desc, 3 asc) var_samp from var_samp_pk order by 1, 2, 3;
--TEST: order by more than 3 positions
select col1, col2, col3, col4, var_samp(col5) over(order by 3, 2 asc, 1 desc, 4) var_samp from var_samp_pk order by 1, 2, 3, 4, 5;
--TEST: order by positions not existed
select col2, var_samp(distinct col5) over(order by 2) var_samp from var_samp_pk order by 1, 2;
select col1, var_samp(all col5) over(order by 3, 4, 1 desc) var_samp, col2, col4 from var_samp_pk order by 1, 2;
select col3, col4, var_samp(col5) over(order by 5) var_samp from var_samp_pk order by 1, 2;
select col3, col1, var_samp(col5) over(order by 100) var_samp from var_samp_pk order by 1, 2;
--TEST: order by column names and positions
select col1, col2, col3, col4, var_samp(col5) over(order by 1, col2 desc, 3, col4 asc) var_samp from var_samp_pk order by 1, 2, 3, 4, 5;
--TEST: OVER(ORDER BY) clause, table with fk
--TEST: order by 1 column name
select col1, var_samp(col1) over(order by col1) var_samp from var_samp_fk order by 1, 2;
--TEST: order by 2 column names
select col2, col3, var_samp(all col1) over(order by col2, col3 asc) var_samp from var_samp_fk order by 1, 2, 3;
--TEST: order by more than 2 column names
select col1, col2, col3, var_samp(unique col1) over(order by col1, col2 desc, col3 asc) var_samp from var_samp_fk order by 1, 2, 3, 4;
--TEST: order by columns not selected
select col3, var_samp(distinctrow col1) over(order by col2, col1 asc) var_samp from var_samp_fk order by 1, 2;
--TEST: order by 1 position
select col3, var_samp(all col1) over(order by 1) var_samp from var_samp_fk order by 1, 2;
--TEST: order by 3 positions
select col3, col2, var_samp(col1) over(order by 1, 2 desc, 3 asc) var_samp from var_samp_fk order by 1, 2, 3;
--TEST: order by positions not existed
select col2, var_samp(distinct col1) over(order by 2) var_samp from var_samp_fk order by 1, 2;
select col1, var_samp(all col1) over(order by 3, 4, 1 desc) var_samp, col2, col4 from var_samp_fk order by 1, 2;
select col3, col1, var_samp(col1) over(order by 100) var_samp from var_samp_fk order by 1, 2;
--TEST: order by column names and positions
select col1, col2, col3, var_samp(col1) over(order by 1, col2 desc, 3) var_samp from var_samp_fk order by 1, 2, 3, 4;
--TEST: OVER(PARTITION BY ORDER BY) clause, table with pk
--TEST: partition by date
select col1, col2, col3, var_samp(distinct col5) over(partition by col1 order by 1, 2, 3) from var_samp_pk order by 1, 2, 3, 4;
--TEST: partition by time
select col2, col4, col1, var_samp(col5) over(partition by col2 order by col2, col4, col1 desc) from var_samp_pk order by 1, 2, 3, 4;
--TEST: partition by timestamp
select col3, var_samp(all col5) over(partition by col3 order by 1, 3) var_samp, col2 from var_samp_pk order by 1, 2;
--TEST: partition by datetime
select col4, col1, var_samp(col5) over(partition by col4 order by 1, 2 desc) var_samp from var_samp_pk order by 1, 2, 3;
--TEST: syntax error
select col1, col2, var_samp(distinctrow col5) over(order by col1, col2 partition by col2) from var_samp_pk order by 1, 2;
--TEST: OVER(PARTITION BY ORDER BY) clause, table with fk
--TEST: partition by int
select col1, col2, col3, var_samp(distinct col1) over(partition by col1 order by 1, 2, 3) from var_samp_fk order by 1, 2, 3, 4;
--TEST: partition by char(n)
select col2, col3, col1, var_samp(col1) over(partition by col2 order by col2, col3, col1 desc) from var_samp_fk order by 1, 2, 3, 4;
--TEST: partition by timestamp
select col3, var_samp(all col1) over(partition by col3 order by 1, 3) var_samp, col2 from var_samp_fk order by 1, 2;
--TEST: syntax error
select col1, col2, var_samp(unique col1) over(order by col1, col2 partition by col2) from var_samp_fk;
drop table var_samp_fk;
drop table var_samp_pk;
|
DROP TABLE "public"."RoomPersonRole";
|
<reponame>liveprojects-alex/gaddum_app
SELECT * FROM music_provider_settings
WHERE
[provider] = ?1
AND
[id] = ?2
|
EXEC [EST].[Proc_yjbb_Ins] @Code = N'603058',@CutoffDate = N'2017-09-30',@EPS = N'0.1379',@EPSDeduct = N'0',@Revenue = N'2.22亿',@RevenueYoy = N'-0.94',@RevenueQoq = N'22.37',@Profit = N'5812.24万',@ProfitYoy = N'-13.59',@ProfiltQoq = N'11.91',@NAVPerUnit = N'1.9434',@ROE = N'7.27',@CashPerUnit = N'0.1597',@GrossProfitRate = N'35.62',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-27'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'603058',@CutoffDate = N'2017-06-30',@EPS = N'0.0961',@EPSDeduct = N'0.0976',@Revenue = N'1.44亿',@RevenueYoy = N'-15.37',@RevenueQoq = N'-21.41',@Profit = N'4049.82万',@ProfitYoy = N'-14.32',@ProfiltQoq = N'-36.37',@NAVPerUnit = N'1.9016',@ROE = N'5.13',@CashPerUnit = N'0.0888',@GrossProfitRate = N'36.28',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-08-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'603058',@CutoffDate = N'2017-03-31',@EPS = N'0.06',@EPSDeduct = N'0',@Revenue = N'8077.26万',@RevenueYoy = N'31.62',@RevenueQoq = N'-22.25',@Profit = N'2474.95万',@ProfitYoy = N'17.57',@ProfiltQoq = N'-6.51',@NAVPerUnit = N'1.9043',@ROE = N'3.13',@CashPerUnit = N'0.0560',@GrossProfitRate = N'42.66',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'603058',@CutoffDate = N'2016-06-30',@EPS = N'0.1246',@EPSDeduct = N'0.1172',@Revenue = N'1.70亿',@RevenueYoy = N'-',@RevenueQoq = N'77.74',@Profit = N'4726.47万',@ProfitYoy = N'-',@ProfiltQoq = N'24.52',@NAVPerUnit = N'1.4728',@ROE = N'8.74',@CashPerUnit = N'0.1558',@GrossProfitRate = N'36.41',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-08-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'603058',@CutoffDate = N'2016-03-31',@EPS = N'0.06',@EPSDeduct = N'0',@Revenue = N'6136.69万',@RevenueYoy = N'-',@RevenueQoq = N'-',@Profit = N'2105.17万',@ProfitYoy = N'-',@ProfiltQoq = N'-',@NAVPerUnit = N'0.0000',@ROE = N'3.97',@CashPerUnit = N'0.0000',@GrossProfitRate = N'44.36',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'603058',@CutoffDate = N'2015-12-31',@EPS = N'0.2405',@EPSDeduct = N'0.2304',@Revenue = N'3.29亿',@RevenueYoy = N'-6.26',@RevenueQoq = N'-',@Profit = N'9125.00万',@ProfitYoy = N'-1.44',@ProfiltQoq = N'-',@NAVPerUnit = N'1.3912',@ROE = N'17.87',@CashPerUnit = N'0.2656',@GrossProfitRate = N'36.82',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'603058',@CutoffDate = N'2016-12-31',@EPS = N'0.2224',@EPSDeduct = N'0.206',@Revenue = N'3.28亿',@RevenueYoy = N'-0.25',@RevenueQoq = N'93.84',@Profit = N'9373.77万',@ProfitYoy = N'2.73',@ProfiltQoq = N'32.37',@NAVPerUnit = N'1.8456',@ROE = N'16.71',@CashPerUnit = N'0.2304',@GrossProfitRate = N'36.91',@Distribution = N'10派0.4',@DividenRate = N'0.18',@AnnounceDate = N'2017-04-28'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'603058',@CutoffDate = N'2012-12-31',@EPS = N'0.49',@EPSDeduct = N'0.49',@Revenue = N'3.25亿',@RevenueYoy = N'-',@RevenueQoq = N'-',@Profit = N'9253.59万',@ProfitYoy = N'-',@ProfiltQoq = N'-',@NAVPerUnit = N'2.4469',@ROE = N'21.92',@CashPerUnit = N'0.7753',@GrossProfitRate = N'38.47',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-06-12'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'603058',@CutoffDate = N'2016-09-30',@EPS = N'0.1773',@EPSDeduct = N'0',@Revenue = N'2.24亿',@RevenueYoy = N'-',@RevenueQoq = N'-50.86',@Profit = N'6726.40万',@ProfitYoy = N'-',@ProfiltQoq = N'-23.71',@NAVPerUnit = N'0.0000',@ROE = N'12.26',@CashPerUnit = N'0.0000',@GrossProfitRate = N'35.59',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-27'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'603058',@CutoffDate = N'2014-12-31',@EPS = N'0.49',@EPSDeduct = N'0.4791',@Revenue = N'3.51亿',@RevenueYoy = N'1.63',@RevenueQoq = N'-',@Profit = N'9258.78万',@ProfitYoy = N'-4.26',@ProfiltQoq = N'-',@NAVPerUnit = N'2.6013',@ROE = N'20.71',@CashPerUnit = N'0.3665',@GrossProfitRate = N'34.49',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-06-12'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'603058',@CutoffDate = N'2013-12-31',@EPS = N'0.51',@EPSDeduct = N'0.51',@Revenue = N'3.45亿',@RevenueYoy = N'6.22',@RevenueQoq = N'-',@Profit = N'9671.25万',@ProfitYoy = N'4.51',@ProfiltQoq = N'-',@NAVPerUnit = N'2.1132',@ROE = N'21.13',@CashPerUnit = N'0.6564',@GrossProfitRate = N'36.40',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-06-12'
|
<reponame>nullivex/node-portal-skeleton
ALTER TABLE `Saleleap`.`disputes`
ADD COLUMN `SellerId` INT(11) NULL DEFAULT NULL AFTER `updatedAt`;
|
<gh_stars>0
/*
Missing Index Details from SQLQuery6.sql - (local).FAAD2 (sa (51))
The Query Processor estimates that implementing the following index could improve the query cost by 53.7441%.
*/
USE [FAAD2]
GO
CREATE NONCLUSTERED INDEX IDX_crmOppStageHistory_01
ON [dbo].[crmOppStageHistory] ([OppID])
INCLUDE ([OppStageName],[OppProb],[OppExpectedRev],[OppChageDate])
GO
|
INSERT INTO UserRoles( username ,password) VALUES('<PASSWORD>',5<PASSWORD>);
INSERT INTO UserRoles( username ,password) VALUES('<PASSWORD>',<PASSWORD>);
INSERT INTO UserRoles( username ,password) VALUES('Onke',2752);
|
-- after "FROM purchases" add code to get rows where the "category" column is "food"
-- or the "character_name" column name is "<NAME>"
SELECT *
FROM purchases
WHERE category="food"
OR character_name="<NAME>";
|
USE `autoclub`;
DROP procedure IF EXISTS `sp_ListTableData`;
DELIMITER $$
CREATE PROCEDURE `sp_ListTableData` (IN TableName VARCHAR(100))
BEGIN
SET @sql =CONCAT('SELECT * FROM ',TableName);
PREPARE statement FROM @sql;
EXECUTE statement;
DEALLOCATE PREPARE statement;
END$$
DELIMITER ;
|
<reponame>jdkoren/sqlite-parser
-- randexpr1.test
--
-- db eval {SELECT case +c-case (select case count(distinct 13) when min(19*e) then ~count(*) else ~min(case when not +13*(case when e*c>=e then e else f end)-a+c not in (b,t1.b,t1.e) then 19 else 17 end*a) end from t1) when 11 then 11 else c end+t1.c when t1.b then d else 19 end FROM t1 WHERE t1.a<>~coalesce((select max(e) from t1 where 13-17*13<>19*17-f or coalesce((select max(~case +t1.d-f*e | c+(17)+a | c*((b)) when a then t1.a else d end-d) from t1 where t1.c>= -t1.a),t1.b) | 19>t1.a),c)}
SELECT case +c-case (select case count(distinct 13) when min(19*e) then ~count(*) else ~min(case when not +13*(case when e*c>=e then e else f end)-a+c not in (b,t1.b,t1.e) then 19 else 17 end*a) end from t1) when 11 then 11 else c end+t1.c when t1.b then d else 19 end FROM t1 WHERE t1.a<>~coalesce((select max(e) from t1 where 13-17*13<>19*17-f or coalesce((select max(~case +t1.d-f*e | c+(17)+a | c*((b)) when a then t1.a else d end-d) from t1 where t1.c>= -t1.a),t1.b) | 19>t1.a),c)
|
<filename>docs/vuln_samples/sqlite-bad-ptr.sql
SELECT 0 UNION SELECT 0 ORDER BY 1 COLLATE"""""""";
|
use sakila;
select * from actor, film, customer;
Select * from film;
select distinct film language from language as alias;
select count * (type) store;
select count * (type) employees;
select * into employees from first names
|
/* 'name's are already unique, so it would allow 1 NULL value. */
ALTER TABLE secrets ALTER COLUMN name SET NOT NULL;
ALTER TABLE secrets ALTER COLUMN secret SET NOT NULL;
ALTER TABLE secrets ALTER COLUMN version SET NOT NULL;
ALTER TABLE secrets ALTER COLUMN metadata SET NOT NULL;
ALTER TABLE secrets ALTER COLUMN createdAt SET NOT NULL;
ALTER TABLE secrets ALTER COLUMN updatedAt SET NOT NULL;
ALTER TABLE secrets ALTER COLUMN createdAt SET DEFAULT NOW();
ALTER TABLE secrets ALTER COLUMN updatedAt SET DEFAULT NOW();
ALTER TABLE groups ALTER COLUMN name SET NOT NULL;
ALTER TABLE groups ALTER COLUMN createdAt SET NOT NULL;
ALTER TABLE groups ALTER COLUMN updatedAt SET NOT NULL;
ALTER TABLE groups ALTER COLUMN createdAt SET DEFAULT NOW();
ALTER TABLE groups ALTER COLUMN updatedAt SET DEFAULT NOW();
ALTER TABLE clients ALTER COLUMN name SET NOT NULL;
ALTER TABLE clients ALTER COLUMN createdAt SET NOT NULL;
ALTER TABLE clients ALTER COLUMN updatedAt SET NOT NULL;
ALTER TABLE clients ALTER COLUMN createdAt SET DEFAULT NOW();
ALTER TABLE clients ALTER COLUMN updatedAt SET DEFAULT NOW();
ALTER TABLE accessGrants ALTER COLUMN createdAt SET NOT NULL;
ALTER TABLE accessGrants ALTER COLUMN updatedAt SET NOT NULL;
ALTER TABLE accessGrants ALTER COLUMN createdAt SET DEFAULT NOW();
ALTER TABLE accessGrants ALTER COLUMN updatedAt SET DEFAULT NOW();
ALTER TABLE memberships ALTER COLUMN createdAt SET NOT NULL;
ALTER TABLE memberships ALTER COLUMN updatedAt SET NOT NULL;
ALTER TABLE memberships ALTER COLUMN createdAt SET DEFAULT NOW();
ALTER TABLE memberships ALTER COLUMN updatedAt SET DEFAULT NOW();
|
<gh_stars>10-100
CREATE INDEX "identity_verifiable_addresses_nid_identity_id_idx" ON "identity_verifiable_addresses" (identity_id, nid);
|
udf: e209
sql: |
CREATE TEMPORARY FUNCTION ... ;
unk: 7
|
/*
-- This shows the critical semantic difference between "now()" (transactional)
-- and "clock_timestamp()" (non-transactional).
do $body$
declare
t0 timestamptz;
t1 timestamptz;
diff interval;
d numeric;
begin
perform pg_sleep(1.0);
t0 := now();
t1 := clock_timestamp();
diff := (t1 - t0);
d := extract(seconds from diff)::numeric;
assert
(d between 0.99 and 1.01),
'assert failed';
end;
$body$;
--------------------------------------------------------------------------------
*/;
create or replace procedure start_clock()
language plpgsql
as $body$
declare
-- Produce a bare timestamp value representing what "clock_timestamp()"
-- (which returns a timestamptz value in the session's current timezone)
-- would be on a wall clock in in UTC.
--
-- These two expressions have identical meaning:
--
-- timezone('UTC', clock_timestamp())
--
-- and:
--
-- clock_timestamp() at time zone 'UTC'
--
-- The second is SQL-Standard-compilant but more verbose.
--
-- If "start_clock()" and "elapsed_time()" were called in
-- the same txn and the session timeszone were changed between
-- the two calls, then we'd get wrong results without doing the
-- conversion to UTC.
start_time constant text not null :=
timezone('UTC', clock_timestamp())::text;
begin
execute 'set clock.start_time to '''||start_time||'''';
end;
$body$;
create or replace function elapsed_time()
returns text
volatile
--
-- This must be marked "volatile" if it's to be used to
-- start and stop the clock _within_ a stored proc because
-- of the transactional behavior of the "set" and "get
-- for a sessipon variable:
--
-- SET: "set clock.start_time to..."
-- GET: "current_setting('clock.start_time')"
--
-- I don't have a mental model for this, but anyway
-- marking it "immuable" has the effect the "elapsed_time()"
-- always reports zero (see as "less than ~20 ms." here).
--
language plpgsql
as $body$
declare
start_time constant timestamp not null :=
current_setting('clock.start_time');
curr_time constant timestamp not null :=
timezone('UTC', clock_timestamp());
diff constant interval := curr_time - start_time;
hours constant numeric := extract(hours from diff);
minutes constant numeric := extract(minutes from diff);
seconds constant numeric := extract(seconds from diff);
begin
return
case
when seconds < 0.020
and minutes < 1
and hours < 1 then 'less than ~20 ms.'
when seconds between 0.020 and 2.0
and minutes < 1
and hours < 1 then ltrim(to_char(round(seconds*1000), '999999'))||' ms.'
when seconds between 2.0 and 59.999
and minutes < 1
and hours < 1 then ltrim(to_char(seconds, '99.9'))||' sec.'
when minutes between 1 and 59
and hours < 1 then ltrim(to_char(minutes, '99'))||':'||
ltrim(to_char(seconds, '09'))||' min.'
else ltrim(to_char(hours, '09'))||':'||
ltrim(to_char(minutes, '09'))||':'||
ltrim(to_char(seconds, '09'))||' hours'
end;
end;
$body$;
-- "warming up" the use seems to improve the accuracy of the reported time.
do $body$
declare
t text not null := '';
begin
for j in 1..5 loop
call start_clock();
t := (select elapsed_time());
end loop;
end;
$body$;
/*
------------------------------------------------------------
-- TEST IT.
do $body$
declare
-- pg_sleep is take as SECONDS.
-- seconds
-- --------
-- 3822 sec -- 01:03:42
sleep_seconds constant double precision[] := array[
'0.016',
'0.023',
'103.0' -- 01:43
];
t text not null := '';
begin
for j in 1..array_upper(sleep_seconds, 1) loop
call start_clock();
perform pg_sleep(sleep_seconds[j]);
t := elapsed_time();
raise info '% :: %',
to_char(sleep_seconds[j], '99999990.999'), t;
end loop;
end;
$body$;
------------------------------------------------------------
*/;
|
ALTER TABLE AllstarFull RENAME TO tmp_allstarfull;
ALTER TABLE tmp_allstarfull RENAME TO allstarfull;
ALTER TABLE FieldingOF RENAME TO tmp_fieldingof;
ALTER TABLE tmp_fieldingof RENAME TO fieldingof;
ALTER TABLE Salaries RENAME TO tmp_salaries;
ALTER TABLE tmp_salaries RENAME TO salaries;
ALTER TABLE Appearances RENAME TO tmp_appearances;
ALTER TABLE tmp_appearances RENAME TO appearances;
ALTER TABLE FieldingPost RENAME TO tmp_fieldingpost;
ALTER TABLE tmp_fieldingpost RENAME TO fieldingpost;
ALTER TABLE Schools RENAME TO tmp_schools;
ALTER TABLE tmp_schools RENAME TO schools;
ALTER TABLE AwardsManagers RENAME TO tmp_awardsmanagers;
ALTER TABLE tmp_awardsmanagers RENAME TO awardsmanagers;
ALTER TABLE HOFold RENAME TO tmp_hofold;
ALTER TABLE tmp_hofold RENAME TO hofold;
ALTER TABLE SchoolsPlayers RENAME TO tmp_schoolsplayers;
ALTER TABLE tmp_schoolsplayers RENAME TO schoolsplayers;
ALTER TABLE AwardsPlayers RENAME TO tmp_awardsplayers;
ALTER TABLE tmp_awardsplayers RENAME TO awardsplayers;
ALTER TABLE HallOfFame RENAME TO tmp_halloffame;
ALTER TABLE tmp_halloffame RENAME TO halloffame;
ALTER TABLE SeriesPost RENAME TO tmp_seriespost;
ALTER TABLE tmp_seriespost RENAME TO seriespost;
ALTER TABLE AwardsShareManagers RENAME TO tmp_awardssharemanagers;
ALTER TABLE tmp_awardssharemanagers RENAME TO awardssharemanagers;
ALTER TABLE Managers RENAME TO tmp_managers;
ALTER TABLE tmp_managers RENAME TO managers;
ALTER TABLE Teams RENAME TO tmp_teams;
ALTER TABLE tmp_teams RENAME TO teams;
ALTER TABLE AwardsSharePlayers RENAME TO tmp_awardsshareplayers;
ALTER TABLE tmp_awardsshareplayers RENAME TO awardsshareplayers;
ALTER TABLE ManagersHalf RENAME TO tmp_managershalf;
ALTER TABLE tmp_managershalf RENAME TO managershalf;
ALTER TABLE TeamsFranchises RENAME TO tmp_teamsfranchises;
ALTER TABLE tmp_teamsfranchises RENAME TO teamsfranchises;
ALTER TABLE Batting RENAME TO tmp_batting;
ALTER TABLE tmp_batting RENAME TO batting;
ALTER TABLE Master RENAME TO tmp_master;
ALTER TABLE tmp_master RENAME TO master;
ALTER TABLE TeamsHalf RENAME TO tmp_teamshalf;
ALTER TABLE tmp_teamshalf RENAME TO teamshalf;
ALTER TABLE BattingPost RENAME TO tmp_battingpost;
ALTER TABLE tmp_battingpost RENAME TO battingpost;
ALTER TABLE Pitching RENAME TO tmp_pitching;
ALTER TABLE tmp_pitching RENAME TO pitching;
ALTER TABLE Fielding RENAME TO tmp_fielding;
ALTER TABLE tmp_fielding RENAME TO fielding;
ALTER TABLE PitchingPost RENAME TO tmp_pitchingpost;
ALTER TABLE tmp_pitchingpost RENAME TO pitchingpost;
|
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Jun 13, 2020 at 10:40 AM
-- Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1
-- PHP Version: 7.2.26-1+ubuntu18.04.1+deb.sury.org+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: `fpoints`
--
-- --------------------------------------------------------
--
-- Table structure for table `absensi`
--
CREATE TABLE `absensi` (
`id_siswa` bigint(20) NOT NULL,
`id_status_absensi` int(11) NOT NULL,
`tanggal` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `agama`
--
CREATE TABLE `agama` (
`id_agama` int(11) NOT NULL,
`agama` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `agama`
--
INSERT INTO `agama` (`id_agama`, `agama`) VALUES
(1, 'ISLAM1'),
(2, 'KRISTEN'),
(3, 'HINDU'),
(4, 'BUDDHA'),
(5, 'KONG HU CHU'),
(6, 'Kong guang');
-- --------------------------------------------------------
--
-- Table structure for table `akumulasi_point`
--
CREATE TABLE `akumulasi_point` (
`id_siswa` bigint(20) NOT NULL,
`id_sanksi` int(11) NOT NULL,
`tanggal` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `aturan`
--
CREATE TABLE `aturan` (
`id_aturan` int(11) NOT NULL,
`id_kategori` int(11) DEFAULT NULL,
`id_tindakan` int(11) DEFAULT NULL,
`pasal` varchar(10) DEFAULT NULL,
`uraian_aturan` text,
`point_aturan` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `aturan`
--
INSERT INTO `aturan` (`id_aturan`, `id_kategori`, `id_tindakan`, `pasal`, `uraian_aturan`, `point_aturan`) VALUES
(4, 2, NULL, 'A1', 'Datang terlambat < 15 menit', 5),
(5, 2, NULL, 'A2', 'Datang terlambat > 15 menit', 15);
-- --------------------------------------------------------
--
-- Table structure for table `hari_efektif`
--
CREATE TABLE `hari_efektif` (
`id_hari_efektif` int(11) NOT NULL,
`nama_hari_efektif` varchar(10) NOT NULL,
`status_hari_efektif` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `hari_efektif`
--
INSERT INTO `hari_efektif` (`id_hari_efektif`, `nama_hari_efektif`, `status_hari_efektif`) VALUES
(1, 'Senin', 1),
(2, 'Selasa', 1),
(3, 'Rabu', 1),
(4, 'Kamis', 1),
(5, 'Jum\'at', 1),
(6, 'Sabtu', 0),
(7, 'Minggu', 0);
-- --------------------------------------------------------
--
-- Table structure for table `hari_tidak_efektif`
--
CREATE TABLE `hari_tidak_efektif` (
`id_hari_tidak_efektif` int(11) NOT NULL,
`tanggal_tidak_efektif` date DEFAULT NULL,
`keterangan_tidak_efektif` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `hari_tidak_efektif`
--
INSERT INTO `hari_tidak_efektif` (`id_hari_tidak_efektif`, `tanggal_tidak_efektif`, `keterangan_tidak_efektif`) VALUES
(3, '2020-06-01', 'an only install one of: mpdf/mpdf[v8.0.6, v7.1.8].\r\n - Installation request for mpdf/mpdf (locked at v7.1.8) -> satisfiable by mpdf/mpdf[v7.1.8].'),
(4, '2020-06-02', 'an only install one of: mpdf/mpdf[v8.0.6, v7.1.8].\r\n - Installation request for mpdf/mpdf (locked at v7.1.8) -> satisfiable by mpdf/mpdf[v7.1.8].');
-- --------------------------------------------------------
--
-- Table structure for table `jurusan`
--
CREATE TABLE `jurusan` (
`id_jurusan` int(11) NOT NULL,
`jurusan` varchar(50) DEFAULT NULL,
`kepala_jurusan` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `jurusan`
--
INSERT INTO `jurusan` (`id_jurusan`, `jurusan`, `kepala_jurusan`) VALUES
(1, 'Rekayasa Perangkat Lunak', 'Defri Indra Mahardika1');
-- --------------------------------------------------------
--
-- Table structure for table `kategori_aturan`
--
CREATE TABLE `kategori_aturan` (
`id_kategori` int(11) NOT NULL,
`kategori_aturan` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `kategori_aturan`
--
INSERT INTO `kategori_aturan` (`id_kategori`, `kategori_aturan`) VALUES
(2, 'Kehadiran');
-- --------------------------------------------------------
--
-- Table structure for table `kelas`
--
CREATE TABLE `kelas` (
`id_kelas` int(11) NOT NULL,
`id_jurusan` int(11) DEFAULT NULL,
`id_wali_kelas` int(11) DEFAULT NULL,
`kelas` varchar(3) DEFAULT NULL,
`grade` varchar(3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `kelas`
--
INSERT INTO `kelas` (`id_kelas`, `id_jurusan`, `id_wali_kelas`, `kelas`, `grade`) VALUES
(19, 1, 8, 'C', 'XII');
-- --------------------------------------------------------
--
-- Table structure for table `migration`
--
CREATE TABLE `migration` (
`version` varchar(180) NOT NULL,
`apply_time` int(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `migration`
--
INSERT INTO `migration` (`version`, `apply_time`) VALUES
('m000000_000000_base', NULL),
('m130524_201442_init', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `nama_kelas`
--
CREATE TABLE `nama_kelas` (
`id_kelas` int(11) NOT NULL,
`nama_kelas` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `nama_kelas`
--
INSERT INTO `nama_kelas` (`id_kelas`, `nama_kelas`) VALUES
(19, 'XII Rekayasa Perangkat Lunak C');
-- --------------------------------------------------------
--
-- Table structure for table `on_kelas_siswa`
--
CREATE TABLE `on_kelas_siswa` (
`id_kelas` int(11) NOT NULL,
`id_siswa` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `pegawai`
--
CREATE TABLE `pegawai` (
`id_pegawai` int(11) NOT NULL,
`id_agama` int(11) NOT NULL,
`nama_pegawai` varchar(100) NOT NULL,
`alamat_pegawai` text NOT NULL,
`jenis_kelamin_pegawai` enum('L','P') NOT NULL,
`no_hp_pegawai` varchar(15) NOT NULL,
`status_kepegawaian` varchar(50) NOT NULL,
`jabatan_pegawai` varchar(50) NOT NULL,
`foto_pegawai` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `pegawai`
--
INSERT INTO `pegawai` (`id_pegawai`, `id_agama`, `nama_pegawai`, `alamat_pegawai`, `jenis_kelamin_pegawai`, `no_hp_pegawai`, `status_kepegawaian`, `jabatan_pegawai`, `foto_pegawai`) VALUES
(1, 1, 'admin', 'admin', 'L', '081234567890', 'Pegawai Tetap', 'Teknisi', ''),
(2, 1, 'Defri Indra Mahardika', 'Ds. Pulung Kec. Pulung', 'L', '+6285604845437', 'Tetap', 'Teknisi', '');
-- --------------------------------------------------------
--
-- Table structure for table `pekerjaan`
--
CREATE TABLE `pekerjaan` (
`id_pekerjaan` int(11) NOT NULL,
`nama_pekerjaan` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `pekerjaan`
--
INSERT INTO `pekerjaan` (`id_pekerjaan`, `nama_pekerjaan`) VALUES
(2, 'Wiraswasta'),
(3, 'Pegawai Negeri Sipil');
-- --------------------------------------------------------
--
-- Table structure for table `pelanggaran`
--
CREATE TABLE `pelanggaran` (
`id_siswa` bigint(20) NOT NULL,
`id_aturan` int(11) NOT NULL,
`tanggal` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `penghargaan`
--
CREATE TABLE `penghargaan` (
`id_penghargaan` int(11) NOT NULL,
`uraian_penghargaan` text,
`point_penghargaan` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `penghargaan`
--
INSERT INTO `penghargaan` (`id_penghargaan`, `uraian_penghargaan`, `point_penghargaan`) VALUES
(1, 'Membawa nama sekolah ke tingkat Provinsi', 10);
-- --------------------------------------------------------
--
-- Table structure for table `prestasi`
--
CREATE TABLE `prestasi` (
`id_siswa` bigint(20) NOT NULL,
`id_penghargaan` int(11) NOT NULL,
`tanggal` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `sanksi`
--
CREATE TABLE `sanksi` (
`id_sanksi` int(11) NOT NULL,
`uraian` text,
`minimum_point` int(11) DEFAULT NULL,
`maximum_point` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `siswa`
--
CREATE TABLE `siswa` (
`id_siswa` bigint(20) NOT NULL,
`id_wali_murid` int(11) NOT NULL,
`id_agama` int(11) NOT NULL,
`nis` varchar(20) NOT NULL,
`nama_siswa` varchar(50) NOT NULL,
`tempat_lahir_siswa` varchar(40) NOT NULL,
`tanggal_lahir_siswa` date NOT NULL,
`jenis_kelamin_siswa` char(1) NOT NULL,
`alamat_rumah_siswa` text NOT NULL,
`alamat_domisili_siswa` text NOT NULL,
`no_hp_siswa` varchar(15) NOT NULL,
`foto_siswa` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `siswa`
--
INSERT INTO `siswa` (`id_siswa`, `id_wali_murid`, `id_agama`, `nis`, `nama_siswa`, `tempat_lahir_siswa`, `tanggal_lahir_siswa`, `jenis_kelamin_siswa`, `alamat_rumah_siswa`, `alamat_domisili_siswa`, `no_hp_siswa`, `foto_siswa`) VALUES
(1, 1, 1, '1', '1', '1', '2020-06-02', 'P', 'L', 'A', '091882', '12');
-- --------------------------------------------------------
--
-- Table structure for table `sp`
--
CREATE TABLE `sp` (
`id_sp` int(11) NOT NULL,
`id_siswa` bigint(20) NOT NULL,
`tanggal_sp` date NOT NULL,
`jml_point_pelanggaran` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `status_absensi`
--
CREATE TABLE `status_absensi` (
`id_status_absensi` int(11) NOT NULL,
`keterangan_status_absensi` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `status_absensi`
--
INSERT INTO `status_absensi` (`id_status_absensi`, `keterangan_status_absensi`) VALUES
(1, 'Alpha'),
(2, 'Mbolos'),
(3, 'Hadir'),
(4, 'Sakit'),
(5, 'Izin');
-- --------------------------------------------------------
--
-- Table structure for table `tindakan`
--
CREATE TABLE `tindakan` (
`id_tindakan` int(11) NOT NULL,
`tindakan` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`id_pegawai` int(11) NOT NULL,
`username` varchar(32) DEFAULT NULL,
`auth_key` varchar(255) DEFAULT NULL,
`password_hash` varchar(255) DEFAULT NULL,
`password_reset_token` varchar(255) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`status` smallint(6) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id`, `id_pegawai`, `username`, `auth_key`, `password_hash`, `password_reset_token`, `email`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, 'admin', '<PASSWORD>', <PASSWORD>a6blxgbbPo.cOsMZrsip6xO94/dnYRVnRSjRfJjgrxPG', NULL, '<EMAIL>', 10, '2020-06-11 02:05:49', '2020-06-11 02:05:49');
-- --------------------------------------------------------
--
-- Table structure for table `wali_kelas`
--
CREATE TABLE `wali_kelas` (
`id_wali_kelas` int(11) NOT NULL,
`id_pegawai` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `wali_kelas`
--
INSERT INTO `wali_kelas` (`id_wali_kelas`, `id_pegawai`) VALUES
(8, 2);
-- --------------------------------------------------------
--
-- Table structure for table `wali_murid`
--
CREATE TABLE `wali_murid` (
`id_wali_murid` int(11) NOT NULL,
`id_pekerjaan` int(11) NOT NULL,
`id_agama` int(11) NOT NULL,
`nama_wali_murid` varchar(50) NOT NULL,
`tempat_lahir_wali_murid` varchar(50) NOT NULL,
`tanggal_lahir_wali_murid` date NOT NULL,
`jenis_kelamin_wali_murid` enum('L','P') NOT NULL,
`alamat_rumah_wali_murid` text NOT NULL,
`no_hp_wali_murid` varchar(15) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `wali_murid`
--
INSERT INTO `wali_murid` (`id_wali_murid`, `id_pekerjaan`, `id_agama`, `nama_wali_murid`, `tempat_lahir_wali_murid`, `tanggal_lahir_wali_murid`, `jenis_kelamin_wali_murid`, `alamat_rumah_wali_murid`, `no_hp_wali_murid`) VALUES
(1, 2, 1, '<NAME>', 'Ponorogo', '2002-05-19', 'L', 'Ds. Pulung Kec. Pulung', '085604845437');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `absensi`
--
ALTER TABLE `absensi`
ADD PRIMARY KEY (`id_siswa`,`id_status_absensi`),
ADD KEY `FK_ABSENSI2` (`id_status_absensi`);
--
-- Indexes for table `agama`
--
ALTER TABLE `agama`
ADD PRIMARY KEY (`id_agama`);
--
-- Indexes for table `akumulasi_point`
--
ALTER TABLE `akumulasi_point`
ADD PRIMARY KEY (`id_siswa`,`id_sanksi`),
ADD KEY `FK_AKUMULASI_POINT2` (`id_sanksi`);
--
-- Indexes for table `aturan`
--
ALTER TABLE `aturan`
ADD PRIMARY KEY (`id_aturan`),
ADD KEY `FK_ON_KATEGORI_ATURAN` (`id_kategori`),
ADD KEY `FK_ON_TINDAKAN_ATURAN` (`id_tindakan`);
--
-- Indexes for table `hari_efektif`
--
ALTER TABLE `hari_efektif`
ADD PRIMARY KEY (`id_hari_efektif`),
ADD UNIQUE KEY `nama_hari_efektif` (`nama_hari_efektif`);
--
-- Indexes for table `hari_tidak_efektif`
--
ALTER TABLE `hari_tidak_efektif`
ADD PRIMARY KEY (`id_hari_tidak_efektif`);
--
-- Indexes for table `jurusan`
--
ALTER TABLE `jurusan`
ADD PRIMARY KEY (`id_jurusan`);
--
-- Indexes for table `kategori_aturan`
--
ALTER TABLE `kategori_aturan`
ADD PRIMARY KEY (`id_kategori`);
--
-- Indexes for table `kelas`
--
ALTER TABLE `kelas`
ADD PRIMARY KEY (`id_kelas`),
ADD UNIQUE KEY `id_wali_kelas` (`id_wali_kelas`),
ADD KEY `FK_ON_JURUSAN_KELAS` (`id_jurusan`),
ADD KEY `FK_ON_WALIKELAS` (`id_wali_kelas`);
--
-- Indexes for table `migration`
--
ALTER TABLE `migration`
ADD PRIMARY KEY (`version`);
--
-- Indexes for table `nama_kelas`
--
ALTER TABLE `nama_kelas`
ADD PRIMARY KEY (`id_kelas`);
--
-- Indexes for table `on_kelas_siswa`
--
ALTER TABLE `on_kelas_siswa`
ADD PRIMARY KEY (`id_kelas`,`id_siswa`),
ADD KEY `FK_ON_KELAS_SISWA2` (`id_siswa`);
--
-- Indexes for table `pegawai`
--
ALTER TABLE `pegawai`
ADD PRIMARY KEY (`id_pegawai`),
ADD KEY `FK_ON_AGAMA_PEGAWAI` (`id_agama`);
--
-- Indexes for table `pekerjaan`
--
ALTER TABLE `pekerjaan`
ADD PRIMARY KEY (`id_pekerjaan`);
--
-- Indexes for table `pelanggaran`
--
ALTER TABLE `pelanggaran`
ADD PRIMARY KEY (`id_siswa`,`id_aturan`),
ADD KEY `FK_PELANGGARAN2` (`id_aturan`);
--
-- Indexes for table `penghargaan`
--
ALTER TABLE `penghargaan`
ADD PRIMARY KEY (`id_penghargaan`);
--
-- Indexes for table `prestasi`
--
ALTER TABLE `prestasi`
ADD PRIMARY KEY (`id_siswa`,`id_penghargaan`),
ADD KEY `FK_PRESTASI2` (`id_penghargaan`);
--
-- Indexes for table `sanksi`
--
ALTER TABLE `sanksi`
ADD PRIMARY KEY (`id_sanksi`);
--
-- Indexes for table `siswa`
--
ALTER TABLE `siswa`
ADD PRIMARY KEY (`id_siswa`),
ADD KEY `FK_ON_AGAMA_SISWA` (`id_agama`),
ADD KEY `FK_ON_WALI_MURid_siswa` (`id_wali_murid`);
--
-- Indexes for table `sp`
--
ALTER TABLE `sp`
ADD PRIMARY KEY (`id_sp`),
ADD KEY `FK_ON_SISWA_SP` (`id_siswa`);
--
-- Indexes for table `status_absensi`
--
ALTER TABLE `status_absensi`
ADD PRIMARY KEY (`id_status_absensi`);
--
-- Indexes for table `tindakan`
--
ALTER TABLE `tindakan`
ADD PRIMARY KEY (`id_tindakan`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_ON_PEGAWAI_USER` (`id_pegawai`);
--
-- Indexes for table `wali_kelas`
--
ALTER TABLE `wali_kelas`
ADD PRIMARY KEY (`id_wali_kelas`),
ADD UNIQUE KEY `id_pegawai` (`id_pegawai`),
ADD KEY `FK_ON_PEGAWAI_WALIKELAS` (`id_pegawai`);
--
-- Indexes for table `wali_murid`
--
ALTER TABLE `wali_murid`
ADD PRIMARY KEY (`id_wali_murid`),
ADD KEY `FK_ON_AGAMA_WALI_MURID` (`id_agama`),
ADD KEY `FK_ON_PEKERJAAN_WALI_MURID` (`id_pekerjaan`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `absensi`
--
ALTER TABLE `absensi`
MODIFY `id_siswa` bigint(20) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `agama`
--
ALTER TABLE `agama`
MODIFY `id_agama` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `aturan`
--
ALTER TABLE `aturan`
MODIFY `id_aturan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `hari_efektif`
--
ALTER TABLE `hari_efektif`
MODIFY `id_hari_efektif` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `hari_tidak_efektif`
--
ALTER TABLE `hari_tidak_efektif`
MODIFY `id_hari_tidak_efektif` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `jurusan`
--
ALTER TABLE `jurusan`
MODIFY `id_jurusan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `kategori_aturan`
--
ALTER TABLE `kategori_aturan`
MODIFY `id_kategori` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `kelas`
--
ALTER TABLE `kelas`
MODIFY `id_kelas` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
--
-- AUTO_INCREMENT for table `pegawai`
--
ALTER TABLE `pegawai`
MODIFY `id_pegawai` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `pekerjaan`
--
ALTER TABLE `pekerjaan`
MODIFY `id_pekerjaan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `penghargaan`
--
ALTER TABLE `penghargaan`
MODIFY `id_penghargaan` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `sanksi`
--
ALTER TABLE `sanksi`
MODIFY `id_sanksi` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `siswa`
--
ALTER TABLE `siswa`
MODIFY `id_siswa` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `sp`
--
ALTER TABLE `sp`
MODIFY `id_sp` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `status_absensi`
--
ALTER TABLE `status_absensi`
MODIFY `id_status_absensi` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `tindakan`
--
ALTER TABLE `tindakan`
MODIFY `id_tindakan` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `wali_kelas`
--
ALTER TABLE `wali_kelas`
MODIFY `id_wali_kelas` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `wali_murid`
--
ALTER TABLE `wali_murid`
MODIFY `id_wali_murid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `absensi`
--
ALTER TABLE `absensi`
ADD CONSTRAINT `FK_ABSENSI` FOREIGN KEY (`id_siswa`) REFERENCES `siswa` (`id_siswa`),
ADD CONSTRAINT `FK_ABSENSI2` FOREIGN KEY (`id_status_absensi`) REFERENCES `status_absensi` (`id_status_absensi`);
--
-- Constraints for table `akumulasi_point`
--
ALTER TABLE `akumulasi_point`
ADD CONSTRAINT `FK_AKUMULASI_POINT` FOREIGN KEY (`id_siswa`) REFERENCES `siswa` (`id_siswa`),
ADD CONSTRAINT `FK_AKUMULASI_POINT2` FOREIGN KEY (`id_sanksi`) REFERENCES `sanksi` (`id_sanksi`);
--
-- Constraints for table `aturan`
--
ALTER TABLE `aturan`
ADD CONSTRAINT `FK_ON_KATEGORI_ATURAN` FOREIGN KEY (`id_kategori`) REFERENCES `kategori_aturan` (`id_kategori`),
ADD CONSTRAINT `FK_ON_TINDAKAN_ATURAN` FOREIGN KEY (`id_tindakan`) REFERENCES `tindakan` (`id_tindakan`);
--
-- Constraints for table `kelas`
--
ALTER TABLE `kelas`
ADD CONSTRAINT `FK_ON_JURUSAN_KELAS` FOREIGN KEY (`id_jurusan`) REFERENCES `jurusan` (`id_jurusan`),
ADD CONSTRAINT `FK_ON_WALIKELAS` FOREIGN KEY (`id_wali_kelas`) REFERENCES `wali_kelas` (`id_wali_kelas`);
--
-- Constraints for table `nama_kelas`
--
ALTER TABLE `nama_kelas`
ADD CONSTRAINT `FK_ON_NAMA_KELAS` FOREIGN KEY (`id_kelas`) REFERENCES `kelas` (`id_kelas`);
--
-- Constraints for table `on_kelas_siswa`
--
ALTER TABLE `on_kelas_siswa`
ADD CONSTRAINT `FK_ON_KELAS_SISWA` FOREIGN KEY (`id_kelas`) REFERENCES `kelas` (`id_kelas`),
ADD CONSTRAINT `FK_ON_KELAS_SISWA2` FOREIGN KEY (`id_siswa`) REFERENCES `siswa` (`id_siswa`);
--
-- Constraints for table `pegawai`
--
ALTER TABLE `pegawai`
ADD CONSTRAINT `FK_ON_AGAMA_PEGAWAI` FOREIGN KEY (`id_agama`) REFERENCES `agama` (`id_agama`);
--
-- Constraints for table `pelanggaran`
--
ALTER TABLE `pelanggaran`
ADD CONSTRAINT `FK_PELANGGARAN` FOREIGN KEY (`id_siswa`) REFERENCES `siswa` (`id_siswa`),
ADD CONSTRAINT `FK_PELANGGARAN2` FOREIGN KEY (`id_aturan`) REFERENCES `aturan` (`id_aturan`);
--
-- Constraints for table `prestasi`
--
ALTER TABLE `prestasi`
ADD CONSTRAINT `FK_PRESTASI` FOREIGN KEY (`id_siswa`) REFERENCES `siswa` (`id_siswa`),
ADD CONSTRAINT `FK_PRESTASI2` FOREIGN KEY (`id_penghargaan`) REFERENCES `penghargaan` (`id_penghargaan`);
--
-- Constraints for table `siswa`
--
ALTER TABLE `siswa`
ADD CONSTRAINT `FK_ON_AGAMA_SISWA` FOREIGN KEY (`id_agama`) REFERENCES `agama` (`id_agama`),
ADD CONSTRAINT `FK_ON_WALI_MURid_siswa` FOREIGN KEY (`id_wali_murid`) REFERENCES `wali_murid` (`id_wali_murid`);
--
-- Constraints for table `sp`
--
ALTER TABLE `sp`
ADD CONSTRAINT `FK_ON_SISWA_SP` FOREIGN KEY (`id_siswa`) REFERENCES `siswa` (`id_siswa`);
--
-- Constraints for table `user`
--
ALTER TABLE `user`
ADD CONSTRAINT `FK_ON_PEGAWAI_USER` FOREIGN KEY (`id_pegawai`) REFERENCES `pegawai` (`id_pegawai`);
--
-- Constraints for table `wali_kelas`
--
ALTER TABLE `wali_kelas`
ADD CONSTRAINT `FK_ON_PEGAWAI_WALIKELAS` FOREIGN KEY (`id_pegawai`) REFERENCES `pegawai` (`id_pegawai`);
--
-- Constraints for table `wali_murid`
--
ALTER TABLE `wali_murid`
ADD CONSTRAINT `FK_ON_AGAMA_WALI_MURID` FOREIGN KEY (`id_agama`) REFERENCES `agama` (`id_agama`),
ADD CONSTRAINT `FK_ON_PEKERJAAN_WALI_MURID` FOREIGN KEY (`id_pekerjaan`) REFERENCES `pekerjaan` (`id_pekerjaan`);
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>db_setup/func_calc_mph.sql
create or replace function cmn.calcMPH(dist_mi decimal, tm_sec decimal)
returns decimal
as $$
--calculate miles per hour based on the passed distance and time
SELECT
round(dist_mi / tm_sec*3600,2)
;
$$ LANGUAGE SQL
|
-- SELECT * result in a sequential scan
SELECT *
FROM title_basics;
-- Predicates involving an index can be more efficient (also pay attention to the width)
SELECT *
FROM title_basics
WHERE "tconst" = 368226;
-- Selecting fewer attributes reduces the width
SELECT "originalTitle", "runtimeMinutes"
FROM title_basics
WHERE "tconst" = 368226;
-- drop some indices to make queries slow
DROP INDEX "ix_title_basics_titleType";
-- drop some indices to make queries slow
DROP INDEX "ix_title_basics_runtimeMinutes";
-- Create an index to show how it changes the query (w/o index)
SELECT *
FROM title_basics
WHERE "titleType" = 'movie';
-- Create an index to show how it changes the query
CREATE INDEX "ix_title_basics_titleType" on title_basics("titleType");
-- Create an index to show how it changes the query (now with index)
SELECT *
FROM title_basics
WHERE "titleType" = 'movie';
-- Sorting on an attribute w/o an index
SELECT "originalTitle", "runtimeMinutes"
FROM title_basics
WHERE "runtimeMinutes" is not null
AND "titleType" = 'movie'
ORDER BY "runtimeMinutes" DESC
LIMIT 10;
-- Create index on that attribute
CREATE INDEX "ix_title_basics_runtimeMinutes" on title_basics("runtimeMinutes");
-- Sorting on an attribute w/ an index
SELECT "originalTitle", "runtimeMinutes"
FROM title_basics
WHERE "runtimeMinutes" is not null
AND "titleType" = 'movie'
ORDER BY "runtimeMinutes" DESC
LIMIT 10;
-- Simple query plan for an aggregation + join (group by on non-indexed attribute)
SELECT "originalTitle", COUNT(*)
FROM title_basics RIGHT JOIN title_episode USING (tconst)
GROUP BY "originalTitle";
-- Simple query plan for an aggregation + several joins (group by on indexed attribute)
SELECT "originalTitle", counts.c
FROM title_basics INNER JOIN (
SELECT tconst, COUNT(*) as c
FROM title_basics RIGHT JOIN title_episode USING (tconst)
GROUP BY tconst
) counts ON title_basics.tconst = counts.tconst;
-- actors in The Room (2003)
SELECT n."primaryName"
FROM title_principals p, name_basics n
WHERE p.nconst = n.nconst
AND p.tconst = 368226;
-- other movies that actors in The Room appeared in
SELECT n."primaryName", t."originalTitle"
FROM title_principals p1, title_principals p2, name_basics n, title_basics t
WHERE p1.nconst = n.nconst AND p2.nconst = n.nconst
AND p1.tconst = 368226
AND p2.tconst = t.tconst
AND t."titleType" = 'movie';
-- films <NAME> has been in
SELECT p1.tconst
FROM title_principals p1
INNER JOIN name_basics n ON n.nconst = p1.nconst
WHERE n."primaryName" = '<NAME>' AND p1."category" = 'actor';
-- actors who have been in films with <NAME> (bacon number = 1)
SELECT DISTINCT p2.nconst, p2.tconst
FROM title_principals p2 INNER JOIN
(
SELECT p1.tconst
FROM title_principals p1
INNER JOIN name_basics n ON n.nconst = p1.nconst
WHERE n."primaryName" = '<NAME>' AND p1."category" = 'actor'
) p1 ON p2.tconst = p1.tconst;
-- bacon number = 2
SELECT DISTINCT p3.nconst, p3.tconst
FROM title_principals p3 INNER JOIN
(
SELECT p2.tconst
FROM title_principals p2 INNER JOIN
(
SELECT p1.tconst
FROM title_principals p1
INNER JOIN name_basics n ON n.nconst = p1.nconst
WHERE n."primaryName" = '<NAME>' AND p1."category" = 'actor'
) p1 ON p2.tconst = p1.tconst
WHERE p2.nconst != 102
) p2 ON p3.tconst = p2.tconst
WHERE p3.nconst != 102;
-- bacon number = 3
SELECT DISTINCT p4.nconst, p4.tconst
FROM title_principals p4 INNER JOIN (
SELECT p3.tconst
FROM title_principals p3 INNER JOIN
(
SELECT p2.tconst
FROM title_principals p2 INNER JOIN
(
SELECT p1.tconst
FROM title_principals p1
INNER JOIN name_basics n ON n.nconst = p1.nconst
WHERE n."primaryName" = '<NAME>' AND p1."category" = 'actor'
) p1 ON p2.tconst = p1.tconst
WHERE p2.nconst != 102
) p2 ON p3.tconst = p2.tconst
WHERE p3.nconst != 102
) p3 ON p4.tconst = p3.tconst
WHERE p4.nconst != 102;
-- bacon number = 4
SELECT DISTINCT p5.nconst, p5.tconst
FROM title_principals p5 INNER JOIN (
SELECT p4.tconst
FROM title_principals p4 INNER JOIN (
SELECT p3.tconst
FROM title_principals p3 INNER JOIN
(
SELECT p2.tconst
FROM title_principals p2 INNER JOIN
(
SELECT p1.tconst
FROM title_principals p1
INNER JOIN name_basics n ON n.nconst = p1.nconst
WHERE n."primaryName" = '<NAME>' AND p1."category" = 'actor'
) p1 ON p2.tconst = p1.tconst
WHERE p2.nconst != 102
) p2 ON p3.tconst = p2.tconst
WHERE p3.nconst != 102
) p3 ON p4.tconst = p3.tconst
WHERE p4.nconst != 102
) p4 ON p5.tconst = p4.tconst
WHERE p5.nconst != 102;
-- that's the end!
|
<gh_stars>0
-- @testpoint:opengauss关键字partial(非保留),作为视图名
--关键字partial作为视图名,不带引号,创建成功
CREATE or replace VIEW partial AS
SELECT * FROM pg_tablespace WHERE spcname = 'pg_default';
drop view partial;
--关键字partial作为视图名,加双引号,创建成功
CREATE or replace VIEW "partial" AS
SELECT * FROM pg_tablespace WHERE spcname = 'pg_default';
drop VIEW "partial";
--关键字partial作为视图名,加单引号,合理报错
CREATE or replace VIEW 'partial' AS
SELECT * FROM pg_tablespace WHERE spcname = 'pg_default';
--关键字partial作为视图名,加反引号,合理报错
CREATE or replace VIEW `partial` AS
SELECT * FROM pg_tablespace WHERE spcname = 'pg_default';
|
INSERT INTO shortstop_metric (
player_id,first_name,last_name,wRC,BB_percent,K_percent,barrel_p,hardhit_p,max_exit,avg_EV,zone_contact,chase,BABIP
)
VALUES
(1,'Bo','Bichette',122,0.06,0.20,0.10,0.48,116,91,0.89,0.43,0.339),
(2,'JP','Crawford',103,0.08,0.17,0.02,0.30,111,86,0.92,0.26,0.320),
(3,'Isiah','<NAME>',85,0.04,0.13,0.02,0.29,108,86,0.95,0.34,0.304),
(4,'Dansby','Swanson',98,0.08,0.26,0.11,0.42,110,89,0.81,0.29,0.297),
(5,'Carlos','Correa',134,0.12,0.18,0.09,0.43,116,90,0.89,0.27,0.308),
(6,'Xander','Bogaerts',130,0.10,0.19,0.10,0.43,114,90,0.87,0.34,0.333),
(7,'Trevor','Story',100,0.09,0.23,0.10,0.43,111,91,0.86,0.34,0.293),
(8,'Amed','Rosario',99,0.05,0.20,0.03,0.43,112,89,0.85,0.37,0.340),
(9,'Luis','Urias',111,0.11,0.20,0.09,0.40,112,88,0.85,0.29,0.280),
(10,'Nicky','Lopez',106,0.09,0.13,0.01,0.27,108,87,0.93,0.28,0.347),
(11,'Willy','Adames',119,0.10,0.28,0.11,0.45,113,90,0.79,0.32,0.331),
(12,'Kevin','Newman',54,0.05,0.07,0.02,0.26,109,85,0.95,0.31,0.236),
(13,'Tim','Anderson',120,0.04,0.22,0.08,0.42,110,90,0.85,0.41,0.372),
(14,'Brandon','Crawford',139,0.10,0.19,0.12,0.43,110,89,0.82,0.32,0.334),
(15,'Fernando','<NAME>',156,0.11,0.28,0.21,0.56,117,94,0.80,0.33,0.324),
(16,'Elvis','Andrus',72,0.06,0.15,0.02,0.35,110,88,0.92,0.35,0.283),
(17,'Miguel','Rojas',97,0.07,0.14,0.03,0.33,109,86,0.91,0.30,0.295),
(18,'Kyle','Farmer',91,0.04,0.18,0.04,0.32,108,87,0.90,0.39,0.296),
(19,'Francisco','Lindor',103,0.11,0.18,0.08,0.44,113,91,0.86,0.30,0.248),
(20,'Gleyber','Torres',94,0.10,0.20,0.08,0.36,112,87,0.83,0.28,0.314),
(21,'Jose','Iglesias',91,0.04,0.15,0.03,0.28,110,85,0.93,0.47,0.305),
(22,'Nick','Ahmed',64,0.07,0.22,0.02,0.28,110,87,0.84,0.36,0.279),
(23,'Andrelton','Simmons',56,0.07,0.14,0.01,0.22,108,84,0.89,0.32,0.256),
(24,'Corey','Seager',147,0.12,0.16,0.12,0.49,115,91,0.89,0.32,0.256),
(25,'Didi','Gregorius',68,0.06,0.16,0.02,0.26,108,86,0.85,0.37,0.217),
(26,'Paul','DeJong',86,0.09,0.26,0.11,0.35,110,86,0.83,0.32,0.216),
(27,'Freddy','Galvis',90,0.07,0.20,0.05,0.32,109,87,0.89,0.35,0.269),
(28,'Edmundo','Sosa',104,0.05,0.19,0.04,0.31,115,87,0.83,0.37,0.326),
(29,'Niko','Goodrum',79,0.09,0.33,0.10,0.40,109,88,0.75,0.33,0.301),
(30,'Wander','Franco',127,0.08,0.12,0.05,0.38,110,88,0.91,0.33,0.311),
(31,'Ramon','Urias',115,0.10,0.26,0.10,0.43,113,90,0.84,0.25,0.369),
(32,'Andres','Gimenez',73,0.05,0.26,0.04,0.30,110,86,0.83,0.44,0.273),
(33,'Jorge','Mateo',83,0.04,0.26,0.06,0.31,110,85,0.82,0.37,0.324),
(34,'Luis','Rengifo',50,0.05,0.20,0.06,0.27,109,86,0.81,0.36,0.220),
(35,'Mauricio','Dubon',75,0.05,0.22,0.04,0.30,107,86,0.88,0.38,0.282),
(36,'Taylor','Walls',80,0.13,0.28,0.03,0.34,106,89,0.80,0.22,0.304);
SELECT * FROM shortstop_metric;
|
-- add columns for username and password;
ALTER TABLE oskari_maplayer ADD COLUMN username character varying(256);
ALTER TABLE oskari_maplayer ADD COLUMN password character varying(256);
|
ALTER TABLE `zt_story` CHANGE `stage` `stage` ENUM('','wait','planned','projected','developing','developed','testing','tested','verified','released','closed') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'wait';
ALTER TABLE `zt_todo` ADD `config` varchar(255) NOT NULL;
ALTER TABLE `zt_todo` ADD `cycle` tinyint unsigned NOT NULL DEFAULT '0' AFTER `type`;
ALTER TABLE `zt_todo` ADD `assignedTo` VARCHAR(30) NOT NULL DEFAULT '' AFTER `config`;
ALTER TABLE `zt_todo` ADD `assignedBy` VARCHAR(30) NOT NULL DEFAULT '' AFTER `assignedTo`;
ALTER TABLE `zt_todo` ADD `assignedDate` DATETIME NOT NULL AFTER `assignedBy`;
ALTER TABLE `zt_todo` ADD `finishedBy` VARCHAR(30) NOT NULL DEFAULT '' AFTER `assignedDate`;
ALTER TABLE `zt_todo` ADD `finishedDate` DATETIME NOT NULL AFTER `finishedBy`;
ALTER TABLE `zt_todo` ADD `closedBy` VARCHAR(30) NOT NULL DEFAULT '' AFTER `finishedDate`;
ALTER TABLE `zt_todo` ADD `closedDate` DATETIME NOT NULL AFTER `closedBy`;
ALTER TABLE `zt_todo` CHANGE `status` `status` ENUM('wait','doing','done','closed') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'wait';
INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES
('1', '1', '*', '*', '*', 'moduleName=todo&methodName=createCycle', '生成周期性待办', 'zentao', 1, 'normal', '0000-00-00 00:00:00');
ALTER TABLE `zt_projectproduct` ADD `plan` MEDIUMINT(8) UNSIGNED NOT NULL AFTER `branch`;
CREATE TABLE IF NOT EXISTS `zt_notify` (
`id` mediumint unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
`objectType` varchar(50) NOT NULL,
`objectID` mediumint unsigned NOT NULL,
`action` mediumint NOT NULL,
`toList` varchar(255) NOT NULL,
`ccList` text NOT NULL,
`subject` varchar(255) NOT NULL,
`data` text NOT NULL,
`createdBy` char(30) NOT NULL,
`createdDate` datetime NOT NULL,
`sendTime` datetime NOT NULL,
`status` varchar(10) NOT NULL DEFAULT 'wait',
`failReason` text NOT NULL
) ENGINE='MyISAM' COLLATE 'utf8_general_ci';
|
CREATE TABLE public.account
(
id BIGSERIAL PRIMARY KEY,
username VARCHAR NOT NULL UNIQUE,
password VARCHAR NOT NULL
);
-- Useless but who knows
ALTER SEQUENCE account_id_seq RESTART 100 INCREMENT BY 50;
|
<gh_stars>0
-- CreateTable
CREATE TABLE `Product` (
`id` VARCHAR(191) NOT NULL,
`created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`created_by` VARCHAR(191) NULL,
`updated_at` DATETIME(3) NOT NULL,
`updated_by` VARCHAR(191) NULL,
`name` VARCHAR(191) NOT NULL,
`image` VARCHAR(191) NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
\unset ECHO
\i test/setup.sql
SELECT plan(372);
--SELECT * FROM no_plan();
SET client_min_messages = warning;
CREATE SCHEMA ha;
CREATE TABLE ha.sometab(id INT);
CREATE SEQUENCE ha.someseq;
CREATE SCHEMA "LOL";
CREATE TABLE "LOL"."ATable"("AColumn" INT);
CREATE SEQUENCE "LOL"."ASeq";
-- Include the new schemas in the path.
CREATE OR REPLACE FUNCTION set_search_path() returns setof text as $$
BEGIN
IF pg_version_num() < 80200 THEN
EXECUTE 'SET search_path = ha, "LOL", '
|| regexp_replace(current_setting('search_path'), '[$][^,]+,', '')
|| ', pg_catalog';
RETURN;
ELSE
EXECUTE 'SET search_path = ha, "LOL", ' || current_setting('search_path') || ', pg_catalog';
END IF;
END;
$$ language plpgsql;
SELECT * FROM set_search_path();
RESET client_min_messages;
/****************************************************************************/
-- Test table_privs_are().
SELECT * FROM check_test(
table_privs_are( 'ha', 'sometab', current_user, _table_privs(), 'whatever' ),
true,
'table_privs_are(sch, tab, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
table_privs_are( 'LOL', 'ATable', current_user, _table_privs(), 'whatever' ),
true,
'table_privs_are(LOL, ATable, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
table_privs_are( 'ha', 'sometab', current_user, _table_privs() ),
true,
'table_privs_are(sch, tab, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(_table_privs(), ', ') || ' on table ha.sometab' ,
''
);
SELECT * FROM check_test(
table_privs_are( 'LOL', 'ATable', current_user, _table_privs() ),
true,
'table_privs_are(LOL, ATable, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(_table_privs(), ', ') || ' on table "LOL"."ATable"' ,
''
);
SELECT * FROM check_test(
table_privs_are( 'sometab', current_user, _table_privs(), 'whatever' ),
true,
'table_privs_are(tab, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
table_privs_are( 'ATable', current_user, _table_privs(), 'whatever' ),
true,
'table_privs_are(ATable, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
table_privs_are( 'sometab', current_user, _table_privs() ),
true,
'table_privs_are(tab, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(_table_privs(), ', ') || ' on table sometab' ,
''
);
SELECT * FROM check_test(
table_privs_are( 'ATable', current_user, _table_privs() ),
true,
'table_privs_are(ATable, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(_table_privs(), ', ') || ' on table "ATable"' ,
''
);
CREATE OR REPLACE FUNCTION run_extra_fails() RETURNS SETOF TEXT LANGUAGE plpgsql AS $$
DECLARE
allowed_privs TEXT[];
test_privs TEXT[] := '{}';
missing_privs TEXT[] := '{}';
tap record;
last_index INTEGER;
BEGIN
-- Test table failure.
allowed_privs := _table_privs();
last_index := array_upper(allowed_privs, 1);
FOR i IN 1..last_index - 2 LOOP
test_privs := test_privs || allowed_privs[i];
END LOOP;
FOR i IN last_index - 1..last_index LOOP
missing_privs := missing_privs || allowed_privs[i];
END LOOP;
FOR tap IN SELECT * FROM check_test(
table_privs_are( 'ha', 'sometab', current_user, test_privs, 'whatever' ),
false,
'table_privs_are(sch, tab, role, some privs, desc)',
'whatever',
' Extra privileges:
' || array_to_string(missing_privs, E'\n ')
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
table_privs_are( 'sometab', current_user, test_privs, 'whatever' ),
false,
'table_privs_are(tab, role, some privs, desc)',
'whatever',
' Extra privileges:
' || array_to_string(missing_privs, E'\n ')
) AS b LOOP RETURN NEXT tap.b; END LOOP;
END;
$$;
SELECT * FROM run_extra_fails();
-- Create another role.
CREATE USER __someone_else;
SELECT * FROM check_test(
table_privs_are( 'ha', 'sometab', '__someone_else', _table_privs(), 'whatever' ),
false,
'table_privs_are(sch, tab, other, privs, desc)',
'whatever',
' Missing privileges:
' || array_to_string(_table_privs(), E'\n ')
);
-- Grant them some permission.
GRANT SELECT, INSERT, UPDATE, DELETE ON ha.sometab TO __someone_else;
SELECT * FROM check_test(
table_privs_are( 'ha', 'sometab', '__someone_else', ARRAY[
'SELECT', 'INSERT', 'UPDATE', 'DELETE'
], 'whatever'),
true,
'table_privs_are(sch, tab, other, privs, desc)',
'whatever',
''
);
-- Try a non-existent table.
SELECT * FROM check_test(
table_privs_are( 'ha', 'nonesuch', current_user, _table_privs(), 'whatever' ),
false,
'table_privs_are(sch, tab, role, privs, desc)',
'whatever',
' Table ha.nonesuch does not exist'
);
-- Try a non-existent user.
SELECT * FROM check_test(
table_privs_are( 'ha', 'sometab', '__nonesuch', _table_privs(), 'whatever' ),
false,
'table_privs_are(sch, tab, role, privs, desc)',
'whatever',
' Role __nonesuch does not exist'
);
-- Test default description with no permissions.
SELECT * FROM check_test(
table_privs_are( 'ha', 'sometab', '__nonesuch', '{}'::text[] ),
false,
'table_privs_are(sch, tab, role, no privs)',
'Role __nonesuch should be granted no privileges on table ha.sometab' ,
' Role __nonesuch does not exist'
);
SELECT * FROM check_test(
table_privs_are( 'sometab', '__nonesuch', '{}'::text[] ),
false,
'table_privs_are(tab, role, no privs)',
'Role __nonesuch should be granted no privileges on table sometab' ,
' Role __nonesuch does not exist'
);
/****************************************************************************/
-- Test database_privileges_are().
SELECT * FROM check_test(
database_privs_are( current_database(), current_user, _db_privs(), 'whatever' ),
true,
'database_privs_are(db, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
database_privs_are( current_database(), current_user, _db_privs() ),
true,
'database_privs_are(db, role, privs, desc)',
'Role ' || current_user || ' should be granted '
|| array_to_string(_db_privs(), ', ') || ' on database ' || quote_ident( current_database() ),
''
);
-- Try nonexistent database.
SELECT * FROM check_test(
database_privs_are( '__nonesuch', current_user, _db_privs(), 'whatever' ),
false,
'database_privs_are(non-db, role, privs, desc)',
'whatever',
' Database __nonesuch does not exist'
);
-- Try nonexistent user.
SELECT * FROM check_test(
database_privs_are( current_database(), '__noone', _db_privs(), 'whatever' ),
false,
'database_privs_are(db, non-role, privs, desc)',
'whatever',
' Role __noone does not exist'
);
-- Try another user.
SELECT * FROM check_test(
database_privs_are( current_database(), '__someone_else', _db_privs(), 'whatever' ),
false,
'database_privs_are(db, ungranted, privs, desc)',
'whatever',
' Missing privileges:
CREATE'
);
-- Try a subset of privs.
SELECT * FROM check_test(
database_privs_are(
current_database(), current_user,
CASE WHEN pg_version_num() < 80200 THEN ARRAY['CREATE'] ELSE ARRAY['CREATE', 'CONNECT'] END,
'whatever'
),
false,
'database_privs_are(db, ungranted, privs, desc)',
'whatever',
' Extra privileges:
TEMPORARY'
);
-- Try testing default description for no permissions.
SELECT * FROM check_test(
database_privs_are( current_database(), '__noone', '{}'::text[] ),
false,
'database_privs_are(db, non-role, no privs)',
'Role __noone should be granted no privileges on database ' || quote_ident( current_database() ),
' Role __noone does not exist'
);
/****************************************************************************/
-- Test function_privs_are().
CREATE OR REPLACE FUNCTION public.foo(int, text) RETURNS VOID LANGUAGE SQL AS '';
CREATE OR REPLACE FUNCTION "LOL"."DoIt"(int, text) RETURNS VOID LANGUAGE SQL AS '';
SELECT * FROM check_test(
function_privs_are(
'public', 'foo', ARRAY['integer', 'text'],
current_user, ARRAY['EXECUTE'], 'whatever'
),
true,
'function_privs_are(sch, func, args, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
function_privs_are(
'LOL', 'DoIt', ARRAY['integer', 'text'],
current_user, ARRAY['EXECUTE'], 'whatever'
),
true,
'function_privs_are(LOL, DoIt, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
function_privs_are(
'public', 'foo', ARRAY['integer', 'text'],
current_user, ARRAY['EXECUTE']
),
true,
'function_privs_are(sch, func, args, role, privs)',
'Role ' || current_user || ' should be granted EXECUTE on function public.foo(integer, text)'
''
);
SELECT * FROM check_test(
function_privs_are(
'LOL', 'DoIt', ARRAY['integer', 'text'],
current_user, ARRAY['EXECUTE']
),
true,
'function_privs_are(LOL, DoIt, args, role, privs)',
'Role ' || current_user || ' should be granted EXECUTE on function "LOL"."DoIt"(integer, text)'
''
);
SELECT * FROM check_test(
function_privs_are(
'foo', ARRAY['integer', 'text'],
current_user, ARRAY['EXECUTE'], 'whatever'
),
true,
'function_privs_are(func, args, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
function_privs_are(
'DoIt', ARRAY['integer', 'text'],
current_user, ARRAY['EXECUTE'], 'whatever'
),
true,
'function_privs_are(DoIt, args, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
function_privs_are(
'foo', ARRAY['integer', 'text'],
current_user, ARRAY['EXECUTE']
),
true,
'function_privs_are(func, args, role, privs)',
'Role ' || current_user || ' should be granted EXECUTE on function foo(integer, text)'
''
);
SELECT * FROM check_test(
function_privs_are(
'DoIt', ARRAY['integer', 'text'],
current_user, ARRAY['EXECUTE']
),
true,
'function_privs_are(DoIt, args, role, privs)',
'Role ' || current_user || ' should be granted EXECUTE on function "DoIt"(integer, text)'
''
);
-- Try a nonexistent funtion.
SELECT * FROM check_test(
function_privs_are(
'public', '__nonesuch', ARRAY['integer', 'text'],
current_user, ARRAY['EXECUTE'], 'whatever'
),
false,
'function_privs_are(sch, non-func, args, role, privs, desc)',
'whatever',
' Function public.__nonesuch(integer, text) does not exist'
);
SELECT * FROM check_test(
function_privs_are(
'__nonesuch', ARRAY['integer', 'text'],
current_user, ARRAY['EXECUTE'], 'whatever'
),
false,
'function_privs_are(non-func, args, role, privs, desc)',
'whatever',
' Function __nonesuch(integer, text) does not exist'
);
-- Try a nonexistent user.
SELECT * FROM check_test(
function_privs_are(
'public', 'foo', ARRAY['integer', 'text'],
'__noone', ARRAY['EXECUTE'], 'whatever'
),
false,
'function_privs_are(sch, func, args, noone, privs, desc)',
'whatever',
' Role __noone does not exist'
);
SELECT * FROM check_test(
function_privs_are(
'foo', ARRAY['integer', 'text'],
'__noone', ARRAY['EXECUTE'], 'whatever'
),
false,
'function_privs_are(func, args, noone, privs, desc)',
'whatever',
' Role __noone does not exist'
);
-- Try an unprivileged user.
SELECT * FROM check_test(
function_privs_are(
'public', 'foo', ARRAY['integer', 'text'],
'__someone_else', ARRAY['EXECUTE'], 'whatever'
),
true,
'function_privs_are(sch, func, args, other, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
function_privs_are(
'foo', ARRAY['integer', 'text'],
'__someone_else', ARRAY['EXECUTE'], 'whatever'
),
true,
'function_privs_are(func, args, other, privs, desc)',
'whatever',
''
);
REVOKE EXECUTE ON FUNCTION public.foo(int, text) FROM PUBLIC;
-- Now fail.
SELECT * FROM check_test(
function_privs_are(
'public', 'foo', ARRAY['integer', 'text'],
'__someone_else', ARRAY['EXECUTE'], 'whatever'
),
false,
'function_privs_are(sch, func, args, unpriv, privs, desc)',
'whatever',
' Missing privileges:
EXECUTE'
);
SELECT * FROM check_test(
function_privs_are(
'foo', ARRAY['integer', 'text'],
'__someone_else', ARRAY['EXECUTE'], 'whatever'
),
false,
'function_privs_are(func, args, unpriv, privs, desc)',
'whatever',
' Missing privileges:
EXECUTE'
);
-- It should work for an empty array.
SELECT * FROM check_test(
function_privs_are(
'public', 'foo', ARRAY['integer', 'text'],
'__someone_else', '{}'::text[], 'whatever'
),
true,
'function_privs_are(sch, func, args, unpriv, empty, desc)',
'whatever',
''
);
SELECT * FROM check_test(
function_privs_are(
'public', 'foo', ARRAY['integer', 'text'],
'__someone_else', '{}'::text[]
),
true,
'function_privs_are(sch, func, args, unpriv, empty)',
'Role __someone_else should be granted no privileges on function public.foo(integer, text)'
''
);
SELECT * FROM check_test(
function_privs_are(
'foo', ARRAY['integer', 'text'],
'__someone_else', '{}'::text[]
),
true,
'function_privs_are(func, args, unpriv, empty)',
'Role __someone_else should be granted no privileges on function foo(integer, text)'
''
);
-- Empty for the current user should yeild an extra permission.
SELECT * FROM check_test(
function_privs_are(
'public', 'foo', ARRAY['integer', 'text'],
current_user, '{}'::text[], 'whatever'
),
false,
'function_privs_are(sch, func, args, unpriv, privs, desc)',
'whatever',
' Extra privileges:
EXECUTE'
);
SELECT * FROM check_test(
function_privs_are(
'foo', ARRAY['integer', 'text'],
current_user, '{}'::text[], 'whatever'
),
false,
'function_privs_are(func, args, unpriv, privs, desc)',
'whatever',
' Extra privileges:
EXECUTE'
);
-- Try a really long function signature.
CREATE OR REPLACE FUNCTION public.function_with_a_moderate_signature(
anyelement, date, text[], boolean
) RETURNS VOID LANGUAGE SQL AS '';
SELECT * FROM check_test(
function_privs_are(
'public', 'function_with_a_moderate_signature',
ARRAY['anyelement','date','text[]','boolean'],
current_user, ARRAY['EXECUTE'], 'whatever'
),
true,
'long function signature',
'whatever',
''
);
/****************************************************************************/
-- Test language_privilege_is().
SELECT * FROM check_test(
language_privs_are( 'plpgsql', current_user, '{USAGE}', 'whatever' ),
true,
'language_privs_are(lang, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
language_privs_are( 'plpgsql', current_user, '{USAGE}' ),
true,
'language_privs_are(lang, role, privs, desc)',
'Role ' || current_user || ' should be granted USAGE on language plpgsql',
''
);
-- Try nonexistent language.
SELECT * FROM check_test(
language_privs_are( '__nonesuch', current_user, '{USAGE}', 'whatever' ),
false,
'language_privs_are(non-lang, role, privs, desc)',
'whatever',
' Language __nonesuch does not exist'
);
-- Try nonexistent user.
SELECT * FROM check_test(
language_privs_are( 'plpgsql', '__noone', '{USAGE}', 'whatever' ),
false,
'language_privs_are(lang, non-role, privs, desc)',
'whatever',
' Role __noone does not exist'
);
-- Try another user.
REVOKE USAGE ON LANGUAGE plpgsql FROM public;
SELECT * FROM check_test(
language_privs_are( 'plpgsql', '__someone_else', '{USAGE}', 'whatever' ),
false,
'language_privs_are(lang, ungranted, privs, desc)',
'whatever',
' Missing privileges:
USAGE'
);
-- Try testing default description for no permissions.
SELECT * FROM check_test(
language_privs_are( 'plpgsql', '__someone_else', '{}'::text[] ),
true,
'language_privs_are(lang, role, no privs)',
'Role __someone_else should be granted no privileges on language plpgsql',
''
);
/****************************************************************************/
-- Test schema_privileges_are().
SELECT * FROM check_test(
schema_privs_are( current_schema(), current_user, ARRAY['CREATE', 'USAGE'], 'whatever' ),
true,
'schema_privs_are(schema, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
schema_privs_are( 'LOL', current_user, ARRAY['CREATE', 'USAGE'], 'whatever' ),
true,
'schema_privs_are(LOL, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
schema_privs_are( current_schema(), current_user, ARRAY['CREATE', 'USAGE'] ),
true,
'schema_privs_are(schema, role, privs, desc)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['CREATE', 'USAGE'], ', ') || ' on schema ' || current_schema(),
''
);
SELECT * FROM check_test(
schema_privs_are( 'LOL', current_user, ARRAY['CREATE', 'USAGE'] ),
true,
'schema_privs_are(LOL, role, privs, desc)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['CREATE', 'USAGE'], ', ') || ' on schema "LOL"',
''
);
-- Try nonexistent schema.
SELECT * FROM check_test(
schema_privs_are( '__nonesuch', current_user, ARRAY['CREATE', 'USAGE'], 'whatever' ),
false,
'schema_privs_are(non-schema, role, privs, desc)',
'whatever',
' Schema __nonesuch does not exist'
);
-- Try nonexistent user.
SELECT * FROM check_test(
schema_privs_are( current_schema(), '__noone', ARRAY['CREATE', 'USAGE'], 'whatever' ),
false,
'schema_privs_are(schema, non-role, privs, desc)',
'whatever',
' Role __noone does not exist'
);
-- Try another user.
SELECT * FROM check_test(
schema_privs_are( current_schema(), '__someone_else', ARRAY['CREATE', 'USAGE'], 'whatever' ),
false,
'schema_privs_are(schema, ungranted, privs, desc)',
'whatever',
' Missing privileges:
CREATE
USAGE'
);
-- Try a subset of privs.
SELECT * FROM check_test(
schema_privs_are(
current_schema(), current_user, ARRAY['CREATE'],
'whatever'
),
false,
'schema_privs_are(schema, ungranted, privs, desc)',
'whatever',
' Extra privileges:
USAGE'
);
-- Try testing default description for no permissions.
SELECT * FROM check_test(
schema_privs_are( current_schema(), '__noone', '{}'::text[] ),
false,
'schema_privs_are(schema, non-role, no privs)',
'Role __noone should be granted no privileges on schema ' || current_schema(),
' Role __noone does not exist'
);
/****************************************************************************/
-- Test tablespace_privilege_is().
SELECT * FROM check_test(
tablespace_privs_are( 'pg_default', current_user, '{CREATE}', 'whatever' ),
true,
'tablespace_privs_are(tablespace, role, privs, desc)',
'whatever',
''
);
SELECT * FROM check_test(
tablespace_privs_are( 'pg_default', current_user, '{CREATE}' ),
true,
'tablespace_privs_are(tablespace, role, privs, desc)',
'Role ' || current_user || ' should be granted CREATE on tablespace pg_default',
''
);
-- Try nonexistent tablespace.
SELECT * FROM check_test(
tablespace_privs_are( '__nonesuch', current_user, '{CREATE}', 'whatever' ),
false,
'tablespace_privs_are(non-tablespace, role, privs, desc)',
'whatever',
' Tablespace __nonesuch does not exist'
);
-- Try nonexistent user.
SELECT * FROM check_test(
tablespace_privs_are( 'pg_default', '__noone', '{CREATE}', 'whatever' ),
false,
'tablespace_privs_are(tablespace, non-role, privs, desc)',
'whatever',
' Role __noone does not exist'
);
-- Try another user.
REVOKE CREATE ON TABLESPACE pg_default FROM public;
SELECT * FROM check_test(
tablespace_privs_are( 'pg_default', '__someone_else', '{CREATE}', 'whatever' ),
false,
'tablespace_privs_are(tablespace, ungranted, privs, desc)',
'whatever',
' Missing privileges:
CREATE'
);
-- Try testing default description for no permissions.
SELECT * FROM check_test(
tablespace_privs_are( 'pg_default', '__someone_else', '{}'::text[] ),
true,
'tablespace_privs_are(tablespace, role, no privs)',
'Role __someone_else should be granted no privileges on tablespace pg_default',
''
);
/****************************************************************************/
-- Test sequence_privilege_is().
CREATE FUNCTION test_sequence() RETURNS SETOF TEXT AS $$
DECLARE
allowed_privs TEXT[];
test_privs TEXT[];
missing_privs TEXT[];
tap record;
last_index INTEGER;
BEGIN
IF pg_version_num() >= 90000 THEN
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'ha', 'someseq', current_user, ARRAY[
'USAGE', 'SELECT', 'UPDATE'
], 'whatever' ),
true,
'sequence_privs_are(sch, seq, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'LOL', 'ASeq', current_user, ARRAY[
'USAGE', 'SELECT', 'UPDATE'
], 'whatever' ),
true,
'sequence_privs_are(LOL, ASeq, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'ha', 'someseq', current_user, ARRAY['USAGE', 'SELECT', 'UPDATE'] ),
true,
'sequence_privs_are(sch, seq, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['USAGE', 'SELECT', 'UPDATE'], ', ')
|| ' on sequence ha.someseq' ,
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'LOL', 'ASeq', current_user, ARRAY['USAGE', 'SELECT', 'UPDATE'] ),
true,
'sequence_privs_are(sch, seq, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['USAGE', 'SELECT', 'UPDATE'], ', ')
|| ' on sequence "LOL"."ASeq"' ,
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'someseq', current_user, ARRAY[
'USAGE', 'SELECT', 'UPDATE'
], 'whatever' ),
true,
'sequence_privs_are(seq, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'ASeq', current_user, ARRAY[
'USAGE', 'SELECT', 'UPDATE'
], 'whatever' ),
true,
'sequence_privs_are(ASeq, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'someseq', current_user, ARRAY['USAGE', 'SELECT', 'UPDATE'] ),
true,
'sequence_privs_are(seq, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['USAGE', 'SELECT', 'UPDATE'], ', ')
|| ' on sequence someseq' ,
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'ASeq', current_user, ARRAY['USAGE', 'SELECT', 'UPDATE'] ),
true,
'sequence_privs_are(seq, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['USAGE', 'SELECT', 'UPDATE'], ', ')
|| ' on sequence "ASeq"' ,
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Test sequence failure.
allowed_privs := ARRAY['USAGE', 'SELECT', 'UPDATE'];
last_index := array_upper(allowed_privs, 1);
FOR i IN 1..last_index - 2 LOOP
test_privs := test_privs || allowed_privs[i];
END LOOP;
FOR i IN last_index - 1..last_index LOOP
missing_privs := missing_privs || allowed_privs[i];
END LOOP;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'ha', 'someseq', current_user, test_privs, 'whatever' ),
false,
'sequence_privs_are(sch, seq, role, some privs, desc)',
'whatever',
' Extra privileges:
' || array_to_string(missing_privs, E'\n ')
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'someseq', current_user, test_privs, 'whatever' ),
false,
'sequence_privs_are(seq, role, some privs, desc)',
'whatever',
' Extra privileges:
' || array_to_string(missing_privs, E'\n ')
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'ha', 'someseq', '__someone_else', ARRAY[
'USAGE', 'SELECT', 'UPDATE'
], 'whatever' ),
false,
'sequence_privs_are(sch, seq, other, privs, desc)',
'whatever',
' Missing privileges:
' || array_to_string(ARRAY['SELECT', 'UPDATE', 'USAGE'], E'\n ')
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Grant them some permission.
GRANT SELECT, UPDATE ON ha.someseq TO __someone_else;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'ha', 'someseq', '__someone_else', ARRAY[
'SELECT', 'UPDATE'
], 'whatever'),
true,
'sequence_privs_are(sch, seq, other, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent sequence.
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'ha', 'nonesuch', current_user, ARRAY[
'USAGE', 'SELECT', 'UPDATE'
], 'whatever' ),
false,
'sequence_privs_are(sch, seq, role, privs, desc)',
'whatever',
' Sequence ha.nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent user.
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'ha', 'someseq', '__nonesuch', ARRAY[
'USAGE', 'SELECT', 'UPDATE'
], 'whatever' ),
false,
'sequence_privs_are(sch, seq, role, privs, desc)',
'whatever',
' Role __nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Test default description with no permissions.
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'ha', 'someseq', '__nonesuch', '{}'::text[] ),
false,
'sequence_privs_are(sch, seq, role, no privs)',
'Role __nonesuch should be granted no privileges on sequence ha.someseq' ,
' Role __nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
sequence_privs_are( 'someseq', '__nonesuch', '{}'::text[] ),
false,
'sequence_privs_are(seq, role, no privs)',
'Role __nonesuch should be granted no privileges on sequence someseq' ,
' Role __nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
ELSE
-- Fake it with pass() and fail().
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'sequence_privs_are(sch, seq, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'sequence_privs_are(LOL, ASeq, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'sequence_privs_are(sch, seq, role, privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'sequence_privs_are(sch, seq, role, privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'sequence_privs_are(seq, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'sequence_privs_are(ASeq, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'sequence_privs_are(seq, role, privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'sequence_privs_are(seq, role, privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'sequence_privs_are(sch, seq, role, some privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'sequence_privs_are(seq, role, some privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'sequence_privs_are(sch, seq, other, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Grant them some permission.
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'sequence_privs_are(sch, seq, other, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent sequence.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'sequence_privs_are(sch, seq, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent user.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'sequence_privs_are(sch, seq, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Test default description with no permissions.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'sequence_privs_are(sch, seq, role, no privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'sequence_privs_are(seq, role, no privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
END IF;
END;
$$ LANGUAGE PLPGSQL;
SELECT * FROM test_sequence();
/****************************************************************************/
-- Test any_column_privs_are().
CREATE FUNCTION test_anycols() RETURNS SETOF TEXT AS $$
DECLARE
allowed_privs TEXT[];
test_privs TEXT[];
missing_privs TEXT[];
tap record;
last_index INTEGER;
BEGIN
IF pg_version_num() >= 80400 THEN
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'ha', 'sometab', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
true,
'any_column_privs_are(sch, tab, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'ha', 'sometab', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
] ),
true,
'any_column_privs_are(sch, tab, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['INSERT', 'REFERENCES', 'SELECT', 'UPDATE'], ', ')
|| ' on any column in ha.sometab' ,
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'sometab', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
true,
'any_column_privs_are(tab, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'sometab', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
] ),
true,
'any_column_privs_are(tab, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['INSERT', 'REFERENCES', 'SELECT', 'UPDATE'], ', ')
|| ' on any column in sometab' ,
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Test table failure.
allowed_privs := ARRAY['INSERT', 'REFERENCES', 'SELECT', 'UPDATE'];
last_index := array_upper(allowed_privs, 1);
FOR i IN 1..last_index - 2 LOOP
test_privs := test_privs || allowed_privs[i];
END LOOP;
FOR i IN last_index - 1..last_index LOOP
missing_privs := missing_privs || allowed_privs[i];
END LOOP;
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'ha', 'sometab', current_user, test_privs, 'whatever' ),
false,
'any_column_privs_are(sch, tab, role, some privs, desc)',
'whatever',
' Extra privileges:
' || array_to_string(missing_privs, E'\n ')
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'sometab', current_user, test_privs, 'whatever' ),
false,
'any_column_privs_are(tab, role, some privs, desc)',
'whatever',
' Extra privileges:
' || array_to_string(missing_privs, E'\n ')
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'ha', 'sometab', '__someone_else', ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
false,
'any_column_privs_are(sch, tab, other, privs, desc)',
'whatever',
' Missing privileges:
' || array_to_string(ARRAY['REFERENCES'], E'\n ')
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'ha', 'sometab', '__someone_else', ARRAY[
'SELECT', 'INSERT', 'UPDATE'
], 'whatever'),
true,
'any_column_privs_are(sch, tab, other, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent table.
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'ha', 'nonesuch', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
false,
'any_column_privs_are(sch, tab, role, privs, desc)',
'whatever',
' Table ha.nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent user.
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'ha', 'sometab', '__nonesuch', ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
false,
'any_column_privs_are(sch, tab, role, privs, desc)',
'whatever',
' Role __nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Test default description with no permissions.
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'ha', 'sometab', '__nonesuch', '{}'::text[] ),
false,
'any_column_privs_are(sch, tab, role, no privs)',
'Role __nonesuch should be granted no privileges on any column in ha.sometab' ,
' Role __nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
any_column_privs_are( 'sometab', '__nonesuch', '{}'::text[] ),
false,
'any_column_privs_are(tab, role, no privs)',
'Role __nonesuch should be granted no privileges on any column in sometab' ,
' Role __nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
ELSE
-- Fake it with pass() and fail().
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'any_column_privs_are(sch, tab, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'any_column_privs_are(sch, tab, role, privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'any_column_privs_are(tab, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'any_column_privs_are(tab, role, privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'any_column_privs_are(sch, tab, role, some privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'any_column_privs_are(tab, role, some privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'any_column_privs_are(sch, tab, other, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'any_column_privs_are(sch, tab, other, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent table.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'any_column_privs_are(sch, tab, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent user.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'any_column_privs_are(sch, tab, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Test default description with no permissions.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'any_column_privs_are(sch, tab, role, no privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'any_column_privs_are(tab, role, no privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
END IF;
END;
$$ LANGUAGE PLPGSQL;
SELECT * FROM test_anycols();
/****************************************************************************/
-- Test column_privs_are().
CREATE FUNCTION test_cols() RETURNS SETOF TEXT AS $$
DECLARE
allowed_privs TEXT[];
test_privs TEXT[];
missing_privs TEXT[];
tap record;
last_index INTEGER;
BEGIN
IF pg_version_num() >= 80400 THEN
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'ha', 'sometab', 'id', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
true,
'column_privs_are(sch, tab, col, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'LOL', 'ATable', 'AColumn', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
true,
'column_privs_are(LOL, ATable, AColumn, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'ha', 'sometab', 'id', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
] ),
true,
'column_privs_are(sch, tab, col, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['INSERT', 'REFERENCES', 'SELECT', 'UPDATE'], ', ')
|| ' on column ha.sometab.id' ,
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'LOL', 'ATable', 'AColumn', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
] ),
true,
'column_privs_are(LOL, ATable, AColumn, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['INSERT', 'REFERENCES', 'SELECT', 'UPDATE'], ', ')
|| ' on column "LOL"."ATable"."AColumn"' ,
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'sometab', 'id', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
true,
'column_privs_are(tab, col, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'ATable', 'AColumn', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
true,
'column_privs_are(tab, col, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'sometab', 'id', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
] ),
true,
'column_privs_are(tab, col, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['INSERT', 'REFERENCES', 'SELECT', 'UPDATE'], ', ')
|| ' on column sometab.id' ,
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'ATable', 'AColumn', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
] ),
true,
'column_privs_are(tab, col, role, privs)',
'Role ' || current_user || ' should be granted '
|| array_to_string(ARRAY['INSERT', 'REFERENCES', 'SELECT', 'UPDATE'], ', ')
|| ' on column "ATable"."AColumn"' ,
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Test table failure.
allowed_privs := ARRAY['INSERT', 'REFERENCES', 'SELECT', 'UPDATE'];
last_index := array_upper(allowed_privs, 1);
FOR i IN 1..last_index - 2 LOOP
test_privs := test_privs || allowed_privs[i];
END LOOP;
FOR i IN last_index - 1..last_index LOOP
missing_privs := missing_privs || allowed_privs[i];
END LOOP;
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'ha', 'sometab', 'id', current_user, test_privs, 'whatever' ),
false,
'column_privs_are(sch, tab, role, some privs, desc)',
'whatever',
' Extra privileges:
' || array_to_string(missing_privs, E'\n ')
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'sometab', 'id', current_user, test_privs, 'whatever' ),
false,
'column_privs_are(tab, role, some privs, desc)',
'whatever',
' Extra privileges:
' || array_to_string(missing_privs, E'\n ')
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'ha', 'sometab', 'id', '__someone_else', ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
false,
'column_privs_are(sch, tab, other, privs, desc)',
'whatever',
' Missing privileges:
' || array_to_string(ARRAY['REFERENCES'], E'\n ')
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Grant them some permission.
EXECUTE 'GRANT SELECT, INSERT, UPDATE (id) ON ha.sometab TO __someone_else;';
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'ha', 'sometab', 'id', '__someone_else', ARRAY[
'SELECT', 'INSERT', 'UPDATE'
], 'whatever'),
true,
'column_privs_are(sch, tab, other, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent table.
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'ha', 'nonesuch', 'id', current_user, ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
false,
'column_privs_are(sch, tab, role, privs, desc)',
'whatever',
' Table ha.nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent user.
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'ha', 'sometab', 'id', '__nonesuch', ARRAY[
'INSERT', 'REFERENCES', 'SELECT', 'UPDATE'
], 'whatever' ),
false,
'column_privs_are(sch, tab, role, privs, desc)',
'whatever',
' Role __nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Test default description with no permissions.
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'ha', 'sometab', 'id', '__nonesuch', '{}'::text[] ),
false,
'column_privs_are(sch, tab, role, no privs)',
'Role __nonesuch should be granted no privileges on column ha.sometab.id' ,
' Role __nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
column_privs_are( 'sometab', 'id', '__nonesuch', '{}'::text[] ),
false,
'column_privs_are(tab, role, no privs)',
'Role __nonesuch should be granted no privileges on column sometab.id' ,
' Role __nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
ELSE
-- Fake it.
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'column_privs_are(sch, tab, col, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'column_privs_are(LOL, ATable, AColumn, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'column_privs_are(sch, tab, col, role, privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'column_privs_are(LOL, ATable, AColumn, role, privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'column_privs_are(tab, col, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'column_privs_are(tab, col, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'column_privs_are(tab, col, role, privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'column_privs_are(tab, col, role, privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'column_privs_are(sch, tab, role, some privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'column_privs_are(tab, role, some privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'column_privs_are(sch, tab, other, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'column_privs_are(sch, tab, other, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent table.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'column_privs_are(sch, tab, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try a non-existent user.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'column_privs_are(sch, tab, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Test default description with no permissions.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'column_privs_are(sch, tab, role, no privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'column_privs_are(tab, role, no privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
END IF;
END;
$$ LANGUAGE PLPGSQL;
SELECT * FROM test_cols();
/****************************************************************************/
-- Test fdw_privs_are().
CREATE FUNCTION test_fdw() RETURNS SETOF TEXT AS $$
DECLARE
tap record;
BEGIN
IF pg_version_num() >= 80400 THEN
EXECUTE 'CREATE FOREIGN DATA WRAPPER dummy;';
EXECUTE 'CREATE FOREIGN DATA WRAPPER "SomeFDW";';
FOR tap IN SELECT * FROM check_test(
fdw_privs_are( 'dummy', current_user, '{USAGE}', 'whatever' ),
true,
'fdw_privs_are(fdw, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fdw_privs_are( 'SomeFDW', current_user, '{USAGE}', 'whatever' ),
true,
'fdw_privs_are(SomeFDW, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fdw_privs_are( 'dummy', current_user, '{USAGE}' ),
true,
'fdw_privs_are(fdw, role, privs, desc)',
'Role ' || current_user || ' should be granted USAGE on FDW dummy',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
fdw_privs_are( 'SomeFDW', current_user, '{USAGE}' ),
true,
'fdw_privs_are(SomeFDW, role, privs, desc)',
'Role ' || current_user || ' should be granted USAGE on FDW "SomeFDW"',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try nonexistent fdw.
FOR tap IN SELECT * FROM check_test(
fdw_privs_are( '__nonesuch', current_user, '{USAGE}', 'whatever' ),
false,
'fdw_privs_are(non-fdw, role, privs, desc)',
'whatever',
' FDW __nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try nonexistent user.
FOR tap IN SELECT * FROM check_test(
fdw_privs_are( 'dummy', '__noone', '{USAGE}', 'whatever' ),
false,
'fdw_privs_are(fdw, non-role, privs, desc)',
'whatever',
' Role __noone does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try another user.
FOR tap IN SELECT * FROM check_test(
fdw_privs_are( 'dummy', '__someone_else', '{USAGE}', 'whatever' ),
false,
'fdw_privs_are(fdw, ungranted, privs, desc)',
'whatever',
' Missing privileges:
USAGE'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try testing default description for no permissions.
FOR tap IN SELECT * FROM check_test(
fdw_privs_are( 'dummy', '__someone_else', '{}'::text[] ),
true,
'fdw_privs_are(fdw, role, no privs)',
'Role __someone_else should be granted no privileges on FDW dummy',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
ELSE
-- Fake it with pass() and fail().
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'fdw_privs_are(fdw, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'fdw_privs_are(SomeFDW, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'fdw_privs_are(fdw, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'fdw_privs_are(SomeFDW, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try nonexistent fdw.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'fdw_privs_are(non-fdw, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try nonexistent user.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'fdw_privs_are(fdw, non-role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try another user.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'fdw_privs_are(fdw, ungranted, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try testing default description for no permissions.
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'fdw_privs_are(fdw, role, no privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
END IF;
RETURN;
END;
$$ LANGUAGE plpgsql;
SELECT * FROM test_fdw();
CREATE FUNCTION test_server() RETURNS SETOF TEXT AS $$
DECLARE
tap record;
BEGIN
IF pg_version_num() >= 80400 THEN
EXECUTE 'CREATE SERVER foo FOREIGN DATA WRAPPER dummy;';
EXECUTE 'CREATE SERVER "SomeServer" FOREIGN DATA WRAPPER "SomeFDW";';
FOR tap IN SELECT * FROM check_test(
server_privs_are( 'foo', current_user, '{USAGE}', 'whatever' ),
true,
'server_privs_are(server, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
server_privs_are( 'SomeServer', current_user, '{USAGE}', 'whatever' ),
true,
'server_privs_are(SomeServer, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
server_privs_are( 'foo', current_user, '{USAGE}' ),
true,
'server_privs_are(server, role, privs, desc)',
'Role ' || current_user || ' should be granted USAGE on server foo',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
server_privs_are( 'SomeServer', current_user, '{USAGE}' ),
true,
'server_privs_are(SomeServer, role, privs, desc)',
'Role ' || current_user || ' should be granted USAGE on server "SomeServer"',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try nonexistent server.
FOR tap IN SELECT * FROM check_test(
server_privs_are( '__nonesuch', current_user, '{USAGE}', 'whatever' ),
false,
'server_privs_are(non-server, role, privs, desc)',
'whatever',
' Server __nonesuch does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try nonexistent user.
FOR tap IN SELECT * FROM check_test(
server_privs_are( 'foo', '__noone', '{USAGE}', 'whatever' ),
false,
'server_privs_are(server, non-role, privs, desc)',
'whatever',
' Role __noone does not exist'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try another user.
FOR tap IN SELECT * FROM check_test(
server_privs_are( 'foo', '__someone_else', '{USAGE}', 'whatever' ),
false,
'server_privs_are(server, ungranted, privs, desc)',
'whatever',
' Missing privileges:
USAGE'
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try testing default description for no permissions.
FOR tap IN SELECT * FROM check_test(
server_privs_are( 'foo', '__someone_else', '{}'::text[] ),
true,
'server_privs_are(server, role, no privs)',
'Role __someone_else should be granted no privileges on server foo',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
ELSE
-- Fake it with pass() and fail().
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'server_privs_are(server, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'server_privs_are(SomeServer, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'server_privs_are(server, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'server_privs_are(SomeServer, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try nonexistent server.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'server_privs_are(non-server, role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try nonexistent user.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'server_privs_are(server, non-role, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try another user.
FOR tap IN SELECT * FROM check_test(
fail('whatever'),
false,
'server_privs_are(server, ungranted, privs, desc)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
-- Try testing default description for no permissions.
FOR tap IN SELECT * FROM check_test(
pass('whatever'),
true,
'server_privs_are(server, role, no privs)',
'whatever',
''
) AS b LOOP RETURN NEXT tap.b; END LOOP;
END IF;
RETURN;
END;
$$ LANGUAGE plpgsql;
SELECT * FROM test_server();
/****************************************************************************/
-- Finish the tests and clean up.
SELECT * FROM finish();
ROLLBACK;
|
drop table if exists reported_adjudications;
create table reported_adjudications
(
id serial primary key,
prisoner_number varchar(7) not null,
booking_id bigint not null,
report_number bigint not null,
agency_id varchar(6) not null,
date_time_of_incident timestamp not null,
handover_deadline timestamp not null,
location_id bigint not null,
statement varchar not null,
create_user_id varchar(32) not null,
create_datetime timestamp not null,
modify_user_id varchar(32),
modify_datetime timestamp,
constraint unique_report_number UNIQUE (report_number)
);
|
<filename>sis-db.sql
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 11, 2020 at 05:57 AM
-- Server version: 8.0.21
-- 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: `sis-db`
--
-- --------------------------------------------------------
--
-- Table structure for table `challenges`
--
CREATE TABLE `challenges` (
`id` bigint UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`filename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`hint` 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 `challenges`
--
INSERT INTO `challenges` (`id`, `name`, `filename`, `hint`, `created_at`, `updated_at`) VALUES
(1, 'Challenge 1', 'doanxem.c', 'doan xem ?', '2020-10-09 09:56:39', '2020-10-09 09:56:39'),
(2, 'Bai 2', '20-continue', 'dap an: 20-continue', '2020-10-10 19:13:00', '2020-10-10 19:13:00'),
(3, 'Bai 3', 'Viet Bac', 'Tac gia la To Huu, viet nam 1947', '2020-10-10 19:31:21', '2020-10-10 19:31:21');
-- --------------------------------------------------------
--
-- Table structure for table `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint 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;
-- --------------------------------------------------------
--
-- Table structure for table `homework`
--
CREATE TABLE `homework` (
`id` bigint UNSIGNED NOT NULL,
`filename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`fromUser` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`hwID` int 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 `homework`
--
INSERT INTO `homework` (`id`, `filename`, `fromUser`, `hwID`, `created_at`, `updated_at`) VALUES
(1, 'doanxem.c', 'hung1', 1, '2020-10-08 09:19:15', '2020-10-08 09:19:15');
-- --------------------------------------------------------
--
-- Table structure for table `messages`
--
CREATE TABLE `messages` (
`id` bigint UNSIGNED NOT NULL,
`fromID` int NOT NULL,
`toID` int NOT NULL,
`content` 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 `messages`
--
INSERT INTO `messages` (`id`, `fromID`, `toID`, `content`, `created_at`, `updated_at`) VALUES
(2, 2, 1, 'hello test1 edited', '2020-10-07 01:07:55', '2020-10-07 01:10:33'),
(3, 3, 1, 'abc', '2020-10-07 01:13:12', '2020-10-07 01:13:12'),
(4, 3, 1, 'abc 1', '2020-10-07 01:13:52', '2020-10-07 01:13:52'),
(5, 3, 1, 'abc 11', '2020-10-07 01:21:36', '2020-10-07 01:21:36'),
(6, 3, 1, 'abcdef', '2020-10-10 02:05:10', '2020-10-10 02:05:10'),
(7, 1, 3, 'hellu', '2020-10-10 02:05:50', '2020-10-10 02:05:50');
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(5, '2014_10_12_000000_create_users_table', 1),
(6, '2014_10_12_100000_create_password_resets_table', 1),
(7, '2019_08_19_000000_create_failed_jobs_table', 1),
(8, '2020_10_03_081808_create_posts_table', 1),
(9, '2020_10_06_145701_create_messages_table', 2),
(11, '2020_10_07_085657_create_uploads_table', 3),
(14, '2020_10_08_034257_create_homework_table', 4),
(15, '2020_10_09_154413_create_challenges_table', 5);
-- --------------------------------------------------------
--
-- 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;
--
-- Dumping data for table `password_resets`
--
INSERT INTO `password_resets` (`email`, `token`, `created_at`) VALUES
('<EMAIL>', <PASSWORD>', '2020-10-04 03:03:33');
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE `posts` (
`id` bigint UNSIGNED NOT NULL,
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`body` mediumtext 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 `posts`
--
INSERT INTO `posts` (`id`, `title`, `body`, `created_at`, `updated_at`) VALUES
(1, 'Post 3', 'This is post 3 body', '2020-10-04 19:54:57', '2020-10-04 19:54:57');
-- --------------------------------------------------------
--
-- Table structure for table `uploads`
--
CREATE TABLE `uploads` (
`id` bigint UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`filename` 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 `uploads`
--
INSERT INTO `uploads` (`id`, `name`, `filename`, `created_at`, `updated_at`) VALUES
(1, 'Bai 1', '20-continue.c', '2020-10-07 19:13:52', '2020-10-07 19:13:52');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` bigint UNSIGNED NOT NULL,
`username` varchar(255) COLLATE utf8mb4_unicode_ci 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,
`phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`isTeacher` tinyint(1) NOT NULL DEFAULT '0',
`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;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `name`, `email`, `email_verified_at`, `phone`, `isTeacher`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'test1', '<NAME>', '<EMAIL>', NULL, '11234', 0, '$2y$10$GMsSJCFeeJf8cj81r/ivCOcQUF5PwAVTnFNXRGv654UGCIw0G87Eq', NULL, '2020-10-03 21:44:09', '2020-10-06 09:46:57'),
(2, 'giaovien', '<NAME>', '<EMAIL>', NULL, '1234', 1, '$2y$10$PeOlleOAfUrwEuVABXnh.e1FDLP7V87Q0otwJPwOSstsIvohI8TaK', NULL, '2020-10-03 21:47:10', '2020-10-03 21:47:10'),
(3, 'hung1', '<NAME>', '<EMAIL>', NULL, '0123456', 0, '$2y$10$AiOLqJjW/h.zrhHRVi61QOjOBIL59o7WLU4I18RUPBOpJwbSYCHZq', NULL, '2020-10-04 02:10:03', '2020-10-05 00:31:12');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `challenges`
--
ALTER TABLE `challenges`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);
--
-- Indexes for table `homework`
--
ALTER TABLE `homework`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `messages`
--
ALTER TABLE `messages`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `uploads`
--
ALTER TABLE `uploads`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_username_unique` (`username`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `challenges`
--
ALTER TABLE `challenges`
MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `homework`
--
ALTER TABLE `homework`
MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `uploads`
--
ALTER TABLE `uploads`
MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` bigint UNSIGNED 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 */;
|
<gh_stars>10-100
select pl.parameter,pl.type,pl.level,bf.estimate
from bbref._parameter_levels pl
left outer join bbref._basic_factors bf
on (bf.factor,bf.level,bf.type)=(pl.parameter,pl.level,pl.type)
where pl.type='random'
order by parameter,level;
|
-- changes to CFMBB 1.20 from 1.1/1.11
alter table cfmbb_settings add defaultIndex varchar(35) not null default 'forums.cfm';
alter table cfmbb_settings add enableChat smallint not null default 1;
alter table cfmbb_settings add useCaptcha smallint not null default 1;
alter table cfmbb_threads add views integer not null default 0;
alter table cfmbb_forums add lastpost text null;
alter table cfmbb_forums add msgcount integer not null default 0;
alter table cfmbb_threads add msgcount integer not null default 0;
alter table cfmbb_threads add lastpost datetime null;
CREATE TABLE cfmbb_notifications
(
useridfk varchar(35) not null,
idfk varchar(35) not null default '',
notification_type smallint not null,
primary key (useridfk, idfk)
);
CREATE TABLE cfmbb_pages (
PAGE_ID char(35) not null,
PAGE_FILENAME varchar(255) NOT NULL,
PAGE_TITLE varchar(255) NOT NULL,
META_DESC text NOT NULL,
META_KEYS text NOT NULL,
CONTENT_ID varchar(35) NOT NULL,
INCLUDE_CONTENT varchar(255) null,
REDIRECT_URL varchar(255) null,
MEMBERS_ONLY smallint not null default '0',
PRIMARY KEY (PAGE_ID)
);
CREATE TABLE cfmbb_page_content (
CONTENT_ID varchar(35) NOT NULL default '',
HISTORY_ID bigint not null,
HISTORY_DATE datetime NOT NULL,
CONTENT mediumtext NULL,
PRIMARY KEY (CONTENT_ID,HISTORY_ID)
);
CREATE TABLE cfmbb_custom_nav (
nav_id char(35) NOT NULL,
nav_order smallint(6) NOT NULL default '0',
page_id char(35) default NULL,
nav_url varchar(255) default NULL,
nav_title varchar(255) default NULL,
target varchar(255) default NULL,
PRIMARY KEY (nav_id)
);
create table cfmbb_usergroups
(
id char(35) not null,
title varchar(255) not null,
description text null,
primary key (id)
);
create table cfmbb_usergroup_members
(
groupidfk char(35) not null,
useridfk char(35) not null,
primary key (groupidfk, useridfk)
);
-- this has not been tested and almost certainly does not
-- work in postgresql
CREATE TABLE chat_rooms (
room_id int not null auto_increment,
room_name nvarchar(30) not null DEFAULT '',
permanent int not null default 0,
allow_rename int not null default 0,
allow_private int not null default 0,
primary key (room_id)
);
create unique index idxRoomName on chat_rooms(room_name);
insert into chat_rooms
( room_id, room_name, permanent, allow_rename, allow_private )
values
(0, 'Lobby', 1, 0, 0);
CREATE TABLE chat_users (
user_id nchar(35) not null,
uname nvarchar(30) not null,
primary key (user_id)
);
CREATE TABLE room_users (
room_id int not null,
user_id nchar(35) not null,
uname nvarchar(30) not null,
pingtime datetime not null,
active smallint not null default 0,
primary key (room_id, user_id)
);
CREATE TABLE chat_content (
line_id int NOT NULL auto_increment,
room_id int not null,
action int not null,
user_id nchar(35) not null,
uname nvarchar(30) NOT NULL default '',
content text not null,
recip_id nchar(35) not null default '',
tstamp double null,
PRIMARY KEY (line_id)
);
|
<filename>airbyte-integrations/bases/base-normalization/integration_tests/normalization_test_output/mssql/test_nested_streams/first_output/airbyte_incremental/test_normalization/unnest_alias.sql
USE [test_normalization];
if object_id ('test_normalization."unnest_alias_temp_view"','V') is not null
begin
drop view test_normalization."unnest_alias_temp_view"
end
USE [test_normalization];
if object_id ('test_normalization."unnest_alias"','U') is not null
begin
drop table test_normalization."unnest_alias"
end
USE [test_normalization];
EXEC('create view test_normalization."unnest_alias_temp_view" as
-- Final base SQL model
select
id,
children,
_airbyte_ab_id,
_airbyte_emitted_at,
SYSDATETIME() as _airbyte_normalized_at,
_airbyte_unnest_alias_hashid
from "test_normalization"._airbyte_test_normalization."unnest_alias_ab3"
-- unnest_alias from "test_normalization".test_normalization._airbyte_raw_unnest_alias
where 1 = 1
');
SELECT * INTO "test_normalization".test_normalization."unnest_alias" FROM
"test_normalization".test_normalization."unnest_alias_temp_view"
USE [test_normalization];
if object_id ('test_normalization."unnest_alias_temp_view"','V') is not null
begin
drop view test_normalization."unnest_alias_temp_view"
end
use [test_normalization];
if EXISTS (
SELECT * FROM
sys.indexes WHERE name = 'test_normalization_unnest_alias_cci'
AND object_id=object_id('test_normalization_unnest_alias')
)
DROP index test_normalization.unnest_alias.test_normalization_unnest_alias_cci
CREATE CLUSTERED COLUMNSTORE INDEX test_normalization_unnest_alias_cci
ON test_normalization.unnest_alias
|
<gh_stars>1-10
-- Table structure for table 'digitemp_alarms'
--
-- Table is intended to keep track of current alarms
-- and alarm history
--
--
CREATE TABLE digitemp_alarms (
alarm_id int(11) NOT NULL auto_increment,
SerialNumber varchar(17) NOT NULL,
Fahrenheit decimal(4,2) NOT NULL,
time_raised datetime NOT NULL,
time_cleared datetime,
time_updated timestamp(14),
alarm_type varchar(15) NOT NULL,
description varchar(255),
PRIMARY KEY (alarm_id),
KEY serial_key (SerialNumber),
KEY alarm_type_key (alarm_type),
KEY time_raised_key (time_raised),
KEY time_cleared_key (time_cleared)
) TYPE=MyISAM;
|
# this file is a placeholder, please refer template file from ../mysql_init_temlate
CREATE DATABASE IF NOT EXISTS `${MYSQL_DATABASE}` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
|
SELECT f1.person2, f2.person2
FROM (
SELECT * FROM FriendshipSymmetric WHERE person1 = <id>
) f1
JOIN ON
(
SELECT * FROM FriendshipSymmetric WHERE person1 = <id>
) f2
EXCEPT
(
SELECT * FROM FriendshipSymmetric
)
WHERE f1.person2 != f2.person2
|
-- 2020-08-18T12:46:03.061Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column (AD_Reference_ID,DefaultValue,FieldLength,Version,IsKey,IsParent,IsTranslated,IsIdentifier,SeqNo,AD_Client_ID,IsActive,Created,CreatedBy,IsUpdateable,DDL_NoForeignKey,IsSelectionColumn,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,IsEncrypted,Updated,UpdatedBy,IsAdvancedText,IsLazyLoading,AD_Table_ID,IsCalculated,Help,AD_Column_ID,IsDimension,IsMandatory,IsStaleable,IsUseDocSequence,IsRangeFilter,IsShowFilterIncrementButtons,IsDLMPartitionBoundary,IsGenericZoomKeyColumn,SelectionColumnSeqNo,IsForceIncludeInGeneratedModel,IsGenericZoomOrigin,ColumnName,IsAutoApplyValidationRule,Name,AD_Org_ID,Description,FacetFilterSeqNo,MaxFacetsToFetch,IsFacetFilter,AD_Element_ID,EntityType) VALUES (20,'N',1,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2020-08-18 15:46:02','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','N','N','N','Y','N',TO_TIMESTAMP('2020-08-18 15:46:02','YYYY-MM-DD HH24:MI:SS'),100,'N','N',139,'N','The Default Checkbox indicates if this record will be used as a default value.',571112,'N','Y','N','N','N','N','N','N',0,'N','N','IsDefault','N','Standard',0,'Default value',0,0,'N',1103,'D')
;
-- 2020-08-18T12:46:03.064Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Column_ID=571112 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- 2020-08-18T12:46:03.122Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_Column_Translation_From_AD_Element(1103)
;
-- 2020-08-18T12:46:06.355Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ SELECT public.db_alter_table('C_Calendar','ALTER TABLE public.C_Calendar ADD COLUMN IsDefault CHAR(1) DEFAULT ''N'' CHECK (IsDefault IN (''Y'',''N'')) NOT NULL')
;
|
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (1, 0, 'Assets', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (2, 0, 'Liabilities and Owners Equity', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (3, 0, 'Incomes', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (4, 0, 'Expenses', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (5, 1, 'Fixed Assets', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (6, 1, 'Current Assets', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (7, 1, 'Investments', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (8, 2, 'Capital Account', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (9, 2, 'Current Liabilities', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (10, 2, 'Loans (Liabilities)', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (11, 3, 'Direct Incomes', 1);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (12, 4, 'Direct Expenses', 1);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (13, 3, 'Indirect Incomes', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (14, 4, 'Indirect Expenses', 0);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (15, 3, 'Sales', 1);
INSERT INTO groups (id, parent_id, name, affects_gross) VALUES (16, 4, 'Purchases', 1);
INSERT INTO entry_types (id, label, name, description, base_type, numbering, prefix, suffix, zero_padding, bank_cash_ledger_restriction) VALUES (1, 'receipt', 'Receipt', 'Received in Bank account or Cash account', 1, 1, '', '', 0, 2);
INSERT INTO entry_types (id, label, name, description, base_type, numbering, prefix, suffix, zero_padding, bank_cash_ledger_restriction) VALUES (2, 'payment', 'Payment', 'Payment made from Bank account or Cash account', 1, 1, '', '', 0, 3);
INSERT INTO entry_types (id, label, name, description, base_type, numbering, prefix, suffix, zero_padding, bank_cash_ledger_restriction) VALUES (3, 'contra', 'Contra', 'Transfer between Bank account and Cash account', 1, 1, '', '', 0, 4);
INSERT INTO entry_types (id, label, name, description, base_type, numbering, prefix, suffix, zero_padding, bank_cash_ledger_restriction) VALUES (4, 'journal', 'Journal', 'Transfer between Non Bank account and Cash account', 1, 1, '', '', 0, 5);
|
<reponame>olesgedz/Piscine_PHP<gh_stars>0
SELECT first_name, last_name, DATE(birthdate) from user_card
WHERE YEAR(birthdate) = '1976' ORDER by last_name;
|
<reponame>uudashr/go-jobexec<filename>internal/mysql/migrations/1513125523_execution_trackers_table.up.sql
CREATE TABLE execution_trackers (
id bigint(11) UNSIGNED NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
last_executor varchar(255),
next_execution_time timestamp(6),
created_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE UNIQUE INDEX uqx_name ON execution_trackers (name);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.