sql stringlengths 6 1.05M |
|---|
-----------------------------------------------------------------------
-- $Id$
--
-- Copyright (c) 2009 <NAME> <<EMAIL>>
--
-- This is free software; you can redistribute and/or modify it under
-- the terms of the GNU General Public Licence. See the COPYING file.
-----------------------------------------------------------------------
-----------------------------------------------------------------------
-- st_scalex
-----------------------------------------------------------------------
SELECT id, name, scalex
FROM rt_properties_test
WHERE st_scalex(rast) != scalex;
-----------------------------------------------------------------------
-- st_scalex
-----------------------------------------------------------------------
SELECT id, name, scaley
FROM rt_properties_test
WHERE st_scaley(rast) != scaley;
|
CREATE TABLE album
(
id UUID NOT NULL,
title VARCHAR(100) NOT NULL,
artist VARCHAR(100) NOT NULL,
release_date TIMESTAMP,
item_id UUID REFERENCES item(uuid)
);
CREATE INDEX id_idx ON album(id);
CREATE INDEX title_idx ON album(title);
CREATE INDEX artist_idx ON album(artist);
CREATE INDEX release_date_idx ON album(release_date); |
<reponame>Siyanda-Mzam/grassroot-platform
ALTER TABLE event DROP COLUMN version;
ALTER TABLE group_profile DROP COLUMN version; |
BEGIN;
select _v.register_patch( '002-fix-foreign-key', ARRAY[ '001-fix-input-uniq' ], NULL );
-- FK CONSTRAINTs are implemented as triggers that are painfully slow during
-- batch import taking huge amount of CPU. It's not trivial to disable/enable
-- these constraints in code, so I'm dropping them altogether.
ALTER TABLE ONLY badblob DROP CONSTRAINT badblob_report_no_fkey;
ALTER TABLE ONLY dns_a DROP CONSTRAINT dns_a_domain_no_fkey;
ALTER TABLE ONLY dns_a DROP CONSTRAINT dns_a_msm_no_fkey;
ALTER TABLE ONLY http_control DROP CONSTRAINT http_control_msm_no_fkey;
ALTER TABLE ONLY http_request DROP CONSTRAINT http_request_msm_no_fkey;
ALTER TABLE ONLY http_verdict DROP CONSTRAINT http_verdict_msm_no_fkey;
ALTER TABLE ONLY measurement DROP CONSTRAINT measurement_input_no_fkey;
ALTER TABLE ONLY measurement DROP CONSTRAINT measurement_report_no_fkey;
ALTER TABLE ONLY report DROP CONSTRAINT report_autoclaved_no_fkey;
ALTER TABLE ONLY report DROP CONSTRAINT report_software_no_fkey;
ALTER TABLE ONLY tcp DROP CONSTRAINT tcp_msm_no_fkey;
COMMIT;
|
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 14, 2017 at 07:54 AM
-- Server version: 5.5.24-log
-- PHP Version: 5.4.3
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 utf8 */;
--
-- Database: `foodshop`
--
-- --------------------------------------------------------
--
-- Table structure for table `enquiry_master`
--
CREATE TABLE IF NOT EXISTS `enquiry_master` (
`eid` int(5) NOT NULL AUTO_INCREMENT,
`uname` varchar(120) NOT NULL,
`email` varchar(120) NOT NULL,
`phone` varchar(12) NOT NULL,
`subject` varchar(150) NOT NULL,
`msg` text NOT NULL,
`status` int(1) NOT NULL,
`date` varchar(20) NOT NULL,
PRIMARY KEY (`eid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `enquiry_master`
--
INSERT INTO `enquiry_master` (`eid`, `uname`, `email`, `phone`, `subject`, `msg`, `status`, `date`) VALUES
(2, 'sagar', '<EMAIL>', '3242342', 'asd', 'asdadsaMessage', 1, '14-04-2017');
-- --------------------------------------------------------
--
-- Table structure for table `order_master`
--
CREATE TABLE IF NOT EXISTS `order_master` (
`oid` int(5) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`order_type` varchar(50) NOT NULL,
`cusine` varchar(150) NOT NULL,
`other` varchar(50) DEFAULT 'NA',
`rest_loca` varchar(150) DEFAULT NULL,
`city` varchar(50) NOT NULL,
`deliver_date` varchar(20) NOT NULL,
`order_date` varchar(20) NOT NULL,
`status` int(2) NOT NULL,
`restname` varchar(150) NOT NULL,
PRIMARY KEY (`oid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
--
-- Dumping data for table `order_master`
--
INSERT INTO `order_master` (`oid`, `username`, `order_type`, `cusine`, `other`, `rest_loca`, `city`, `deliver_date`, `order_date`, `status`, `restname`) VALUES
(1, 'sagar', 'Delivery', 'Break Fast', 'NA', 'Sardar Patel Square', 'Rajkot', '2017-06-07', '11-06-2017', 0, 'Domino`s Pizza'),
(2, 'sagar', 'Delivery', 'Dinner', 'NA', 'Sardar Patel Square', 'Surat', '2017-06-22', '13-06-2017', 0, 'Domino`s Pizza'),
(3, 'mahesh', 'Take away', 'Lunch', 'NA', 'Subway', 'Ahmedabad', '2017-06-23', '13-06-2017', 0, 'Subway'),
(5, 'Pooja', 'Take away', '120.00', 'NA', NULL, 'Rajkot', '2017-06-21', '13-06-2017', 1, 'Pizz Hut');
-- --------------------------------------------------------
--
-- Table structure for table `products`
--
CREATE TABLE IF NOT EXISTS `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`resid` int(11) NOT NULL DEFAULT '0',
`name` varchar(100) NOT NULL,
`details` text NOT NULL,
`picture` varchar(20) NOT NULL,
`price` double(6,2) NOT NULL DEFAULT '0.00',
`proprice` double(6,2) NOT NULL DEFAULT '0.00',
`status` tinyint(1) NOT NULL DEFAULT '1',
`isSpcl` int(2) DEFAULT '0',
`spclprice` decimal(8,0) DEFAULT '0',
`validaty` varchar(20) DEFAULT '0000-00-00',
PRIMARY KEY (`id`),
KEY `resid` (`resid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=38 ;
--
-- Dumping data for table `products`
--
INSERT INTO `products` (`id`, `resid`, `name`, `details`, `picture`, `price`, `proprice`, `status`, `isSpcl`, `spclprice`, `validaty`) VALUES
(30, 1, 'Pizaa', 'pizaaa', 'whole-pizza.png', 120.00, 120.00, 0, 0, '0', ''),
(31, 3, 'BIG BURGER', 'SO BIG BURGER', '1.jpg', 50.00, 50.00, 0, 1, '40', '2017-06-15'),
(32, 3, 'Triple Treat Box Veg', 'Meal for 4. Any 2 Veg Medium pizza + 1 Garlic Bread stix + 1 Dip + 1 Potato Poppers + 1 Tandoori Paneer Stuffed Pocket', '1371860.png', 320.00, 320.00, 0, 1, '220', '2017-06-21'),
(33, 5, 'Exotica', 'Red Capsicum, Green Capsicum, Baby Corn, Black Olives, Jalapenos', '1371007.png', 490.00, 490.00, 0, 1, '400', '2017-06-27'),
(34, 3, '420 PUNJABI MASALA PAPAD', '420 PUNJABI MASALA PAPAD', 'masaa045_1_.jpg', 120.00, 120.00, 0, 1, '80', '2017-06-16'),
(35, 5, 'Margherita | Classic', 'Margherita | Classic', 'Farm_Fresh_1.jpg', 250.00, 250.00, 0, NULL, '0', ''),
(36, 5, 'Classic Veggie', 'lassic Veggie', 'Classic_Veggie.jpg', 250.00, 250.00, 0, NULL, '0', ''),
(37, 3, 'Egg & Cheese', 'A classic for a reason. Our Egg and Cheese is simply delicious. Enjoy a fluffy egg omelet with melte', 'as.jpg', 200.00, 200.00, 0, NULL, '0', '');
-- --------------------------------------------------------
--
-- Table structure for table `rest_master`
--
CREATE TABLE IF NOT EXISTS `rest_master` (
`rid` int(5) NOT NULL AUTO_INCREMENT,
`rest_name` varchar(50) NOT NULL,
`rest_address` varchar(255) NOT NULL,
`rest_phone` varchar(12) NOT NULL,
`rest_logo` varchar(255) NOT NULL,
`rest_city` varchar(50) NOT NULL,
`status` varchar(10) NOT NULL,
`createdate` varchar(20) NOT NULL,
PRIMARY KEY (`rid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
--
-- Dumping data for table `rest_master`
--
INSERT INTO `rest_master` (`rid`, `rest_name`, `rest_address`, `rest_phone`, `rest_logo`, `rest_city`, `status`, `createdate`) VALUES
(1, '<NAME>', 'SG Highway', '6565656', 'margherita3.jpg', 'Ahmedabad', 'True', '14-04-2017'),
(3, 'Subway', 'Subway', '135649898', 'restaurent-logo2.jpg', 'Surat', 'True', '29-03-2017'),
(4, 'Barista', 'Maninagar', '956655', 'restaurent-logo3.jpg', 'Ahmedabad', 'False', '29-03-2017'),
(5, 'Papa Johns', 'Gota Chowkdi', '999556556', 'restaurent-logo4.jpg', 'Vadodara', 'True', '29-03-2017'),
(6, 'Domino`s Pizza', 'Sardar Patel Square', '32343243243', 'restaurent-logo5.jpg', 'Ahmedabad', 'True', '29-03-2017');
-- --------------------------------------------------------
--
-- Table structure for table `special_offers`
--
CREATE TABLE IF NOT EXISTS `special_offers` (
`sid` int(5) NOT NULL AUTO_INCREMENT,
`offername` varchar(250) NOT NULL,
`offer_date` varchar(20) NOT NULL,
`restid` varchar(10) NOT NULL,
`spcl_price` decimal(8,0) NOT NULL,
`offer_img` varchar(250) NOT NULL,
`status` int(2) NOT NULL,
PRIMARY KEY (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `usermaster`
--
CREATE TABLE IF NOT EXISTS `usermaster` (
`uid` int(5) NOT NULL AUTO_INCREMENT,
`fname` varchar(150) NOT NULL,
`lname` varchar(150) NOT NULL,
`email` varchar(150) NOT NULL,
`password` varchar(150) NOT NULL,
`role` varchar(10) NOT NULL,
`date` varchar(20) NOT NULL,
PRIMARY KEY (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `usermaster`
--
INSERT INTO `usermaster` (`uid`, `fname`, `lname`, `email`, `password`, `role`, `date`) VALUES
(1, 'sagar', 'rathod', '<EMAIL>', '<PASSWORD>', 'User', '29-03-2017'),
(2, 'deepak', 'asddddd', '123@123.123', '12345', 'User', '15-04-2017');
/*!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>EFREI-M1-LSI-2020-2021/distributed-database<filename>TP2/tp02.sql
-- ============================================================
-- Nom de la base : BD_Notation
-- Nom de SGBD : ORACLE
-- Date de création : Mars 2020
-- Auteur : <NAME>
-- ============================================================
-- ============================================================
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MM-YYYY' ;
-- ============================================================
-- Destruction des tables
DROP TABLE Etudiant CASCADE CONSTRAINTS;
DROP TABLE Matiere CASCADE CONSTRAINTS;
DROP TABLE Epreuve CASCADE CONSTRAINTS;
DROP TABLE Notation CASCADE CONSTRAINTS;
-- Creation des tables
-- Mettez les contraintes de cles primaires et contraintes de domaines
CREATE TABLE Etudiant (
NumEtu NUMBER(8),
Nom VARCHAR2(20),
Prenom VARCHAR2(20),
DateNais DATE,
Rue VARCHAR2(50),
CP CHAR(5),
Ville VARCHAR2(25)
);
CREATE TABLE Matiere (
CodeMat CHAR(3),
Libelle VARCHAR2(20),
Coef NUMBER(3,2)
);
CREATE TABLE Epreuve (
NumEpreuve NUMBER(10),
DateEpreuve DATE,
Lieu VARCHAR2(20),
CodeMat CHAR(3)
);
CREATE TABLE Notation (
NumEtu NUMBER(8),
NumEpreuve NUMBER(10),
Note NUMBER(4,2)
);
-- Ajouter les contraintes de cles etrangeres
REM ALTER TABLE Epreuve ADD CONSTRAINT FkEpreuve1 FOREIGN KEY(CodeMat) REFERENCES
REM Matiere(CodeMat);
-- Remplissage des tables
INSERT INTO Etudiant VALUES (110,'Dupont','Albert','01-06-1990','RuedeCrimée','69001','Lyon');
INSERT INTO Etudiant VALUES (222,'West','James','03-09-1993','Studio',NULL,'Hollywood');
INSERT INTO Etudiant VALUES (300,'Martin','Marie','05-06-1998','RuedesAcacias','69130','Ecully');
INSERT INTO Etudiant VALUES (421,'Durand','Gaston','15-11-1990','RuedelaMeuse','69008','Lyon');
INSERT INTO Etudiant VALUES (575,'Titgoutte','Justine','28-02-1995','CheminduChâteau','69630','Chaponost');
INSERT INTO Etudiant VALUES (667,'Dupond','Noémie','18-09-1997','RuedeDôle','69007','Lyon');
INSERT INTO Etudiant VALUES (999,'Phantom','Marcel','30-01-1990',NULL,NULL,NULL);
INSERT INTO Matiere VALUES ('STA','Statistique',0.4);
INSERT INTO Matiere VALUES ('INF','Informatique',0.4);
INSERT INTO Matiere VALUES ('ECO','Econométrie',0.2);
INSERT INTO Epreuve VALUES(11031,'15-12-2018','Salle191L','STA');
INSERT INTO Epreuve VALUES(11032,'01-04-2019','AmphiG','STA');
INSERT INTO Epreuve VALUES(21031,'30-10-2018','Salle191L','INF');
INSERT INTO Epreuve VALUES(21032,'01-06-2019','Salle192L','INF');
INSERT INTO Epreuve VALUES(31030,'02-07-2019','Salle05R','ECO');
INSERT INTO Notation VALUES (110,11031,10);
INSERT INTO Notation VALUES (110,11032,11.5);
INSERT INTO Notation VALUES (110,21031,8.5);
INSERT INTO Notation VALUES (110,21032, NULL);
INSERT INTO Notation VALUES (110,31030,13);
INSERT INTO Notation VALUES (222,11031,9);
INSERT INTO Notation VALUES (222,11032,14);
INSERT INTO Notation VALUES (222,21031,12);
INSERT INTO Notation VALUES (222,21032,16);
INSERT INTO Notation VALUES (222,31030,20);
INSERT INTO Notation VALUES (300,11031,14);
INSERT INTO Notation VALUES (300,11032,20);
INSERT INTO Notation VALUES (300,21031,20);
INSERT INTO Notation VALUES (300,21032,13.5);
INSERT INTO Notation VALUES (300,31030,16);
INSERT INTO Notation VALUES (421,11031,5.5);
INSERT INTO Notation VALUES (421,11032,17);
INSERT INTO Notation VALUES (421,21031,1.5);
INSERT INTO Notation VALUES (421,21032, NULL);
INSERT INTO Notation VALUES (421,31030,10);
INSERT INTO Notation VALUES (575,11031,13);
INSERT INTO Notation VALUES (575,11032,9);
INSERT INTO Notation VALUES (575,21031,12.5);
INSERT INTO Notation VALUES (575,21032,14);
INSERT INTO Notation VALUES (575,31030,7);
INSERT INTO Notation VALUES (667,11031,16);
INSERT INTO Notation VALUES (667,11032,20);
INSERT INTO Notation VALUES (667,21031,8.5);
INSERT INTO Notation VALUES (667,21032,9.5);
-- Annexe-2
Drop user User1 cascade;
create user Apprenti identified by M1appLSI
default tablespace USERS
temporary tablespace TEMP
quota 2 M on USERS
PROFILE DEFAULT
ACCOUNT UNLOCK;
GRANT ALTER SESSION TO Apprenti;
GRANT CREATE DATABASE LINK TO Apprenti;
GRANT CREATE SYNONYM TO Apprenti;
GRANT CREATE VIEW TO Apprenti;
GRANT CREATE TRIGGER TO Apprenti;
GRANT DEBUG CONNECT SESSION TO Apprenti;
GRANT UNLIMITED TABLESPACE TO Apprenti;
GRANT CONNECT TO Apprenti;
GRANT RESOURCE TO Apprenti;
GRANT SELECT_CATALOG_ROLE TO Apprenti;
|
<filename>controlinventario.sql
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 24-10-2020 a las 05:58:37
-- Versión del servidor: 10.4.14-MariaDB
-- Versión de PHP: 7.2.33
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `controlinventario`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_bitacora`
--
CREATE TABLE `tbl_bitacora` (
`Id_Bitacora` int(11) NOT NULL,
`Usuario` varchar(45) DEFAULT NULL,
`Movimiento` varchar(45) DEFAULT NULL,
`Fecha` varchar(45) DEFAULT NULL,
`Hora` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_cliente`
--
CREATE TABLE `tbl_cliente` (
`Id_Cliente` int(11) NOT NULL,
`Nombre_Cliente` varchar(45) DEFAULT NULL,
`Nit_Cliente` varchar(45) DEFAULT NULL,
`Direccion` varchar(45) NOT NULL,
`Estado` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `tbl_cliente`
--
INSERT INTO `tbl_cliente` (`Id_Cliente`, `Nombre_Cliente`, `Nit_Cliente`, `Direccion`, `Estado`) VALUES
(23, 'Diego', '1321231', 'Ciudad', '1'),
(24, '<NAME>', '25', 'Guatemala', '1'),
(25, 'Diego', '26', 'Guatemala', '1'),
(26, 'Diego', '29', 'Guatemala', '1'),
(27, 'Diego', '30', 'Guatemala', '1'),
(28, 'Diego', '31', 'Guatemala', '1'),
(29, 'Diego', '231321', 'Guatemala', '1'),
(30, 'Diego', '87978', 'Guatemala', '1'),
(31, 'Diego', '4564', 'Guatemala', '1'),
(32, 'Diego', '3', 'Ciudad', '1'),
(33, 'Diego', '21213', 'Guatemala', '1'),
(34, 'Diego', '45', 'Guatemala', '1'),
(35, 'Diego', '1312', 'Guatemala', '1'),
(36, '<NAME>', '001', 'Guatemala', '1'),
(37, 'Diego', '299', 'Guatemala', '1'),
(38, '<NAME>', '7897', 'Guatemala', '1'),
(39, 'Diego', '312321', 'Guatemala', '1'),
(40, 'Diego', '199', 'Guatemala', '1'),
(41, 'Diego', '45345', 'Guatemala', '1'),
(42, 'Diego', '45645', 'Guatemala', '1'),
(43, 'Diego', '5456', 'Guatemala', '1'),
(44, 'Diego', '1234', 'Guatemala', '1'),
(45, 'Diego', '123213', 'Guatemala', '1'),
(46, 'Diego', '12321', 'Guatemala', '1');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_compras_encabezado`
--
CREATE TABLE `tbl_compras_encabezado` (
`Id_ComprasEncabezado` int(11) NOT NULL,
`Fecha` varchar(45) DEFAULT NULL,
`Total` varchar(45) DEFAULT NULL,
`Estado` varchar(45) DEFAULT NULL,
`Tbl_Proveedor_Id_Proveedor` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_compra_detalle`
--
CREATE TABLE `tbl_compra_detalle` (
`Id_CompraDetalle` int(11) NOT NULL,
`Precio` int(11) DEFAULT NULL,
`Cantidad` int(11) DEFAULT NULL,
`Tbl_Compras_Encabezado_Id_ComprasEncabezado` int(11) NOT NULL,
`Tbl_Repuestos_Id_Repuestos` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_devoluciones`
--
CREATE TABLE `tbl_devoluciones` (
`Id_Devoluciones` int(11) NOT NULL,
`Cantidad` int(11) DEFAULT NULL,
`Descripcion` varchar(45) DEFAULT NULL,
`Tbl_Repuestos_Id_Repuestos` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_factura_detalle`
--
CREATE TABLE `tbl_factura_detalle` (
`Id_FacturaDetalle` int(11) NOT NULL,
`Precio` int(11) DEFAULT NULL,
`Cantidad` int(11) DEFAULT NULL,
`Tbl_Factura_Encabezado_idTbl_Factura_Encabezado` int(11) NOT NULL,
`Tbl_Repuestos_Id_Repuestos` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_factura_encabezado`
--
CREATE TABLE `tbl_factura_encabezado` (
`idTbl_Factura_Encabezado` int(11) NOT NULL,
`Serie_Fact` varchar(45) DEFAULT NULL,
`Descuento_Fact` varchar(45) DEFAULT NULL,
`Fecha_Fact` varchar(45) DEFAULT NULL,
`Subtotal` int(11) DEFAULT NULL,
`Descuento` int(11) DEFAULT NULL,
`Total` int(11) DEFAULT NULL,
`Comentario` varchar(45) DEFAULT NULL,
`Tbl_Cliente_Id_Cliente` int(11) NOT NULL,
`Tbl_Tipo_Pago_Id_TipoPago` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_proveedor`
--
CREATE TABLE `tbl_proveedor` (
`Id_Proveedor` int(11) NOT NULL,
`Nombre` varchar(45) DEFAULT NULL,
`Nit` varchar(45) DEFAULT NULL,
`Direccion` varchar(45) DEFAULT NULL,
`Estado` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `tbl_proveedor`
--
INSERT INTO `tbl_proveedor` (`Id_Proveedor`, `Nombre`, `Nit`, `Direccion`, `Estado`) VALUES
(1, 'Diego', '4564', 'Ciudad', '1'),
(2, 'Diego', '4564', 'Ciudad', '1'),
(4, 'Diego', '25', 'Guatemala', '1'),
(6, 'Diego', '26', 'Guatemala', '1'),
(7, 'Diego', '1234', 'Guatemala', '1');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_repuestos`
--
CREATE TABLE `tbl_repuestos` (
`Id_Repuestos` int(11) NOT NULL,
`Descripcion_Repuesto` varchar(45) DEFAULT NULL,
`Costo_Repuesto1` varchar(45) DEFAULT NULL,
`Costo_Repuesto2` varchar(45) DEFAULT NULL,
`Costo_Repuesto3` varchar(45) DEFAULT NULL,
`Costo_Repuesto4` varchar(45) DEFAULT NULL,
`Precio_Venta1` varchar(45) DEFAULT NULL,
`Precio_Venta2` varchar(45) DEFAULT NULL,
`Precio_Venta3` varchar(45) DEFAULT NULL,
`Precio_Venta4` varchar(45) DEFAULT NULL,
`Cantidad` int(11) DEFAULT NULL,
`Facturar_sin_Existencia` varchar(45) DEFAULT NULL,
`Precio_Facturar` varchar(45) DEFAULT NULL,
`Estado` varchar(45) DEFAULT NULL,
`Tbl_Tiporepuesto_Id_Tiporepuesto` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_repuestos_has_tbl_proveedor`
--
CREATE TABLE `tbl_repuestos_has_tbl_proveedor` (
`Tbl_Repuestos_Id_Repuestos` int(11) NOT NULL,
`Tbl_Proveedor_Id_Proveedor` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_tiporepuesto`
--
CREATE TABLE `tbl_tiporepuesto` (
`Id_Tiporepuesto` int(11) NOT NULL,
`Descripcion` varchar(45) DEFAULT NULL,
`Estado` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `tbl_tiporepuesto`
--
INSERT INTO `tbl_tiporepuesto` (`Id_Tiporepuesto`, `Descripcion`, `Estado`) VALUES
(1, 'Descripcion de la prueba del producto', '1'),
(2, 'Diego', '1'),
(3, 'Diego', '1');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_tipo_pago`
--
CREATE TABLE `tbl_tipo_pago` (
`Id_TipoPago` int(11) NOT NULL,
`Nombre` varchar(45) DEFAULT NULL,
`Estado` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `tbl_tipo_pago`
--
INSERT INTO `tbl_tipo_pago` (`Id_TipoPago`, `Nombre`, `Estado`) VALUES
(1, 'Prueba', '1'),
(3, '$Nombre', '1'),
(4, 'Diego', '1'),
(5, '<NAME>', '1'),
(6, 'Diego', '1');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_usuarios`
--
CREATE TABLE `tbl_usuarios` (
`Id_Usuario` int(11) NOT NULL,
`Nombre_Usuario` varchar(45) DEFAULT NULL,
`Correo_Usuario` varchar(45) DEFAULT NULL,
`Pasword_Usuario` varchar(45) DEFAULT NULL,
`Estado` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Volcado de datos para la tabla `tbl_usuarios`
--
INSERT INTO `tbl_usuarios` (`Id_Usuario`, `Nombre_Usuario`, `Correo_Usuario`, `Pasword_Usuario`, `Estado`) VALUES
(1, 'Diego', 'Gomez', '1234', '1'),
(4, '<NAME>', '', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', '1'),
(5, '<NAME>', '<NAME>', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', '1'),
(6, 'Diego', 'Gomez', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', '1'),
(7, 'Prueba', 'Prueba', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', '1'),
(8, 'Diego', '<EMAIL>', '<PASSWORD>', '1');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_venta_credito`
--
CREATE TABLE `tbl_venta_credito` (
`Id_VentaCredito` int(11) NOT NULL,
`Saldo_Pendiente` int(11) DEFAULT NULL,
`Estado` varchar(45) DEFAULT NULL,
`Tbl_Factura_Encabezado_idTbl_Factura_Encabezado` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_venta_efectivo`
--
CREATE TABLE `tbl_venta_efectivo` (
`Id_VentaEfectivo` int(11) NOT NULL,
`Saldo` varchar(45) DEFAULT NULL,
`Estado` varchar(45) DEFAULT NULL,
`Tbl_Factura_Encabezado_idTbl_Factura_Encabezado` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `tbl_bitacora`
--
ALTER TABLE `tbl_bitacora`
ADD PRIMARY KEY (`Id_Bitacora`);
--
-- Indices de la tabla `tbl_cliente`
--
ALTER TABLE `tbl_cliente`
ADD PRIMARY KEY (`Id_Cliente`);
--
-- Indices de la tabla `tbl_compras_encabezado`
--
ALTER TABLE `tbl_compras_encabezado`
ADD PRIMARY KEY (`Id_ComprasEncabezado`),
ADD KEY `fk_Tbl_Compras_Encabezado_Tbl_Proveedor1` (`Tbl_Proveedor_Id_Proveedor`);
--
-- Indices de la tabla `tbl_compra_detalle`
--
ALTER TABLE `tbl_compra_detalle`
ADD PRIMARY KEY (`Id_CompraDetalle`),
ADD KEY `fk_Tbl_Compra_Detalle_Tbl_Compras_Encabezado1` (`Tbl_Compras_Encabezado_Id_ComprasEncabezado`),
ADD KEY `fk_Tbl_Compra_Detalle_Tbl_Repuestos1` (`Tbl_Repuestos_Id_Repuestos`);
--
-- Indices de la tabla `tbl_devoluciones`
--
ALTER TABLE `tbl_devoluciones`
ADD PRIMARY KEY (`Id_Devoluciones`),
ADD KEY `fk_Tbl_Devoluciones_Tbl_Repuestos1` (`Tbl_Repuestos_Id_Repuestos`);
--
-- Indices de la tabla `tbl_factura_detalle`
--
ALTER TABLE `tbl_factura_detalle`
ADD PRIMARY KEY (`Id_FacturaDetalle`),
ADD KEY `fk_Tbl_Factura_Detalle_Tbl_Factura_Encabezado1` (`Tbl_Factura_Encabezado_idTbl_Factura_Encabezado`),
ADD KEY `fk_Tbl_Factura_Detalle_Tbl_Repuestos1` (`Tbl_Repuestos_Id_Repuestos`);
--
-- Indices de la tabla `tbl_factura_encabezado`
--
ALTER TABLE `tbl_factura_encabezado`
ADD PRIMARY KEY (`idTbl_Factura_Encabezado`),
ADD KEY `fk_Tbl_Factura_Encabezado_Tbl_Cliente` (`Tbl_Cliente_Id_Cliente`),
ADD KEY `fk_Tbl_Factura_Encabezado_Tbl_Tipo_Pago1` (`Tbl_Tipo_Pago_Id_TipoPago`);
--
-- Indices de la tabla `tbl_proveedor`
--
ALTER TABLE `tbl_proveedor`
ADD PRIMARY KEY (`Id_Proveedor`);
--
-- Indices de la tabla `tbl_repuestos`
--
ALTER TABLE `tbl_repuestos`
ADD PRIMARY KEY (`Id_Repuestos`),
ADD KEY `fk_Tbl_Repuestos_Tbl_Tiporepuesto1` (`Tbl_Tiporepuesto_Id_Tiporepuesto`);
--
-- Indices de la tabla `tbl_repuestos_has_tbl_proveedor`
--
ALTER TABLE `tbl_repuestos_has_tbl_proveedor`
ADD PRIMARY KEY (`Tbl_Repuestos_Id_Repuestos`,`Tbl_Proveedor_Id_Proveedor`),
ADD KEY `fk_Tbl_Repuestos_has_Tbl_Proveedor_Tbl_Proveedor1` (`Tbl_Proveedor_Id_Proveedor`);
--
-- Indices de la tabla `tbl_tiporepuesto`
--
ALTER TABLE `tbl_tiporepuesto`
ADD PRIMARY KEY (`Id_Tiporepuesto`);
--
-- Indices de la tabla `tbl_tipo_pago`
--
ALTER TABLE `tbl_tipo_pago`
ADD PRIMARY KEY (`Id_TipoPago`);
--
-- Indices de la tabla `tbl_usuarios`
--
ALTER TABLE `tbl_usuarios`
ADD PRIMARY KEY (`Id_Usuario`);
--
-- Indices de la tabla `tbl_venta_credito`
--
ALTER TABLE `tbl_venta_credito`
ADD PRIMARY KEY (`Id_VentaCredito`),
ADD KEY `fk_Tbl_Venta_Credito_Tbl_Factura_Encabezado1` (`Tbl_Factura_Encabezado_idTbl_Factura_Encabezado`);
--
-- Indices de la tabla `tbl_venta_efectivo`
--
ALTER TABLE `tbl_venta_efectivo`
ADD PRIMARY KEY (`Id_VentaEfectivo`),
ADD KEY `fk_Tbl_Venta_Efectivo_Tbl_Factura_Encabezado1` (`Tbl_Factura_Encabezado_idTbl_Factura_Encabezado`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `tbl_bitacora`
--
ALTER TABLE `tbl_bitacora`
MODIFY `Id_Bitacora` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tbl_cliente`
--
ALTER TABLE `tbl_cliente`
MODIFY `Id_Cliente` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=47;
--
-- AUTO_INCREMENT de la tabla `tbl_compras_encabezado`
--
ALTER TABLE `tbl_compras_encabezado`
MODIFY `Id_ComprasEncabezado` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tbl_compra_detalle`
--
ALTER TABLE `tbl_compra_detalle`
MODIFY `Id_CompraDetalle` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tbl_devoluciones`
--
ALTER TABLE `tbl_devoluciones`
MODIFY `Id_Devoluciones` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tbl_factura_detalle`
--
ALTER TABLE `tbl_factura_detalle`
MODIFY `Id_FacturaDetalle` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tbl_factura_encabezado`
--
ALTER TABLE `tbl_factura_encabezado`
MODIFY `idTbl_Factura_Encabezado` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tbl_proveedor`
--
ALTER TABLE `tbl_proveedor`
MODIFY `Id_Proveedor` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT de la tabla `tbl_repuestos`
--
ALTER TABLE `tbl_repuestos`
MODIFY `Id_Repuestos` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tbl_tiporepuesto`
--
ALTER TABLE `tbl_tiporepuesto`
MODIFY `Id_Tiporepuesto` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT de la tabla `tbl_tipo_pago`
--
ALTER TABLE `tbl_tipo_pago`
MODIFY `Id_TipoPago` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT de la tabla `tbl_usuarios`
--
ALTER TABLE `tbl_usuarios`
MODIFY `Id_Usuario` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT de la tabla `tbl_venta_credito`
--
ALTER TABLE `tbl_venta_credito`
MODIFY `Id_VentaCredito` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tbl_venta_efectivo`
--
ALTER TABLE `tbl_venta_efectivo`
MODIFY `Id_VentaEfectivo` int(11) NOT NULL AUTO_INCREMENT;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `tbl_compras_encabezado`
--
ALTER TABLE `tbl_compras_encabezado`
ADD CONSTRAINT `fk_Tbl_Compras_Encabezado_Tbl_Proveedor1` FOREIGN KEY (`Tbl_Proveedor_Id_Proveedor`) REFERENCES `tbl_proveedor` (`Id_Proveedor`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `tbl_compra_detalle`
--
ALTER TABLE `tbl_compra_detalle`
ADD CONSTRAINT `fk_Tbl_Compra_Detalle_Tbl_Compras_Encabezado1` FOREIGN KEY (`Tbl_Compras_Encabezado_Id_ComprasEncabezado`) REFERENCES `tbl_compras_encabezado` (`Id_ComprasEncabezado`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_Tbl_Compra_Detalle_Tbl_Repuestos1` FOREIGN KEY (`Tbl_Repuestos_Id_Repuestos`) REFERENCES `tbl_repuestos` (`Id_Repuestos`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `tbl_devoluciones`
--
ALTER TABLE `tbl_devoluciones`
ADD CONSTRAINT `fk_Tbl_Devoluciones_Tbl_Repuestos1` FOREIGN KEY (`Tbl_Repuestos_Id_Repuestos`) REFERENCES `tbl_repuestos` (`Id_Repuestos`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `tbl_factura_detalle`
--
ALTER TABLE `tbl_factura_detalle`
ADD CONSTRAINT `fk_Tbl_Factura_Detalle_Tbl_Factura_Encabezado1` FOREIGN KEY (`Tbl_Factura_Encabezado_idTbl_Factura_Encabezado`) REFERENCES `tbl_factura_encabezado` (`idTbl_Factura_Encabezado`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_Tbl_Factura_Detalle_Tbl_Repuestos1` FOREIGN KEY (`Tbl_Repuestos_Id_Repuestos`) REFERENCES `tbl_repuestos` (`Id_Repuestos`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `tbl_factura_encabezado`
--
ALTER TABLE `tbl_factura_encabezado`
ADD CONSTRAINT `fk_Tbl_Factura_Encabezado_Tbl_Cliente` FOREIGN KEY (`Tbl_Cliente_Id_Cliente`) REFERENCES `tbl_cliente` (`Id_Cliente`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_Tbl_Factura_Encabezado_Tbl_Tipo_Pago1` FOREIGN KEY (`Tbl_Tipo_Pago_Id_TipoPago`) REFERENCES `tbl_tipo_pago` (`Id_TipoPago`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `tbl_repuestos`
--
ALTER TABLE `tbl_repuestos`
ADD CONSTRAINT `fk_Tbl_Repuestos_Tbl_Tiporepuesto1` FOREIGN KEY (`Tbl_Tiporepuesto_Id_Tiporepuesto`) REFERENCES `tbl_tiporepuesto` (`Id_Tiporepuesto`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `tbl_repuestos_has_tbl_proveedor`
--
ALTER TABLE `tbl_repuestos_has_tbl_proveedor`
ADD CONSTRAINT `fk_Tbl_Repuestos_has_Tbl_Proveedor_Tbl_Proveedor1` FOREIGN KEY (`Tbl_Proveedor_Id_Proveedor`) REFERENCES `tbl_proveedor` (`Id_Proveedor`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_Tbl_Repuestos_has_Tbl_Proveedor_Tbl_Repuestos1` FOREIGN KEY (`Tbl_Repuestos_Id_Repuestos`) REFERENCES `tbl_repuestos` (`Id_Repuestos`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `tbl_venta_credito`
--
ALTER TABLE `tbl_venta_credito`
ADD CONSTRAINT `fk_Tbl_Venta_Credito_Tbl_Factura_Encabezado1` FOREIGN KEY (`Tbl_Factura_Encabezado_idTbl_Factura_Encabezado`) REFERENCES `tbl_factura_encabezado` (`idTbl_Factura_Encabezado`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `tbl_venta_efectivo`
--
ALTER TABLE `tbl_venta_efectivo`
ADD CONSTRAINT `fk_Tbl_Venta_Efectivo_Tbl_Factura_Encabezado1` FOREIGN KEY (`Tbl_Factura_Encabezado_idTbl_Factura_Encabezado`) REFERENCES `tbl_factura_encabezado` (`idTbl_Factura_Encabezado`) ON DELETE NO ACTION ON UPDATE NO ACTION;
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 */;
|
DROP TABLE schedule;
CREATE TABLE `schedule` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`date` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE tbl_bfp;
CREATE TABLE `tbl_bfp` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`establishment` text NOT NULL,
`inspectors` text NOT NULL,
`firstname` text NOT NULL,
`middlename` text NOT NULL,
`lastname` text NOT NULL,
`occupancy` text NOT NULL,
`establish_date` text NOT NULL,
`fsic` text NOT NULL,
`ornum` int(11) NOT NULL,
`amount` int(11) NOT NULL,
`archive_unarchive` int(11) NOT NULL DEFAULT '1',
`region` text NOT NULL,
`province` text NOT NULL,
`municipality` text NOT NULL,
`barangay` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=289 DEFAULT CHARSET=latin1;
INSERT INTO tbl_bfp VALUES ("267","sample3","SPO4 <NAME>,SPO1 Allora S Alviar","sample3","s3","sample","sample","2020-06-08","RO1-056-AFS-LU-2020-","0","2435","0","01","LA UNION","AGOO","SAN AGUSTIN EAST") ;
INSERT INTO tbl_bfp VALUES ("268","sample1","SPO4 <NAME>,SPO1 Allora S Alviar","sample1","s1","sample1","sample","2020-06-08","RO1-056-AFS-LU-2020-","0","2435","0","01","LA UNION","AGOO","SAN MARCOS") ;
INSERT INTO tbl_bfp VALUES ("269","sample2","SPO4 <NAME>,SPO1 Allora S Alviar","sample2","s2","sample2","sample","2020-06-08","RO1-056-AFS-LU-2020-","0","2435","1","01","LA UNION","AGOO","SAN AGUSTIN SUR") ;
INSERT INTO tbl_bfp VALUES ("270","sample1","SPO4 <NAME>,SPO1 Allora S Alviar","sample1","s1","sample2","sample","2020-06-08","RO1-056-AFS-LU-2020-","0","2435","1","01","LA UNION","AGOO","SAN AGUSTIN EAST") ;
INSERT INTO tbl_bfp VALUES ("272","new","SPO1 Allora S Alviar","new","new","new","new","2020-06-08","RO1-056-AFS-LU-2020-242","42525235","242","1","01","LA UNION","ARINGAY","ALASKA") ;
INSERT INTO tbl_bfp VALUES ("275","sample3","sample sample sample sample","sample3","s","sample3","Health Care","2020-06-10","RO1-056-AFS-LU-2020-232","42525","2000","0","01","LA UNION","AGOO","MACALVA NORTE") ;
INSERT INTO tbl_bfp VALUES ("276","sample4","SPO25 <NAME>","sample4","s","sample4","Residential","2020-06-10","RO1-056-AFS-LU-2020-2323","42525","2000","0","01","LA UNION","AGOO","MACALVA NORTE") ;
INSERT INTO tbl_bfp VALUES ("278","sample6","SPO1 Allora S Alviar","sample6","s","sample6","Residential","2020-06-10","RO1-056-AFS-LU-2020-23232","425252","2000","0","01","LA UNION","AGOO","MACALVA NORTE") ;
INSERT INTO tbl_bfp VALUES ("279","sample6","SPO1 Allora S Alviar","sample6","s","sample6","Residential","2020-06-10","RO1-056-AFS-LU-2020-23232","425252","2000","0","01","LA UNION","AGOO","MACALVA NORTE") ;
INSERT INTO tbl_bfp VALUES ("280","sample7","SPO1 Allora S Alviar","sample7","s","sample7","Residential","2020-06-10","RO1-056-AFS-LU-2020-23232","425252","2000","1","01","LA UNION","AGOO","MACALVA NORTE") ;
INSERT INTO tbl_bfp VALUES ("281","sample7","SPO1 Allora S Alviar","sample7","s","sample7","Residential","2020-06-10","RO1-056-AFS-LU-2020-23232","425252","2000","0","01","LA UNION","AGOO","MACALVA NORTE") ;
INSERT INTO tbl_bfp VALUES ("282","asar","SPO1 Allora S Alviar","asd","a","as","Health Care","2020-06-10","RO1-056-AFS-LU-2020-42","225","22","1","01","LA UNION","AGOO","CAPAS") ;
INSERT INTO tbl_bfp VALUES ("283","<NAME>","sample sample sample sample,SPO1 Allora S Alviar","Alvin","P","Laroya","","","RO1-056-AFS-LU-2020-","0","0","1","01","","","") ;
INSERT INTO tbl_bfp VALUES ("284","ab","sample sample sample sample,SPO1 Allora S Alviar","ab","ab","ab","Health Care","2020-06-28","RO1-056-AFS-LU-2020-242","24242","24","1","01","LA UNION","AGOO","SAN FRANCISCO") ;
INSERT INTO tbl_bfp VALUES ("285","Seasons Delights","sample sample sample sample,SPO1 Allora S Alviar","Alvin","P","Laroya","Businesss","2020-06-28","RO1-056-AFS-LU-2020-234","242","3000","1","01","LA UNION","AGOO","SAN AGUSTIN EAST") ;
INSERT INTO tbl_bfp VALUES ("286","Cebuana","sample sample sample sample","Denis","N","Putoza","Businesss","2020-06-28","RO1-056-AFS-LU-2020-23","524","3000","1","01","LA UNION","ARINGAY","DULAO") ;
INSERT INTO tbl_bfp VALUES ("287","Tiga aringay","SPO5 Jheim V Viallanueva","aringay","a","aringay","Detention and Correctional","2020-06-29","RO1-056-AFS-LU-2020-23","2242","4","1","01","LA UNION","ARINGAY","MACABATO") ;
INSERT INTO tbl_bfp VALUES ("288","<NAME>","SPO4 <NAME>","Boyet","Tubilan","Laroya","Businesss","2020-06-29","RO1-056-AFS-LU-2020-23","24","3000","1","01","LA UNION","AGOO","MACALVA CENTRAL") ;
DROP TABLE tbl_fsic;
CREATE TABLE `tbl_fsic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`complete_address` text NOT NULL,
`bin` int(11) NOT NULL,
`tin` int(11) NOT NULL,
`email` text NOT NULL,
`establishment` text NOT NULL,
`fullname` text NOT NULL,
`business_nature` text NOT NULL,
`phone` text NOT NULL,
`representative` text NOT NULL,
`tradename` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1;
INSERT INTO tbl_fsic VALUES ("27","Agoo","0","0","<EMAIL>","<NAME>","<NAME>","Businesss","639381453259","none","none") ;
DROP TABLE tbl_inspectors;
CREATE TABLE `tbl_inspectors` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`position` text NOT NULL,
`firstname` text NOT NULL,
`middlename` text NOT NULL,
`lastname` text NOT NULL,
`address_location` text NOT NULL,
`inspector_status` int(11) DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
INSERT INTO tbl_inspectors VALUES ("1","SPO2","Alvin","P","Laroya","Agoo, La Union","0") ;
INSERT INTO tbl_inspectors VALUES ("2","SPO33","Denis","N","Putoza","San Agustin East","0") ;
INSERT INTO tbl_inspectors VALUES ("3","SPO25","<NAME>","C","Mazon","Nazareno","1") ;
INSERT INTO tbl_inspectors VALUES ("4","SPO3","Justine","P","Tanga","Agoo","1") ;
INSERT INTO tbl_inspectors VALUES ("5","SPO4","<NAME>","N","Makil","Consolacion Agoo, La Union","0") ;
INSERT INTO tbl_inspectors VALUES ("8","SPO1","Allora","S","Alviar","San Marcos Agoo, La Union","1") ;
INSERT INTO tbl_inspectors VALUES ("9","SPO1","Eugene","P","Laroya","San Agustin East Agoo, La Union","0") ;
INSERT INTO tbl_inspectors VALUES ("10","sample","sample","sample","sample","sample","1") ;
INSERT INTO tbl_inspectors VALUES ("11","SPO3","","","","","0") ;
DROP TABLE tbl_users;
CREATE TABLE `tbl_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` text NOT NULL,
`user_password` text NOT NULL,
`fname` text NOT NULL,
`mname` text NOT NULL,
`lname` text NOT NULL,
`status_request` int(11) NOT NULL DEFAULT '0',
`phone` text NOT NULL,
`region` text NOT NULL,
`province` text NOT NULL,
`municipality` text NOT NULL,
`barangay` text NOT NULL,
`avatar` text NOT NULL,
`position` text NOT NULL,
`to_add` int(11) NOT NULL DEFAULT '0',
`to_archive` int(11) NOT NULL DEFAULT '0',
`to_respond_fsic` int(11) NOT NULL DEFAULT '0',
`to_accept_request` int(11) NOT NULL DEFAULT '0',
`to_switch_status` int(11) NOT NULL DEFAULT '0',
`to_active_status` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=latin1;
INSERT INTO tbl_users VALUES ("25","<EMAIL>","$2y$10$rFEYCvFEaSeVMZDCJdrzl.QYjYzMwRTrSM4ic.DqJKxCoQA6uTjp6","ALvin","P.","Laroya","1","09381453259","01","LA UNION","AGOO","SAN AGUSTIN EAST","","SPO4","1","1","1","1","1","1") ;
INSERT INTO tbl_users VALUES ("26","<EMAIL>","$2y$10$5tDSxIU3vIQ/LQkxoibZt.fUvwqCBsgWQPk.7BZyLbscxf4xUhGpO","Denis","N","Putoza","1","935385093890","01","LA UNION","AGOO","SAN AGUSTIN EAST","","SPO1","1","1","1","1","1","0") ;
INSERT INTO tbl_users VALUES ("27","<EMAIL>","$2y$10$xzVkV2hsBthsXg4ZEzoYqe.6/rabXGb0GIxRRbJObCotA8jyNGDCq","Allora","S","Alviar","1","25225252","01","LA UNION","ARINGAY","SAN MARCOS","","SPO3","0","0","0","0","0","0") ;
INSERT INTO tbl_users VALUES ("28","<EMAIL>","$2y$10$7cofHOk361THsqzVcE7HbONFeCJeP3AW2EnopSO5JwF6xaoayLw/2","Diego","S","Beligan","1","2525252","01","LA UNION","ARINGAY","PANGAO-AOAN EAST","","SPO1","0","0","0","0","0","0") ;
INSERT INTO tbl_users VALUES ("29","<EMAIL>","$2y$10$j47L04mckmnfs0xFuxUzIewp4wRMFvjTv86AlRT0qAPAi63pZw2hO","Regine","P","Laroya","1","52352352523","01","LA UNION","AGOO","SAN ANTONINO","","SPO1","1","1","1","1","1","1") ;
INSERT INTO tbl_users VALUES ("30","<EMAIL>","$2y$10$fUQ1xnBbkk6bEVlt/AclFuYiCkLpPYKEtPqLAbj5n2hHo1FTp4SXG","Cardo","S","Dalisay","0","2525252","01","LA UNION","BALAOAN","BARACBAC ESTE","","SPO5","0","1","0","0","0","0") ;
INSERT INTO tbl_users VALUES ("31","<EMAIL>","$2y$10$UJqlG5qbpvPxCgz/sdhdSeSAfZn8IT5K7cRxJXO06Z98TFSJ7uZdG","Justin","R","Madriaga","1","23525252","01","LA UNION","AGOO","MACALVA CENTRAL","","SPO1","1","1","0","1","1","0") ;
INSERT INTO tbl_users VALUES ("32","<EMAIL>","$2y$10$sK6Qn/yJpyCOgtS68Sbrj.BRUfZhbykCXI93MP1Re5DpPLvsiJuWS","Euguene","P","Laroya","1","252523","01","LA UNION","AGOO","CONSOLACION (POB.)","","SPO3","0","0","0","0","0","0") ;
INSERT INTO tbl_users VALUES ("33","<EMAIL>","$2y$10$xRLdMoNdkBkW1p7du8jmT.mE8QVYaGtpkLx02bHpXThlVg4m7VRCu","Constancia","P","Laroya","1","252352","01","LA UNION","AGOO","MACALVA CENTRAL","","SPO4","1","1","1","1","1","0") ;
INSERT INTO tbl_users VALUES ("34","<EMAIL>","$2y$10$/73wvUfB/1QocX2Olv7Smub8fNo2LKhkAV/Hz.K.YulKuUF56kWEC","Jheim","V","Viallanueva","-1","25235235","01","LA UNION","AGOO","SAN AGUSTIN SUR","","SPO5","1","1","1","1","1","0") ;
INSERT INTO tbl_users VALUES ("35","","$2y$10$aos8yippygKFefjnW4kdj.qPwEt2Jb1KmyFcaykgtmhdbRluKbnpS","fwfw","","","0","","","","","","","SPO5","1","1","1","1","1","0") ;
INSERT INTO tbl_users VALUES ("36","<EMAIL>","$2y$10$Q22u6uWtN7natUizmLrWS.e0g.VhNmlvD1A5vCMrSHtmeh1J5q68K","Joseph","P","Ullibac","1","09336262869","01","LA UNION","AGOO","SAN AGUSTIN EAST","../assets/img/faces/avatar.jpg","FO3","0","0","0","0","1","1") ;
INSERT INTO tbl_users VALUES ("37","<EMAIL>","$2y$10$4JbbMJpjsONphIhGdcpYweJfiULUi3BJrdW67eHjzlv9n4lYW4a2i","Angelica","S","Parrocha","0","09328928499","01","LA UNION","ARINGAY","MACABATO","../assets/img/faces/avatar.jpg","SPO3","0","1","1","0","0","1") ;
|
<gh_stars>0
IF OBJECT_ID('dbo.ngbm_block_collection', 'U') IS NOT NULL DROP TABLE dbo.ngbm_block_collection;
IF OBJECT_ID('dbo.ngbm_collection_item', 'U') IS NOT NULL DROP TABLE dbo.ngbm_collection_item;
IF OBJECT_ID('dbo.ngbm_collection_query_translation', 'U') IS NOT NULL DROP TABLE dbo.ngbm_collection_query_translation;
IF OBJECT_ID('dbo.ngbm_collection_query', 'U') IS NOT NULL DROP TABLE dbo.ngbm_collection_query;
IF OBJECT_ID('dbo.ngbm_collection_translation', 'U') IS NOT NULL DROP TABLE dbo.ngbm_collection_translation;
IF OBJECT_ID('dbo.ngbm_collection', 'U') IS NOT NULL DROP TABLE dbo.ngbm_collection;
IF OBJECT_ID('dbo.ngbm_zone', 'U') IS NOT NULL DROP TABLE dbo.ngbm_zone;
IF OBJECT_ID('dbo.ngbm_block_translation', 'U') IS NOT NULL DROP TABLE dbo.ngbm_block_translation;
IF OBJECT_ID('dbo.ngbm_block', 'U') IS NOT NULL DROP TABLE dbo.ngbm_block;
IF OBJECT_ID('dbo.ngbm_layout_translation', 'U') IS NOT NULL DROP TABLE dbo.ngbm_layout_translation;
IF OBJECT_ID('dbo.ngbm_layout', 'U') IS NOT NULL DROP TABLE dbo.ngbm_layout;
IF OBJECT_ID('dbo.ngbm_rule_target', 'U') IS NOT NULL DROP TABLE dbo.ngbm_rule_target;
IF OBJECT_ID('dbo.ngbm_rule_condition', 'U') IS NOT NULL DROP TABLE dbo.ngbm_rule_condition;
IF OBJECT_ID('dbo.ngbm_rule_data', 'U') IS NOT NULL DROP TABLE dbo.ngbm_rule_data;
IF OBJECT_ID('dbo.ngbm_rule', 'U') IS NOT NULL DROP TABLE dbo.ngbm_rule;
CREATE TABLE ngbm_layout (
id int IDENTITY(1, 1),
status int NOT NULL,
type nvarchar(255) NOT NULL,
name nvarchar(255) NOT NULL,
description nvarchar(max) NOT NULL,
created int NOT NULL,
modified int NOT NULL,
shared tinyint NOT NULL,
main_locale nvarchar(255) NOT NULL,
PRIMARY KEY (id, status)
);
CREATE TABLE ngbm_layout_translation (
layout_id int NOT NULL,
status int NOT NULL,
locale nvarchar(255) NOT NULL,
PRIMARY KEY (layout_id, status, locale),
FOREIGN KEY (layout_id, status)
REFERENCES ngbm_layout (id, status)
);
CREATE TABLE ngbm_block (
id int IDENTITY(1, 1),
status int NOT NULL,
layout_id int NOT NULL,
depth int NOT NULL,
path nvarchar(255) NOT NULL,
parent_id int DEFAULT NULL,
placeholder nvarchar(255) DEFAULT NULL,
position int DEFAULT NULL,
definition_identifier nvarchar(255) NOT NULL,
view_type nvarchar(255) NOT NULL,
item_view_type nvarchar(255) NOT NULL,
name nvarchar(255) NOT NULL,
config nvarchar(max) NOT NULL,
translatable tinyint NOT NULL,
main_locale nvarchar(255) NOT NULL,
always_available tinyint NOT NULL,
PRIMARY KEY (id, status),
FOREIGN KEY (layout_id, status)
REFERENCES ngbm_layout (id, status)
);
CREATE TABLE ngbm_block_translation (
block_id int NOT NULL,
status int NOT NULL,
locale nvarchar(255) NOT NULL,
parameters nvarchar(max) NOT NULL,
PRIMARY KEY (block_id, status, locale),
FOREIGN KEY (block_id, status)
REFERENCES ngbm_block (id, status)
);
CREATE TABLE ngbm_zone (
identifier nvarchar(255) NOT NULL,
layout_id int NOT NULL,
status int NOT NULL,
root_block_id int NOT NULL,
linked_layout_id int,
linked_zone_identifier nvarchar(255),
PRIMARY KEY (identifier, layout_id, status),
FOREIGN KEY (layout_id, status)
REFERENCES ngbm_layout (id, status),
FOREIGN KEY (root_block_id, status)
REFERENCES ngbm_block (id, status)
);
CREATE TABLE ngbm_collection (
id int IDENTITY(1, 1),
status int NOT NULL,
start int NOT NULL,
length int,
translatable tinyint NOT NULL,
main_locale nvarchar(255) NOT NULL,
always_available tinyint NOT NULL,
PRIMARY KEY (id, status)
);
CREATE TABLE ngbm_collection_translation (
collection_id int NOT NULL,
status int NOT NULL,
locale nvarchar(255) NOT NULL,
PRIMARY KEY (collection_id, status, locale),
FOREIGN KEY (collection_id, status)
REFERENCES ngbm_collection (id, status)
);
CREATE TABLE ngbm_collection_item (
id int IDENTITY(1, 1),
status int NOT NULL,
collection_id int NOT NULL,
position int NOT NULL,
value nvarchar(255),
value_type nvarchar(255) NOT NULL,
config nvarchar(max) NOT NULL,
PRIMARY KEY (id, status),
FOREIGN KEY (collection_id, status)
REFERENCES ngbm_collection (id, status)
);
CREATE TABLE ngbm_collection_query (
id int IDENTITY(1, 1),
status int NOT NULL,
collection_id int NOT NULL,
type nvarchar(255) NOT NULL,
PRIMARY KEY (id, status),
FOREIGN KEY (collection_id, status)
REFERENCES ngbm_collection (id, status)
);
CREATE TABLE ngbm_collection_query_translation (
query_id int NOT NULL,
status int NOT NULL,
locale nvarchar(255) NOT NULL,
parameters nvarchar(max) NOT NULL,
PRIMARY KEY (query_id, status, locale),
FOREIGN KEY (query_id, status)
REFERENCES ngbm_collection_query (id, status)
);
CREATE TABLE ngbm_block_collection (
block_id int NOT NULL,
block_status int NOT NULL,
collection_id int NOT NULL,
collection_status int NOT NULL,
identifier nvarchar(255) NOT NULL,
PRIMARY KEY (block_id, block_status, identifier),
FOREIGN KEY (block_id, block_status)
REFERENCES ngbm_block (id, status),
FOREIGN KEY (collection_id, collection_status)
REFERENCES ngbm_collection (id, status)
);
CREATE TABLE ngbm_rule (
id int IDENTITY(1, 1),
status int NOT NULL,
layout_id int DEFAULT NULL,
comment nvarchar(max) NOT NULL,
PRIMARY KEY (id, status)
);
CREATE TABLE ngbm_rule_data (
rule_id int NOT NULL,
enabled tinyint NOT NULL,
priority int NOT NULL,
PRIMARY KEY (rule_id)
);
CREATE TABLE ngbm_rule_target (
id int IDENTITY(1, 1),
status int NOT NULL,
rule_id int NOT NULL,
type nvarchar(255) NOT NULL,
value nvarchar(max) NOT NULL,
PRIMARY KEY (id, status),
FOREIGN KEY (rule_id, status)
REFERENCES ngbm_rule (id, status)
);
CREATE TABLE ngbm_rule_condition (
id int IDENTITY(1, 1),
status int NOT NULL,
rule_id int NOT NULL,
type nvarchar(255) NOT NULL,
value nvarchar(max) NOT NULL,
PRIMARY KEY (id, status),
FOREIGN KEY (rule_id, status)
REFERENCES ngbm_rule (id, status)
);
|
<reponame>hzjdhr/laravel-game<filename>game 4-3.sql<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: 2018-04-03 14:58:43
-- 服务器版本: 5.7.19
-- PHP Version: 7.1.9
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: `game`
--
-- --------------------------------------------------------
--
-- 表的结构 `admin_menu`
--
DROP TABLE IF EXISTS `admin_menu`;
CREATE TABLE IF NOT EXISTS `admin_menu` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`parent_id` int(11) NOT NULL DEFAULT '0',
`order` int(11) NOT NULL DEFAULT '0',
`title` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`icon` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`uri` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_menu`
--
INSERT INTO `admin_menu` (`id`, `parent_id`, `order`, `title`, `icon`, `uri`, `created_at`, `updated_at`) VALUES
(1, 0, 1, 'Index', 'fa-bar-chart', '/', NULL, NULL),
(2, 0, 2, 'Admin', 'fa-tasks', '', NULL, NULL),
(3, 2, 3, 'Users', 'fa-users', 'auth/users', NULL, NULL),
(4, 2, 4, 'Roles', 'fa-user', 'auth/roles', NULL, NULL),
(5, 2, 5, 'Permission', 'fa-ban', 'auth/permissions', NULL, NULL),
(6, 2, 6, 'Menu', 'fa-bars', 'auth/menu', NULL, NULL),
(7, 2, 7, 'Operation log', 'fa-history', 'auth/logs', NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_operation_log`
--
DROP TABLE IF EXISTS `admin_operation_log`;
CREATE TABLE IF NOT EXISTS `admin_operation_log` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`path` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`method` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
`ip` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
`input` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `admin_operation_log_user_id_index` (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_operation_log`
--
INSERT INTO `admin_operation_log` (`id`, `user_id`, `path`, `method`, `ip`, `input`, `created_at`, `updated_at`) VALUES
(1, 1, 'admin', 'GET', '127.0.0.1', '[]', '2018-04-03 05:27:23', '2018-04-03 05:27:23'),
(2, 1, 'admin/auth/permissions', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 05:27:38', '2018-04-03 05:27:38'),
(3, 1, 'admin/auth/menu', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 05:27:39', '2018-04-03 05:27:39'),
(4, 1, 'admin/auth/menu', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 05:27:41', '2018-04-03 05:27:41'),
(5, 1, 'admin/auth/permissions', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 05:27:42', '2018-04-03 05:27:42'),
(6, 1, 'admin/auth/menu', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 05:27:42', '2018-04-03 05:27:42'),
(7, 1, 'admin/auth/menu', 'GET', '127.0.0.1', '[]', '2018-04-03 05:32:27', '2018-04-03 05:32:27'),
(8, 1, 'admin', 'GET', '127.0.0.1', '[]', '2018-04-03 05:32:35', '2018-04-03 05:32:35'),
(9, 1, 'admin', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 05:33:04', '2018-04-03 05:33:04'),
(10, 1, 'admin/auth/users', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 05:33:06', '2018-04-03 05:33:06'),
(11, 1, 'admin/auth/users/1/edit', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 05:34:14', '2018-04-03 05:34:14'),
(12, 1, 'admin/auth/users/1/edit', 'GET', '127.0.0.1', '[]', '2018-04-03 13:38:30', '2018-04-03 13:38:30'),
(13, 1, 'admin/auth/users/1/edit', 'GET', '127.0.0.1', '[]', '2018-04-03 13:38:31', '2018-04-03 13:38:31'),
(14, 1, 'admin/auth/users/1/edit', 'GET', '127.0.0.1', '[]', '2018-04-03 13:38:32', '2018-04-03 13:38:32'),
(15, 1, 'admin', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:38:57', '2018-04-03 13:38:57'),
(16, 1, 'admin', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:38:58', '2018-04-03 13:38:58'),
(17, 1, 'admin/auth/users', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:39:01', '2018-04-03 13:39:01'),
(18, 1, 'admin/auth/roles', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:39:03', '2018-04-03 13:39:03'),
(19, 1, 'admin/auth/users', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:39:03', '2018-04-03 13:39:03'),
(20, 1, 'admin/auth/roles', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:39:06', '2018-04-03 13:39:06'),
(21, 1, 'admin/auth/users', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:39:08', '2018-04-03 13:39:08'),
(22, 1, 'admin/auth/permissions', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:39:08', '2018-04-03 13:39:08'),
(23, 1, 'admin/auth/menu', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:39:09', '2018-04-03 13:39:09'),
(24, 1, 'admin/auth/menu', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:39:10', '2018-04-03 13:39:10'),
(25, 1, 'admin/auth/users', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:39:12', '2018-04-03 13:39:12'),
(26, 1, 'admin/auth/roles', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:43:53', '2018-04-03 13:43:53'),
(27, 1, 'admin/auth/permissions', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:43:54', '2018-04-03 13:43:54'),
(28, 1, 'admin/auth/menu', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:43:54', '2018-04-03 13:43:54'),
(29, 1, 'admin/auth/menu', 'GET', '127.0.0.1', '[]', '2018-04-03 13:43:57', '2018-04-03 13:43:57'),
(30, 1, 'admin/auth/roles', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:44:01', '2018-04-03 13:44:01'),
(31, 1, 'admin/auth/roles', 'GET', '127.0.0.1', '{\"_pjax\":\"#pjax-container\"}', '2018-04-03 13:44:02', '2018-04-03 13:44:02');
-- --------------------------------------------------------
--
-- 表的结构 `admin_permissions`
--
DROP TABLE IF EXISTS `admin_permissions`;
CREATE TABLE IF NOT EXISTS `admin_permissions` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`http_method` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`http_path` text COLLATE utf8mb4_unicode_ci,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admin_permissions_name_unique` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_permissions`
--
INSERT INTO `admin_permissions` (`id`, `name`, `slug`, `http_method`, `http_path`, `created_at`, `updated_at`) VALUES
(1, 'All permission', '*', '', '*', NULL, NULL),
(2, 'Dashboard', 'dashboard', 'GET', '/', NULL, NULL),
(3, 'Login', 'auth.login', '', '/auth/login\r\n/auth/logout', NULL, NULL),
(4, 'User setting', 'auth.setting', 'GET,PUT', '/auth/setting', NULL, NULL),
(5, 'Auth management', 'auth.management', '', '/auth/roles\r\n/auth/permissions\r\n/auth/menu\r\n/auth/logs', NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_roles`
--
DROP TABLE IF EXISTS `admin_roles`;
CREATE TABLE IF NOT EXISTS `admin_roles` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admin_roles_name_unique` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_roles`
--
INSERT INTO `admin_roles` (`id`, `name`, `slug`, `created_at`, `updated_at`) VALUES
(1, 'Administrator', 'administrator', '2018-04-03 05:27:00', '2018-04-03 05:27:00');
-- --------------------------------------------------------
--
-- 表的结构 `admin_role_menu`
--
DROP TABLE IF EXISTS `admin_role_menu`;
CREATE TABLE IF NOT EXISTS `admin_role_menu` (
`role_id` int(11) NOT NULL,
`menu_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_role_menu_role_id_menu_id_index` (`role_id`,`menu_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_role_menu`
--
INSERT INTO `admin_role_menu` (`role_id`, `menu_id`, `created_at`, `updated_at`) VALUES
(1, 2, NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_role_permissions`
--
DROP TABLE IF EXISTS `admin_role_permissions`;
CREATE TABLE IF NOT EXISTS `admin_role_permissions` (
`role_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_role_permissions_role_id_permission_id_index` (`role_id`,`permission_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_role_permissions`
--
INSERT INTO `admin_role_permissions` (`role_id`, `permission_id`, `created_at`, `updated_at`) VALUES
(1, 1, NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_role_users`
--
DROP TABLE IF EXISTS `admin_role_users`;
CREATE TABLE IF NOT EXISTS `admin_role_users` (
`role_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_role_users_role_id_user_id_index` (`role_id`,`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_role_users`
--
INSERT INTO `admin_role_users` (`role_id`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 1, NULL, NULL);
-- --------------------------------------------------------
--
-- 表的结构 `admin_users`
--
DROP TABLE IF EXISTS `admin_users`;
CREATE TABLE IF NOT EXISTS `admin_users` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`username` varchar(190) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`avatar` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admin_users_username_unique` (`username`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `admin_users`
--
INSERT INTO `admin_users` (`id`, `username`, `password`, `name`, `avatar`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'admin', <PASSWORD>', 'Administrator', NULL, NULL, '2018-04-03 05:27:00', '2018-04-03 05:27:00');
-- --------------------------------------------------------
--
-- 表的结构 `admin_user_permissions`
--
DROP TABLE IF EXISTS `admin_user_permissions`;
CREATE TABLE IF NOT EXISTS `admin_user_permissions` (
`user_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_user_permissions_user_id_permission_id_index` (`user_id`,`permission_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `articles`
--
DROP TABLE IF EXISTS `articles`;
CREATE TABLE IF NOT EXISTS `articles` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`content` longtext,
`thumb` varchar(255) DEFAULT NULL COMMENT '封面',
`release_time` datetime DEFAULT NULL COMMENT '发布时间',
`hits` int(10) DEFAULT NULL COMMENT '点击量',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `comments`
--
DROP TABLE IF EXISTS `comments`;
CREATE TABLE IF NOT EXISTS `comments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`article_id` int(11) DEFAULT NULL,
`content` text COMMENT '评论内容',
`user_id` int(11) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `friends`
--
DROP TABLE IF EXISTS `friends`;
CREATE TABLE IF NOT EXISTS `friends` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`friend_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `migrations`
--
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE IF NOT EXISTS `migrations` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- 转存表中的数据 `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2016_01_04_173148_create_admin_tables', 1);
-- --------------------------------------------------------
--
-- 表的结构 `password_resets`
--
DROP TABLE IF EXISTS `password_resets`;
CREATE TABLE IF NOT EXISTS `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
KEY `password_resets_email_index` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- 表的结构 `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`username` varchar(40) DEFAULT NULL,
`password` varchar(40) DEFAULT NULL,
`nickname` varchar(20) DEFAULT NULL COMMENT '昵称',
`email` varchar(30) DEFAULT NULL,
`phone` int(11) DEFAULT NULL COMMENT '电话号码',
`qq` int(20) DEFAULT NULL,
`open_id` int(255) DEFAULT NULL,
`avatar` varchar(255) DEFAULT NULL,
`power` int(2) DEFAULT '1' COMMENT '权限:1普通 2管理员',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=28 DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `nickname`, `email`, `phone`, `qq`, `open_id`, `avatar`, `power`, `created_at`, `updated_at`) VALUES
(27, '<EMAIL>', 'hzjdhr123', NULL, NULL, NULL, NULL, NULL, NULL, 1, '2018-04-01 03:55:05', '2018-04-01 03:55:05'),
(25, '<EMAIL>', '22222', NULL, NULL, NULL, NULL, NULL, NULL, 1, '2018-02-26 07:22:00', '2018-02-26 07:22:00');
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
<gh_stars>0
create table city(
ID_city int primary key AUTO_INCREMENT not null,
city varchar(40)
);
insert into city (city) values ("Hortolandia"), ("Sumare"), ("Campinas"); |
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'HTML/CSS/Javascript', 'To know and contrast the roles of HTML/CSS and javascript','https://blog.hubspot.com/marketing/web-design-html-css-javascript#:~:text=HTML%20provides%20the%20basic%20structure,the%20behavior%20of%20different%20elements.');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident, confident) VALUES (1, 'HTML/CSS/Javascript', 'Re-create a website using common HTML elements (h1, h2, ul, li, div...)','https://www.digitalocean.com/community/tutorial_series/how-to-build-a-website-with-html','https://www.proprofs.com/quiz-school/playquiz/?title=frontpage-quiz-2');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident, confident) VALUES (1, 'HTML/CSS/Javascript', 'Describe what the DOM is and why it is useful','https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction','https://www.codeguage.com/courses/js/html-dom-quiz');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident, confident) VALUES (1, 'HTML/CSS/Javascript', 'Style an element using CSS','https://flukeout.github.io/','https://www.w3schools.com/quiztest/quiztest.asp?qtest=CSS');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident, confident) VALUES (1, 'HTML/CSS/Javascript', 'Predict the outcome of CSS based on the rules of CSS specificity','https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity','https://mjswensen.github.io/css-power-ups/the-cascade-and-specificity/specificity-quiz/');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident, confident) VALUES (1, 'HTML/CSS/Javascript', 'Be able to use flexbox to change the layout of a HTML element','https://flexboxfroggy.com/','https://kaitlynbro.github.io/flexbox-quiz/' );
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident, confident) VALUES (1, 'HTML/CSS/Javascript', 'To know how to manipulate the DOM using JavaScript','https://www.youtube.com/watch?v=wiozYyXQEVk','https://kaitlynbro.github.io/flexbox-quiz/' );
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident, confident) VALUES (1, 'Javascript', 'Can Identify different data types in JavaScript (string, number, array and objects)','https://www.programiz.com/javascript/data-types','https://learn.co/lessons/javascript-data-types-quiz');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'Javascript', 'Explain the difference between console.log() and return in Javascript','https://quick-adviser.com/what-is-the-difference-between-console-log-and-return-in-javascript/');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'Javascript', 'Be able to use conditional statement for control flow','https://www.codecademy.com/learn/introduction-to-javascript/modules/learn-javascript-control-flow/cheatsheet');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'React', 'To know the problem that front end framework are trying to solve','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'React', 'Understand what JSX is and how it is different to HTML and Javascript','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'React', "Be able to handle events in React",'https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'React', "Be able to use ternary operators in React and use it to apply conditional rendering",'https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'React', 'Accurately recall the React component lifecycle','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'React', 'Pass props to a React component from another','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'React', 'Pass a function as a prop to a React component to act as a callback','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'React', 'Understand what state is and how to use it to updata a react component','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'React', 'Use setState() to update the state of a React component','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'React', 'Use map to convert a JS object into a React component or HTML element','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'SQL', 'To Understand and define what a relational database is','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'SQL', 'Know how to write an SQL query to retrieve all data from a table ','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'SQL', 'Be able to retrieve data from multiple table at the same time by using the join operator','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective, not_confident) VALUES (1, 'GIT', 'Know how to make a directory','https://reactjs.org/docs/react-component.html');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (1, 'React', 'Understand what state is and how to use it');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (2, 'HTML/CSS', 'Understand what parent and child is');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (2, 'HTML/CSS', 'Can create and link a stylesheet');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (2, 'Javascript', 'Be able to link a Javascript file in your project');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (2, 'Javascript', 'Be able to do a console.log()');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (2, 'Javascript', 'Be able to use built-in object methods like .keys()');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (2, 'Javascript', 'Be able to loop over an object with for...in');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (2, 'Javascript', 'Be able to convert an object into an array');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (2, 'React', 'Understand the difference between class and functional components');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (2, 'React', 'Be able to create a React application with create-react-app');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (3, 'HTML/CSS', 'Understand what parent and child is');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (3, 'HTML/CSS', 'Can create and link a stylesheet');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (3, 'Javascript', 'Be able to link a Javascript file in your project');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (3, 'Javascript', 'Be able to do a console.log()');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (3, 'React', 'Understand the difference between class and functional components');
INSERT INTO learning_objectives(cohort_id, topic, learning_objective) VALUES (3, 'React', 'Be able to create a React application with create-react-app');
INSERT INTO users(email, cohort_id, encrypted_password, created_at, updated_at, admin) VALUES('<EMAIL>', 0, '$2a$08$1pO8zSzvfNwvyW/IRRdgk.Ac7cYQHKEob4kjGEZZqcVUfS/VyikKm', datetime('now'), datetime('now'), true) |
--liquibase formatted sql
--changeset rajeshk:14-case-type-ass-detail-values-table-create
CREATE TABLE IF NOT EXISTS crime_means_assessment.case_type_ass_detail_values
(
id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
caty_case_type VARCHAR(20),
acrd_id INTEGER NOT NULL,
applicant_value DECIMAL(10,2),
partner_value DECIMAL(10,2),
applicant_freq_code VARCHAR(20),
partner_freq_code VARCHAR(20),
date_created TIMESTAMP DEFAULT current_timestamp NOT NULL,
created_by VARCHAR(100) DEFAULT current_user NOT NULL,
date_modified TIMESTAMP,
modified_by VARCHAR(100),
CONSTRAINT pk_case_type_ass_detail_values PRIMARY KEY (id),
CONSTRAINT uk_ctadv_catycasetype_acrdid UNIQUE (caty_case_type, acrd_id),
CONSTRAINT fk_ctadv_acrd FOREIGN KEY (acrd_id)
REFERENCES crime_means_assessment.ass_criteria_details (id)
); |
<reponame>StoneIsDeveloper/.net-identity-without-entity-framework<gh_stars>0
CREATE PROCEDURE dbo.InsertUser
-- Add the parameters for the stored procedure here
@Username nvarchar(250)
,@Email nvarchar(250)
,@Password nvarchar(250)
,@Status int
,@Active bit
,@Deleted bit
,@EmailVerified bit
,@FisrtName nvarchar(250)
,@LastName nvarchar(250)
,@Phone nvarchar(250)
,@PhoneVerified bit
,@ProfilePic nvarchar(500)
,@SecurityStamp nvarchar(500)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO [dbo].[Users]
([Username]
,[Email]
,[Password]
,[Status]
,[CreatedOnDate]
,[Active]
,[Deleted]
,[EmailVerified]
,[FisrtName]
,[LastName]
,[Phone]
,[PhoneVerified]
,[ProfilePic]
,[SecurityStamp])
VALUES
(
@Username
,@Email
,@Password
,@Status
,GETDATE()
,@Active
,@Deleted
,@EmailVerified
,@FisrtName
,@LastName
,@Phone
,@PhoneVerified
,@ProfilePic
,@SecurityStamp
)
return @@IDENTITY
END
|
<filename>src/db/dbscript/KhachHang.sql
INSERT INTO apartment.dbo.KhachHang (MaKhachHang,Ten,Email,SDT,YeuCau) VALUES
(N'KH1',N'<NAME>',N'<EMAIL>',N'0938131201',N''),
(N'KH9mWLAH1xt',N'Long',N'<EMAIL>',N'0938131201',N'hello'); |
<gh_stars>0
-- CreateTable
CREATE TABLE "Account" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"balance" DOUBLE PRECISION NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Credit" (
"id" SERIAL NOT NULL,
"amount" DOUBLE PRECISION NOT NULL,
"notes" TEXT NOT NULL,
"date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"accountId" TEXT NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Debit" (
"id" SERIAL NOT NULL,
"amount" DOUBLE PRECISION NOT NULL,
"notes" TEXT NOT NULL,
"date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"accountId" TEXT NOT NULL,
PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Credit" ADD FOREIGN KEY ("accountId") REFERENCES "Account"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Debit" ADD FOREIGN KEY ("accountId") REFERENCES "Account"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 09, 2022 at 02:02 PM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.3.3
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: `nutration`
--
-- --------------------------------------------------------
--
-- Table structure for table `boquets`
--
CREATE TABLE `boquets` (
`id` bigint(20) UNSIGNED NOT NULL,
`title_en` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`title_ar` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`description_en` text COLLATE utf8mb4_unicode_ci NOT NULL,
`description_ar` text COLLATE utf8mb4_unicode_ci NOT NULL,
`appearance` tinyint(1) DEFAULT NULL,
`img` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`height_img` varchar(191) 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 `boquets`
--
INSERT INTO `boquets` (`id`, `title_en`, `title_ar`, `description_en`, `description_ar`, `appearance`, `img`, `height_img`, `created_at`, `updated_at`) VALUES
(10, 'The first bouquet', 'الباقه الاولي', '<p>The first bouquet The first bouquet The first bouquet The first bouquet The first bouquet The first bouquet The first bouquet The first bouquet The first bouquet The first bouquet The first bouquet </p>', '<p>الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي الباقه الاولي </p>', 1, 'uploads/boquets/images/16468255404538.jpg', NULL, '2022-01-22 15:29:04', '2022-03-09 12:32:21'),
(11, 'The second bouquet', 'الباقه الثانيه', '<p>The second bouquet The second bouquet The second bouquet The second bouquet The second bouquet The second bouquet </p>', '<p>الباقه الثانيه الباقه الثانيه الباقه الثانيه الباقه الثانيه الباقه الثانيه الباقه الثانيه الباقه الثانيه الباقه الثانيه الباقه الثانيه الباقه الثانيه الباقه الثانيه الباقه الثانيه </p>', 1, 'uploads/boquets/images/164682560270412.jpg', NULL, '2022-03-09 12:33:22', '2022-03-09 12:33:22'),
(12, 'The third bouquet', 'الباقه الثالثه', '<p>The third bouquet The third bouquet The third bouquet The third bouquet The third bouquet The third bouquet The third bouquet The third bouquet The third bouquet </p>', '<p>الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه الباقه الثالثه </p>', 1, 'uploads/boquets/images/164682572851010.jpg', NULL, '2022-03-09 12:34:10', '2022-03-09 12:35:28');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `boquets`
--
ALTER TABLE `boquets`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `boquets`
--
ALTER TABLE `boquets`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
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 */;
|
/*
Navicat Premium Data Transfer
Source Server : local
Source Server Type : MySQL
Source Server Version : 80016
Source Host : localhost:3306
Source Schema : etrucking
Target Server Type : MySQL
Target Server Version : 80016
File Encoding : 65001
Date: 21/06/2019 17:40:30
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for drivers
-- ----------------------------
DROP TABLE IF EXISTS `drivers`;
CREATE TABLE `drivers` (
`id` int(18) NOT NULL AUTO_INCREMENT,
`driver_name` varchar(255) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`phone_number` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_by` int(18) DEFAULT NULL,
`updated_by` int(18) DEFAULT NULL,
`deleted_by` int(18) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of drivers
-- ----------------------------
BEGIN;
INSERT INTO `drivers` VALUES (1, 'Kris', 'kris', '$2y$10$pGKkVl5PUU.HPWAJ.DtHReW88KQPfCTUnHDZYiebP433pDtT/cYyi', '081818181', '<EMAIL>', '2019-06-21 09:32:52', '2019-06-21 09:48:34', NULL, 1, 1, NULL);
INSERT INTO `drivers` VALUES (11, 'Ujang', 'ujang', '$2y$10$tep4kOQ8bQqJ/I4IA.ku5.cmMzWU9CiVba40kftyu/XSIJa2iIqJW', '08181818181', '<EMAIL>', '2019-06-21 09:34:04', '2019-06-21 09:34:04', NULL, 1, NULL, NULL);
INSERT INTO `drivers` VALUES (12, 'Bambang', 'bambang', '$2y$10$WUa.MnUopD1cE4pihg3SnODKr4nICgpkd92fstRATLFqrCgKTcg4m', '08181818182', '<EMAIL>', '2019-06-21 09:37:42', '2019-06-21 09:37:42', NULL, 1, NULL, NULL);
INSERT INTO `drivers` VALUES (13, 'Hanaf', 'hanif', '$2y$10$fxlu686wxDpfTwl.LfIQpuJb.UOsMpukVYpXadiCYbDcZZ7zW.rSe', '08181811', '<EMAIL>', '2019-06-21 17:02:09', '2019-06-21 17:07:20', NULL, 1, 1, NULL);
COMMIT;
-- ----------------------------
-- Table structure for menus
-- ----------------------------
DROP TABLE IF EXISTS `menus`;
CREATE TABLE `menus` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`menu_name` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`created_by` int(11) NOT NULL COMMENT 'FILLED WITH ID USER',
`updated_by` int(11) DEFAULT NULL COMMENT 'FILLED WITH ID USER',
`deleted_by` int(11) DEFAULT NULL COMMENT 'FILLED WITH ID USER',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of menus
-- ----------------------------
BEGIN;
INSERT INTO `menus` VALUES (2, 'Data Vendor', '2019-06-21 14:59:25', '2019-06-21 14:59:28', NULL, 1, 1, NULL);
INSERT INTO `menus` VALUES (3, 'Data User', '2019-06-21 15:00:30', '2019-06-21 15:00:32', NULL, 1, 1, NULL);
INSERT INTO `menus` VALUES (5, 'Data truck', '2019-06-21 08:45:58', '2019-06-21 08:46:13', '2019-06-21 08:46:13', 1, NULL, 1);
COMMIT;
-- ----------------------------
-- Table structure for role_menus
-- ----------------------------
DROP TABLE IF EXISTS `role_menus`;
CREATE TABLE `role_menus` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_id` int(11) NOT NULL,
`menu_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_by` int(18) DEFAULT NULL,
`updated_by` int(18) DEFAULT NULL,
`deleted_by` int(18) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of role_menus
-- ----------------------------
BEGIN;
INSERT INTO `role_menus` VALUES (1, 5, 2, '2019-06-21 16:22:56', '2019-06-21 16:22:58', NULL, 1, NULL, NULL);
INSERT INTO `role_menus` VALUES (2, 5, 3, '2019-06-21 16:23:12', '2019-06-21 16:23:15', NULL, 1, NULL, NULL);
INSERT INTO `role_menus` VALUES (3, 10, 3, '2019-06-21 16:45:43', '2019-06-21 16:45:43', NULL, 1, NULL, NULL);
COMMIT;
-- ----------------------------
-- Table structure for roles
-- ----------------------------
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_name` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_by` int(11) DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`deleted_by` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of roles
-- ----------------------------
BEGIN;
INSERT INTO `roles` VALUES (5, 'Superadmin', '2019-06-21 16:12:50', '2019-06-21 16:12:50', NULL, 1, NULL, NULL);
INSERT INTO `roles` VALUES (6, 'Vendor', '2019-06-21 16:15:31', '2019-06-21 16:15:31', NULL, 1, NULL, NULL);
INSERT INTO `roles` VALUES (10, 'Driver', '2019-06-21 16:45:43', '2019-06-21 16:45:43', NULL, 1, NULL, NULL);
COMMIT;
-- ----------------------------
-- Table structure for user_roles
-- ----------------------------
DROP TABLE IF EXISTS `user_roles`;
CREATE TABLE `user_roles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`role_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`created_by` int(11) NOT NULL COMMENT 'FILLED WITH ID USER',
`updated_by` int(11) DEFAULT NULL COMMENT 'FILLED WITH ID USER',
`deleted_by` int(11) DEFAULT NULL COMMENT 'FILLED WITH ID USER',
PRIMARY KEY (`id`,`role_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user_roles
-- ----------------------------
BEGIN;
INSERT INTO `user_roles` VALUES (1, '1', 5, '2019-06-21 16:14:31', '2019-06-21 16:14:33', NULL, 1, NULL, NULL);
INSERT INTO `user_roles` VALUES (2, '1', 6, '2019-06-21 16:15:52', '2019-06-21 16:15:55', NULL, 1, NULL, NULL);
INSERT INTO `user_roles` VALUES (3, '7', 5, '2019-06-21 09:34:57', '2019-06-21 09:34:57', NULL, 0, NULL, NULL);
INSERT INTO `user_roles` VALUES (4, '8', 5, '2019-06-21 09:36:33', '2019-06-21 09:36:33', NULL, 0, NULL, NULL);
COMMIT;
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_role_id` int(11) DEFAULT NULL COMMENT 'user_role_id = 0 for client mobile apps',
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`user_phone` varchar(13) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`user_image` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`company_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`bank_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`account_bank` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`account_bank_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`created_by` int(11) NOT NULL COMMENT 'FILLED WITH ID USER',
`updated_by` int(11) DEFAULT NULL COMMENT 'FILLED WITH ID USER',
`deleted_by` int(11) DEFAULT NULL COMMENT 'FILLED WITH ID USER',
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Records of users
-- ----------------------------
BEGIN;
INSERT INTO `users` VALUES (1, 1, 'admin', '<EMAIL>', 'admin', '8181281', '$2y$12$a9UAXyy0B2HkeOfQXDj/keLClnbGaojVXRN6uP3.qljo8uo25lkgO', NULL, NULL, NULL, NULL, NULL, '2019-06-21 09:24:33', '2019-06-21 09:24:35', NULL, 99, NULL, NULL);
INSERT INTO `users` VALUES (6, 1, 'Admin2', '<EMAIL>', 'admin2', '', '$2y$10$us3FUceEKXdhI78G3SFpN.svob6doYcaxO2zSlOFjhJMBZ14/TuCe', '', '', '', '', '', '2019-06-21 02:26:15', '2019-06-21 02:26:15', NULL, 1, NULL, NULL);
INSERT INTO `users` VALUES (7, 5, 'Admin3', '<EMAIL>', 'admin3', '', '$2y$10$OC.zSEZWQoSJJo.q1dSzeesFuPKLEuFfDi9jevuNZANnVL3.1cl0G', '', '', '', '', '', '2019-06-21 09:34:57', '2019-06-21 09:34:57', NULL, 1, NULL, NULL);
INSERT INTO `users` VALUES (8, 5, 'Admin4', '<EMAIL>', 'admin4', '', '$2y$10$OevuXYCVY30a6pDYANCkiOlUMWFJ2xZM7ZURMcGvX6L5bBElqfON2', '', '', '', '', '', '2019-06-21 09:36:33', '2019-06-21 09:36:33', NULL, 1, NULL, NULL);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
|
<reponame>ucdavis/ipa-web
ALTER TABLE `CourseOfferings`
ADD COLUMN `SeatsTotal` INT(11) NULL DEFAULT NULL;
|
<filename>contrib/UcsFPHub/db/combined-SQL-Server.sql<gh_stars>10-100
-- This is an amalgamation of all SQL-Server scripts
IF OBJECT_ID('usp_sys_ServiceBrokerSetupService') IS NOT NULL DROP PROC usp_sys_ServiceBrokerSetupService
GO
-- exec usp_sys_ServiceBrokerSetupService @Mode = 'DROP_EXISTING'
-- exec usp_sys_ServiceBrokerSetupService @Mode = 'DROP_ONLY'
-- exec usp_sys_ServiceBrokerSetupService @Mode = 'DROP_ONLY', @ProcessID = 59
-- exec usp_sys_ServiceBrokerSetupService @Mode = 'DROP_ONLY', @ProcessID = 58
-- exec usp_sys_ServiceBrokerSetupService @Mode = 'DROP_ONLY', @ProcessID = 55
CREATE PROC usp_sys_ServiceBrokerSetupService (
@QueueName SYSNAME = NULL OUTPUT
, @SvcName SYSNAME = NULL OUTPUT
, @Mode VARCHAR(20) = NULL
) WITH EXECUTE AS OWNER AS
/*------------------------------------------------------------------------
'
' UcsFPHub (c) 2019-2020 by Unicontsoft
'
' Unicontsoft Fiscal Printers Hub
'
' This project is licensed under the terms of the MIT license
' See the LICENSE file in the project root for more information
'
*/------------------------------------------------------------------------
SET NOCOUNT ON
DECLARE @SQL NVARCHAR(MAX)
, @Handle UNIQUEIDENTIFIER
, @CrsClean CURSOR
, @Name SYSNAME
--- used to be params
, @Prefix SYSNAME
, @Suffix SYSNAME
, @ProcessID INT
SELECT @Mode = COALESCE(@Mode, '')
, @ProcessID = COALESCE(@ProcessID, @@SPID)
, @Prefix = COALESCE(@Prefix, N'UcsFpInitiator')
, @Suffix = COALESCE(@Suffix, CONVERT(NVARCHAR(50), @ProcessID))
, @QueueName = COALESCE(@QueueName, @Prefix + N'Queue/' + @Suffix)
, @SvcName = COALESCE(@SvcName, @Prefix + N'Service/' + @Suffix)
IF EXISTS (SELECT 0 FROM sys.databases WHERE database_id = DB_ID() AND is_broker_enabled = 0)
BEGIN
SET @SQL = N'BEGIN TRY ALTER DATABASE ' + QUOTENAME(DB_NAME()) + N' SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE END TRY BEGIN CATCH END CATCH'
EXEC (@SQL)
END
IF EXISTS (SELECT 0 FROM sys.services WHERE name = @SvcName) AND @Mode IN ('DROP_SERVICE', 'DROP_EXISTING', 'DROP_ONLY')
BEGIN
SET @CrsClean = CURSOR FAST_FORWARD FOR
SELECT conversation_handle
FROM sys.conversation_endpoints
WHERE service_id IN (SELECT service_id FROM sys.services WHERE name = @SvcName)
OPEN @CrsClean
WHILE 1=1
BEGIN
FETCH NEXT FROM @CrsClean INTO @Handle
IF @@FETCH_STATUS <> 0 BREAK
; END CONVERSATION @Handle WITH CLEANUP
END
CLOSE @CrsClean
DEALLOCATE @CrsClean
IF EXISTS (SELECT 0 FROM sys.services WHERE name = @SvcName)
BEGIN
SET @SQL = N'DROP SERVICE ' + QUOTENAME(@SvcName)
EXEC (@SQL)
END
END
IF EXISTS (SELECT 0 FROM sys.service_queues WHERE SCHEMA_NAME(schema_id) = N'dbo' AND name = @QueueName) AND @Mode IN ('DROP_EXISTING', 'DROP_ONLY')
BEGIN
SET @CrsClean = CURSOR FAST_FORWARD FOR
SELECT name
FROM sys.services
WHERE service_queue_id IN (SELECT object_id FROM sys.service_queues WHERE SCHEMA_NAME(schema_id) = N'dbo' AND name = @QueueName)
OPEN @CrsClean
WHILE 1=1
BEGIN
FETCH NEXT FROM @CrsClean INTO @Name
IF @@FETCH_STATUS <> 0 BREAK
IF EXISTS (SELECT 0 FROM sys.services WHERE name = @Name)
BEGIN
SET @SQL = N'DROP SERVICE ' + QUOTENAME(@Name)
EXEC (@SQL)
END
END
CLOSE @CrsClean
DEALLOCATE @CrsClean
IF EXISTS (SELECT 0 FROM sys.service_queues WHERE SCHEMA_NAME(schema_id) = N'dbo' AND name = @QueueName)
BEGIN
SET @SQL = N'DROP QUEUE dbo.' + QUOTENAME(@QueueName)
EXEC (@SQL)
END
END
IF @Mode NOT IN ('DROP_ONLY')
BEGIN
IF NOT EXISTS (SELECT 0 FROM sys.service_queues WHERE SCHEMA_NAME(schema_id) = N'dbo' AND name = @QueueName)
BEGIN
SET @SQL = N'CREATE QUEUE dbo.' + QUOTENAME(@QueueName)
EXEC (@SQL)
SET @SQL = N'GRANT RECEIVE ON dbo.' + QUOTENAME(@QueueName) + N' TO public'
EXEC (@SQL)
END
IF NOT EXISTS (SELECT 0 FROM sys.services WHERE name = @SvcName)
BEGIN
SET @SQL = N'CREATE SERVICE ' + QUOTENAME(@SvcName) + N' ON QUEUE dbo.' + QUOTENAME(@QueueName) + N' ([DEFAULT])'
EXEC (@SQL)
END
END
GO
IF OBJECT_ID('usp_sys_ServiceBrokerSend') IS NOT NULL DROP PROC usp_sys_ServiceBrokerSend
GO
/*
DECLARE @Handle1 UNIQUEIDENTIFIER
, @Result INT
, @Response NVARCHAR(MAX)
--- setup receiving queue for current connection once on re-connect
EXEC dbo.usp_sys_ServiceBrokerSetupService
--- open conversation and send request
EXEC @Result = dbo.usp_sys_ServiceBrokerSend '{ "Url": "/printers/DT518315/status" }', @Response OUTPUT, @TargetSvc = 'UcsFpTargetService/DT518315', @Handle = @Handle1 OUTPUT
SELECT @Result AS Result, @Response AS Response
--{
-- "Ok":true,
-- "DeviceStatus":"",
-- "DeviceDateTime":"2019-07-23 17:17:18"
--}
--- send another request on the same conversation (result in XML)
EXEC @Result = dbo.usp_sys_ServiceBrokerSend '{ "Url": "/printers?format=xml" }', @Response OUTPUT, @Handle = @Handle1
SELECT @Result AS Result, CONVERT(XML, @Response) AS Response
--<Root>
-- <Ok __json__bool="1">1</Ok>
-- <Count>2</Count>
-- <DT240349>
-- <DeviceSerialNo>DT240349</DeviceSerialNo>
-- <FiscalMemoryNo>02240349</FiscalMemoryNo>
-- <DeviceProtocol>DATECS</DeviceProtocol>
-- <DeviceModel>FP-3530?</DeviceModel>
-- <FirmwareVersion>4.10BG 10MAR08 1130</FirmwareVersion>
-- <CharsPerLine>30</CharsPerLine>
-- <TaxNo>0000000000</TaxNo>
-- <TaxCaption>БУЛСТАТ</TaxCaption>
-- <DeviceString>Protocol=DATECS;Port=COM1;Speed=9600</DeviceString>
-- </DT240349>
-- <DT518315>
-- <DeviceSerialNo>DT518315</DeviceSerialNo>
-- <FiscalMemoryNo>02518315</FiscalMemoryNo>
-- <DeviceProtocol>DATECS</DeviceProtocol>
-- <DeviceModel>DP-25</DeviceModel>
-- <FirmwareVersion>263453 08Nov18 1312</FirmwareVersion>
-- <CharsPerLine>30</CharsPerLine>
-- <TaxNo>НЕЗАДАДЕН</TaxNo>
-- <TaxCaption>ЕИК</TaxCaption>
-- <DeviceString>Protocol=DATECS;Port=COM2;Speed=115200</DeviceString>
-- </DT518315>
-- <Aliases>
-- <Count>1</Count>
-- <PrinterID1>
-- <DeviceSerialNo>DT518315</DeviceSerialNo>
-- </PrinterID1>
-- </Aliases>
--</Root>
--- send another request on the same conversation (request and result in XML)
EXEC @Result = dbo.usp_sys_ServiceBrokerSend '<Request><Url>/printers/DT518315/deposit?format=xml</Url><Amount>10.55</Amount></Request>', @Response OUTPUT, @Handle = @Handle1
SELECT @Result AS Result, CONVERT(XML, @Response) AS Response
--<Root>
-- <Ok __json__bool="1">1</Ok>
-- <ReceiptNo>0000076</ReceiptNo>
-- <ReceiptDateTime>2019-07-23 16:37:43</ReceiptDateTime>
-- <TotalAvailable>475.2</TotalAvailable>
-- <TotalDeposits>488.63</TotalDeposits>
-- <TotalWithdraws>236.56</TotalWithdraws>
--</Root>
--- close conversation
EXEC @Result = dbo.usp_sys_ServiceBrokerSend @Handle = @Handle1
*/
CREATE PROC usp_sys_ServiceBrokerSend (
@Request NVARCHAR(MAX) = NULL
, @Response NVARCHAR(MAX) = NULL OUTPUT
, @TargetSvc SYSNAME = NULL
, @Handle UNIQUEIDENTIFIER = NULL OUTPUT
, @QueueName SYSNAME = NULL
, @SvcName SYSNAME = NULL
, @Timeout INT = NULL
, @Retry INT = NULL
) AS
/*------------------------------------------------------------------------
'
' UcsFPHub (c) 2019-2020 by Unicontsoft
'
' Unicontsoft Fiscal Printers Hub
'
' This project is licensed under the terms of the MIT license
' See the LICENSE file in the project root for more information
'
*/------------------------------------------------------------------------
SET NOCOUNT ON
DECLARE @RetVal INT
, @SQL NVARCHAR(MAX)
, @MsgType SYSNAME
, @Attempt INT
, @IsAck INT
SELECT @QueueName = COALESCE(@QueueName, N'UcsFpInitiator' + N'Queue/' + CONVERT(NVARCHAR(50), @@SPID))
, @SvcName = COALESCE(@SvcName, N'UcsFpInitiator' + N'Service/' + CONVERT(NVARCHAR(50), @@SPID))
, @Timeout = COALESCE(@Timeout, 30000)
, @Retry = COALESCE(@Retry, 3)
, @Attempt = 0
, @IsAck = 0
, @RetVal = 0
WHILE @Attempt < @Retry
BEGIN
BEGIN TRY
SET @Attempt = @Attempt + 1
IF @TargetSvc IS NOT NULL
BEGIN
IF @Handle IS NOT NULL
BEGIN
; END CONVERSATION @Handle
END
BEGIN DIALOG CONVERSATION @Handle
FROM SERVICE @SvcName
TO SERVICE @TargetSvc, N'CURRENT DATABASE'
WITH ENCRYPTION = OFF
END
IF @Request IS NULL
BEGIN
IF EXISTS ( SELECT *
FROM sys.conversation_endpoints
WHERE conversation_handle = @Handle AND state NOT IN ('CD', 'ER') )
BEGIN
; SEND ON CONVERSATION @Handle (N'__FIN__')
; END CONVERSATION @Handle
END
GOTO QH
END
; SEND ON CONVERSATION @Handle (N'__PING__')
SET @SQL = N'
WAITFOR ( RECEIVE TOP (1) @Response = CONVERT(NVARCHAR(MAX), message_body)
, @MsgType = message_type_name
FROM dbo.' + QUOTENAME(@QueueName) + N' ), TIMEOUT 100'
EXEC dbo.sp_executesql @SQL, N'@Response NVARCHAR(MAX) OUTPUT, @MsgType SYSNAME OUTPUT',
@Response OUTPUT, @MsgType OUTPUT
IF @Response = N'__PONG__'
BEGIN
IF @Request = N'__PING__'
BEGIN
GOTO QH
END
SET @IsAck = 0
; SEND ON CONVERSATION @Handle (@Request)
SET @SQL = N'
WAITFOR ( RECEIVE TOP (1) @Response = CONVERT(NVARCHAR(MAX), message_body)
, @MsgType = message_type_name
FROM dbo.' + QUOTENAME(@QueueName) + N' ), TIMEOUT ' + CONVERT(NVARCHAR(50), @Timeout)
RepeatWait:
SELECT @Response = NULL, @MsgType = NULL
EXEC dbo.sp_executesql @SQL, N'@Response NVARCHAR(MAX) OUTPUT, @MsgType SYSNAME OUTPUT',
@Response OUTPUT, @MsgType OUTPUT
IF @MsgType = 'DEFAULT'
BEGIN
IF @IsAck = 0 OR LEFT(@Response, 2) = N'__'
BEGIN
IF @Response = N'__ACK__'
BEGIN
SET @IsAck = 1
END
GOTO RepeatWait
END
BREAK
END
END
END TRY
BEGIN CATCH
--PRINT { fn CURRENT_TIMESTAMP } + ': ERROR_MESSAGE=' + ERROR_MESSAGE()
IF @Handle IS NOT NULL AND ERROR_NUMBER() <> 8426 -- The conversation handle "%s" is not found.
BEGIN
; END CONVERSATION @Handle
END
IF @Attempt >= @Retry
BEGIN
SELECT @RetVal = 2
, @Response = LEFT(ERROR_MESSAGE(), 255)
GOTO QH
END
END CATCH
END
IF @MsgType = 'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog'
BEGIN
; END CONVERSATION @Handle
SELECT @RetVal = 1
, @Response = N'Conversation ended'
GOTO QH
END
IF @MsgType = 'http://schemas.microsoft.com/SQL/ServiceBroker/Error'
BEGIN
; END CONVERSATION @Handle
SELECT @RetVal = 1
, @Response = LEFT(CONVERT(XML, @Response).value('declare namespace ns="http://schemas.microsoft.com/SQL/ServiceBroker/Error";
(//ns:Description)[1]', 'NVARCHAR(MAX)'), 255)
GOTO QH
END
IF @MsgType IS NULL
BEGIN
--PRINT { fn CURRENT_TIMESTAMP } + ': Timeout'
SELECT @RetVal = 99
, @Response = N'Timeout'
GOTO QH
END
QH:
RETURN @RetVal
GO
IF OBJECT_ID('usp_sys_ServiceBrokerWaitRequest') IS NOT NULL DROP PROC usp_sys_ServiceBrokerWaitRequest
GO
/*
DECLARE @QueueName SYSNAME
, @Handle UNIQUEIDENTIFIER
, @Request NVARCHAR(MAX)
, @MsgType SYSNAME
, @SvcName SYSNAME
, @ErrorText NVARCHAR(255)
, @Result INT
SELECT @QueueName = 'UcsFpTargetQueue/POS2-PC'
EXEC dbo.usp_sys_ServiceBrokerSetupService @QueueName, 'UcsFpTargetService/DT123456', 'DROP_EXISTING'
EXEC dbo.usp_sys_ServiceBrokerSetupService @QueueName, 'UcsFpTargetService/DT518315', 'DROP_SERVICE'
WHILE 1=1
BEGIN
EXEC @Result = dbo.usp_sys_ServiceBrokerWaitRequest @QueueName, 5000, @Handle OUTPUT, @Request OUTPUT, @MsgType OUTPUT, @SvcName OUTPUT, @ErrorText OUTPUT
SELECT @Result AS Result, @Handle AS Handle, @Request AS Request, @MsgType AS MsgType, @SvcName AS SvcName, @ErrorText AS ErrorText
RAISERROR ('Result=%d', 10, 0, @Result) WITH NOWAIT
END
*/
CREATE PROC usp_sys_ServiceBrokerWaitRequest (
@QueueName SYSNAME = NULL
, @Timeout INT = NULL
, @Handle UNIQUEIDENTIFIER = NULL OUTPUT
, @Request NVARCHAR(MAX) = NULL OUTPUT
, @MsgType SYSNAME = NULL OUTPUT
, @SvcName SYSNAME = NULL OUTPUT
, @ErrorText NVARCHAR(255) = NULL OUTPUT
) AS
/*------------------------------------------------------------------------
'
' UcsFPHub (c) 2019-2020 by Unicontsoft
'
' Unicontsoft Fiscal Printers Hub
'
' This project is licensed under the terms of the MIT license
' See the LICENSE file in the project root for more information
'
*/------------------------------------------------------------------------
SET NOCOUNT ON
DECLARE @RetVal INT
, @SQL NVARCHAR(MAX)
, @State VARCHAR(50)
SELECT @RetVal = 0
, @Timeout = COALESCE(@Timeout, 5000)
IF NOT EXISTS (SELECT 0 FROM sys.service_queues WHERE SCHEMA_NAME(schema_id) = N'dbo' AND name = @QueueName)
BEGIN
SELECT @RetVal = 2
, @ErrorText = N'Queue not found'
GOTO QH
END
SELECT @SQL = N'
WAITFOR ( RECEIVE TOP (1) @Handle = conversation_handle
, @Request = CONVERT(NVARCHAR(MAX), message_body)
, @MsgType = message_type_name
, @SvcName = service_name
FROM dbo.' + QUOTENAME(@QueueName) + N' ), TIMEOUT ' + CONVERT(NVARCHAR(50), @Timeout)
RepeatWait:
BEGIN TRAN
SELECT @Handle = NULL, @Request = NULL, @MsgType = NULL, @SvcName = NULL, @ErrorText = NULL, @State = NULL
EXEC dbo.sp_executesql @SQL
, N'@Handle UNIQUEIDENTIFIER OUTPUT, @Request NVARCHAR(MAX) OUTPUT, @MsgType SYSNAME OUTPUT, @SvcName SYSNAME OUTPUT'
, @Handle OUTPUT, @Request OUTPUT, @MsgType OUTPUT, @SvcName OUTPUT
IF @Handle IS NULL
BEGIN
--PRINT { fn CURRENT_TIMESTAMP() } + ': Timeout'
ROLLBACK
SELECT @RetVal = 99
, @ErrorText = N'Timeout'
GOTO QH
END
IF @MsgType = 'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog'
BEGIN
--PRINT { fn CURRENT_TIMESTAMP() } + ': Conversation closed by ' + @MsgType
; END CONVERSATION @Handle
COMMIT
GOTO RepeatWait
END
IF @MsgType = 'http://schemas.microsoft.com/SQL/ServiceBroker/Error'
BEGIN
; END CONVERSATION @Handle
COMMIT
SELECT @RetVal = 1
, @ErrorText = LEFT(CONVERT(XML, @Request).value('declare namespace ns="http://schemas.microsoft.com/SQL/ServiceBroker/Error";
(//ns:Description)[1]', 'NVARCHAR(MAX)'), 255)
GOTO QH
END
SELECT @State = state
FROM sys.conversation_endpoints
WHERE conversation_handle = @Handle
IF @State IN ('DI', 'DO', 'ER')
BEGIN
--PRINT { fn CURRENT_TIMESTAMP() } + ': Conversation closed by state ' + @State
; END CONVERSATION @Handle
COMMIT
GOTO RepeatWait
END
IF @Request = N'__FIN__'
BEGIN
--PRINT { fn CURRENT_TIMESTAMP() } + ': Conversation closed by __FIN__'
; END CONVERSATION @Handle
COMMIT
GOTO RepeatWait
END
IF @Request = N'__PING__'
BEGIN
--PRINT { fn CURRENT_TIMESTAMP() } + ': Ping reply send'
; SEND ON CONVERSATION @Handle (N'__PONG__')
COMMIT
GOTO RepeatWait
END
; SEND ON CONVERSATION @Handle (N'__ACK__')
COMMIT
QH:
RETURN @RetVal
GO
|
<gh_stars>1-10
CREATE TABLE [dbo].[ExperimentGoals]
(
[Id] INT NOT NULL PRIMARY KEY IDENTITY,
[ExperimentId] INT NOT NULL,
[GoalId] INT NOT NULL,
CONSTRAINT [FK_ExperimentGoals_ToExperiments] FOREIGN KEY ([ExperimentId]) REFERENCES [Experiments]([Id]),
CONSTRAINT [FK_ExperimentGoals_ToGoals] FOREIGN KEY ([GoalId]) REFERENCES [Goals]([Id])
)
|
<reponame>AslanLM/SistemaClinica.BackEnd
CREATE PROCEDURE SP_Pacientes_Insertar
@CedulaPaciente VARCHAR(12),
@NombrePaciente VARCHAR(40),
@Apellidos VARCHAR(60),
@Telefono VARCHAR(12),
@Edad INT,
@CreadoPor VARCHAR(60)
AS
BEGIN
INSERT INTO Pacientes
(CedulaPaciente, NombrePaciente, Apellidos, Telefono, Edad, CreadoPor)
VALUES (
@CedulaPaciente, @NombrePaciente, @Apellidos, @Telefono, @Edad, @CreadoPor)
END |
-- file:timestamptz.sql ln:358 expect:true
SELECT '2011-03-27 00:00:00'::timestamp AT TIME ZONE 'Europe/Moscow'
|
CREATE TABLE "#__action_logs_users" (
"user_id" int NOT NULL,
"notify" tinyint NOT NULL,
"extensions" nvarchar(max) NOT NULL,
CONSTRAINT "PK_#__action_logs_users_user_id" PRIMARY KEY NONCLUSTERED
(
"user_id" ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY];
CREATE CLUSTERED INDEX "idx_notify" ON "#__action_logs_users"
(
"notify" ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
|
<gh_stars>1000+
-- 2019-09-12T10:12:34.453Z
-- URL zum Konzept
UPDATE AD_Column SET AD_Reference_ID=30,Updated=TO_TIMESTAMP('2019-09-12 13:12:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column.AD_Element_ID=113
;
|
<reponame>aravi5/drill-test-framework
set `exec.query.return_result_set_for_ddl` = false;
use dfs.`drillTestDir`;
reset `exec.query.return_result_set_for_ddl`; |
create table if not exist areas (
name name,
-- The geometry
geom geometry(Geometry,4326),
-- The way, geom converted to OSM coordinate system
way geometry(Geometry,3857),
primary key (name)
);
insert into areas (name, geom) values (
"gb",
ST_MakePolygon(ST_GeomFromText('LINESTRING( 1.983960E+00 5.133770E+01, 5.807600E-02 5.010375E+01, -1.246112E+00 4.989032E+01, -2.027284E+00 4.977612E+01, -2.020900E+00 4.976352E+01, -2.031990E+00 4.976171E+01, -1.808598E+00 4.910263E+01, -1.835368E+00 4.900443E+01, -3.940324E+00 4.915592E+01, -7.024780E+00 4.970097E+01, -5.441616E+00 5.278017E+01, -5.206178E+00 5.377268E+01, -5.488813E+00 5.486510E+01, -6.208707E+00 5.533747E+01, -6.604158E+00 5.543057E+01, -7.148041E+00 5.566455E+01, -1.486751E+01 5.746894E+01, -1.499070E+01 5.768017E+01, -1.208287E+01 5.853333E+01, -1.637515E+00 6.113564E+01, -2.670263E-01 6.110300E+01, 1.278458E-01 5.976591E+01, 9.781600E-02 5.942198E+01, 7.998970E-01 5.579959E+01, 1.702395E+00 5.443427E+01, 2.250000E+00 5.258000E+01, 1.983960E+00 5.133770E+01)'));
);
-- Update areas to osm
update areas set way = st_transform( geom, 3857);
|
<filename>src/test/resources/com/foundationdb/sql/unparser/create-table-8a.sql<gh_stars>10-100
CREATE TABLE t2 (id INT PRIMARY KEY NOT NULL, pid INT REFERENCES t1 (id) NOT NULL) |
DROP VIEW v_Subj15Department CASCADE;
CREATE OR REPLACE VIEW v_Subj15Department AS
SELECT innerRel.x1 AS att1
FROM (
SELECT ca_0.individual AS x1
FROM concept_assertion ca_0
WHERE ca_0.concept=36
) as innerRel
|
create table contributions
(
id serial primary key,
user_id bigint not null references users (id),
contribute_session_id bigint not null references contribute_sessions (id),
article_id bigint not null references articles (id),
images jsonb,
status text not null,
created_at timestamptz,
updated_at timestamptz
) |
ALTER TABLE spotify_artist DROP COLUMN last_updated;
ALTER TABLE spotify_artist DROP COLUMN followers;
ALTER TABLE spotify_artist DROP COLUMN genres;
ALTER TABLE spotify_artist DROP COLUMN popularity;
|
<reponame>DmytroSokhach/EntityFramework-Reverse-POCO-Code-First-Generator<gh_stars>10-100
CREATE TABLE [dbo].[Shippers] (
[ShipperID] INT IDENTITY (1, 1) NOT NULL,
[CompanyName] NVARCHAR (40) NOT NULL,
[Phone] NVARCHAR (24) NULL,
CONSTRAINT [PK_Shippers] PRIMARY KEY CLUSTERED ([ShipperID] ASC)
);
|
--
-- 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.
--
-- using default substitutions
with revenue0 as
(select
l_suppkey as supplier_no,
sum(l_extendedprice * (1 - l_discount)) as total_revenue
from
lineitem
where
l_shipdate >= date '1996-01-01'
and l_shipdate < date '1996-01-01' + interval '3' month
group by
l_suppkey)
select
s_suppkey,
s_name,
s_address,
s_phone,
total_revenue
from
supplier,
revenue0
where
s_suppkey = supplier_no
and total_revenue = (
select
max(total_revenue)
from
revenue0
)
order by
s_suppkey
|
<reponame>nenadnoveljic/tpt-oracle
-- Copyright 2018 <NAME>. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
SELECT
"AREA NAME" -- VARCHAR2(32)
, "NUMAPG" -- NUMBER
, "PAGESIZE" / 1024 mempage_kb -- NUMBER
, ROUND("SEGMENT SIZE" / 1048576) segsize_mb -- NUMBER
, ROUND("SIZE" / 1048576) area_size_mb -- NUMBER
, ROUND("REMAINING ALLOC SIZE" / 1048576) remain_mb -- NUMBER
, "SHMID" -- NUMBER
, "SEGMENT DISTRIBUTED" -- VARCHAR2(20)
, "AREA FLAGS" -- NUMBER
, "SEGMENT DEFERRED" -- VARCHAR2(20)
, "SEG_START ADDR" -- RAW(8)
, "START ADDR" -- RAW(8)
FROM
x$ksmssinfo
/
|
<gh_stars>10-100
ALTER TABLE public.oauth_client_details
ADD COLUMN silent_refresh_redirect_uri character varying(255);
ALTER TABLE public.oauth_client_details
ADD COLUMN auth_type character varying(255);
ALTER TABLE public.oauth_client_details
ADD COLUMN issuer character varying(255);
ALTER TABLE public.oauth_client_details
ADD COLUMN response_type character varying(255);
ALTER TABLE public.oauth_client_details
ADD COLUMN token_endpoint character varying(255);
ALTER TABLE public.oauth_client_details
ADD COLUMN oidc boolean
DEFAULT 'TRUE';
ALTER TABLE public.oauth_client_details
ADD COLUMN show_debug_information boolean
DEFAULT 'TRUE';
ALTER TABLE public.oauth_client_details
ADD COLUMN require_https boolean
DEFAULT 'TRUE';
ALTER TABLE public.oauth_client_details
ADD COLUMN strict_discovery_document_validation boolean
DEFAULT 'TRUE';
ALTER TABLE public.oauth_client_details
ADD COLUMN use_http_basic_auth boolean
DEFAULT 'TRUE';
|
--
-- PostgreSQL database dump
--
SET client_encoding = 'UTF8';
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON SCHEMA public IS 'Standard public schema';
--
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner:
--
CREATE PROCEDURAL LANGUAGE plpgsql;
SET search_path = pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: eeincometax(double precision); Type: FUNCTION; Schema: public; Owner: shamsutdinov_lr
--
CREATE FUNCTION public.eeincometax(double precision) RETURNS double precision
LANGUAGE sql
AS $_$
SELECT (least($1, 256) * 21) / 79
$_$;
ALTER FUNCTION public.eeincometax(double precision) OWNER TO shamsutdinov_lr;
--
-- Name: grt_finalfunc(point); Type: FUNCTION; Schema: public; Owner: shamsutdinov_lr
--
CREATE FUNCTION public.grt_finalfunc(agg_state point) RETURNS double precision
LANGUAGE plpgsql IMMUTABLE STRICT
AS $$
begin
return agg_state[1];
end;
$$;
ALTER FUNCTION public.grt_finalfunc(agg_state point) OWNER TO shamsutdinov_lr;
--
-- Name: grt_sfunc(point, double precision); Type: FUNCTION; Schema: public; Owner: shamsutdinov_lr
--
CREATE FUNCTION public.grt_sfunc(agg_state point, el double precision) RETURNS point
LANGUAGE plpgsql IMMUTABLE
AS $$
declare
greatest_sum float8;
current_sum float8;
begin
current_sum := agg_state[0] + el;
if agg_state[1] < current_sum then
greatest_sum := current_sum;
else
greatest_sum := agg_state[1];
end if;
return point(current_sum, greatest_sum);
end;
$$;
ALTER FUNCTION public.grt_sfunc(agg_state point, el double precision) OWNER TO shamsutdinov_lr;
--
-- Name: mode_bool_final(integer[]); Type: FUNCTION; Schema: public; Owner: shamsutdinov_lr
--
CREATE FUNCTION public.mode_bool_final(integer[]) RETURNS boolean
LANGUAGE sql
AS $_$
SELECT CASE WHEN ( $1[1] = 0 AND $1[2] = 0 )
THEN NULL
ELSE $1[1] >= $1[2]
END;
$_$;
ALTER FUNCTION public.mode_bool_final(integer[]) OWNER TO shamsutdinov_lr;
--
-- Name: mode_bool_final(integer[], boolean); Type: FUNCTION; Schema: public; Owner: shamsutdinov_lr
--
CREATE FUNCTION public.mode_bool_final(integer[], boolean) RETURNS boolean
LANGUAGE sql
AS $_$
SELECT CASE WHEN ( $1[1] = 0 AND $1[2] = 0 )
THEN NULL
ELSE $1[1] >= $1[2]
END;
$_$;
ALTER FUNCTION public.mode_bool_final(integer[], boolean) OWNER TO shamsutdinov_lr;
--
-- Name: mode_bool_final(integer[], boolean, integer, text); Type: FUNCTION; Schema: public; Owner: shamsutdinov_lr
--
CREATE FUNCTION public.mode_bool_final(integer[], boolean, integer, text) RETURNS boolean
LANGUAGE sql
AS $_$
SELECT CASE WHEN ( $1[1] = 0 AND $1[2] = 0 )
THEN NULL
ELSE $1[1] >= $1[2]
END;
$_$;
ALTER FUNCTION public.mode_bool_final(integer[], boolean, integer, text) OWNER TO shamsutdinov_lr;
--
-- Name: mode_bool_state(integer[]); Type: FUNCTION; Schema: public; Owner: shamsutdinov_lr
--
CREATE FUNCTION public.mode_bool_state(integer[]) RETURNS integer[]
LANGUAGE sql
AS $_$
SELECT CASE 1 > 2
WHEN TRUE THEN
array[ $1[1] + 1, $1[2] ]
WHEN FALSE THEN
array[ $1[1], $1[2] + 1 ]
ELSE
$1
END;
$_$;
ALTER FUNCTION public.mode_bool_state(integer[]) OWNER TO shamsutdinov_lr;
--
-- Name: mode_bool_state(integer[], boolean); Type: FUNCTION; Schema: public; Owner: shamsutdinov_lr
--
CREATE FUNCTION public.mode_bool_state(integer[], boolean) RETURNS integer[]
LANGUAGE sql
AS $_$
SELECT CASE $2
WHEN TRUE THEN
array[ $1[1] + 1, $1[2] ]
WHEN FALSE THEN
array[ $1[1], $1[2] + 1 ]
ELSE
$1
END;
$_$;
ALTER FUNCTION public.mode_bool_state(integer[], boolean) OWNER TO shamsutdinov_lr;
--
-- Name: mode_bool_state(integer[], boolean, text); Type: FUNCTION; Schema: public; Owner: shamsutdinov_lr
--
CREATE FUNCTION public.mode_bool_state(integer[], boolean, text) RETURNS integer[]
LANGUAGE sql
AS $_$
SELECT CASE 1 > 2
WHEN TRUE THEN
array[ $1[1] + 1, $1[2] ]
WHEN FALSE THEN
array[ $1[1], $1[2] + 1 ]
ELSE
$1
END;
$_$;
ALTER FUNCTION public.mode_bool_state(integer[], boolean, text) OWNER TO shamsutdinov_lr;
--
-- Name: mode_bool_state(integer[], boolean, text, integer); Type: FUNCTION; Schema: public; Owner: shamsutdinov_lr
--
CREATE FUNCTION public.mode_bool_state(integer[], boolean, text, integer) RETURNS integer[]
LANGUAGE sql
AS $_$
SELECT CASE 1 > 2
WHEN TRUE THEN
array[ $1[1] + 1, $1[2] ]
WHEN FALSE THEN
array[ $1[1], $1[2] + 1 ]
ELSE
$1
END;
$_$;
ALTER FUNCTION public.mode_bool_state(integer[], boolean, text, integer) OWNER TO shamsutdinov_lr;
|
<reponame>pdv-ru/ClickHouse
SELECT toDecimal32(2, 2) * 1.2;
SELECT toDecimal64(0.5, 2) * 20.33;
SELECT 0.00001 * toDecimal32(12, 2);
SELECT 30.033 * toDecimal32(5, 1);
CREATE TABLE IF NOT EXISTS test01603 (
f64 Float64,
d Decimal64(3) DEFAULT toDecimal32(f64, 3),
f32 Float32 DEFAULT f64
) ENGINE=MergeTree() ORDER BY f32;
INSERT INTO test01603(f64) SELECT 1 / (number + 1) FROM system.numbers LIMIT 1000;
SELECT sum(d * 1.1) FROM test01603;
SELECT sum(8.01 * d) FROM test01603;
SELECT sum(f64 * toDecimal64(80, 2)) FROM test01603;
SELECT sum(toDecimal64(40, 2) * f32) FROM test01603;
SELECT sum(f64 * toDecimal64(0.1, 2)) FROM test01603;
SELECT sum(toDecimal64(0.3, 2) * f32) FROM test01603;
SELECT sum(f64 * d) FROM test01603;
SELECT sum(d * f64) FROM test01603;
SELECT sum(f32 * d) FROM test01603;
SELECT sum(d * f32) FROM test01603;
DROP TABLE IF EXISTS test01603;
|
<gh_stars>0
-- Dropping table while reindex database should not fail reindex
CREATE EXTENSION IF NOT EXISTS gp_inject_fault;
CREATE DATABASE reindexdb1 TEMPLATE template1;
-- halt reindex after scanning the pg_class and getting the relids
SELECT gp_inject_fault('reindex_db', 'suspend', '', '', '', 0, 0, 1);
1:@db_name reindexdb1: CREATE TABLE heap1(a INT, b INT);
1&:REINDEX DATABASE reindexdb1;
SELECT gp_inject_fault('reindex_db', 'wait_until_triggered', '', '', '', 0, 0, 1);
2:@db_name reindexdb1:DROP TABLE heap1;
SELECT gp_inject_fault('reindex_db', 'reset', '', '', '', 0, 0, 1);
-- reindex should complete fine
1<:
1q:
2q:
-- Adding index after scanning indexes for relation to reindex should
-- not fail reindex
BEGIN;
CREATE TABLE reindex_index1(a int, b int);
CREATE INDEX reindex_index1_idx1 on reindex_index1 (b);
insert into reindex_index1 select i,i+1 from generate_series(1, 10)i;
COMMIT;
SELECT gp_inject_fault('reindex_relation', 'suspend', '', '', '', 0, 0, 1);
3&: REINDEX TABLE reindex_index1;
SELECT gp_inject_fault('reindex_relation', 'wait_until_triggered', '', '', '', 0, 0, 1);
-- create one more index
CREATE INDEX reindex_index1_idx2 on reindex_index1 (a);
SELECT gp_inject_fault('reindex_relation', 'reset', '', '', '', 0, 0, 1);
3<:
DROP DATABASE reindexdb1;
|
<filename>scheme/migration_20160209.sql
alter table Model add column resize_mode text;
alter table Model add column channels integer Default 3;
|
<filename>openGaussBase/testcase/KEYWORDS/range/Opengauss_Function_Keyword_Range_Case0028.sql
-- @testpoint: opengauss关键字range(非保留),作为同义词对象名,部分测试点合理报错
--前置条件
drop table if exists range_test;
create table range_test(id int,name varchar(10));
--关键字不带引号-成功
drop synonym if exists range;
create synonym range for range_test;
insert into range values (1,'ada'),(2, 'bob');
update range set range.name='cici' where range.id=2;
select * from range;
drop synonym if exists range;
--关键字带双引号-成功
drop synonym if exists "range";
create synonym "range" for range_test;
insert into "range" values (1,'ada'),(2, 'bob');
update "range" set "range".name='cici' where "range".id=2;
select * from "range";
drop synonym if exists "range";
--关键字带单引号-合理报错
drop synonym if exists 'range';
--关键字带反引号-合理报错
drop synonym if exists `range`;
--清理环境
drop table if exists range_test; |
<filename>backup_latest.sql
CREATE DATABASE IF NOT EXISTS `smartmenu` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;
USE `smartmenu`;
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: 127.0.0.1 Database: smartmenu
-- ------------------------------------------------------
-- Server version 5.7.29-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 `allergens`
--
DROP TABLE IF EXISTS `allergens`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `allergens` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_it` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`icon` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`initials_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`initials_it` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description_en` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`description_it` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`visible` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `allergens`
--
LOCK TABLES `allergens` WRITE;
/*!40000 ALTER TABLE `allergens` DISABLE KEYS */;
INSERT INTO `allergens` VALUES (1,'gluten','Gluten','Glutine','http://smartmenu.local/storage/photos/1/allergens/gluten.png','G','G','<p>Gluten</p>','<p>Glutine</p>',1,'2020-06-10 10:28:44','2020-06-22 08:10:30'),(2,'celery','Celery','Sedano','http://smartmenu.local/storage/photos/1/allergens/celery.png','S','S','<p>Celery</p>','<p>Sedano</p>',1,'2020-06-10 15:00:03','2020-06-22 08:11:49'),(3,'nuts','Nuts','Frutta a Guscio','http://smartmenu.local/storage/photos/1/allergens/nuts.png','FG','FG','<p>Nuts</p>','<p>Frutta a Guscio</p>',1,'2020-06-11 11:14:10','2020-06-22 08:11:22'),(4,'milk','Milk','Latte','http://smartmenu.local/storage/photos/1/allergens/milk.png','L','L','<p>Milk</p>','<p>Latte</p>',1,'2020-06-15 12:10:17','2020-06-22 08:12:25'),(5,'eggs','Eggs','Uova','http://smartmenu.local/storage/photos/1/allergens/eggs.png','U','U','<p>Eggs</p>','<p>Uova</p>',1,'2020-06-22 08:13:05','2020-06-22 08:13:18'),(6,'fish','Fish','Pesce','http://smartmenu.local/storage/photos/1/allergens/fish.png','P','P','<p>Fish</p>','<p>Pesce</p>',1,'2020-06-22 08:13:56','2020-06-22 08:13:56'),(7,'lupins','Lupins','Lupini','http://smartmenu.local/storage/photos/1/allergens/lupins.png','L','L','<p>Lupins</p>','<p>Lupini</p>',1,'2020-06-22 08:14:28','2020-06-22 08:14:28'),(8,'mustard','Mustard','Senape','http://smartmenu.local/storage/photos/1/allergens/mustard.png','SE','SE','<p>Mustad</p>','<p>Senape</p>',1,'2020-06-22 08:14:56','2020-06-22 08:14:56'),(9,'peanuts','Peanuts','Arachidi','http://smartmenu.local/storage/photos/1/allergens/peanuts.png','A','A','<p>Peanuts</p>','<p>Arachidi</p>',1,'2020-06-22 08:15:47','2020-06-22 08:15:47'),(10,'sesam','Sesam','Sesamo','http://smartmenu.local/storage/photos/1/allergens/sesam.png','SS','SS','<p>Sesam</p>','<p>Sesamo</p>',1,'2020-06-22 08:16:27','2020-06-22 08:16:27'),(11,'shellfish','Shell Fish','Crostacei','http://smartmenu.local/storage/photos/1/allergens/shellfish.png','C','C','<p>Shellfish</p>','<p>Crostacei</p>',1,'2020-06-22 08:17:06','2020-06-22 08:17:06'),(12,'soya','Soya','Soia','http://smartmenu.local/storage/photos/1/allergens/soya.png','SO','SO','<p>Soya</p>','<p>Soia</p>',1,'2020-06-22 08:17:32','2020-06-22 08:17:32'),(13,'sulphites','Sulphites','Solfiti','http://smartmenu.local/storage/photos/1/allergens/sulphites.png','AS','AS','<p>Sulphites</p>','<p>Solfiti</p>',1,'2020-06-22 08:18:15','2020-06-22 08:18:15'),(14,'clams','Clams','Molluschi','http://smartmenu.local/storage/photos/1/allergens/clams.png','M','M','<p>Clams</p>','<p>Molluschi</p>',1,'2020-06-22 08:19:14','2020-06-22 08:19:14');
/*!40000 ALTER TABLE `allergens` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `dishes`
--
DROP TABLE IF EXISTS `dishes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dishes` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_it` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`cover` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`structure_id` int(10) unsigned NOT NULL,
`visible` tinyint(1) NOT NULL,
`view` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`ingredients` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`allergens` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`features` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`description_en` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`description_it` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`),
KEY `dishes_structure_id_foreign` (`structure_id`),
KEY `dishes_user_id_foreign` (`user_id`),
CONSTRAINT `dishes_structure_id_foreign` FOREIGN KEY (`structure_id`) REFERENCES `structures` (`id_code`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `dishes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `dishes`
--
LOCK TABLES `dishes` WRITE;
/*!40000 ALTER TABLE `dishes` DISABLE KEYS */;
INSERT INTO `dishes` VALUES (1,'pastaesalsiccia','Pasta with Sausage','Pasta E Salsiccia','http://smartmenu.local/storage/photos/1/Structure Category/423px-Coppa_Italia_-_Logo_2019.svg.png',1,1,'ingredients','12','2,4,5','1,2','1','<p>Pasta with Sausage</p>','<p>Pasta e Salsiccia</p>',1,'2020-06-15 13:18:08','2020-06-15 13:18:08');
/*!40000 ALTER TABLE `dishes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `failed_jobs`
--
DROP TABLE IF EXISTS `failed_jobs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `failed_jobs` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`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,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `failed_jobs`
--
LOCK TABLES `failed_jobs` WRITE;
/*!40000 ALTER TABLE `failed_jobs` DISABLE KEYS */;
/*!40000 ALTER TABLE `failed_jobs` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `features`
--
DROP TABLE IF EXISTS `features`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `features` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_it` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`icon` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`initials_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`initials_it` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description_en` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`description_it` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`visible` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `features`
--
LOCK TABLES `features` WRITE;
/*!40000 ALTER TABLE `features` DISABLE KEYS */;
INSERT INTO `features` VALUES (1,'frozen','Frozen','Surgelato','http://smartmenu.local/storage/photos/1/features/frozen.png','FR','SU','<p>Frozen</p>','<p>Surgelato</p>',1,'2020-06-15 12:12:15','2020-06-22 08:21:32'),(2,'knockeddown','Knocked Down','Abbattuto','http://smartmenu.local/storage/photos/1/features/knocked-down.png','KD','AB','<p>Knocked Down</p>','<p>Abbattuto</p>',1,'2020-06-22 08:22:10','2020-06-22 08:22:10'),(3,'spicy','Spicy','Piccante','http://smartmenu.local/storage/photos/1/features/spicy.png','S','P','<p>Spicy</p>','<p>Piccante</p>',1,'2020-06-22 08:22:40','2020-06-22 08:22:40'),(4,'bio','Bio','Bio','http://smartmenu.local/storage/photos/1/features/bio.png','B','B','<p>Bio</p>','<p>Bio</p>',1,'2020-06-22 08:23:08','2020-06-22 08:23:08'),(5,'vegan','Vegan','Vegano','http://smartmenu.local/storage/photos/1/features/vegan.png','VEG','VEG','<p>Vegan</p>','<p>Vegano</p>',1,'2020-06-22 08:23:37','2020-06-22 08:23:37'),(6,'vegetarian','Vegetarian','Vegetariano','http://smartmenu.local/storage/photos/1/features/vegetarian.png','VG','VG','<p>Vegetarian</p>','<p>Vegetariano</p>',1,'2020-06-22 08:24:12','2020-06-22 08:24:12'),(7,'glutenfree','Gluten Free','Senza Glutine','http://smartmenu.local/storage/photos/1/features/gluten-free.png','GF','SG','<p>Gluten Free</p>','<p>Senza Glutine</p>',1,'2020-06-22 08:25:00','2020-06-22 08:25:00'),(8,'lactosefree','Lactose Free','Senza Lattosio','http://smartmenu.local/storage/photos/1/features/lactose-free.png','LF','SL','<p>Lactose Free</p>','<p>Senza Lattosio</p>',1,'2020-06-22 08:25:39','2020-06-22 08:25:39');
/*!40000 ALTER TABLE `features` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `formats`
--
DROP TABLE IF EXISTS `formats`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `formats` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_it` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`visible` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `formats`
--
LOCK TABLES `formats` WRITE;
/*!40000 ALTER TABLE `formats` DISABLE KEYS */;
INSERT INTO `formats` VALUES (1,'020','20 cl','20 cl',NULL,1,'2020-06-30 08:24:51','2020-06-30 08:24:51'),(2,'010','10 cl','10 cl',NULL,1,'2020-06-30 08:25:07','2020-06-30 08:25:07');
/*!40000 ALTER TABLE `formats` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ingredients`
--
DROP TABLE IF EXISTS `ingredients`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ingredients` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_it` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`allergens` longtext COLLATE utf8mb4_unicode_ci,
`description_en` longtext COLLATE utf8mb4_unicode_ci,
`description_it` longtext COLLATE utf8mb4_unicode_ci,
`visible` tinyint(1) NOT NULL,
`user_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ingredients`
--
LOCK TABLES `ingredients` WRITE;
/*!40000 ALTER TABLE `ingredients` DISABLE KEYS */;
INSERT INTO `ingredients` VALUES (1,'sedano','Sedan','Sedano','1','<p>Sedan</p>','<p>Sedano</p>',1,'1','2020-06-11 09:59:03','2020-06-18 13:11:47'),(2,'farina','Flour 00','Farina 00','1',NULL,NULL,1,'1','2020-06-11 10:02:22','2020-06-11 15:57:57'),(3,'pesce','Fish','Pesce','3','<p>Fish</p>','<p>Pesce</p>',1,'1','2020-06-11 11:15:11','2020-06-11 14:22:34'),(4,'pasta','Pasta','Pasta','2,1',NULL,NULL,1,'1','2020-06-11 15:40:30','2020-06-11 15:54:58'),(5,'salsiccia','Sausage','Salsiccia',NULL,NULL,NULL,1,'1','2020-06-11 15:44:16','2020-06-11 15:55:29'),(6,'salame','Salami','Salame','2','<p>Salami</p>','<p>Salame</p>',1,'1','2020-06-16 12:52:21','2020-07-07 09:09:18');
/*!40000 ALTER TABLE `ingredients` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `item_categories`
--
DROP TABLE IF EXISTS `item_categories`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_categories` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_it` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`cover` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`fields` longtext COLLATE utf8mb4_unicode_ci,
`description_en` longtext COLLATE utf8mb4_unicode_ci,
`description_it` longtext COLLATE utf8mb4_unicode_ci,
`visible` tinyint(1) NOT NULL,
`user_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`),
KEY `item_categories_user_id_foreign` (`user_id`),
CONSTRAINT `item_categories_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `item_categories`
--
LOCK TABLES `item_categories` WRITE;
/*!40000 ALTER TABLE `item_categories` DISABLE KEYS */;
INSERT INTO `item_categories` VALUES (1,'firstcourse','First Course','Primi','http://smartmenu.local/storage/photos/1/itemcategories/firstcourse.png','ingredients,allergens,features',NULL,NULL,1,1,'2020-06-15 15:05:53','2020-07-03 13:51:24'),(2,'wine','Wines','Vini','http://smartmenu.local/storage/photos/1/itemcategories/wine.png','',NULL,NULL,1,1,'2020-06-15 15:49:02','2020-07-03 12:47:34'),(3,'drink','Drinks','Drinks','http://smartmenu.local/storage/photos/1/itemcategories/drink.png','',NULL,NULL,1,1,'2020-06-16 08:31:39','2020-06-24 09:36:20'),(4,'maincourse','Main Course','Secondi','http://smartmenu.local/storage/photos/1/itemcategories/maincourse.png','',NULL,NULL,1,1,'2020-06-17 08:21:32','2020-06-23 13:11:09'),(5,'pizza','Pizza','Pizza','http://smartmenu.local/storage/photos/1/itemcategories/pizza.png','',NULL,NULL,1,1,'2020-06-17 10:37:44','2020-06-23 13:46:51'),(6,'sidedish','Side Dishes','Contorni','http://smartmenu.local/storage/photos/1/itemcategories/sidedish.png','',NULL,NULL,1,1,'2020-06-18 14:59:53','2020-06-25 14:45:29'),(7,'softdrink','Soft Drinks','Soft Drinks','http://smartmenu.local/storage/photos/1/itemcategories/softdrink.png','ingredients,format,vol',NULL,NULL,1,1,'2020-06-24 09:00:02','2020-07-03 14:09:45'),(8,'sandwich','Sandwiches','Panini','http://smartmenu.local/storage/photos/1/itemcategories/sandwich.png','',NULL,NULL,1,1,'2020-06-24 09:04:31','2020-06-24 09:04:31'),(9,'dessert','Dessert','Dolci','http://smartmenu.local/storage/photos/1/itemcategories/dessert.png','ingredients,allergens,features',NULL,NULL,1,1,'2020-06-24 09:09:25','2020-07-08 10:21:08'),(10,'bitter','Bitter & Spirit','Amari & Liquori','http://smartmenu.local/storage/photos/1/itemcategories/bitter.png','',NULL,NULL,1,1,'2020-06-24 09:13:21','2020-06-24 09:13:21'),(11,'appetizer','Appetizers','Antipasti','http://smartmenu.local/storage/photos/1/itemcategories/appetizer.png','ingredients,allergens,features',NULL,NULL,1,1,'2020-06-24 09:22:23','2020-07-03 14:09:18'),(12,'fry','Fry','Friggitoria','http://smartmenu.local/storage/photos/1/itemcategories/fry.png','',NULL,NULL,1,1,'2020-06-24 09:24:56','2020-06-24 09:24:56'),(13,'special','Specials','Speciali','http://smartmenu.local/storage/photos/1/itemcategories/special.png','',NULL,NULL,0,1,'2020-06-24 09:28:08','2020-06-24 09:28:08'),(14,'coffebar','Coffee Bar','Caffetteria','http://smartmenu.local/storage/photos/1/itemcategories/coffeebar.png','',NULL,NULL,1,1,'2020-06-29 14:09:28','2020-06-29 14:09:28'),(15,'crushedice','Crushed','Granite',NULL,'ingredients,allergens,format',NULL,NULL,1,1,'2020-07-03 12:59:13','2020-07-03 13:51:09'),(16,'separator','Separator','Separatore',NULL,NULL,NULL,NULL,1,1,'2020-07-08 08:00:20','2020-07-08 08:00:56');
/*!40000 ALTER TABLE `item_categories` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `items`
--
DROP TABLE IF EXISTS `items`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `items` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`category_id` int(10) unsigned NOT NULL,
`name_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_it` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`cover` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`structure_id` int(10) unsigned NOT NULL,
`visible` tinyint(1) NOT NULL,
`view` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`ingredients` longtext COLLATE utf8mb4_unicode_ci,
`allergens` longtext COLLATE utf8mb4_unicode_ci,
`features` longtext COLLATE utf8mb4_unicode_ci,
`winery` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`year` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`format` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`region` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`vol` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`wine_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`wine_doc` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description_en` longtext COLLATE utf8mb4_unicode_ci,
`description_it` longtext COLLATE utf8mb4_unicode_ci,
`user_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`),
KEY `items_category_id_foreign` (`category_id`),
KEY `items_structure_id_foreign` (`structure_id`),
KEY `items_user_id_foreign` (`user_id`),
CONSTRAINT `items_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `item_categories` (`id_code`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `items_structure_id_foreign` FOREIGN KEY (`structure_id`) REFERENCES `structures` (`id_code`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `items_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `items`
--
LOCK TABLES `items` WRITE;
/*!40000 ALTER TABLE `items` DISABLE KEYS */;
INSERT INTO `items` VALUES (1,'pastaesalsiccia',1,'Pasta with Sausage','Pasta E Salsiccia',NULL,1,1,'ingredients','12','5,4','2','1',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'<p>Pasta</p>','<p>Pasta</p>',1,'2020-06-16 08:54:44','2020-06-22 12:32:58'),(2,'filetto',4,'Fillet','Filetto',NULL,1,1,'ingredients','10','4','3',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'<p>Filetto</p>','<p>Filetto</p>',1,'2020-06-17 08:28:36','2020-06-17 08:28:36'),(3,'pastaesalame',1,'Pasta with Salami','Pasta e Salame',NULL,2,1,'ingredients','20','3,2,5,1,4','1,2','1',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,4,'2020-06-18 12:23:43','2020-07-06 08:04:55'),(4,'prosciuttoemelone',11,'Prosciutto e Melone','Prosciutto e Melone',NULL,1,1,'ingredients','8','4,6,3,2','11,1,14',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,'2020-06-29 15:31:12','2020-07-06 11:08:45'),(5,'prosciuttoemelonea',11,'Parma','Parma',NULL,1,1,'ingredients','8',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,'2020-06-29 15:32:28','2020-07-06 11:08:32'),(6,'campaniawines',16,'Campania Wines','Vini Campani',NULL,1,1,'empty',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,'2020-07-08 08:21:50','2020-07-08 08:21:50');
/*!40000 ALTER TABLE `items` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `menus`
--
DROP TABLE IF EXISTS `menus`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `menus` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_it` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`cover` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`structure_id` int(10) unsigned NOT NULL,
`visible` tinyint(1) NOT NULL,
`items` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`order` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
`price` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`price_view` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description_en` longtext COLLATE utf8mb4_unicode_ci,
`description_it` longtext COLLATE utf8mb4_unicode_ci,
`user_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`),
KEY `menus_structure_id_foreign` (`structure_id`),
KEY `menus_user_id_foreign` (`user_id`),
CONSTRAINT `menus_structure_id_foreign` FOREIGN KEY (`structure_id`) REFERENCES `structures` (`id_code`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `menus_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `menus`
--
LOCK TABLES `menus` WRITE;
/*!40000 ALTER TABLE `menus` DISABLE KEYS */;
INSERT INTO `menus` VALUES (1,'primipiatti','First Course','Primi Piatti',NULL,1,1,'1,2','1',NULL,'hide_price',NULL,NULL,1,'2020-06-16 09:28:53','2020-06-22 13:53:38'),(2,'secondi','Main Course','Secondi Piatti',NULL,1,1,'5,1','0','12','show_price',NULL,NULL,1,'2020-06-22 13:25:34','2020-07-06 11:18:12'),(3,'pizze','Pizze','Pizze',NULL,2,1,'3','0',NULL,'ingredients',NULL,NULL,4,'2020-06-22 13:38:28','2020-06-22 13:38:28');
/*!40000 ALTER TABLE `menus` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `migrations`
--
DROP TABLE IF EXISTS `migrations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `migrations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `migrations`
--
LOCK TABLES `migrations` WRITE;
/*!40000 ALTER TABLE `migrations` DISABLE KEYS */;
INSERT INTO `migrations` VALUES (1,'2014_10_12_000000_create_users_table',1),(2,'2014_10_12_100000_create_password_resets_table',1),(3,'2019_08_19_000000_create_failed_jobs_table',1),(4,'2020_05_27_123143_laratrust_setup_tables',1),(5,'2020_05_27_145254_create_structure_categories_table',2),(6,'2020_06_10_093931_create_allergens_table',3),(7,'2020_06_10_111237_create_ingredients_table',4),(8,'2020_06_15_095701_create_towns_table',5),(9,'2020_06_15_100350_create_structures_table',5),(10,'2020_06_15_115517_create_features_table',6),(11,'2020_06_15_121240_create_dishes_table',7),(12,'2020_06_15_142008_create_item_categories_table',8),(14,'2020_06_15_142639_create_items_table',9),(15,'2020_06_16_083744_create_menus_table',10),(16,'2020_06_16_094002_create_structure_users_table',11),(17,'2020_06_22_143354_create_qr_codes_table',12),(19,'2020_06_26_094159_add_activation_to_qr_codes_table',13),(20,'2020_06_30_075108_create_formats_table',14),(21,'2020_07_03_125437_add_fields_to_item_categories_table',15),(22,'2020_07_07_094917_create_templates_table',16);
/*!40000 ALTER TABLE `migrations` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `password_resets`
--
DROP TABLE IF EXISTS `password_resets`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
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,
KEY `password_resets_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `password_resets`
--
LOCK TABLES `password_resets` WRITE;
/*!40000 ALTER TABLE `password_resets` DISABLE KEYS */;
/*!40000 ALTER TABLE `password_resets` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `permission_role`
--
DROP TABLE IF EXISTS `permission_role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `permission_role` (
`permission_id` int(10) unsigned NOT NULL,
`role_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`permission_id`,`role_id`),
KEY `permission_role_role_id_foreign` (`role_id`),
CONSTRAINT `permission_role_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `permission_role_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `permission_role`
--
LOCK TABLES `permission_role` WRITE;
/*!40000 ALTER TABLE `permission_role` DISABLE KEYS */;
INSERT INTO `permission_role` VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(1,2),(2,2),(3,2),(4,2),(9,2),(10,2),(9,3),(10,3),(11,4),(12,4),(13,4),(14,4);
/*!40000 ALTER TABLE `permission_role` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `permission_user`
--
DROP TABLE IF EXISTS `permission_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `permission_user` (
`permission_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL,
`user_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`user_id`,`permission_id`,`user_type`),
KEY `permission_user_permission_id_foreign` (`permission_id`),
CONSTRAINT `permission_user_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `permission_user`
--
LOCK TABLES `permission_user` WRITE;
/*!40000 ALTER TABLE `permission_user` DISABLE KEYS */;
/*!40000 ALTER TABLE `permission_user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `permissions`
--
DROP TABLE IF EXISTS `permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `permissions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`display_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `permissions_name_unique` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `permissions`
--
LOCK TABLES `permissions` WRITE;
/*!40000 ALTER TABLE `permissions` DISABLE KEYS */;
INSERT INTO `permissions` VALUES (1,'create-users','Create Users','Create Users','2020-05-27 13:43:44','2020-05-27 13:43:44'),(2,'read-users','Read Users','Read Users','2020-05-27 13:43:44','2020-05-27 13:43:44'),(3,'update-users','Update Users','Update Users','2020-05-27 13:43:44','2020-05-27 13:43:44'),(4,'delete-users','Delete Users','Delete Users','2020-05-27 13:43:44','2020-05-27 13:43:44'),(5,'create-payments','Create Payments','Create Payments','2020-05-27 13:43:44','2020-05-27 13:43:44'),(6,'read-payments','Read Payments','Read Payments','2020-05-27 13:43:44','2020-05-27 13:43:44'),(7,'update-payments','Update Payments','Update Payments','2020-05-27 13:43:44','2020-05-27 13:43:44'),(8,'delete-payments','Delete Payments','Delete Payments','2020-05-27 13:43:44','2020-05-27 13:43:44'),(9,'read-profile','Read Profile','Read Profile','2020-05-27 13:43:44','2020-05-27 13:43:44'),(10,'update-profile','Update Profile','Update Profile','2020-05-27 13:43:44','2020-05-27 13:43:44'),(11,'create-module_1_name','Create Module_1_name','Create Module_1_name','2020-05-27 13:43:45','2020-05-27 13:43:45'),(12,'read-module_1_name','Read Module_1_name','Read Module_1_name','2020-05-27 13:43:45','2020-05-27 13:43:45'),(13,'update-module_1_name','Update Module_1_name','Update Module_1_name','2020-05-27 13:43:45','2020-05-27 13:43:45'),(14,'delete-module_1_name','Delete Module_1_name','Delete Module_1_name','2020-05-27 13:43:45','2020-05-27 13:43:45');
/*!40000 ALTER TABLE `permissions` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `qr_codes`
--
DROP TABLE IF EXISTS `qr_codes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `qr_codes` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`active` tinyint(1) NOT NULL,
`menus` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`password_enable` tinyint(1) NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`password_daily` tinyint(1) NOT NULL,
`visible` tinyint(1) NOT NULL,
`structure_id` int(10) unsigned NOT NULL,
`template_id` int(10) NOT NULL,
`activation_start` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`activation_end` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `qr_codes`
--
LOCK TABLES `qr_codes` WRITE;
/*!40000 ALTER TABLE `qr_codes` DISABLE KEYS */;
INSERT INTO `qr_codes` VALUES (1,'masaniello',1,'1,2',1,'Pieronano1987',0,1,1,1,'06/07/2020','29/09/2020','2020-06-22 15:26:56','2020-07-07 11:02:09'),(2,'aa',0,'',0,NULL,0,0,1,0,'','','2020-06-26 10:15:25','2020-06-26 10:15:25');
/*!40000 ALTER TABLE `qr_codes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `role_user`
--
DROP TABLE IF EXISTS `role_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `role_user` (
`role_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL,
`user_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`user_id`,`role_id`,`user_type`),
KEY `role_user_role_id_foreign` (`role_id`),
CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `role_user`
--
LOCK TABLES `role_user` WRITE;
/*!40000 ALTER TABLE `role_user` DISABLE KEYS */;
INSERT INTO `role_user` VALUES (1,1,'App\\User'),(1,2,'App\\User'),(5,3,'App\\User'),(5,4,'App\\User');
/*!40000 ALTER TABLE `role_user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `roles`
--
DROP TABLE IF EXISTS `roles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `roles` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`display_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `roles_name_unique` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `roles`
--
LOCK TABLES `roles` WRITE;
/*!40000 ALTER TABLE `roles` DISABLE KEYS */;
INSERT INTO `roles` VALUES (1,'superadministrator','Superadministrator','Superadministrator','2020-05-27 13:43:44','2020-05-27 13:43:44'),(2,'administrator','Administrator','Administrator','2020-05-27 13:43:45','2020-05-27 13:43:45'),(3,'user','User','User','2020-05-27 13:43:45','2020-05-27 13:43:45'),(4,'role_name','Role Name','Role Name','2020-05-27 13:43:45','2020-05-27 13:43:45'),(5,'owner','Owner','Owner','2020-06-16 10:24:40','2020-06-16 10:24:40');
/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `structure_categories`
--
DROP TABLE IF EXISTS `structure_categories`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `structure_categories` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_en` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_it` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`cover` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`icon` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`icon_svg` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`map` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description_en` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`description_it` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`visible` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `structure_categories`
--
LOCK TABLES `structure_categories` WRITE;
/*!40000 ALTER TABLE `structure_categories` DISABLE KEYS */;
INSERT INTO `structure_categories` VALUES (1,'restaurant','Restaurant','Ristorante','http://smartmenu.local/storage/photos/1/structurecategories/restaurant.png','http://smartmenu.local/storage/photos/1/structurecategories/restaurant.png','fas fa-utensils','http://smartmenu.local/storage/photos/1/structurecategories/restaurant.png','<p>Restaurant</p>','<p>Ristorante</p>',1,'2020-06-10 08:46:54','2020-06-23 12:53:28'),(2,'bar','Bar','Bar','http://smartmenu.local/storage/photos/1/structurecategories/bar.png','http://smartmenu.local/storage/photos/1/structurecategories/bar.png','fas fa-cocktail','http://smartmenu.local/storage/photos/1/structurecategories/bar.png','<p>Bar</p>','<p>Bar</p>',0,'2020-06-10 08:54:09','2020-06-25 14:03:27');
/*!40000 ALTER TABLE `structure_categories` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `structure_users`
--
DROP TABLE IF EXISTS `structure_users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `structure_users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`structure_id` int(10) unsigned NOT NULL,
`user_id` bigint(20) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `structure_users_structure_id_foreign` (`structure_id`),
KEY `structure_users_user_id_foreign` (`user_id`),
CONSTRAINT `structure_users_structure_id_foreign` FOREIGN KEY (`structure_id`) REFERENCES `structures` (`id_code`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `structure_users_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `structure_users`
--
LOCK TABLES `structure_users` WRITE;
/*!40000 ALTER TABLE `structure_users` DISABLE KEYS */;
INSERT INTO `structure_users` VALUES (1,1,3,'2020-06-16 10:25:40','2020-06-16 10:25:40'),(2,2,4,'2020-06-18 12:22:22','2020-06-18 12:22:22');
/*!40000 ALTER TABLE `structure_users` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `structures`
--
DROP TABLE IF EXISTS `structures`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `structures` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`town_id` int(10) unsigned NOT NULL,
`logo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`cover` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`category_id` int(10) unsigned NOT NULL,
`subcategories` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`latitude` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`longitude` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`telephone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`website` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tripadvisor` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`facebook` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`facebook_album` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`instagram` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description_en` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`description_it` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`images` longtext COLLATE utf8mb4_unicode_ci,
`sponsored` tinyint(1) NOT NULL,
`visible` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`),
KEY `structures_town_id_foreign` (`town_id`),
KEY `structures_category_id_foreign` (`category_id`),
CONSTRAINT `structures_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `structure_categories` (`id_code`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `structures_town_id_foreign` FOREIGN KEY (`town_id`) REFERENCES `towns` (`id_code`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `structures`
--
LOCK TABLES `structures` WRITE;
/*!40000 ALTER TABLE `structures` DISABLE KEYS */;
INSERT INTO `structures` VALUES (1,'masaniello','Masaniello Art Cafe\'','Largo Cesario Console, 7',1,'http://smartmenu.local/storage/photos/1/structures/amalfi/masanielloartcafe/masanielloartcafe-00.jpg','http://smartmenu.local/storage/photos/1/structures/amalfi/masanielloartcafe/masanielloartcafe-00.jpg',2,'','40.6338737','14.6023588','+39 089871929','<EMAIL>','www.masanielloartcafe.it','7383352','MasanielloArtCafe','636583833136187','masaniello_art_cafe_amalfi','<p>Masaniello Art Cafe\' - Amalfi, Italy</p>','<p>Masaniello Art Cafe\' - Amalfi, Italy</p>','http://smartmenu.local/storage/photos/1/structures/amalfi/masanielloartcafe/masanielloartcafe-01.jpg,http://smartmenu.local/storage/photos/1/structures/amalfi/masanielloartcafe/masanielloartcafe-02.jpg,http://smartmenu.local/storage/photos/1/structures/amalfi/masanielloartcafe/masanielloartcafe-03.jpg',0,1,'2020-06-15 11:01:39','2020-07-06 15:59:11'),(2,'ilpinguino','Il Pinguino','<NAME>',1,'','http://smartmenu.local/storage/photos/1/structures/amalfi/masanielloartcafe/masanielloartcafe-00.jpg',1,'','40.634482','14.603132','089855454','<EMAIL>','www.ilpinguino.it','7383352','ilpnguino','927903807305351','ilpinguino','<p>Il Pinguino</p>','<p>Il Pinguino</p>','http://smartmenu.local/storage/photos/1/structures/amalfi/masanielloartcafe/masanielloartcafe-00.jpg',0,1,'2020-06-18 12:15:21','2020-06-18 12:15:21');
/*!40000 ALTER TABLE `structures` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `templates`
--
DROP TABLE IF EXISTS `templates`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `templates` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description` longtext COLLATE utf8mb4_unicode_ci,
`visible` tinyint(1) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `templates`
--
LOCK TABLES `templates` WRITE;
/*!40000 ALTER TABLE `templates` DISABLE KEYS */;
INSERT INTO `templates` VALUES (1,'template01','Template 01','http://smartmenu.local/storage/photos/1/templates/template-01.jpg',NULL,1,'2020-07-07 10:22:50','2020-07-07 10:54:34');
/*!40000 ALTER TABLE `templates` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `towns`
--
DROP TABLE IF EXISTS `towns`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `towns` (
`id_code` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`cover` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`latitude` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`longitude` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`facebook` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`instagram_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`telephone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`website` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`resume_en` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`resume_it` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`description_en` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`description_it` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`images` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id_code`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `towns`
--
LOCK TABLES `towns` WRITE;
/*!40000 ALTER TABLE `towns` DISABLE KEYS */;
INSERT INTO `towns` VALUES (1,'amalfi','Amalfi','http://smartmenu.local/storage/photos/1/Towns/Amalfi/amalfi-00.jpg','40.634176','14.602545','comunediamalfi','222836363','+39 089 873512','https://www.amalfi.gov.it','<p>Amalfi was founded by the Romans in the IV century A.D. (in the coat of arms reads \"ex Descendit patribus Romanorum\"). The town became independent from the Byzantine Empire in 839, and proclaimed itself Maritime Republic (the first of the four most important ones with Pisa, Genoa and Venice). The core of its wealth was produced form the trade with the East. Amalfi reached its maximum splendor in the XI century with its powerful and agile fleet, with berths in the main ports of the Mediterranean. The Arsenal of masonry, used for the construction of the hulls of the galleys, are today two stone brick halls, divided by ten pillars. The sea front and the ancient port of Amalfi were swallowed by the sea, after an underwater landslide, caused by a powerful current of Libeccio in the night between 24 and 25 November 1343.</p>','<p>Fondata dai Romani nel IV sec d.C. (nello stemma della città si legge \"Descendit ex patribus Romanorum\") e resasi autonoma dall\'Impero bizantino nell\'839, Amalfi, la prima delle quattro Repubbliche Marinare, fece dei traffici commerciali con l\'Oriente il perno della sua ricchezza. Raggiunse il massimo del suo splendore nell\'XI secolo: era dotata di una potente ed agile flotta, con attracchi nei principali porti del Mediterraneo. Dell\'arsenale in muratura, utilizzato per la costruzione degli scafi delle galee di combattimento, restano oggi solo due corsie divise da dieci pilastri; la parte antistante, nonché l\'antico porto di Amalfi, è stato risucchiato dal mare in seguito ad una frana sottomarina, provocata da una possente corrente di Libeccio nella notte fra il 24 e il 25 novembre del 1343.</p>','<p>Amalfi was founded by the Romans in the IV century A.D. (in the coat of arms reads \"ex Descendit patribus Romanorum\"). The town became independent from the Byzantine Empire in 839, and proclaimed itself Maritime Republic (the first of the four most important ones with Pisa, Genoa and Venice). The core of its wealth was produced form the trade with the East. Amalfi reached its maximum splendor in the XI century with its powerful and agile fleet, with berths in the main ports of the Mediterranean. The Arsenal of masonry, used for the construction of the hulls of the galleys, are today two stone brick halls, divided by ten pillars. The sea front and the ancient port of Amalfi were swallowed by the sea, after an underwater landslide, caused by a powerful current of Libeccio in the night between 24 and 25 November 1343.<br />The local traditions narrate that the mariners of Amalfi were the first to use the compass during their voyages, identifying the name of the inventor <NAME>.<br />The present town, which lies on the higher grounds in the valley, features a series of white houses, most with barrel vault ceilings and built on terraces within a picturesque web of alleys and stairways.</p>\r\n<p>The main monument and symbol of the city is the Cathedral of St. Andrew, preceded by an imposing staircase. The original structure is in Romanesque style, currently covered with sumptuous Baroque decorations. The polychrome façade, preceded by an elegant portico, is dominated by the mosaic tympanum, Christ\'s triumph, artwork of <NAME>, whose proofs are still preserved in the hall, entitled to him, in the Town Hall. Inside the Cathedral preserves a wide selection of masterpieces: an elegant coffered ceiling with paintings of the XVIII century, a wooden crucifix of the XIII century, a mother of pearl cross from Jerusalem, the baptismal font (a basin of porphyry stone from an ancient Roman villa), two pillars of Egyptian granite from nearby Paestum that support the main arch, spiral columns and an Ambon of the XII century. In the crypt are preserved the relics of St. Andrew, from which, since 1304, exudes a dew, called \"manna\", which is collected in a glass bowl that for the locals has miraculous effects.</p>\r\n<p>The Campanile (bell tower), edified since 1180, is composed of bifore and trifore windows, green and yellow majolica roof tiles, all with Arabesque influenced features. Dating to the IX century, the adjoining Basilica of the Crucifix, built over an existing early Christian church, at present remain only some of the columns and their capitals. Entitled to Our Lady of the Assumption and the Saints Cosma and Damiano, it is the seat of the Diocesan Museum of Sacred Arts, a permanent exhibition of the treasures of the Cathedral.</p>\r\n<p>The Cloister of Paradise (XIII century) is an elegant cloister in Moorish narrow crossed arches. Initially used as a burial place of the notables of Amalfi, today it preserves some Roman sarcophagi, a XIV century sarcophagus and the remains of the old façade of the Cathedral.<br />In the Civic Museum in the Town Hall are preserved the famous \"Tavole Amalfitane\" (Tabula Civitatis Malphae), the first legal text of navigation rules which had a great influence up till the XVII century. These rules are the main structure of the naval mercantile Foscarini Code, traced in Vienna and returned to Amalfi in 1929.<br />Going up to the Valle dei Mulini, worth a visit is the Paper Museum, located in the ruins of an old medieval mill of the XIII century, witnessing the old production techniques of the Amalfi paper-making traditions and the functionality of the old mills operated by the power of the stream Canneto.</p>','<p>Fondata dai Romani nel IV sec d.C. (nello stemma della città si legge \"Descendit ex patribus Romanorum\") e resasi autonoma dall\'Impero bizantino nell\'839, Amalfi, la prima delle quattro Repubbliche Marinare, fece dei traffici commerciali con l\'Oriente il perno della sua ricchezza. Raggiunse il massimo del suo splendore nell\'XI secolo: era dotata di una potente ed agile flotta, con attracchi nei principali porti del Mediterraneo. Dell\'arsenale in muratura, utilizzato per la costruzione degli scafi delle galee di combattimento, restano oggi solo due corsie divise da dieci pilastri; la parte antistante, nonché l\'antico porto di Amalfi, è stato risucchiato dal mare in seguito ad una frana sottomarina, provocata da una possente corrente di Libeccio nella notte fra il 24 e il 25 novembre del 1343.<br />La tradizione tramanda che gli amalfitani furono i primi ad utilizzare la bussola durante le loro navigazioni, identificando l\'inventore col nome di <NAME>.</p>\r\n<p>L\'odierno centro abitato, che sorge in parte su un pendìo, è caratterizzato da case bianche con volta a botte costruite su terrazzamenti ed una pittoresca trama di vicoli e scale.<br />Il monumento principale, nonché simbolo della città, è il Duomo di Sant\'Andrea, preceduto da una scenografica scalinata. L\'impianto originario della struttura è romanico, attualmente rivestito da una sontuosa veste barocca. La policroma facciata, preceduta da un elegante portico, è dominata dal mosaico del timpano, il Trionfo di Cristo, opera di <NAME> i cui cartoni originali sono tutt\'ora conservati presso l\'omonima sala della sede municipale. All\'interno è un tripudio di opere d\'arte: un elegante soffitto a cassettoni, tele del XVIII secolo, un crocifisso ligneo del XIII secolo, una croce di madreperla proveniente da Gerusalemme, la fonte battesimale (una vasca di porfido proveniente da un\'antica villa romana), due antiche colonne di granito egizio provenienti dalla vicina Paestum che sorreggono l\'arco trionfale, colonnine tortili e amboni del XII secolo. Nella cripta sono conservate le reliquie di Sant\'Andrea da cui, sin dal 1304 trasuda una rugiada, la manna, raccolta in un\'ampolla e dagli effetti taumaturgici.<br />Il Campanile, esistente sin dal 1180, è composto da bifore e trifore con coronamento arabeggiante e copertura ad embrici maiolicati verdi e gialli.</p>\r\n<p>Risale, invece, al IX secolo la Basilica del Crocifisso, sorta su un preesistente impianto paleocristiano di cui oggi restano alcune colonne e capitelli. Dedicata alla Madonna Assunta ed ai Santi Cosma e Damiano, oggi ospita il Museo Diocesano di Arte Sacra che raccoglie i Tesori del Duomo.<br />Il Chiostro del Paradiso (XIII secolo) è un elegante claustro in stile arabeggiante a stretti archi acuti ed incrociati. Inizialmente adoperato come luogo di sepoltura di notabili amalfitani, oggi conserva alcuni sarcofagi romani, un sarcofago trecentesco, resti dell\'antica facciata del Duomo.</p>\r\n<p>Presso il Museo Civico sono conservate le famose Tavole Amalfitane (<NAME>), il primo testo di diritto della navigazione che ebbe una grande influenza fino al XVII secolo. Parte integrante del Codice Foscariniano, furono ritrovate a Vienna e riportate ad Amalfi nel 1929.<br />Salendo verso la Valle dei Mulini è possibile visitare il Museo della Carta, situato in un\'antica cartiera medievale del XIII secolo, assistendo alle tecniche di realizzazione della rinomata carta di Amalfi e vedere in azione i vecchi mulini azionati dalla potenza del torrente Canneto.</p>','http://smartmenu.local/storage/photos/1/Towns/Amalfi/amalfi-01.jpg,http://smartmenu.local/storage/photos/1/Towns/Amalfi/amalfi-02.jpg,http://smartmenu.local/storage/photos/1/Towns/Amalfi/amalfi-03.jpg','2020-06-15 10:47:25','2020-06-15 10:47:25');
/*!40000 ALTER TABLE `towns` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'Admin','<EMAIL>',NULL,'$2y$10$rs2a5nxO9d5yCXKOvuHdO.DlJm5oM0g9vIrwOf9R5LBQnBmPSMdje','GU0BqOFFSNAacvUn1yUUv4lEAmSeWhTl3cTQ3VD5Jul9cZ5kV2OyOi5AK1yE','2020-05-27 12:57:38','2020-06-23 12:20:55'),(2,'<NAME>','<EMAIL>',NULL,'$2y$10$eafPU6BTkUazho53yWWkrueOHwK2UWpDdP7yUmwASPI4QdmOuK0JW',NULL,'2020-05-27 13:50:31','2020-05-27 13:50:31'),(3,'Masaniello Art Cafe','<EMAIL>',NULL,'$2y$10$FGfnvLxaa0XO00lV/.uuQe5OnywRU9Mrk4yl9srSmq2QO05Z6ZkDi',NULL,'2020-06-16 10:25:20','2020-06-16 10:25:20'),(4,'<NAME>','<EMAIL>',NULL,'$2y$10$JaphNw0g5ucf1gH4Cc4YRu7N2wZ965r75P67GX32IiMTVln1/0IP2',NULL,'2020-06-16 12:50:24','2020-06-16 12:50:24');
/*!40000 ALTER TABLE `users` 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-07-13 11:53:28
|
<reponame>Flash1ee/db-5th-sem-bmstu<filename>labs/rk_03/task_01.sql
create type days as enum (
'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота', 'Воскресенье'
);
create table employer_time
(
id bigint not null references employers (id),
date date not null default current_date,
day days,
time time not null default current_time,
type int check ( type = 1 or type = 2) not null
);
create table employers
(
id bigint not null primary key,
fio text not null,
birthday date not null,
departament text not null
);
create or replace function get_number_of_employers()
RETURNS bigint as
$$
BEGIN
return (select *
from employers
where extract(year from now()) - extract(year from birthday) BETWEEN (18, 40)
and id in (
select id from employer_time
group by id, type
having count(*) > 3)
);
end;
$$ language plpgsql;
|
<gh_stars>0
CREATE TABLE "accounts" (
"id" SERIAL PRIMARY KEY,
"owner" varchar NOT NULL,
"balance" decimal NOT NULL,
"currency" varchar NOT NULL,
"created_at" timestamp NOT NULL DEFAULT 'now()'
);
CREATE TABLE "entries" (
"id" SERIAL PRIMARY KEY,
"account_id" bigserial NOT NULL,
"amount" decimal NOT NULL,
"created_at" timestamp NOT NULL DEFAULT 'now()'
);
CREATE TABLE "transfers" (
"id" SERIAL PRIMARY KEY,
"from_account_id" bigserial NOT NULL,
"to_account_id" bigserial NOT NULL,
"amount" decimal NOT NULL,
"created_at" timestamp NOT NULL DEFAULT 'now()'
);
ALTER TABLE "entries" ADD FOREIGN KEY ("account_id") REFERENCES "accounts" ("id");
ALTER TABLE "transfers" ADD FOREIGN KEY ("from_account_id") REFERENCES "accounts" ("id");
ALTER TABLE "transfers" ADD FOREIGN KEY ("to_account_id") REFERENCES "accounts" ("id");
CREATE INDEX ON "accounts" ("owner");
CREATE INDEX ON "entries" ("account_id");
CREATE INDEX ON "transfers" ("from_account_id");
CREATE INDEX ON "transfers" ("to_account_id");
CREATE INDEX ON "transfers" ("from_account_id", "to_account_id");
|
<reponame>Kamkas/Jewelry-catalogue
ALTER TABLE "ProducerCompany" DROP CONSTRAINT IF EXISTS "ProducerCompany_fk0";
ALTER TABLE "JewelryItem" DROP CONSTRAINT IF EXISTS "JewelryItem_fk0";
ALTER TABLE "JewelryItem" DROP CONSTRAINT IF EXISTS "JewelryItem_fk1";
DROP TABLE IF EXISTS "Region";
DROP TABLE IF EXISTS "ProducerCompany";
DROP TABLE IF EXISTS "JewelryShop";
DROP TABLE IF EXISTS "ItemComposition";
DROP TABLE IF EXISTS "JewelryItem";
CREATE TABLE "Region" (
"id" serial NOT NULL,
"region_number" integer NOT NULL,
"region_name" VARCHAR(256) NOT NULL,
CONSTRAINT Region_pk PRIMARY KEY ("id")
) WITH (
OIDS=FALSE
);
CREATE TABLE "ProducerCompany" (
"id" serial NOT NULL,
"company_name" VARCHAR(1024) NOT NULL,
"region" integer NOT NULL,
CONSTRAINT ProducerCompany_pk PRIMARY KEY ("id")
) WITH (
OIDS=FALSE
);
CREATE TABLE "JewelryShop" (
"id" serial NOT NULL,
"address" VARCHAR(1024) NOT NULL,
"license copy" bytea,
"schedule day" VARCHAR(255) NOT NULL,
"schedule time" VARCHAR(255) NOT NULL,
CONSTRAINT JewelryShop_pk PRIMARY KEY ("id")
) WITH (
OIDS=FALSE
);
CREATE TABLE "ItemComposition" (
"id" serial NOT NULL,
"material" VARCHAR(255) NOT NULL,
"weight" FLOAT NOT NULL,
CONSTRAINT ItemComposition_pk PRIMARY KEY ("id")
) WITH (
OIDS=FALSE
);
CREATE TABLE "JewelryItem" (
"id" serial NOT NULL,
"item_type" VARCHAR(255) NOT NULL,
"item_weight" FLOAT NOT NULL,
"item_probe" integer NOT NULL,
"company_producer" integer NOT NULL,
"item_arrive_date" DATETIME NOT NULL,
"item_cost" FLOAT NOT NULL,
"item_composition" integer NOT NULL,
CONSTRAINT JewelryItem_pk PRIMARY KEY ("id")
) WITH (
OIDS=FALSE
);
ALTER TABLE "ProducerCompany" ADD CONSTRAINT "ProducerCompany_fk0" FOREIGN KEY ("region") REFERENCES "Region"("id");
ALTER TABLE "JewelryItem" ADD CONSTRAINT "JewelryItem_fk0" FOREIGN KEY ("company_producer") REFERENCES "ProducerCompany"("id");
ALTER TABLE "JewelryItem" ADD CONSTRAINT "JewelryItem_fk1" FOREIGN KEY ("item_composition") REFERENCES "ItemComposition"("id");
|
<reponame>iafb/greatreadingadventure
/****** Object: StoredProcedure [dbo].[app_CustomEventFields_GetByID] Script Date: 01/05/2015 14:43:20 ******/
--Create the Select Proc
CREATE PROCEDURE [dbo].[app_CustomEventFields_GetByID] @TenID INT
AS
SELECT *
FROM [CustomEventFields]
WHERE TenID = @TenID
|
-- 通用抽奖工具(万能胶Glue) glue_session_prizes 抽奖场次奖品表
CREATE TABLE `glue_session_prizes` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`session_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '场次ID',
`node` varchar(255) NOT NULL DEFAULT '' COMMENT '节点标识 按时间抽奖: 空值, 按抽奖次数抽奖: 第几次参与值, 按数额范围区间抽奖: 数额区间上限值',
`prize_type` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '奖品类型 1:优惠券, 2:积分, 3:实物, 4:空奖 ...',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '奖品名称',
`pic_url` varchar(255) NOT NULL DEFAULT '' COMMENT '奖品图片',
`value` varchar(255) NOT NULL DEFAULT '' COMMENT '奖品抽象值 优惠券:优惠券ID, 积分:积分值, 实物: sku ID',
`probability` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '中奖概率1~100',
`create_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`create_by` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建人staff_id',
`update_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
`update_by` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改人staff_id',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态 -1:deleted, 0:disable, 1:enable',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='抽奖场次奖品表';
|
SET DEFINE OFF;
ALTER TABLE AFW_23_APLIC_MODL_RECHR ADD (
CONSTRAINT AFW_23_APLIC_MODL_RECHR_CK1
CHECK (NOMBR_MAXIM_RESLT < 1000)
ENABLE VALIDATE)
/
|
<gh_stars>1-10
SET DEFINE OFF;
create or replace package body afw_25_plpdf_expor_ir_pkg
as
knu_marge_gauch constant number default 0.5;
knu_marge_droit constant number default 0.5;
kva_apex_expr constant varchar2 (30) default '#APXWS_EXPR#';
kva_apex_expr2 constant varchar2 (30) default '#APXWS_EXPR2#';
kva_apex_hl_id constant varchar2 (30) default '#APXWS_HL_ID#';
kva_apex_cc_expr constant varchar2 (30) default '#APXWS_CC_EXPR#';
kva_varbl_cc constant varchar2 (30) default 'APXWS_CC%';
type typ_rec_page is record
(
nu_largr number default 0
,nu_dernr_coln binary_integer default 0
);
type typ_arr_page is table of typ_rec_page
index by binary_integer;
type typ_rec_surlg is record
(
vva_indic_afich varchar2 (1) default 'N'
,vva_type_surlg varchar2 (23)
,vva_coulr_polc_ligne apex_ir_condt.row_font_color%type
,vva_coulr_backg_ligne apex_ir_condt.row_bg_color%type
,vva_coulr_polc_cel apex_ir_condt.column_font_color%type
,vva_coulr_backg_cel apex_ir_condt.column_bg_color%type
,vva_condt_surlg apex_ir_condt.condition_sql%type
,vva_nom_coln apex_ir_condt.column_name%type
,vva_opert apex_ir_condt.operator%type
,vva_expr apex_ir_condt.expr%type
,vva_expr2 apex_ir_condt.expr2%type
,vnu_seqnc apex_ir_condt.highlight_sequence%type
,vnu_max_seqnc apex_ir_condt.highlight_sequence%type
,vva_expr_type apex_ir_condt.expr_type%type
);
type typ_tab_surlg is table of typ_rec_surlg
index by pls_integer;
type typ_rec_coln_surlg is record
(
vva_type_surlg varchar2 (30) default 'LIGNE'
,vre_coulr_backg plpdf_type.t_color
,vre_coulr_polc plpdf_type.t_color
);
type typ_tab_coln_surlg is table of typ_rec_coln_surlg
index by varchar2 (30);
type typ_rec_ligne_surlg is record
(
vre_coulr_backg plpdf_type.t_color
,vre_coulr_polc plpdf_type.t_color
,vta_coln_surlg typ_tab_coln_surlg
);
type typ_rec_group_entet is record
(
vva_group apex_ir_rpts.break_on%type
,vva_group_sur apex_ir_rpts.break_enabled_on%type
,vva_coln_somme apex_ir_rpts.sum_columns_on_break%type
,vva_coln_moyen apex_ir_rpts.avg_columns_on_break%type
,vva_coln_max apex_ir_rpts.max_columns_on_break%type
,vva_coln_min apex_ir_rpts.min_columns_on_break%type
,vva_coln_medn apex_ir_rpts.median_columns_on_break%type
,vva_coln_mode apex_ir_rpts.mode_columns_on_break%type
,vva_coln_compt apex_ir_rpts.count_columns_on_break%type
,vva_coln_compt_distn apex_ir_rpts.count_distnt_col_on_break%type
);
type typ_tab_compt_distn is table of pls_integer
index by varchar2 (4000);
type typ_tab_medn is table of number;
type typ_rec_parmt_group_coln is record
(
vva_indic_afich varchar2 (1)
,vva_nom_coln varchar2 (30)
,vnu_numr_group pls_integer
,vva_indic_somme varchar2 (1)
,vnu_somme number
,vva_indic_moyen varchar2 (1)
,vnu_moyen number
,vva_indic_max varchar2 (1)
,vnu_max number
,vva_indic_min varchar2 (1)
,vnu_min number
,vva_indic_medn varchar2 (1)
,vnu_medn number
,vta_tabl_medn typ_tab_medn
,vva_indic_mode varchar2 (1)
, --Prévoir donnée (probablement un type) pour gérer le mode
vva_indic_compt varchar2 (1)
,vnu_compt number
,vva_indic_compt_distn varchar2 (1)
,vnu_compt_distn number
,vta_tabl_compt typ_tab_compt_distn
);
type typ_tab_parmt_group_coln is table of typ_rec_parmt_group_coln
index by pls_integer;
type typ_rec_parmt_group is record
(
vva_nom_coln_1 varchar2 (30)
,vva_nom_coln_2 varchar2 (30)
,vva_nom_coln_3 varchar2 (30)
,vva_nom_coln_4 varchar2 (30)
,vva_nom_coln_5 varchar2 (30)
,vva_nom_coln_6 varchar2 (30)
,vva_valr_coln_1 varchar2 (4000)
,vva_valr_coln_2 varchar2 (4000)
,vva_valr_coln_3 varchar2 (4000)
,vva_valr_coln_4 varchar2 (4000)
,vva_valr_coln_5 varchar2 (4000)
,vva_valr_coln_6 varchar2 (4000)
,vva_libl_coln_1 varchar2 (4000)
,vva_libl_coln_2 varchar2 (4000)
,vva_libl_coln_3 varchar2 (4000)
,vva_libl_coln_4 varchar2 (4000)
,vva_libl_coln_5 varchar2 (4000)
,vva_libl_coln_6 varchar2 (4000)
);
type typ_rec_parmt_group_plugn is record
(
vva_ligne_1 varchar2 (4000)
,vva_ligne_2 varchar2 (4000)
,vva_ligne_3 varchar2 (4000)
,vva_trans_libl varchar2 (4000)
,vva_indic_ventl varchar2 (1)
,vnu_nombr_coln_ventl number default 1
);
type typ_rec_coln_plugn is record
(
vva_valr varchar2 (4000)
,vnu_colsp number
,vnu_rowsp number
,vva_indic_ventl varchar2 (1)
);
type typ_tab_coln_plugn is table of typ_rec_coln_plugn
index by pls_integer;
type typ_tab_trans_libl is table of varchar2 (4000)
index by varchar2 (100);
gar_tail_papr afw_07_sql_pkg.typ_arr_ndx_vc30;
--Gestion du highlight
gre_ligne_a_surlg typ_rec_ligne_surlg;
gnu_max_seqnc number;
gre_style_ligne afw_25_formt_ir_pkg.typ_formt;
--Gestion des groupes
gre_group typ_rec_parmt_group;
--Gestion des fonctions
gta_fonct_coln typ_tab_parmt_group_coln;
--Gestion des groupements d'entêtes (plugin)
gre_parmt_group_plugn typ_rec_parmt_group_plugn;
gta_trans_libl typ_tab_trans_libl;
gva_valr_nul varchar2 (4000);
gbo_presn_group boolean default false;
function formt_chain_br (pva_elemn in varchar2)
return varchar2
is
vva_elemn varchar2 (4000);
begin
vva_elemn :=
afw_07_sql_pkg.rempl_br (pva_elemn
, chr (10)
|| chr (13));
return replace (vva_elemn
,' '
,' ');
end formt_chain_br;
function formt_nom_fichr (pva_nom in varchar2)
return varchar2
is
vva_nom varchar2 (1000) default lower (pva_nom);
begin
vva_nom :=
afw_07_sql_pkg.rempl_br (vva_nom
,'_');
vva_nom :=
replace (vva_nom
, chr (10)
|| chr (13)
,'_');
vva_nom :=
replace (vva_nom
,chr (10)
,'_');
vva_nom :=
substr (translate (vva_nom
,'çàâéèêöùû /\?'
,'caaeeeouu____')
,1
,120);
while instr (vva_nom
,'__') > 0
loop
vva_nom :=
replace (vva_nom
,'__'
,'_');
end loop;
vva_nom :=
replace (vva_nom
,'_.'
,'.');
return vva_nom;
end;
function formt_date (pda_date in date default sysdate)
return varchar2
is
begin
return 'Le '
|| trim (to_char (pda_date
,'day'))
|| ' '
|| extract (day from pda_date)
|| ' '
|| trim (to_char (pda_date
,'month'))
|| ' '
|| extract (year from pda_date);
end;
function convr_parmt_align (pva_parmt in varchar2
,pva_deft in varchar2)
return varchar2
is
begin
return case upper (pva_parmt) when 'LEFT' then 'L' when 'RIGHT' then 'R' when 'CENTER' then 'C' else pva_deft end;
end;
function convr_parmt_faml (pva_parmt in varchar2)
return varchar2
is
begin
return case lower (pva_parmt) when 'times' then 'Times new roman' when 'courier' then 'Courier' else 'Arial' -- Défaut
end;
end;
function convr_parmt_poids (pva_parmt in varchar2
,pva_deft in varchar2)
return varchar2
is
begin
return case lower (pva_parmt) when 'bold' then 'B' when 'normal' then null else pva_deft end;
end;
procedure init_hautr_cel (pva_faml_polc in varchar2 default 'Arial')
is
begin
--En points
case pva_faml_polc
when 'Arial'
then
gta_hautr_cel ('Arial').vta_hautr_minml ('5') := 10;
gta_hautr_cel ('Arial').vta_hautr_minml ('5.5') := 10;
gta_hautr_cel ('Arial').vta_hautr_minml ('6') := 10;
gta_hautr_cel ('Arial').vta_hautr_minml ('6.5') := 11.5;
gta_hautr_cel ('Arial').vta_hautr_minml ('7') := 11.5;
gta_hautr_cel ('Arial').vta_hautr_minml ('7.5') := 12.8;
gta_hautr_cel ('Arial').vta_hautr_minml ('8') := 12.8;
gta_hautr_cel ('Arial').vta_hautr_minml ('8.5') := 12.8;
gta_hautr_cel ('Arial').vta_hautr_minml ('9') := 14.2;
gta_hautr_cel ('Arial').vta_hautr_minml ('9.5') := 14.2;
gta_hautr_cel ('Arial').vta_hautr_minml ('10') := 15.6;
gta_hautr_cel ('Arial').vta_hautr_minml ('10.5') := 15.6;
gta_hautr_cel ('Arial').vta_hautr_minml ('11') := 15.6;
gta_hautr_cel ('Arial').vta_hautr_minml ('11.5') := 17.05;
gta_hautr_cel ('Arial').vta_hautr_minml ('12') := 18.5;
gta_hautr_cel ('Arial').vta_hautr_minml ('12.5') := 18.5;
gta_hautr_cel ('Arial').vta_hautr_minml ('13') := 18.5;
gta_hautr_cel ('Arial').vta_hautr_minml ('13.5') := 18.5;
gta_hautr_cel ('Arial').vta_hautr_minml ('14') := 19.9;
else
null;
end case;
end init_hautr_cel;
function obten_hautr_cel (pva_faml_polc in varchar2 default 'Arial'
,pnu_tail_polc in number default 8)
return number
is
vva_tail_polc varchar2 (4000)
default replace (pnu_tail_polc
,','
,'.');
begin
--if gta_hautr_cel.exists (/*case pva_faml_polc when 'Helvetica' then 'Arial' else */pva_faml_polc /*end*/) then
if gta_hautr_cel ('Arial').vta_hautr_minml.exists (vva_tail_polc)
then
return gta_hautr_cel ('Arial').vta_hautr_minml (vva_tail_polc);
end if;
--end if;
return 19.9;
end obten_hautr_cel;
function obten_parmt_impre_raprt (pnu_ref_ir in number)
return typ_rec_parmt_impre
is
vpi_deft typ_rec_parmt_impre;
gpi_parmt_impr typ_rec_parmt_impre;
begin
begin
select 'O'
,reg.prn_content_disposition
,reg.prn_paper_size
,reg.prn_orientation
,reg.prn_units
,reg.prn_width
,reg.prn_height
,reg.prn_border_width
,reg.prn_border_color
,reg.prn_page_header_font_family
,reg.prn_page_header_font_weight
,reg.prn_page_header_font_size
,reg.prn_page_header_font_color
,reg.prn_page_header_alignment
,reg.prn_page_header
,reg.prn_header_font_family
,reg.prn_header_font_weight
,reg.prn_header_font_size
,reg.prn_header_font_color
,reg.prn_header_bg_color
,reg.prn_body_font_family
,reg.prn_body_font_weight
,reg.prn_body_font_size
,reg.prn_body_font_color
,reg.prn_body_bg_color
,reg.prn_page_footer_font_family
,reg.prn_page_footer_font_weight
,reg.prn_page_footer_font_size
,reg.prn_page_footer_font_color
,reg.prn_page_footer_alignment
,reg.prn_page_footer
into gpi_parmt_impr
from vd_afw_13_page_ir pir
,apex_ir air
,apex_regn reg
where pir.seqnc = pnu_ref_ir
and air.id = pir.id_apex
and reg.id = air.region_id;
exception
when no_data_found
then
gpi_parmt_impr.va_indic_trouv := 'N';
end;
return gpi_parmt_impr;
end;
function detrm_type_surlg (pva_coulr_polc_ligne apex_ir_condt.row_font_color%type
,pva_coulr_backg_ligne apex_ir_condt.row_bg_color%type)
return varchar2
is
vva_type_surlg varchar2 (23);
begin
if pva_coulr_polc_ligne is not null
or pva_coulr_backg_ligne is not null
then
vva_type_surlg := 'LIGNE';
else
vva_type_surlg := 'CEL';
end if;
return vva_type_surlg;
end detrm_type_surlg;
function obten_parmt_surlg_raprt (pnu_rpts_id in number)
return typ_tab_surlg
is
vta_parmt_surlg typ_tab_surlg;
vre_parmt_surlg typ_rec_surlg;
vnu_compt pls_integer default 1;
cursor cur_surlg
is
select 'O' indic_afich
,detrm_type_surlg (airc.row_font_color
,airc.row_bg_color)
type_surlg
,row_font_color coulr_polc_ligne
,row_bg_color coulr_backg_ligne
,column_font_color coulr_polc_cel
,column_bg_color coulr_backg_cel
,condition_sql condt_surlg
,column_name nom_coln
,expr expr
,expr2 expr2
,operator opert
,highlight_sequence seqnc
,expr_type expr_type
from apex_ir_rpts airr
,apex_ir_condt airc
where airr.id = pnu_rpts_id
and airr.id = airc.report_id
and airc.condition_type = 'HIGHLIGHT'
and airc.enabled = 'Y'
order by airc.highlight_sequence;
begin
for rec_surlg in cur_surlg
loop
vre_parmt_surlg.vva_indic_afich := rec_surlg.indic_afich;
vre_parmt_surlg.vva_type_surlg := rec_surlg.type_surlg;
vre_parmt_surlg.vva_coulr_polc_ligne := rec_surlg.coulr_polc_ligne;
vre_parmt_surlg.vva_coulr_backg_ligne := rec_surlg.coulr_backg_ligne;
vre_parmt_surlg.vva_coulr_polc_cel := rec_surlg.coulr_polc_cel;
vre_parmt_surlg.vva_coulr_backg_cel := rec_surlg.coulr_backg_cel;
vre_parmt_surlg.vva_condt_surlg := rec_surlg.condt_surlg;
vre_parmt_surlg.vva_nom_coln := rec_surlg.nom_coln;
vre_parmt_surlg.vva_expr := rec_surlg.expr;
vre_parmt_surlg.vva_expr2 := rec_surlg.expr2;
vre_parmt_surlg.vva_opert := rec_surlg.opert;
vre_parmt_surlg.vnu_seqnc := rec_surlg.seqnc;
vre_parmt_surlg.vva_expr_type := rec_surlg.expr_type;
vta_parmt_surlg (vnu_compt) := vre_parmt_surlg;
vnu_compt := vnu_compt + 1;
end loop;
return vta_parmt_surlg;
end obten_parmt_surlg_raprt;
function obten_parmt_group_raprt (pnu_rpts_id in number)
return typ_rec_group_entet
is
vre_parmt_group typ_rec_group_entet;
begin
select break_on
,break_enabled_on
,sum_columns_on_break
,avg_columns_on_break
,max_columns_on_break
,min_columns_on_break
,median_columns_on_break
,mode_columns_on_break
,count_columns_on_break
,count_distnt_col_on_break
into vre_parmt_group
from apex_ir_rpts airr
where airr.id = pnu_rpts_id;
return vre_parmt_group;
end obten_parmt_group_raprt;
function obten_parmt_group_plugn (pnu_reprt_id in number)
return typ_rec_parmt_group_plugn
is
vre_parmt_group_plugn typ_rec_parmt_group_plugn;
begin
select apex_application.do_substitutions (attribute_01)
,apex_application.do_substitutions (attribute_02)
,apex_application.do_substitutions (attribute_03)
,apex_application.do_substitutions (attribute_04)
,attribute_05
,attribute_10
into vre_parmt_group_plugn
from apex_actio_dynmq_actio
where affected_elements_type = 'REGION'
and affected_region_id = pnu_reprt_id
and action = 'PLUGIN_IO_AFW_21_GROUP_ENTET_RAPRT'
and rownum <= 1;
return vre_parmt_group_plugn;
exception
when no_data_found
then
return null;
end obten_parmt_group_plugn;
procedure defnr_coulr_pdf (pva_nom_procd in varchar2)
is
vva_progr_a_lancr varchar2 (4000)
default 'begin '
|| ' afw_25_plpdf_expor_ir_pkg.gre_coulr_pdf := %PROCD_PERSN%; '
|| ' exception when others then
ete();'
|| 'end;';
vre_coulr_deft typ_rec_coulr_pdf;
begin
vva_progr_a_lancr :=
replace (vva_progr_a_lancr
,'%PROCD_PERSN%'
,pva_nom_procd);
execute immediate vva_progr_a_lancr;
exception
when others
then
gre_coulr_pdf.vva_coulr_polc_entet := '#FFFFFF';
gre_coulr_pdf.vva_coulr_backg_entet := '#E0E0E0';
end defnr_coulr_pdf;
function obten_coulr_a_partr_hex (pva_valr_hex in varchar2)
return plpdf_type.t_color
is
vre_coulr plpdf_type.t_color;
vre_coulr_deft plpdf_type.t_color;
function obten_rgb_de_hex (pva_part_hex in varchar2)
return number
is
begin
return plpdf_util.to_dec (pva_part_hex);
end obten_rgb_de_hex;
begin
--Vérifier si la longueur du hex est bien de 7 (# + 6 * {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F})
if length (pva_valr_hex) = 7
and pva_valr_hex is not null
then
vre_coulr.r :=
obten_rgb_de_hex (substr (pva_valr_hex
,2
,2));
vre_coulr.g :=
obten_rgb_de_hex (substr (pva_valr_hex
,4
,2));
vre_coulr.b :=
obten_rgb_de_hex (substr (pva_valr_hex
,6
,2));
return vre_coulr;
end if;
vre_coulr_deft.r := 255;
vre_coulr_deft.g := 255;
vre_coulr_deft.b := 255;
return vre_coulr_deft;
end obten_coulr_a_partr_hex;
procedure init_surlg_ligne
is
begin
gnu_max_seqnc := 0;
gre_ligne_a_surlg.vre_coulr_polc := null;
gre_ligne_a_surlg.vre_coulr_backg := null;
end init_surlg_ligne;
procedure init_surlg_coln (pva_nom_coln in varchar2)
is
begin
gre_ligne_a_surlg.vta_coln_surlg (pva_nom_coln).vva_type_surlg := null;
gre_ligne_a_surlg.vta_coln_surlg (pva_nom_coln).vre_coulr_polc := null;
gre_ligne_a_surlg.vta_coln_surlg (pva_nom_coln).vre_coulr_backg := null;
end init_surlg_coln;
procedure gerer_surlg (pta_parmt_surlg in typ_tab_surlg
,pva_valr_a_compr in out varchar2
,pva_nom_coln in varchar2
,pva_type_coln in varchar2
,pva_formt_coln in varchar2)
is
vva_condt_sql apex_ir_condt.condition_sql%type;
vbo_presn_expr boolean;
vbo_presn_expr2 boolean;
vva_valr_retr varchar2 (1);
vre_coulr_polc plpdf_type.t_color;
vre_coulr_fond plpdf_type.t_color;
begin
if pta_parmt_surlg.exists (1)
then
for i in pta_parmt_surlg.first () .. pta_parmt_surlg.last ()
loop
--Valider si le nom de la colonne est présente dans la condition ou verifier si c'est un champ calculé
if instr (pta_parmt_surlg (i).vva_condt_surlg
, '"'
|| pva_nom_coln
|| '"') > 0
or ( pva_nom_coln like kva_varbl_cc
and instr (pta_parmt_surlg (i).vva_condt_surlg
,kva_apex_cc_expr) > 0)
then
vva_condt_sql :=
replace (pta_parmt_surlg (i).vva_condt_surlg
, '"'
|| pta_parmt_surlg (i).vva_nom_coln
|| '"'
,kva_apex_cc_expr);
--Dans un cas où la valeur a comparer est égale à la valeur nullable du IR, ikl faut la remplacer par null
if pva_valr_a_compr = formt_chain_br (gva_valr_nul)
then
vva_condt_sql :=
replace (vva_condt_sql
,kva_apex_cc_expr
,'null');
else
--Remplace le nom de colonne et expr
case pva_type_coln
when 'VARCH'
then
vva_condt_sql :=
replace (vva_condt_sql
,kva_apex_cc_expr
, ''''
|| replace (pva_valr_a_compr
,''''
,'''''')
|| '''');
when 'NUMBR'
then
vva_condt_sql :=
replace (vva_condt_sql
,kva_apex_cc_expr
,replace (to_number (pva_valr_a_compr
,pva_formt_coln)
,','
,'.'));
when 'DATE'
then
vva_condt_sql :=
replace (vva_condt_sql
,kva_apex_cc_expr
,to_date (pva_valr_a_compr
,pva_formt_coln));
when 'TIMST'
then
vva_condt_sql :=
replace (vva_condt_sql
,kva_apex_cc_expr
,to_timestamp (pva_valr_a_compr
,pva_formt_coln));
else
vva_condt_sql :=
replace (vva_condt_sql
,kva_apex_cc_expr
, ''''
|| replace (pva_valr_a_compr
,''''
,'''''')
|| '''');
end case;
end if;
vva_condt_sql :=
replace (vva_condt_sql
,kva_apex_hl_id
,'''O''');
if instr (vva_condt_sql
,kva_apex_expr) > 0
then
vbo_presn_expr := true;
vva_condt_sql :=
replace (vva_condt_sql
,kva_apex_expr
,':valr_expr');
else
vbo_presn_expr := false;
end if;
if instr (vva_condt_sql
,kva_apex_expr2) > 0
then
vbo_presn_expr2 := true;
vva_condt_sql :=
replace (vva_condt_sql
,kva_apex_expr2
,':valr_expr2');
else
vbo_presn_expr2 := false;
end if;
--Valider si la condition pour le surlignage est respectée
--Afficher ensuite la couleur selon le type
if vbo_presn_expr2
then
execute immediate
'select '
|| vva_condt_sql
|| ' from dual'
into vva_valr_retr
using pta_parmt_surlg (i).vva_expr
,pta_parmt_surlg (i).vva_expr2;
elsif vbo_presn_expr
then
execute immediate
'select '
|| vva_condt_sql
|| ' from dual'
into vva_valr_retr
using pta_parmt_surlg (i).vva_expr;
else
execute immediate
'select '
|| vva_condt_sql
|| ' from dual'
into vva_valr_retr;
end if;
--Il faut ajouter les paramètres de highlight à la colonne courante
if vva_valr_retr is not null
then
if pta_parmt_surlg (i).vva_type_surlg = 'LIGNE'
and pta_parmt_surlg (i).vnu_seqnc >= gnu_max_seqnc
then
gnu_max_seqnc := pta_parmt_surlg (i).vnu_seqnc;
gre_ligne_a_surlg.vre_coulr_backg := obten_coulr_a_partr_hex (pta_parmt_surlg (i).vva_coulr_backg_ligne);
gre_ligne_a_surlg.vre_coulr_polc := obten_coulr_a_partr_hex (pta_parmt_surlg (i).vva_coulr_polc_ligne);
end if;
if pta_parmt_surlg (i).vva_type_surlg <> 'LIGNE'
then
gre_ligne_a_surlg.vta_coln_surlg (pva_nom_coln).vva_type_surlg := 'COL';
gre_ligne_a_surlg.vta_coln_surlg (pva_nom_coln).vre_coulr_backg :=
obten_coulr_a_partr_hex (nvl (pta_parmt_surlg (i).vva_coulr_backg_cel, pta_parmt_surlg (i).vva_coulr_backg_ligne));
gre_ligne_a_surlg.vta_coln_surlg (pva_nom_coln).vre_coulr_polc :=
obten_coulr_a_partr_hex (nvl (pta_parmt_surlg (i).vva_coulr_polc_cel, pta_parmt_surlg (i).vva_coulr_polc_ligne));
end if;
end if;
end if;
end loop;
end if;
end gerer_surlg;
procedure afich_pdf (pnu_aplic in number default afw_07_util_pkg.v ('APP_ID')
,pnu_page in number default afw_07_util_pkg.v ('APP_PAGE_ID'))
is
vta_parmt_surlg typ_tab_surlg;
vre_parmt_group typ_rec_group_entet;
vre_parmt_group_plugn typ_rec_parmt_group_plugn;
vnu_ref_ir number;
vva_nom_raprt varchar2 (4000);
vva_mesg_aucun_don varchar2 (32767);
vnu_largr_deft number;
vnu_id_plugn number;
vva_procd_coulr varchar2 (200);
vva_procd_entet varchar2 (200);
vva_procd_pied_page varchar2 (200);
vbo_presn_fonct boolean default false;
vva_indic_forcr_ajust_page varchar2 (1);
--vnu_unite_mesr_largr_deft number(10);
vva_selct varchar2 (32767);
vnu_cursr number;
var_infor_coln afw_07_sql_pkg.typ_arr_infor_coln;
vnu_largr_dispo number;
var_pages typ_arr_page;
vnu_index_page binary_integer;
vnu_somme_largr number;
vnu_dernr_coln_ajout number;
vnu_rpts_id number;
vnu_hautr_ligne number;
--variable pour afficher fonctions
vnu_tail_group pls_integer default 0;
-- variables plpdf
vnu_elmnt_lign number := 0;
vnu_elmnt_tabl number := 0;
vnu_elmnt_restn number := 0;
vnu_tail_polc_ent number := 0;
vnu_tail_polc_corps number := 0;
vnu_tail_polc_pied number := 0;
vnu_largr_restn number := 0;
vva_elmnt varchar2 (300);
vbo_type_indtr boolean := false;
v_blob blob;
--variable des paramètres du tableau
v_bordr_cell plpdf_type.t_row_borders;
v_data_cell plpdf_type.t_row_datas;
v_data_row_ent plpdf_type.t_row_datas;
v_tail_cell plpdf_type.t_row_widths;
v_tail_intr_cell plpdf_type.t_row_widths;
v_algnm_cell plpdf_type.t_row_aligns;
v_algnm_entet plpdf_type.t_row_aligns;
v_style_cell plpdf_type.t_row_styles;
v_lign_max plpdf_type.t_row_maxlines;
v_coulr_cell plpdf_type.t_row_filles;
procedure init_pdf
is
vva_progr_a_lancr varchar2 (4000)
default 'begin '
|| ' %PROCD_PERSN%(:a); '
|| ' exception when others then ete();'
|| 'end;';
begin
--compter le nombre d'éléments
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
and gta_fonct_coln (i).vva_indic_afich = 'O'
then
vnu_elmnt_lign := vnu_elmnt_lign + 1;
end if;
end loop;
--initialiser le pdf
if gpi_parmt_impr.va_orien_papr = 'VERTICAL'
then
plpdf.init1 (
'P'
,plpdf_const.point
,case gpi_parmt_impr.va_formt_papr
when 'LEGAL' then plpdf_const.legal
when 'LETTER' then plpdf_const.letter
when 'A3' then plpdf_const.a3
when 'A4' then plpdf_const.a4
else plpdf_const.letter
end);
else
plpdf.init1 (
'L'
,plpdf_const.point
,case gpi_parmt_impr.va_formt_papr
when 'LEGAL' then plpdf_const.legal
when 'LETTER' then plpdf_const.letter
when 'A3' then plpdf_const.a3
when 'A4' then plpdf_const.a4
else plpdf_const.letter
end);
end if;
plpdf.nopalias;
plpdf.setdoctitle ( formt_nom_fichr (vva_nom_raprt)
|| '.pdf');
plpdf.setallmargin (knu_marge_droit * 72
,0.5 * 72
,knu_marge_gauch * 72);
plpdf.newpage;
plpdf.setcellmargin (knu_marge_cel);
if not gta_hautr_cel.exists (convr_parmt_faml (gpi_parmt_impr.va_entet_polc_faml))
then
init_hautr_cel (convr_parmt_faml (gpi_parmt_impr.va_entet_polc_faml));
end if;
if not gta_hautr_cel.exists (convr_parmt_faml (gpi_parmt_impr.va_coln_polc_faml))
then
init_hautr_cel (convr_parmt_faml (gpi_parmt_impr.va_coln_polc_faml));
end if;
if not gta_hautr_cel.exists (convr_parmt_faml (gpi_parmt_impr.va_corps_polc_faml))
then
init_hautr_cel (convr_parmt_faml (gpi_parmt_impr.va_corps_polc_faml));
end if;
if not gta_hautr_cel.exists (convr_parmt_faml (gpi_parmt_impr.va_pied_polc_faml))
then
init_hautr_cel (convr_parmt_faml (gpi_parmt_impr.va_pied_polc_faml));
end if;
if vva_procd_entet is not null
then
vva_progr_a_lancr :=
replace (vva_progr_a_lancr
,'%PROCD_PERSN%'
,vva_procd_entet);
execute immediate vva_progr_a_lancr using vva_nom_raprt;
else
plpdf.setprintfont (convr_parmt_faml (gpi_parmt_impr.va_entet_polc_faml)
,convr_parmt_poids (gpi_parmt_impr.va_entet_polc_poids
,'B')
,gpi_parmt_impr.nu_entet_polc_tail);
plpdf.printcell (0
,obten_hautr_cel (gpi_parmt_impr.va_entet_polc_faml
,gpi_parmt_impr.nu_entet_polc_tail)
,vva_nom_raprt
,0
,0
,convr_parmt_align (gpi_parmt_impr.va_entet_align
,'C'));
plpdf.linebreak (56.7);
end if;
end init_pdf;
procedure calcl_largr_raprt
is
vnu_total_reltf number default 0;
vbo_activ_fit_to_page boolean default false;
vnu_largr_total_reel number default 0;
begin
-- Créer les différents set d'entêtes (tableau)
vnu_dernr_coln_ajout := 0;
vnu_largr_restn := plpdf.getpageavailablewidth;
vnu_elmnt_restn := vnu_elmnt_lign;
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
and gta_fonct_coln (i).vva_indic_afich = 'O'
then
case var_infor_coln (i).va_type_largr
when 'POUCE'
then
vnu_largr_restn := vnu_largr_restn - (var_infor_coln (i).nu_largr * 72);
when 'INDET'
then
var_infor_coln (i).nu_largr := vnu_largr_deft;
vnu_largr_restn := vnu_largr_restn - (var_infor_coln (i).nu_largr * 72);
when 'RELTF'
then
vnu_total_reltf := vnu_total_reltf + var_infor_coln (i).nu_largr;
else
--Ne devrait pas arriver
null;
end case;
if var_infor_coln (i).va_type_largr in ('POUCE'
,'INDET')
then
vnu_largr_total_reel := vnu_largr_total_reel + (var_infor_coln (i).nu_largr * 72);
end if;
end if;
end loop;
if vnu_largr_restn <= 0
or vnu_total_reltf = 0
and vnu_largr_total_reel < plpdf.getpageavailablewidth
and vva_indic_forcr_ajust_page = 'O'
then
vbo_activ_fit_to_page := true;
end if;
for j in var_pages.first () .. var_pages.last ()
loop
for i in vnu_dernr_coln_ajout + 1 .. var_pages (j).nu_dernr_coln
loop
if vbo_activ_fit_to_page
and var_infor_coln (i).va_type_largr = 'RELTF'
then
var_infor_coln (i).va_indic_expor := 'N';
gta_fonct_coln (i).vva_indic_afich := 'N';
end if;
if var_infor_coln (i).va_indic_expor = 'O'
and gta_fonct_coln (i).vva_indic_afich = 'O'
then
--Taille selon la largeur du champ
case var_infor_coln (i).va_type_largr
when 'RELTF'
then
var_infor_coln (i).nu_largr_reltv := var_infor_coln (i).nu_largr / vnu_total_reltf;
v_tail_intr_cell (i) := vnu_largr_restn * var_infor_coln (i).nu_largr_reltv;
else
if not vbo_activ_fit_to_page
then
v_tail_intr_cell (i) := (var_infor_coln (i).nu_largr * 72);
else
v_tail_intr_cell (i) := plpdf.getpageavailablewidth * ( (var_infor_coln (i).nu_largr * 72) / vnu_largr_total_reel);
end if;
end case;
vnu_elmnt_tabl := vnu_elmnt_tabl + 1;
if gta_trans_libl.exists (var_infor_coln (i).va_nom)
then
vva_elmnt := gta_trans_libl (var_infor_coln (i).va_nom);
else
vva_elmnt := var_infor_coln (i).va_libl;
end if;
vva_elmnt := formt_chain_br (vva_elmnt);
v_bordr_cell (vnu_elmnt_tabl) := '1';
v_tail_cell (vnu_elmnt_tabl) := v_tail_intr_cell (i);
vnu_elmnt_restn := vnu_elmnt_lign - vnu_elmnt_tabl;
v_algnm_entet (vnu_elmnt_tabl) :=
convr_parmt_align (var_infor_coln (i).va_align_entet
,'C');
v_data_row_ent (vnu_elmnt_tabl) := vva_elmnt;
vbo_type_indtr := false;
end if;
end loop;
vnu_dernr_coln_ajout := var_pages (j).nu_dernr_coln;
end loop;
vnu_elmnt_tabl := 0;
end calcl_largr_raprt;
procedure impri_entet
is
begin
if gpi_parmt_impr.nu_coln_polc_tail is not null
then
vnu_tail_polc_ent := gpi_parmt_impr.nu_coln_polc_tail;
else
vnu_tail_polc_ent := 11;
end if;
plpdf.setcolor4filling (obten_coulr_a_partr_hex (gre_coulr_pdf.vva_coulr_backg_entet));
plpdf.setprintfont (convr_parmt_faml (gpi_parmt_impr.va_coln_polc_faml)
,convr_parmt_poids (gpi_parmt_impr.va_coln_polc_poids
,'B')
,vnu_tail_polc_ent);
plpdf.row_print2 (v_data_row_ent
,v_bordr_cell
,v_tail_cell
,v_algnm_entet
,v_style_cell
,v_lign_max
,obten_hautr_cel (gpi_parmt_impr.va_coln_polc_faml
,vnu_tail_polc_ent)
,1
,0
,0);
end impri_entet;
procedure impri_corps
is
begin
if gpi_parmt_impr.nu_corps_polc_tail is not null
then
vnu_tail_polc_corps := gpi_parmt_impr.nu_corps_polc_tail;
else
vnu_tail_polc_corps := 8;
end if;
plpdf.setprintfont (convr_parmt_faml (gpi_parmt_impr.va_corps_polc_faml)
,convr_parmt_poids (gpi_parmt_impr.va_corps_polc_poids
,null)
,vnu_tail_polc_corps);
plpdf.row_print2 (v_data_cell
,v_bordr_cell
,v_tail_cell
,v_algnm_cell
,v_style_cell
,v_lign_max
,obten_hautr_cel (gpi_parmt_impr.va_corps_polc_faml
,vnu_tail_polc_corps)
,v_coulr_cell);
vnu_elmnt_tabl := 0;
end impri_corps;
procedure defnr_ligne
is
vbo_presn_ligne_bold boolean default false;
begin
gre_style_ligne.indic_ligne := false;
gre_style_ligne.indic_gras := false;
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
then
if gta_fonct_coln (i).vva_indic_afich = 'O'
then
vnu_elmnt_tabl := vnu_elmnt_tabl + 1;
v_bordr_cell (vnu_elmnt_tabl) := '1';
v_tail_cell (vnu_elmnt_tabl) := v_tail_intr_cell (i);
--Aligner selon le type de données
case var_infor_coln (i).va_type_valr
when 'VARCH'
then
vva_elmnt := var_infor_coln (i).va_valr_varch;
if vva_elmnt is null
then
vva_elmnt := gva_valr_nul;
end if;
when 'NUMBR'
then
if var_infor_coln (i).nu_valr_numbr is null
then
vva_elmnt := gva_valr_nul;
else
if var_infor_coln (i).va_formt is null
then
vva_elmnt := to_char (var_infor_coln (i).nu_valr_numbr);
else
vva_elmnt :=
(ltrim (to_char (var_infor_coln (i).nu_valr_numbr
,var_infor_coln (i).va_formt)));
end if;
end if;
when 'DATE'
then
if var_infor_coln (i).da_valr_date is null
then
vva_elmnt := gva_valr_nul;
else
if var_infor_coln (i).va_formt is null
then
vva_elmnt := to_char (var_infor_coln (i).da_valr_date);
else
vva_elmnt :=
(to_char (var_infor_coln (i).da_valr_date
,var_infor_coln (i).va_formt));
end if;
end if;
when 'TIMST'
then
if var_infor_coln (i).ts_valr_timst is null
then
vva_elmnt := gva_valr_nul;
else
if var_infor_coln (i).va_formt is null
then
vva_elmnt := to_char (var_infor_coln (i).ts_valr_timst);
else
vva_elmnt :=
(to_char (var_infor_coln (i).ts_valr_timst
,var_infor_coln (i).va_formt));
end if;
end if;
else
vva_elmnt := var_infor_coln (i).va_valr_varch;
end case;
vva_elmnt := apex_application.do_substitutions (vva_elmnt);
if vva_elmnt like '<span style="%"></span>%'
then
declare
vnu_postn number;
begin
vnu_postn :=
instr (vva_elmnt
,'</span>')
+ length ('</span>')
- 1;
gre_style_ligne :=
afw_25_formt_ir_pkg.digr_bals_formt (substr (vva_elmnt
,1
,vnu_postn));
vva_elmnt :=
substr (vva_elmnt
,vnu_postn + 1);
if gre_style_ligne.indic_ligne
and gre_style_ligne.indic_gras
then
vbo_presn_ligne_bold := true;
end if;
end;
end if;
v_style_cell (vnu_elmnt_tabl) := null;
vva_elmnt := formt_chain_br (vva_elmnt);
v_algnm_cell (vnu_elmnt_tabl) :=
convr_parmt_align (var_infor_coln (i).va_align_coln
,'C');
v_data_cell (vnu_elmnt_tabl) := vva_elmnt;
end if;
--Alimenter le highlight pour les colonnes
init_surlg_coln (var_infor_coln (i).va_nom);
gerer_surlg (vta_parmt_surlg
,vva_elmnt
,var_infor_coln (i).va_nom
,var_infor_coln (i).va_type_valr
,var_infor_coln (i).va_formt);
end if;
end loop;
if vbo_presn_ligne_bold
then
for c in v_style_cell.first () .. v_style_cell.last ()
loop
if v_style_cell (c) not like '%B%'
or v_style_cell (c) is null
then
v_style_cell (c) :=
v_style_cell (c)
|| 'B';
end if;
end loop;
end if;
vnu_elmnt_tabl := 0;
end defnr_ligne;
procedure impri_pied_page
is
vva_progr_a_lancr varchar2 (4000)
default 'begin '
|| ' %PROCD_PERSN%; '
|| ' exception when others then ete();'
|| 'end;';
begin
if vva_procd_pied_page is not null
then
vva_progr_a_lancr :=
replace (vva_progr_a_lancr
,'%PROCD_PERSN%'
,vva_procd_pied_page);
execute immediate vva_progr_a_lancr;
else
if gpi_parmt_impr.nu_pied_polc_tail is not null
then
vnu_tail_polc_pied := gpi_parmt_impr.nu_pied_polc_tail;
else
vnu_tail_polc_pied := 8;
end if;
plpdf.setcurrenty (round (plpdf.getpageavailableheight + 14.2
,0));
plpdf.setprintfont (convr_parmt_faml (gpi_parmt_impr.va_pied_polc_faml)
,convr_parmt_poids (gpi_parmt_impr.va_pied_polc_poids
,null)
,vnu_tail_polc_pied);
if gpi_parmt_impr.va_pied_texte is not null
then
plpdf.printcell (0
,obten_hautr_cel (gpi_parmt_impr.va_pied_polc_faml
,vnu_tail_polc_pied)
,apex_application.do_substitutions (gpi_parmt_impr.va_pied_texte)
,0
,0
,'C');
end if;
plpdf.printcell (0
,obten_hautr_cel (gpi_parmt_impr.va_pied_polc_faml
,vnu_tail_polc_pied)
,to_char (plpdf.currentpagenumber)
,0
,0
,'C');
end if;
end impri_pied_page;
--Gestion du surlignement
procedure defnr_surlg
is
begin
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
then
if gta_fonct_coln (i).vva_indic_afich = 'O'
then
vnu_elmnt_tabl := vnu_elmnt_tabl + 1;
v_coulr_cell (vnu_elmnt_tabl) := gre_ligne_a_surlg.vre_coulr_backg;
if gre_ligne_a_surlg.vta_coln_surlg (var_infor_coln (i).va_nom).vva_type_surlg <> 'LIGNE'
then
v_coulr_cell (vnu_elmnt_tabl) := gre_ligne_a_surlg.vta_coln_surlg (var_infor_coln (i).va_nom).vre_coulr_backg;
end if;
end if;
end if;
end loop;
end defnr_surlg;
--Gestion des regroupements
function obten_valr_fonct (pva_nom_coln in varchar2
,pva_fonct in varchar2 default 'SOMME')
return number
is
vnu_fonct number;
begin
case pva_fonct
when 'SOMME'
then
vnu_fonct :=
instr (vre_parmt_group.vva_coln_somme
,pva_nom_coln);
when 'MOYEN'
then
vnu_fonct :=
instr (vre_parmt_group.vva_coln_moyen
,pva_nom_coln);
when 'MAX'
then
vnu_fonct :=
instr (vre_parmt_group.vva_coln_max
,pva_nom_coln);
when 'MIN'
then
vnu_fonct :=
instr (vre_parmt_group.vva_coln_min
,pva_nom_coln);
when 'MEDN'
then
vnu_fonct :=
instr (vre_parmt_group.vva_coln_medn
,pva_nom_coln);
when 'MODE'
then
vnu_fonct :=
instr (vre_parmt_group.vva_coln_mode
,pva_nom_coln);
when 'COMPT'
then
vnu_fonct :=
instr (vre_parmt_group.vva_coln_compt
,pva_nom_coln);
when 'DISTN'
then
vnu_fonct :=
instr (vre_parmt_group.vva_coln_compt_distn
,pva_nom_coln);
else
null;
end case;
return vnu_fonct;
end obten_valr_fonct;
function afich_fonct (pnu_valr in number
,pva_formt in varchar2
,pva_fonct in varchar2 default 'SOMME')
return varchar2
is
vva_fonct varchar2 (4000);
begin
case pva_fonct
when 'SOMME'
then
vva_fonct := null;
when 'MOYEN'
then
vva_fonct := 'Moyenne';
when 'MAX'
then
vva_fonct := 'Maximum';
when 'MIN'
then
vva_fonct := 'Minimum';
when 'MEDN'
then
vva_fonct := 'Médiane';
when 'MODE'
then
vva_fonct := 'Mode';
when 'COMPT'
then
vva_fonct := 'Calculer';
when 'DISTN'
then
vva_fonct := 'Nombre de valeurs distinctes';
else
null;
end case;
if pva_fonct <> 'SOMME'
then
vva_fonct :=
vva_fonct
|| ': ';
end if;
if pva_fonct in ('COMPT'
,'DISTN')
then
return vva_fonct
|| to_char (pnu_valr);
else
return vva_fonct
|| to_char (pnu_valr
,pva_formt);
end if;
end afich_fonct;
function obten_group_actif (pva_nom_coln in varchar2)
return boolean
is
begin
return instr ( ':'
|| vre_parmt_group.vva_group_sur
|| ':'
, ':'
|| pva_nom_coln
|| ':') > 0;
end obten_group_actif;
function obten_fonct_activ (pva_nom_coln in varchar2
,pva_mode in varchar2 default 'SOMME')
return boolean
is
vbo_activ boolean default false;
begin
case pva_mode
when 'SOMME'
then
vbo_activ :=
instr ( ':'
|| vre_parmt_group.vva_coln_somme
|| ':'
, ':'
|| pva_nom_coln
|| ':') > 0;
when 'MOYEN'
then
vbo_activ :=
instr ( ':'
|| vre_parmt_group.vva_coln_moyen
|| ':'
, ':'
|| pva_nom_coln
|| ':') > 0;
when 'MAX'
then
vbo_activ :=
instr ( ':'
|| vre_parmt_group.vva_coln_max
|| ':'
, ':'
|| pva_nom_coln
|| ':') > 0;
when 'MIN'
then
vbo_activ :=
instr ( ':'
|| vre_parmt_group.vva_coln_min
|| ':'
, ':'
|| pva_nom_coln
|| ':') > 0;
when 'MEDN'
then
vbo_activ :=
instr ( ':'
|| vre_parmt_group.vva_coln_medn
|| ':'
, ':'
|| pva_nom_coln
|| ':') > 0;
when 'MODE'
then
vbo_activ :=
instr ( vre_parmt_group.vva_coln_mode
|| ':'
, ':'
|| pva_nom_coln
|| ':') > 0;
when 'COMPT'
then
vbo_activ :=
instr ( ':'
|| vre_parmt_group.vva_coln_compt
|| ':'
, ':'
|| pva_nom_coln
|| ':') > 0;
when 'DISTN'
then
vbo_activ :=
instr ( ':'
|| vre_parmt_group.vva_coln_compt_distn
|| ':'
, ':'
|| pva_nom_coln
|| ':') > 0;
else
null;
end case;
return vbo_activ;
end obten_fonct_activ;
/*Création des métadonnées*/
procedure init_group_entet
is
vbo_presn_group boolean default false;
vnu_compt pls_integer default 0;
vnu_compt_group pls_integer default 0;
vbo_presn_fonct boolean default false;
function detrm_postn_coln_group (pva_nom_coln in varchar2
,pva_break_on in varchar2)
return pls_integer
is
vva_chain varchar2 (4000);
vnu_postn pls_integer default 0;
begin
vva_chain :=
substr (pva_break_on
,1
,instr (pva_break_on
,pva_nom_coln));
select length (vva_chain)
- length (replace (vva_chain
,':'
,''))
+ 1
into vnu_postn
from dual;
return vnu_postn;
end detrm_postn_coln_group;
begin
--Déterminer les colonnes qui font partie du break ainsi que les fonctions par colonnes,
--les ajouter au tableau des groupes globaux
--Ne pas oublier le format number pour la colonne
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
then
if obten_group_actif (var_infor_coln (i).va_nom)
then
vbo_presn_group := true;
gbo_presn_group := vbo_presn_group;
vnu_compt_group :=
detrm_postn_coln_group (var_infor_coln (i).va_nom
,vre_parmt_group.vva_group);
--Alimenter les colonnes qui font parties du groupe
case vnu_compt_group
when 1
then
gre_group.vva_nom_coln_1 := var_infor_coln (i).va_nom;
when 2
then
gre_group.vva_nom_coln_2 := var_infor_coln (i).va_nom;
when 3
then
gre_group.vva_nom_coln_3 := var_infor_coln (i).va_nom;
when 4
then
gre_group.vva_nom_coln_4 := var_infor_coln (i).va_nom;
when 5
then
gre_group.vva_nom_coln_5 := var_infor_coln (i).va_nom;
when 6
then
gre_group.vva_nom_coln_6 := var_infor_coln (i).va_nom;
else
null;
end case;
gta_fonct_coln (i).vnu_numr_group := vnu_compt_group;
end if;
gta_fonct_coln (i).vva_nom_coln := var_infor_coln (i).va_nom;
if vbo_presn_group
then
gta_fonct_coln (i).vva_indic_afich := 'N';
else
gta_fonct_coln (i).vva_indic_afich := 'O';
if obten_fonct_activ (var_infor_coln (i).va_nom
,'SOMME')
then
gta_fonct_coln (i).vva_indic_somme := 'O';
end if;
if obten_fonct_activ (var_infor_coln (i).va_nom
,'MOYEN')
then
gta_fonct_coln (i).vva_indic_moyen := 'O';
end if;
if obten_fonct_activ (var_infor_coln (i).va_nom
,'MAX')
then
gta_fonct_coln (i).vva_indic_max := 'O';
end if;
if obten_fonct_activ (var_infor_coln (i).va_nom
,'MIN')
then
gta_fonct_coln (i).vva_indic_min := 'O';
end if;
if obten_fonct_activ (var_infor_coln (i).va_nom
,'MEDN')
then
gta_fonct_coln (i).vva_indic_medn := 'O';
end if;
if obten_fonct_activ (var_infor_coln (i).va_nom
,'MODE')
then
gta_fonct_coln (i).vva_indic_mode := 'O';
end if;
if obten_fonct_activ (var_infor_coln (i).va_nom
,'COMPT')
then
gta_fonct_coln (i).vva_indic_compt := 'O';
end if;
if obten_fonct_activ (var_infor_coln (i).va_nom
,'DISTN')
then
gta_fonct_coln (i).vva_indic_compt_distn := 'O';
end if;
end if;
vbo_presn_group := false;
end if;
end loop;
vnu_elmnt_tabl := 0;
end init_group_entet;
function verfr_chang_group
return boolean
is
vbo_chang boolean default false;
vva_elemn varchar2 (32767);
begin
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
and gta_fonct_coln (i).vva_indic_afich = 'N'
then
--Déterminer s'il y a eu changement de groupe
case var_infor_coln (i).va_type_valr
when 'VARCH'
then
vva_elemn := var_infor_coln (i).va_valr_varch;
when 'NUMBR'
then
vva_elemn :=
(ltrim (to_char (var_infor_coln (i).nu_valr_numbr
,var_infor_coln (i).va_formt)));
when 'DATE'
then
vva_elemn :=
(to_char (var_infor_coln (i).da_valr_date
,var_infor_coln (i).va_formt));
when 'TIMST'
then
vva_elemn :=
(to_char (var_infor_coln (i).ts_valr_timst
,var_infor_coln (i).va_formt));
else
vva_elemn := var_infor_coln (i).va_valr_varch;
end case;
case gta_fonct_coln (i).vnu_numr_group
when 1
then
vbo_chang :=
gre_group.vva_valr_coln_1 <> vva_elemn
or gre_group.vva_valr_coln_1 is null;
when 2
then
vbo_chang :=
gre_group.vva_valr_coln_2 <> vva_elemn
or gre_group.vva_valr_coln_2 is null;
when 3
then
vbo_chang :=
gre_group.vva_valr_coln_3 <> vva_elemn
or gre_group.vva_valr_coln_3 is null;
when 4
then
vbo_chang :=
gre_group.vva_valr_coln_4 <> vva_elemn
or gre_group.vva_valr_coln_4 is null;
when 5
then
vbo_chang :=
gre_group.vva_valr_coln_5 <> vva_elemn
or gre_group.vva_valr_coln_5 is null;
when 6
then
vbo_chang :=
gre_group.vva_valr_coln_6 <> vva_elemn
or gre_group.vva_valr_coln_6 is null;
else
null;
end case;
end if;
if vbo_chang
then
exit;
end if;
end loop;
return vbo_chang;
end verfr_chang_group;
/*Print à chaque groupe*/
procedure gerer_group_entet
is
vbo_presn_entet boolean default false;
vva_elemn varchar2 (4000);
vva_valr_coln varchar2 (200);
begin
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
and gta_fonct_coln (i).vva_indic_afich = 'N'
then
--Construire la cellule à imprimer
vbo_presn_entet := true;
case var_infor_coln (i).va_type_valr
when 'VARCH'
then
vva_valr_coln := var_infor_coln (i).va_valr_varch;
when 'NUMBR'
then
vva_valr_coln :=
(ltrim (to_char (var_infor_coln (i).nu_valr_numbr
,var_infor_coln (i).va_formt)));
when 'DATE'
then
vva_valr_coln :=
(to_char (var_infor_coln (i).da_valr_date
,var_infor_coln (i).va_formt));
when 'TIMST'
then
vva_valr_coln :=
(to_char (var_infor_coln (i).ts_valr_timst
,var_infor_coln (i).va_formt));
else
vva_valr_coln := var_infor_coln (i).va_valr_varch;
end case;
case gta_fonct_coln (i).vnu_numr_group
when 1
then
gre_group.vva_libl_coln_1 := var_infor_coln (i).va_libl;
gre_group.vva_valr_coln_1 := vva_valr_coln;
when 2
then
gre_group.vva_libl_coln_2 := var_infor_coln (i).va_libl;
gre_group.vva_valr_coln_2 := vva_valr_coln;
when 3
then
gre_group.vva_libl_coln_3 := var_infor_coln (i).va_libl;
gre_group.vva_valr_coln_3 := vva_valr_coln;
when 4
then
gre_group.vva_libl_coln_4 := var_infor_coln (i).va_libl;
gre_group.vva_valr_coln_4 := vva_valr_coln;
when 5
then
gre_group.vva_libl_coln_5 := var_infor_coln (i).va_libl;
gre_group.vva_valr_coln_5 := vva_valr_coln;
when 6
then
gre_group.vva_libl_coln_6 := var_infor_coln (i).va_libl;
gre_group.vva_valr_coln_6 := vva_valr_coln;
else
null;
end case;
end if;
end loop;
if gre_group.vva_nom_coln_1 is not null
then
vva_elemn :=
vva_elemn
|| ', '
|| gre_group.vva_libl_coln_1
|| ' : '
|| gre_group.vva_valr_coln_1;
end if;
if gre_group.vva_nom_coln_2 is not null
then
vva_elemn :=
vva_elemn
|| ', '
|| gre_group.vva_libl_coln_2
|| ' : '
|| gre_group.vva_valr_coln_2;
end if;
if gre_group.vva_nom_coln_3 is not null
then
vva_elemn :=
vva_elemn
|| ', '
|| gre_group.vva_libl_coln_3
|| ' : '
|| gre_group.vva_valr_coln_3;
end if;
if gre_group.vva_nom_coln_4 is not null
then
vva_elemn :=
vva_elemn
|| ', '
|| gre_group.vva_libl_coln_4
|| ' : '
|| gre_group.vva_valr_coln_4;
end if;
if gre_group.vva_nom_coln_5 is not null
then
vva_elemn :=
vva_elemn
|| ', '
|| gre_group.vva_libl_coln_5
|| ' : '
|| gre_group.vva_valr_coln_5;
end if;
if gre_group.vva_nom_coln_6 is not null
then
vva_elemn :=
vva_elemn
|| ', '
|| gre_group.vva_libl_coln_6
|| ' : '
|| gre_group.vva_valr_coln_6;
end if;
if vbo_presn_entet
then
if gpi_parmt_impr.nu_coln_polc_tail is not null
then
vnu_tail_polc_ent := gpi_parmt_impr.nu_coln_polc_tail;
else
vnu_tail_polc_ent := 11;
end if;
plpdf.setcolor4filling (obten_coulr_a_partr_hex (gre_coulr_pdf.vva_coulr_backg_entet));
plpdf.setprintfont (convr_parmt_faml (gpi_parmt_impr.va_coln_polc_faml)
,convr_parmt_poids (gpi_parmt_impr.va_coln_polc_poids
,'B')
,vnu_tail_polc_ent);
plpdf.printmultilinecell (0
,obten_hautr_cel (gpi_parmt_impr.va_coln_polc_faml
,vnu_tail_polc_ent)
,substr (vva_elemn
,3)
,'1'
,'L'
,1
,p_ln => 1);
end if;
end gerer_group_entet;
/* Fin print à chaque groupe*/
procedure termn_group_entet
is
vva_elemn varchar2 (4000);
vnu_compt_termn pls_integer default 0;
v_data_row_fonct plpdf_type.t_row_datas;
v_algnm_fonct plpdf_type.t_row_aligns;
vbo_retrn boolean default false;
function obten_medn
return number
is
vta_medn typ_tab_medn;
begin /*
select cast(multiset(
select * from table(gta_fonct_coln(c).vta_tabl_medn)
order by 1) as typ_tab_medn)
into vta_medn from dual;
--Médianne est la valeur
if mod (vta_medn.count(), 2) = 1 then
null;
else --Sinon, il faut calculer la position avant et après
null;
end if;*/
return null;
end obten_medn;
function nouvl_ligne
return varchar2
is
begin
return chr (13)
|| chr (10);
end nouvl_ligne;
begin
for c in gta_fonct_coln.first () .. gta_fonct_coln.last ()
loop
if gta_fonct_coln (c).vva_indic_afich = 'O'
then
vnu_compt_termn := vnu_compt_termn + 1;
if gta_fonct_coln (c).vva_indic_somme = 'O'
then
vbo_retrn := true;
vva_elemn :=
afich_fonct (gta_fonct_coln (c).vnu_somme
,var_infor_coln (c).va_formt
,'SOMME');
end if;
if gta_fonct_coln (c).vva_indic_moyen = 'O'
then
if vbo_retrn
then
vva_elemn :=
vva_elemn
|| nouvl_ligne;
end if;
vbo_retrn := true;
vva_elemn :=
vva_elemn
|| afich_fonct ( (gta_fonct_coln (c).vnu_moyen / gta_fonct_coln (c).vnu_compt)
,nvl (var_infor_coln (c).va_formt, kva_formt_nombr)
,'MOYEN');
end if;
if gta_fonct_coln (c).vva_indic_max = 'O'
then
if vbo_retrn
then
vva_elemn :=
vva_elemn
|| nouvl_ligne;
end if;
vbo_retrn := true;
vva_elemn :=
vva_elemn
|| afich_fonct (gta_fonct_coln (c).vnu_max
,var_infor_coln (c).va_formt
,'MAX');
end if;
if gta_fonct_coln (c).vva_indic_min = 'O'
then
if vbo_retrn
then
vva_elemn :=
vva_elemn
|| nouvl_ligne;
end if;
vbo_retrn := true;
vva_elemn :=
vva_elemn
|| afich_fonct (gta_fonct_coln (c).vnu_min
,var_infor_coln (c).va_formt
,'MIN');
end if;
/*
if gta_fonct_coln (c).vva_indic_medn = 'O' then
if vbo_retrn then
vva_elemn := vva_elemn || nouvl_ligne;
end if;
vbo_retrn := true;
vva_elemn := vva_elemn || afich_fonct(obten_medn, var_infor_coln(c).va_formt, 'MEDN');
end if;
*/
if gta_fonct_coln (c).vva_indic_compt = 'O'
then
if vbo_retrn
then
vva_elemn :=
vva_elemn
|| nouvl_ligne;
end if;
vbo_retrn := true;
vva_elemn :=
vva_elemn
|| afich_fonct (gta_fonct_coln (c).vnu_compt
,null
,'COMPT');
end if;
if gta_fonct_coln (c).vva_indic_compt_distn = 'O'
then
if vbo_retrn
then
vva_elemn :=
vva_elemn
|| nouvl_ligne;
end if;
vbo_retrn := true;
vva_elemn :=
vva_elemn
|| afich_fonct (gta_fonct_coln (c).vnu_compt_distn
,null
,'DISTN');
end if;
v_algnm_fonct (vnu_compt_termn) := 'R';
v_data_row_fonct (vnu_compt_termn) := vva_elemn;
vva_elemn := null;
vbo_retrn := false;
end if;
end loop;
if gpi_parmt_impr.nu_coln_polc_tail is not null
then
vnu_tail_polc_ent := gpi_parmt_impr.nu_coln_polc_tail;
else
vnu_tail_polc_ent := 11;
end if;
plpdf.setcolor4filling (obten_coulr_a_partr_hex (gre_coulr_pdf.vva_coulr_backg_entet));
plpdf.setprintfont (convr_parmt_faml (gpi_parmt_impr.va_coln_polc_faml)
,convr_parmt_poids (gpi_parmt_impr.va_coln_polc_poids
,'B')
,vnu_tail_polc_ent);
plpdf.row_print2 (v_data_row_fonct
,v_bordr_cell
,v_tail_cell
,v_algnm_fonct
,v_style_cell
,v_lign_max
,obten_hautr_cel (gpi_parmt_impr.va_coln_polc_faml
,vnu_tail_polc_ent)
,1);
end termn_group_entet;
procedure init_calcl_fonct
is
begin
vnu_tail_group := 0;
for i in gta_fonct_coln.first () .. gta_fonct_coln.last ()
loop
if gta_fonct_coln (i).vva_indic_afich = 'O'
then
if gta_fonct_coln (i).vva_indic_somme = 'O'
then
vbo_presn_fonct := true;
gta_fonct_coln (i).vnu_somme := 0;
end if;
if gta_fonct_coln (i).vva_indic_min = 'O'
then
vbo_presn_fonct := true;
gta_fonct_coln (i).vnu_min := null;
end if;
if gta_fonct_coln (i).vva_indic_max = 'O'
then
vbo_presn_fonct := true;
gta_fonct_coln (i).vnu_max := null;
end if;
if gta_fonct_coln (i).vva_indic_moyen = 'O'
then
vbo_presn_fonct := true;
gta_fonct_coln (i).vnu_moyen := 0;
end if;
if gta_fonct_coln (i).vva_indic_compt = 'O'
or gta_fonct_coln (i).vva_indic_moyen = 'O'
then
vbo_presn_fonct := true;
gta_fonct_coln (i).vnu_compt := 0;
end if;
if gta_fonct_coln (i).vva_indic_compt_distn = 'O'
then
vbo_presn_fonct := true;
gta_fonct_coln (i).vnu_compt_distn := 0;
gta_fonct_coln (i).vta_tabl_compt.delete ();
end if;
if gta_fonct_coln (i).vva_indic_medn = 'O'
then
vbo_presn_fonct := true;
gta_fonct_coln (i).vnu_medn := 0;
--gta_fonct_coln (i).vta_tabl_medn.delete ();
end if;
end if;
end loop;
end init_calcl_fonct;
procedure calcl_fonct
is
vbo_elemn_exist boolean default false;
i pls_integer;
begin
vnu_tail_group := vnu_tail_group + 1;
for i in gta_fonct_coln.first () .. gta_fonct_coln.last ()
loop
if gta_fonct_coln (i).vva_indic_afich = 'O'
then
if gta_fonct_coln (i).vva_indic_somme = 'O'
then
gta_fonct_coln (i).vnu_somme := gta_fonct_coln (i).vnu_somme + nvl (var_infor_coln (i).nu_valr_numbr, 0);
end if;
if gta_fonct_coln (i).vva_indic_min = 'O'
and ( gta_fonct_coln (i).vnu_min is null
or gta_fonct_coln (i).vnu_min > var_infor_coln (i).nu_valr_numbr)
then
gta_fonct_coln (i).vnu_min := var_infor_coln (i).nu_valr_numbr;
end if;
if gta_fonct_coln (i).vva_indic_max = 'O'
and ( gta_fonct_coln (i).vnu_max is null
or gta_fonct_coln (i).vnu_max < var_infor_coln (i).nu_valr_numbr)
then
gta_fonct_coln (i).vnu_max := var_infor_coln (i).nu_valr_numbr;
end if;
if gta_fonct_coln (i).vva_indic_moyen = 'O'
then
gta_fonct_coln (i).vnu_moyen := gta_fonct_coln (i).vnu_moyen + nvl (var_infor_coln (i).nu_valr_numbr, 0);
end if;
if gta_fonct_coln (i).vva_indic_compt = 'O'
or gta_fonct_coln (i).vva_indic_moyen = 'O'
then
if var_infor_coln (i).nu_valr_numbr is not null
or var_infor_coln (i).va_valr_varch is not null
or var_infor_coln (i).da_valr_date is not null
or var_infor_coln (i).ts_valr_timst is not null
then
gta_fonct_coln (i).vnu_compt := gta_fonct_coln (i).vnu_compt + 1;
end if;
end if;
if gta_fonct_coln (i).vva_indic_compt_distn = 'O'
then
case var_infor_coln (i).va_type_valr
when 'VARCH'
then
if not gta_fonct_coln (i).vta_tabl_compt.exists (var_infor_coln (i).va_valr_varch)
then
gta_fonct_coln (i).vta_tabl_compt (var_infor_coln (i).va_valr_varch) := 1;
gta_fonct_coln (i).vnu_compt_distn := gta_fonct_coln (i).vnu_compt_distn + 1;
end if;
when 'NUMBR'
then
if not gta_fonct_coln (i).vta_tabl_compt.exists (to_char (var_infor_coln (i).nu_valr_numbr))
then
gta_fonct_coln (i).vta_tabl_compt (to_char (var_infor_coln (i).nu_valr_numbr)) := 1;
gta_fonct_coln (i).vnu_compt_distn := gta_fonct_coln (i).vnu_compt_distn + 1;
end if;
when 'DATE'
then
if not gta_fonct_coln (i).vta_tabl_compt.exists (to_char (var_infor_coln (i).da_valr_date))
then
gta_fonct_coln (i).vta_tabl_compt (to_char (var_infor_coln (i).da_valr_date)) := 1;
gta_fonct_coln (i).vnu_compt_distn := gta_fonct_coln (i).vnu_compt_distn + 1;
end if;
when 'TIMST'
then
if not gta_fonct_coln (i).vta_tabl_compt.exists (to_char (var_infor_coln (i).ts_valr_timst))
then
gta_fonct_coln (i).vta_tabl_compt (to_char (var_infor_coln (i).ts_valr_timst)) := 1;
gta_fonct_coln (i).vnu_compt_distn := gta_fonct_coln (i).vnu_compt_distn + 1;
end if;
else
if not gta_fonct_coln (i).vta_tabl_compt.exists (var_infor_coln (i).va_valr_varch)
then
gta_fonct_coln (i).vta_tabl_compt (var_infor_coln (i).va_valr_varch) := 1;
gta_fonct_coln (i).vnu_compt_distn := gta_fonct_coln (i).vnu_compt_distn + 1;
end if;
end case;
end if;
/*
if gta_fonct_coln (i).vva_indic_medn = 'O' then
if var_infor_coln (i).nu_valr_numbr is not null then
gta_fonct_coln (i).vta_tabl_medn(vnu_tail_group) := var_infor_coln (i).nu_valr_numbr;
end if;
end if;*/
end if;
end loop;
end calcl_fonct;
procedure trans_libl
is
vva_tabl_javsc varchar2 (4000);
vvc_liste_a_trans apex_application_global.vc_arr2;
vvc_liste_coupl apex_application_global.vc_arr2;
begin
vvc_liste_a_trans :=
afw_07_util_pkg.string_to_table (vre_parmt_group_plugn.vva_trans_libl
,',');
if vvc_liste_a_trans.count > 0
then
for v in vvc_liste_a_trans.first .. vvc_liste_a_trans.last
loop
vvc_liste_coupl :=
afw_07_util_pkg.string_to_table (vvc_liste_a_trans (v)
,';');
gta_trans_libl (vvc_liste_coupl (1)) := vvc_liste_coupl (2);
end loop;
end if;
end trans_libl;
procedure impri_entet_plugn
is
vta_ligne_1 typ_tab_coln_plugn;
vta_ligne_2 typ_tab_coln_plugn;
vta_ligne_3 typ_tab_coln_plugn;
function analz_ligne_entet (pva_ligne in varchar2)
return typ_tab_coln_plugn
is
vta_coln_plugn typ_tab_coln_plugn;
vvc_liste_group apex_application_global.vc_arr2;
vvc_liste_sous_group apex_application_global.vc_arr2;
vnu_compt pls_integer default 0;
begin
vvc_liste_group :=
afw_07_util_pkg.string_to_table (pva_ligne
,',');
if vvc_liste_group.count > 0
then
for v in vvc_liste_group.first .. vvc_liste_group.last
loop
vnu_compt := vnu_compt + 1;
vvc_liste_sous_group :=
afw_07_util_pkg.string_to_table (vvc_liste_group (v)
,';');
vta_coln_plugn (vnu_compt).vva_valr := trim (vvc_liste_sous_group (1));
vta_coln_plugn (vnu_compt).vnu_colsp := vvc_liste_sous_group (2);
vta_coln_plugn (vnu_compt).vnu_rowsp := vvc_liste_sous_group (3);
end loop;
end if;
return vta_coln_plugn;
end analz_ligne_entet;
procedure impri_ligne (pta_ligne in typ_tab_coln_plugn)
is
v_data_row_plugn plpdf_type.t_row_datas;
v_algnm_plugn plpdf_type.t_row_aligns;
v_tail_plugn plpdf_type.t_row_widths;
vnu_compt pls_integer default 0;
vnu_tail_ventl number default 0;
vnu_coln_courn pls_integer default 1;
vnu_coln_max pls_integer default 0;
begin
if pta_ligne.count > 0
then
for v in pta_ligne.first () .. pta_ligne.last ()
loop
vnu_compt := vnu_compt + 1;
v_data_row_plugn (vnu_compt) := formt_chain_br (pta_ligne (v).vva_valr);
if v = pta_ligne.first ()
and vre_parmt_group_plugn.vva_indic_ventl = 'Y'
then
for c in v .. vre_parmt_group_plugn.vnu_nombr_coln_ventl
loop
vnu_tail_ventl := vnu_tail_ventl + v_tail_cell (c);
end loop;
v_tail_plugn (vnu_compt) := vnu_tail_ventl;
vnu_coln_courn := vnu_coln_courn + vre_parmt_group_plugn.vnu_nombr_coln_ventl - 1;
else
vnu_coln_max := vnu_coln_courn + pta_ligne (v).vnu_colsp - 1;
v_tail_plugn (vnu_compt) := 0;
for b in vnu_coln_courn .. vnu_coln_max
loop
v_tail_plugn (vnu_compt) := v_tail_plugn (vnu_compt) + v_tail_cell (b);
end loop;
vnu_coln_courn := vnu_coln_max;
end if;
vnu_coln_courn := vnu_coln_courn + 1;
v_algnm_plugn (vnu_compt) := 'C';
end loop;
plpdf.row_print2 (v_data_row_plugn
,v_bordr_cell
,v_tail_plugn
,v_algnm_plugn
,v_style_cell
,v_lign_max
,obten_hautr_cel (gpi_parmt_impr.va_coln_polc_faml
,vnu_tail_polc_ent)
,1);
end if;
end impri_ligne;
begin
vta_ligne_1 := analz_ligne_entet (vre_parmt_group_plugn.vva_ligne_1);
vta_ligne_2 := analz_ligne_entet (vre_parmt_group_plugn.vva_ligne_2);
vta_ligne_3 := analz_ligne_entet (vre_parmt_group_plugn.vva_ligne_3);
if gpi_parmt_impr.nu_coln_polc_tail is not null
then
vnu_tail_polc_ent := gpi_parmt_impr.nu_coln_polc_tail;
else
vnu_tail_polc_ent := 11;
end if;
plpdf.setcolor4filling (obten_coulr_a_partr_hex (gre_coulr_pdf.vva_coulr_backg_entet));
plpdf.setprintfont (convr_parmt_faml (gpi_parmt_impr.va_coln_polc_faml)
,convr_parmt_poids (gpi_parmt_impr.va_coln_polc_poids
,'B')
,vnu_tail_polc_ent);
impri_ligne (vta_ligne_1);
impri_ligne (vta_ligne_2);
impri_ligne (vta_ligne_3);
end impri_entet_plugn;
begin
begin
-- Chercher le rapport interactif sur la page
select apex_application.do_substitutions (pir.libl_regn)
,air.region_id id_plug
,air.no_data_found_message
,pir.seqnc
,pir.largr_deft
,apex_application.do_substitutions (air.show_nulls_as)
--pir.unite_mesr_largr_deft
into vva_nom_raprt
,vnu_id_plugn
,vva_mesg_aucun_don
,vnu_ref_ir
,vnu_largr_deft
,gva_valr_nul
--vnu_unite_mesr_largr_deft
from vd_afw_13_page_ir pir
,apex_ir air
where pir.app_id_formt = pnu_aplic
and pir.app_page_id_formt = pnu_page
and air.id = pir.id_apex;
-- Récupérer le select
vnu_rpts_id := afw_13_raprt_inter_pkg.obten_repts_courn ();
vva_selct := afw_13_raprt_inter_pkg.obten_selct_rpts (vnu_rpts_id);
exception
when no_data_found
then
vva_selct := null;
end;
if vva_selct is null
then
afw_01_err_apex_pkg.lever_err_apex_code ('SPX.000001'
,pva_code_prodt => 'AFW');
end if;
vnu_largr_deft := nvl (vnu_largr_deft, 0);
if vnu_largr_deft <= 0
then
vnu_largr_deft := 1.5;
end if;
-- Récupérer les paramètres du raport
gpi_parmt_impr := obten_parmt_impre_raprt (vnu_ref_ir);
-- Obtenir les paramètres pour le surlignement
vta_parmt_surlg := obten_parmt_surlg_raprt (vnu_rpts_id);
vre_parmt_group := obten_parmt_group_raprt (vnu_rpts_id);
vre_parmt_group_plugn := obten_parmt_group_plugn (vnu_id_plugn);
vva_nom_raprt :=
nvl (replace (gpi_parmt_impr.va_entet_texte
,'#TITLE#'
,vva_nom_raprt)
,vva_nom_raprt);
vva_nom_raprt := apex_application.do_substitutions (vva_nom_raprt);
vva_nom_raprt := formt_chain_br (vva_nom_raprt);
--Obtenir la procédure de couleur
vva_procd_coulr := afw_11_prodt_pkg.obten_procd_coulr_plpdf (afw_11_aplic_pkg.obten_prodt (afw_11_aplic_pkg.obten_aplic (pnu_aplic)));
if vva_procd_coulr is not null
then
defnr_coulr_pdf (vva_procd_coulr);
end if;
vva_procd_entet := afw_11_prodt_pkg.obten_procd_entet_plpdf (afw_11_aplic_pkg.obten_prodt (afw_11_aplic_pkg.obten_aplic (pnu_aplic)));
vva_procd_pied_page := afw_11_prodt_pkg.obten_procd_pied_page_plpdf (afw_11_aplic_pkg.obten_prodt (afw_11_aplic_pkg.obten_aplic (pnu_aplic)));
vnu_cursr :=
afw_07_sql_pkg.ouvri_selct (vnu_ref_ir
,vnu_rpts_id
,apex_application.do_substitutions (vva_selct)
,var_infor_coln
, chr (10)
|| chr (13));
declare
vbo_aucun_afich boolean default true;
begin
if var_infor_coln.first () is not null
then
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
then
vbo_aucun_afich := false;
exit;
end if;
end loop;
end if;
if vbo_aucun_afich
then
var_infor_coln.delete ();
end if;
end;
if var_infor_coln.first () is not null
then
-- vnu_largr_dispo := obten_largr_dispo_page (gpi_parmt_impr);
-- Transformer toutes les valeurs en pouces
vnu_index_page := 1;
-- Créer la premiere page
var_pages (vnu_index_page).nu_dernr_coln := 0;
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
then
-- La page sera créée si elle n'existe pas
var_pages (vnu_index_page).nu_dernr_coln := i;
var_pages (vnu_index_page).nu_largr := var_pages (vnu_index_page).nu_largr + var_infor_coln (i).nu_largr_reltv;
end if;
end loop;
begin
init_group_entet;
init_calcl_fonct;
init_pdf;
trans_libl;
calcl_largr_raprt;
impri_entet_plugn;
if not gbo_presn_group
then
impri_entet;
end if;
-- Écrire les données
while afw_07_sql_pkg.lire_ligne_selct (vnu_cursr
,var_infor_coln)
loop
--Créer une nouvelle entête de tableau sur une nouvelle page s'il reste des données
if round ( (plpdf.getpageavailableheight - 34.05)
,0) < round (plpdf.getcurrenty
,0)
then
impri_pied_page;
plpdf.newpage;
gerer_group_entet;
impri_entet;
end if;
if verfr_chang_group
then
if vnu_tail_group <> 0
and vbo_presn_fonct
then
termn_group_entet;
init_calcl_fonct;
end if;
--Ajouter code pour saut de page si indicateur saut page groupe est à oui
if round ( (plpdf.getpageavailableheight - 34.05)
,0) < round (plpdf.getcurrenty
,0)
then
impri_pied_page;
plpdf.newpage;
gerer_group_entet;
impri_entet;
end if;
gerer_group_entet;
impri_entet;
end if;
init_surlg_ligne;
calcl_fonct;
--Remplir le tableau
defnr_ligne;
--Définir le highlight pour la ligne courante.
defnr_surlg;
if round ( (plpdf.getpageavailableheight - 34.05)
,0) < round (plpdf.getcurrenty
,0)
then
impri_pied_page;
plpdf.newpage;
gerer_group_entet;
impri_entet;
end if;
--imprimer la ligne
impri_corps;
end loop;
--pied de page
if vbo_presn_fonct
then
termn_group_entet;
end if;
impri_pied_page;
--Envoyer les données au fichier blob
plpdf.senddoc (v_blob);
end;
--téléverser pdf
owa_util.mime_header ('application/pdf'
,false);
htp.p ( 'Content-length: '
|| dbms_lob.getlength (v_blob));
htp.p ( 'Content-Disposition: attachment; filename="'
|| replace ( formt_nom_fichr (vva_nom_raprt)
|| '.pdf'
,chr (13)
,'_'));
owa_util.http_header_close ();
wpg_docload.download_file (v_blob);
else
null;
-- On a un problème... afficher une erreur dans le PDF ou lever une erreur...
htp.p ('<h1>Aucune colonne affichable n''a été trouvée.</h1>');
end if;
-- Fermer le curseur
afw_07_sql_pkg.fermr_selct (vnu_cursr);
-- Arrêter tous les autres traitements d'APEX
afw_07_util_pkg.aret_trait_page_apex;
exception
when others
then
ete ();
end;
procedure afich_csv (pnu_aplic in number default afw_07_util_pkg.v ('APP_ID')
,pnu_page in number default afw_07_util_pkg.v ('APP_PAGE_ID')
,pva_seprt_coln in varchar2 default kva_seprt_coln)
is
vbo_dirct boolean default false;
vnu_ref_ir number;
vva_nom_raprt varchar2 (200);
vva_mesg_aucun_don varchar2 (32767);
vnu_largr_deft number;
--vnu_unite_mesr_largr_deft number(10);
vva_selct varchar2 (32767);
vnu_cursr number;
var_infor_coln afw_07_sql_pkg.typ_arr_infor_coln;
vcl_corps clob;
vva_seprt_coln varchar2 (1);
vnu_compt_ligne number;
vnu_rpts_id number;
procedure ajouter (pva_pre in varchar2
,pva_chaine in varchar2)
is
begin
if pva_pre is not null
or pva_chaine is not null
then
if vbo_dirct
then
--htp.putraw (utl_raw.cast_to_raw(pva_pre || pva_chaine));
htp.prn ( pva_pre
|| pva_chaine);
--dbms_output.put (pva_pre || pva_chaine);
else
dbms_lob.writeappend (vcl_corps
,length ( pva_pre
|| pva_chaine)
, pva_pre
|| pva_chaine);
end if;
end if;
end;
procedure ajouter_chaine (pva_pre in varchar2
,pva_chaine in varchar2)
is
begin
ajouter (pva_pre
, '"'
|| replace (pva_chaine
,'"'
,'""')
|| '"');
end;
begin
begin
-- Chercher le rapport interactif sur la page
select pir.libl_regn
,air.no_data_found_message
,pir.seqnc
,pir.largr_deft
--pir.unite_mesr_largr_deft
into vva_nom_raprt
,vva_mesg_aucun_don
,vnu_ref_ir
,vnu_largr_deft
--vnu_unite_mesr_largr_deft
from vd_afw_13_page pag
,vd_afw_13_page_ir pir
,apex_ir air
where pag.ref_aplic = afw_11_aplic_pkg.obten_aplic_numr_apex (pnu_aplic)
and pag.numr_apex = pnu_page
and pir.ref_page = pag.seqnc
and air.id = pir.id_apex;
-- Récupérer le select
vnu_rpts_id := afw_13_raprt_inter_pkg.obten_repts_courn ();
vva_selct := afw_13_raprt_inter_pkg.obten_selct_rpts (vnu_rpts_id);
exception
when no_data_found
then
vva_selct := null;
end;
if vva_selct is null
then
afw_01_err_apex_pkg.lever_err_apex_code ('SPX.000001'
,pva_code_prodt => 'AFW');
end if;
vnu_cursr :=
afw_07_sql_pkg.ouvri_selct (vnu_ref_ir
,vnu_rpts_id
,vva_selct
,var_infor_coln
,chr (10));
declare
vbo_aucun_afich boolean default true;
begin
if var_infor_coln.first () is not null
then
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
then
vbo_aucun_afich := false;
exit;
end if;
end loop;
end if;
if vbo_aucun_afich
then
var_infor_coln.delete ();
end if;
end;
if var_infor_coln.first () is not null
then
if vbo_dirct
then
owa_util.mime_header ('text/csv'
,false);
htp.p ( 'Content-Disposition: attachment; filename="'
|| formt_nom_fichr (vva_nom_raprt)
|| '.csv'
|| '"');
--dbms_output.put_line ('HTTP/1.x 200 OK');
--dbms_output.put_line ('Content-Type: text/csv; charset=UTF-8');
--dbms_output.put_line ('Content-Disposition: attachment; filename="' || formt_nom_fichr(vva_nom_raprt) || '.csv' || '"');
owa_util.http_header_close;
--dbms_output.put_line (null);
else
dbms_lob.createtemporary (vcl_corps
,true);
end if;
-- Créer la ligne d'entête
vva_seprt_coln := null;
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
then
ajouter_chaine (vva_seprt_coln
,var_infor_coln (i).va_libl);
vva_seprt_coln := pva_seprt_coln;
end if;
end loop;
-- Saut de ligne
ajouter (null
,chr (10));
-- Écrire les données
vnu_compt_ligne := 0;
while afw_07_sql_pkg.lire_ligne_selct (vnu_cursr
,var_infor_coln)
loop
vnu_compt_ligne := vnu_compt_ligne + 1;
vva_seprt_coln := null;
for i in var_infor_coln.first () .. var_infor_coln.last ()
loop
if var_infor_coln (i).va_indic_expor = 'O'
then
case var_infor_coln (i).va_type_valr
when 'VARCH'
then
ajouter_chaine (vva_seprt_coln
,var_infor_coln (i).va_valr_varch);
when 'NUMBR'
then
ajouter_chaine (vva_seprt_coln
,var_infor_coln (i).nu_valr_numbr);
when 'DATE'
then
ajouter_chaine (vva_seprt_coln
,to_char (var_infor_coln (i).da_valr_date
,'YYYY-MM-DD'));
when 'TIMST'
then
ajouter_chaine (vva_seprt_coln
,var_infor_coln (i).ts_valr_timst);
else
ajouter_chaine (vva_seprt_coln
,var_infor_coln (i).va_valr_varch);
end case;
vva_seprt_coln := pva_seprt_coln;
end if;
end loop;
-- Saut de ligne
ajouter (null
,chr (10));
end loop;
if vnu_compt_ligne = 0
then
ajouter_chaine (null
,vva_mesg_aucun_don);
ajouter (null
,chr (10));
end if;
if vbo_dirct
then
null;
else
afw_11_prodt_pkg.telvs_fichr (vcl_corps
, formt_nom_fichr (vva_nom_raprt)
|| '.csv'
,true
,'texte/csv');
dbms_lob.freetemporary (vcl_corps);
end if;
else
null;
-- On a un problème... afficher une erreur dans le PDF ou lever une erreur...
htp.p ('<h1>Aucune colonne affichable n''a été trouvée.</h1>');
end if;
-- Fermer le curseur
afw_07_sql_pkg.fermr_selct (vnu_cursr);
-- Arrêter tous les autres traitements d'APEX
afw_07_util_pkg.aret_trait_page_apex;
/*exception
when others then
htp.p (sqlerrm);*/
end;
end afw_25_plpdf_expor_ir_pkg;
/
|
-- Revert app_jobs_fn:do_notify from pg
BEGIN;
DROP FUNCTION app_jobs_fn.do_notify();
COMMIT;
|
/*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50540
Source Host : localhost:3306
Source Database : springboot-api-demo
Target Server Type : MYSQL
Target Server Version : 50540
File Encoding : 65001
Date: 2020-05-05 15:57:02
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for sys_account
-- ----------------------------
DROP TABLE IF EXISTS `sys_account`;
CREATE TABLE `sys_account` (
`account_id` varchar(40) NOT NULL,
`account_no` varchar(30) NOT NULL,
`password` varchar(30) DEFAULT NULL,
`role` varchar(40) DEFAULT NULL,
PRIMARY KEY (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of sys_account
-- ----------------------------
INSERT INTO `sys_account` VALUES ('1', 'admin', '123456', '1');
INSERT INTO `sys_account` VALUES ('2', 'root', '123456', '1');
INSERT INTO `sys_account` VALUES ('3', 'guest', 'guest', '2');
INSERT INTO `sys_account` VALUES ('5', 'test', '123456', '2');
INSERT INTO `sys_account` VALUES ('8', 'roott', '123456', null);
|
create database frogsoft_cms_db;
create user 'frogsoft_cms_user'@'%' identified by '<PASSWORD>cms_password';
grant all on frogsoft_cms_db.* to 'frogsoft_cms_user'@'%'; |
ALTER TABLE bookmarks DROP CONSTRAINT bookmarks_user_id_fkey;
ALTER TABLE bookmarks
ADD CONSTRAINT bookmarks_user_id_fkey FOREIGN KEY (user_id)
REFERENCES users (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE;
ALTER TABLE subscriptions DROP CONSTRAINT subscriptions_user_id_fkey;
ALTER TABLE subscriptions
ADD CONSTRAINT subscriptions_user_id_fkey FOREIGN KEY (user_id)
REFERENCES users (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE;
|
<reponame>timshadel/subdivision-list
CREATE TABLE subdivision_IT (id VARCHAR(6) NOT NULL, name VARCHAR(255) NOT NULL, level VARCHAR(64) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-65', 'Abruzzes', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-AG', 'Agrigente', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-AL', 'Alexandrie', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-AN', 'Ancône', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-AO', 'Aoste', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-AR', 'Arezzo', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-AP', 'Ascoli Piceno', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-AT', 'Asti', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-AV', 'Avellino', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-BA', 'Bari', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-77', 'Basilicate', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-BL', 'Belluno', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-BN', 'Bénévent', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-BG', 'Bergame', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-BI', 'Biella', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-BO', 'Bologne', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-BZ', 'Bolzano', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-BS', 'Brescia', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-BR', 'Brindisi', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CA', 'Cagliari', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-78', 'Calabre', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CL', 'Caltanissetta', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-72', 'Campanie', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CB', 'Campobasso', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CE', 'Caserte', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CT', 'Catane', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CZ', 'Catanzaro', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CH', 'Chieti', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CO', 'Côme', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CS', 'Cosenza', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CR', 'Crémone', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-KR', 'Crotone', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CN', 'Coni', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-45', 'Émilie-Romagne', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-EN', 'Enna', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-FM', 'Fermo', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-FE', 'Ferrare', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-FI', 'Florence', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-FG', 'Foggia', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-FO', 'Forlì', '');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-36', 'Frioul-Vénétie julienne', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-FR', 'Frosinone', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-GE', 'Gênes', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-GO', 'Gorizia', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-GR', 'Grosseto', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-IM', 'Imperia', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-IS', 'Isernia', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-BT', 'Province de Barletta-Andria-Trani', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-CI', 'Province de Carbonia-Iglesias', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-FC', 'Province de Forlì-Cesena', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-75', 'Pouilles', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-SP', 'La Spezia', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-62', 'Latium', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-LE', 'Lecce', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-LC', 'Lecco', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-42', 'Ligurie', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-LI', 'Livourne', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-LO', 'Lodi', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-25', 'Lombardie', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-LU', 'Lucques', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-MC', 'Macerata', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-MN', 'Mantoue', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-57', 'Marches', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-MT', 'Matera', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-ME', 'Messine', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-MI', 'Milan', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-MO', 'Modène', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-67', 'Molise', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-NA', 'Naples', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-NO', 'Novare', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-NU', 'Nuoro', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-OR', 'Oristano', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PD', 'Padoue', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PA', 'Palerme', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PR', 'Parme', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PV', 'Pavie', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PG', 'Pérouse', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PE', 'Pescara', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PC', 'Plaisance', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-21', 'Piémont', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PI', 'Pise', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PT', 'Pistoia', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PN', 'Pordenone', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PZ', 'Potenza', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-PO', 'Prato', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-MS', 'Province de Massa et Carrare', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-MA', 'Province du Medio Campidano', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-MB', 'Province de Monza et de la Brianza', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-RG', 'Raguse', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-RA', 'Ravenne', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-RC', 'Reggio de Calabre', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-LT', 'Latino', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-VB', 'Province du Verbano-Cusio-Ossola', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-RI', 'Rieti', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-RN', 'Rimini', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-RM', 'Roma', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-RO', 'Rovigo', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-SA', 'Salerne', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-88', 'Sardaigne', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-SS', 'Sassari', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-SV', 'Savone', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-82', 'Sicile', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-SI', 'Sienne', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-SO', 'Sondrio', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-TA', 'Tarente', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-TE', 'Teramo', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-TR', 'Terni', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-TP', 'Trapani', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-32', 'Trentin-Haut-Adige', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-TN', 'Trente', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-TV', 'Trévise', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-TS', 'Trieste', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-TO', 'Turin', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-52', 'Toscane', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-UD', 'Udine', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-55', 'Ombrie', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-VA', 'Varèse', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-34', 'Vénétie', 'region');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-VE', 'Venise', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-VC', 'Verceil', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-VR', 'Vérone', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-VV', 'Vibo Valentia', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-VI', 'Vicence', 'province');
INSERT INTO `subdivision_IT` (`id`, `name`, `level`) VALUES ('IT-VT', 'Viterbe', 'province');
|
-- Let the `api` role---the view owner---query the data.
grant select, insert, update, delete on data.assignment_submission to api;
-- Define the who can access assignment_submission data.
-- Enable RLS on the table holding the data.
alter table data.assignment_submission enable row level security;
-- Define the RLS policy controlling what rows are visible to a
-- particular user.
create policy assignment_submission_access_policy on data.assignment_submission to api
using (
(
-- If the role is student
request.user_role() = ANY('{student,ta}'::text[])
-- They can see rows in the assignment_submissions table if
and (
-- It is an individual assignment and it has their user_id
(NOT is_team AND request.user_id() = user_id)
or
-- It is a team assignment and they are on that team
-- Note that the table constraints ensure `team_nickname`
-- is not null when `is_team` is TRUE.
(is_team AND (
EXISTS(
SELECT u.id FROM api.users as u
WHERE
u.id = request.user_id()
AND
u.team_nickname = assignment_submission.team_nickname
)
))
)
)
OR
-- faculty can see assignment_submission by all users
(request.user_role() = 'faculty')
) WITH CHECK (
(request.user_role() = 'faculty')
OR
(
-- If the role is student
request.user_role() = ANY('{student,ta}'::text[])
-- They can write rows in the assignment_submissions table if
and
(
-- The assignment is open
EXISTS(
SELECT a.slug
FROM api.assignments as a
LEFT OUTER JOIN api.assignment_grade_exceptions as e
ON (a.slug = e.assignment_slug)
LEFT OUTER JOIN api.users as u
ON (e.user_id = u.id OR e.team_nickname = u.team_nickname)
WHERE (
a.slug = data.assignment_submission.assignment_slug
and (
-- It is either open
a.is_open
-- Or they have an exception
OR (
e.closed_at > current_timestamp
AND
a.is_draft = False
AND (
-- Remember NULLs are never equal to each other
e.user_id = data.assignment_submission.user_id
OR
e.team_nickname = data.assignment_submission.team_nickname
)
)
)
)
)
)
and (
-- It is an individual assignment and it has their user_id
(NOT is_team AND request.user_id() = user_id)
or
-- It is a team assignment and they are on the team
-- for which they are making a submission
(is_team AND (
-- TODO: REFACTOR to reduce code duplication with the
-- RLS policy above on reads.
EXISTS(
SELECT u.id FROM api.users as u
WHERE
u.id = request.user_id()
AND
u.team_nickname = assignment_submission.team_nickname
)
))
)
)
);
-- student users can select from this view. The RLS will
-- limit them to viewing their own assignment_submissions.
grant select, insert on api.assignment_submissions to student, ta;
-- faculty have CRUD privileges
grant usage on data.assignment_submission_id_seq to faculty, ta, student;
grant select, insert, update, delete on api.assignment_submissions to faculty;
|
-- file:tstypes.sql ln:204 expect:true
SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bases')
|
<reponame>Shuttl-Tech/antlr_psql
-- file:oidjoins.sql ln:44 expect:true
SELECT ctid, aggtranstype
FROM pg_catalog.pg_aggregate fk
WHERE aggtranstype != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.aggtranstype)
|
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 07, 2021 at 06:48 PM
-- Server version: 10.4.6-MariaDB
-- PHP Version: 7.3.8
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: `insurance`
--
-- --------------------------------------------------------
--
-- Table structure for table `address`
--
CREATE TABLE `address` (
`address_id` int(100) NOT NULL,
`preAddress` text NOT NULL,
`perAddress` text NOT NULL,
`email` varchar(100) NOT NULL,
`create_date` datetime NOT NULL DEFAULT current_timestamp(),
`update_date` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `address`
--
INSERT INTO `address` (`address_id`, `preAddress`, `perAddress`, `email`, `create_date`, `update_date`) VALUES
(2, '', '', '<EMAIL>', '2021-03-06 07:45:22', '2021-03-06 07:45:22');
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`admin_id` int(100) NOT NULL,
`name` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`profile_pic` varchar(1000) NOT NULL,
`create_date` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`admin_id`, `name`, `email`, `password`, `profile_pic`, `create_date`) VALUES
(1, 'jahid', '<EMAIL>', '<PASSWORD>', '<PASSWORD>', '2021-02-09');
-- --------------------------------------------------------
--
-- Table structure for table `facilities`
--
CREATE TABLE `facilities` (
`facilities_id` int(100) NOT NULL,
`facilities_name` varchar(100) NOT NULL,
`facilities_price` int(100) NOT NULL,
`image` varchar(1000) NOT NULL,
`package_id` int(100) NOT NULL,
`status` int(6) NOT NULL DEFAULT 0,
`create_date` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `facilities`
--
INSERT INTO `facilities` (`facilities_id`, `facilities_name`, `facilities_price`, `image`, `package_id`, `status`, `create_date`) VALUES
(1, 'Hospitalization (in-patient service)', 5000, '<PASSWORD>', 1, 0, '2021-02-16'),
(2, 'Out-patient service', 5000, 'b9ae47eab93172ca0522e3913cd5d507603f6f9539034', 1, 0, '2021-02-16'),
(3, 'Hospitalization (in-patient service)', 135000, 'adbc7d23694f695d7e578475a736870c603f6fb042e97', 3, 0, '2021-02-17');
-- --------------------------------------------------------
--
-- Table structure for table `gift`
--
CREATE TABLE `gift` (
`gift_id` int(10) NOT NULL,
`sender` int(100) NOT NULL,
`reciever` int(100) NOT NULL,
`Create_date` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `insurance_info`
--
CREATE TABLE `insurance_info` (
`insurance_id` int(50) NOT NULL,
`insurance_type` varchar(100) NOT NULL,
`policy_title` text NOT NULL,
`policy_icon` varchar(100) NOT NULL,
`policy_delete` int(2) NOT NULL DEFAULT 0,
`create_date` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `insurance_info`
--
INSERT INTO `insurance_info` (`insurance_id`, `insurance_type`, `policy_title`, `policy_icon`, `policy_delete`, `create_date`) VALUES
(1, 'Health Insurance', 'Custom-tailored Health and Life Insurance plan to suit the changing needs of you and your family.', 'life', 0, '2021-02-13 18:17:38'),
(2, 'Automobiles', 'Kick start a hassle-free ride! A worry-free journey ensured with our convenient combos of Motor & Life/Health insurance coverage.', 'automobiles', 1, '2021-02-13 18:28:35'),
(3, 'Life Insurance', 'Be it for your loved one’s future, we offer the simplest of all', 'health', 1, '2021-02-13 18:29:25'),
(4, 'Savings', 'Do not save what is left after spending; instead spend what is left after saving. This is not only for you , but also for your family.', 'savings', 1, '2021-02-13 20:37:08');
-- --------------------------------------------------------
--
-- Table structure for table `nominee`
--
CREATE TABLE `nominee` (
`nominee_id` int(10) NOT NULL,
`nominee_nid` int(100) NOT NULL,
`full_name` varchar(100) NOT NULL,
`relation_ship` varchar(100) NOT NULL,
`birth_date` date NOT NULL,
`email` varchar(100) NOT NULL,
`phone` int(100) NOT NULL,
`flat_area` varchar(100) NOT NULL,
`post_office` varchar(100) NOT NULL,
`thana` varchar(100) NOT NULL,
`district` varchar(100) NOT NULL,
`post_code` int(100) NOT NULL,
`division` varchar(100) NOT NULL,
`order_id` int(100) NOT NULL,
`create_date` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `nominee`
--
INSERT INTO `nominee` (`nominee_id`, `nominee_nid`, `full_name`, `relation_ship`, `birth_date`, `email`, `phone`, `flat_area`, `post_office`, `thana`, `district`, `post_code`, `division`, `order_id`, `create_date`) VALUES
(3, 123456789, 'MD. <NAME>', 'mother', '1971-09-03', '<EMAIL>', 1749903970, '10/1 Mayakanan , P.O : Basabo , P.S.: Sabujbagh', 'a', 'a', 'a', 1214, 'a', 2, '2021-03-05 00:28:23');
-- --------------------------------------------------------
--
-- Table structure for table `orders`
--
CREATE TABLE `orders` (
`order_id` int(100) NOT NULL,
`customer_id` int(100) NOT NULL,
`customer_nid` int(100) NOT NULL,
`customer_name` varchar(100) NOT NULL,
`package_id` int(100) NOT NULL,
`phone_number` int(100) NOT NULL,
`email` varchar(100) NOT NULL,
`payment_status` int(100) NOT NULL DEFAULT 0,
`nominee_nid` int(100) NOT NULL,
`order_time` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `orders`
--
INSERT INTO `orders` (`order_id`, `customer_id`, `customer_nid`, `customer_name`, `package_id`, `phone_number`, `email`, `payment_status`, `nominee_nid`, `order_time`) VALUES
(2, 17, 123456789, 'Md. Raju', 1, 1749903970, '<EMAIL>', 0, 123456789, '2021-03-05 00:28:23');
-- --------------------------------------------------------
--
-- Table structure for table `package`
--
CREATE TABLE `package` (
`package_id` int(100) NOT NULL,
`package_name` varchar(100) NOT NULL,
`premium` int(100) NOT NULL,
`coverage` int(100) NOT NULL,
`package_title` varchar(100) NOT NULL,
`insurance_id` int(100) NOT NULL,
`package_delete` int(100) NOT NULL,
`create_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`update_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `package`
--
INSERT INTO `package` (`package_id`, `package_name`, `premium`, `coverage`, `package_title`, `insurance_id`, `package_delete`, `create_date`, `update_date`) VALUES
(1, 'Assure Health (Bronze)', 350, 50000, 'For 1 year & 1 person by Chartered Life Insurance Co. Ltd.', 1, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(2, 'Assure Health (Silver)', 1700, 100000, 'For 1 year & 1 person by Chartered Life Insurance Co. Ltd.', 1, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `reciever`
--
CREATE TABLE `reciever` (
`reciever_id` int(50) NOT NULL,
`name` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`phone` int(100) NOT NULL,
`create_date` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`user_id` int(100) NOT NULL,
`nid_number` int(100) NOT NULL,
`name` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`phoneNumber` int(100) NOT NULL,
`password` varchar(100) NOT NULL,
`profile_picture` varchar(1000) NOT NULL DEFAULT 'avatar',
`gender` varchar(100) NOT NULL,
`status` int(10) NOT NULL DEFAULT 1,
`createDate` date NOT NULL DEFAULT current_timestamp(),
`updateDate` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`user_id`, `nid_number`, `name`, `email`, `phoneNumber`, `password`, `profile_picture`, `gender`, `status`, `createDate`, `updateDate`) VALUES
(22, 963258741, '<NAME>', '<EMAIL>', 1236985471, '12345', 'avatar', 'male', 0, '2021-03-06', '0000-00-00');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `address`
--
ALTER TABLE `address`
ADD PRIMARY KEY (`address_id`);
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`admin_id`);
--
-- Indexes for table `facilities`
--
ALTER TABLE `facilities`
ADD PRIMARY KEY (`facilities_id`);
--
-- Indexes for table `gift`
--
ALTER TABLE `gift`
ADD PRIMARY KEY (`gift_id`);
--
-- Indexes for table `insurance_info`
--
ALTER TABLE `insurance_info`
ADD PRIMARY KEY (`insurance_id`);
--
-- Indexes for table `nominee`
--
ALTER TABLE `nominee`
ADD PRIMARY KEY (`nominee_id`);
--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`order_id`);
--
-- Indexes for table `package`
--
ALTER TABLE `package`
ADD PRIMARY KEY (`package_id`);
--
-- Indexes for table `reciever`
--
ALTER TABLE `reciever`
ADD PRIMARY KEY (`reciever_id`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`user_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `address`
--
ALTER TABLE `address`
MODIFY `address_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `admin_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `facilities`
--
ALTER TABLE `facilities`
MODIFY `facilities_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `gift`
--
ALTER TABLE `gift`
MODIFY `gift_id` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `insurance_info`
--
ALTER TABLE `insurance_info`
MODIFY `insurance_id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `nominee`
--
ALTER TABLE `nominee`
MODIFY `nominee_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
MODIFY `order_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `package`
--
ALTER TABLE `package`
MODIFY `package_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `reciever`
--
ALTER TABLE `reciever`
MODIFY `reciever_id` int(50) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
MODIFY `user_id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
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 */;
|
/*
Warnings:
- A unique constraint covering the columns `[firstMessageId]` on the table `Thread` will be added. If there are existing duplicate values, this will fail.
*/
-- AlterTable
ALTER TABLE "Thread" ADD COLUMN "firstMessageId" TEXT;
-- CreateIndex
CREATE UNIQUE INDEX "Thread_firstMessageId_key" ON "Thread"("firstMessageId");
-- AddForeignKey
ALTER TABLE "Thread" ADD CONSTRAINT "Thread_firstMessageId_fkey" FOREIGN KEY ("firstMessageId") REFERENCES "Message"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
-- 08.07.2016 11:40
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_PrintFormat (AD_Client_ID,AD_Org_ID,AD_PrintColor_ID,AD_PrintFont_ID,AD_Printformat_Group,AD_PrintFormat_ID,AD_PrintPaper_ID,AD_PrintTableFormat_ID,AD_Table_ID,CreateCopy,Created,CreatedBy,FooterMargin,HeaderMargin,IsActive,IsDefault,IsForm,IsStandardHeaderFooter,IsTableBased,JasperProcess_ID,Name,Updated,UpdatedBy) VALUES (1000000,1000000,100,160,'None',540054,102,100,319,'N',TO_TIMESTAMP('2016-07-08 11:40:42','YYYY-MM-DD HH24:MI:SS'),100,0,0,'Y','N','N','Y','Y',540698,'Lieferschein ohne Preis',TO_TIMESTAMP('2016-07-08 11:40:42','YYYY-MM-DD HH24:MI:SS'),100)
;
|
INSERT INTO `{table.users}` VALUES ('{0}', '{1}', '{2}', '{3}'); |
<gh_stars>10-100
SELECT DISTINCT [CONCEPT_CODE], [CONCEPT_ID]
FROM [CONCEPT]
WHERE VOCABULARY_ID = 24 |
<filename>obevo-db-impls/obevo-db-oracle/src/test/resources/reveng/oracle/expected/DBDEPLOY01/sequence/MYSEQ1.sql
CREATE SEQUENCE MYSEQ1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE NOKEEP NOSCALE GLOBAL
GO |
<filename>medium/_02_xtests/cases/cast2.sql
autocommit off;
create class foo (
num numeric(5,2), i integer, s short,
f float, r real, d double, m monetary,
si set(int), ms multiset(numeric, string), sq sequence(float),
dt date, t time, ut timestamp, vb bit varying(4), b bit(11));
insert into foo values(123.45, 345, 127, 23.456e0, 123.45e0, 1.2234342e0,$12.56, set{1,2,3,4}, multiset{1.234, 'test1', 23.45},
sequence{1.234e0, 23.45e0}, date '05/17/1973',
time '12:33 PM', timestamp '02/14/1994 12:30pm',
b'1010', b'1100110011');
select * from foo;
select cast(345 as int) from class db_user;
select cast(i as int) from foo;
select cast(345 as smallint) from class db_user;
select cast(i as smallint) from foo;
select cast(345 as numeric(7,2)) from class db_user;
select cast(i as numeric(7,2)) from foo;
select cast(345 as double) from class db_user;
select cast(i as double) from foo;
select cast(345 as monetary) from class db_user;
select cast(i as monetary) from foo;
select cast(345 as char(50)) from class db_user;
select cast(i as char(50)) from foo;
select cast(345 as varchar(50)) from class db_user;
select cast(i as varchar(50)) from foo;
select cast(345 as nchar(50)) from class db_user;
select cast(i as nchar varying(50)) from foo;
select cast(s as int) from foo;
select cast(s as smallint) from foo;
select cast(s as numeric(7,2)) from foo;
select cast(s as double) from foo;
select cast(s as monetary) from foo;
select cast(s as char(50)) from foo;
select cast(s as varchar(50)) from foo;
select cast(s as nchar(50)) from foo;
select cast(s as nchar varying(50)) from foo;
select cast(123.45 as int) from class db_user;
select cast(num as int) from foo;
select cast(123.45 as smallint) from class db_user;
select cast(num as smallint) from foo;
select cast(123.45 as numeric(7,2)) from class db_user;
select cast(num as numeric(7,2)) from foo;
select cast(123.45 as double) from class db_user;
select cast(num as double) from foo;
select cast(123.45 as float) from class db_user;
select cast(num as float) from foo;
select cast(123.45 as monetary) from class db_user;
select cast(num as monetary) from foo;
select cast(123.45 as char(50)) from class db_user;
select cast(num as char(50)) from foo;
select cast(123.45 as varchar(50)) from class db_user;
select cast(num as varchar(50)) from foo;
select cast(123.45 as nchar(50)) from class db_user;
select cast(num as nchar(50)) from foo;
select cast(123.45 as nchar varying(50)) from class db_user;
select cast(num as nchar varying(50)) from foo;
select cast(f as int) from foo;
select cast(f as smallint) from foo;
select cast(f as numeric(5,2)) from foo;
select cast(r as float) from foo;
select cast(f as double) from foo;
select cast(f as monetary) from foo;
select cast(f as char(50)) from foo;
select cast(f as varchar(50)) from foo;
select cast(f as nchar(50)) from foo;
select cast(f as nchar varying(50)) from foo;
select cast(r as int) from foo;
select cast(r as smallint) from foo;
select cast(r as numeric(5,2)) from foo;
select cast(r as float) from foo;
select cast(r as double) from foo;
select cast(r as monetary) from foo;
select cast(r as char(50)) from foo;
select cast(r as varchar(50)) from foo;
select cast(r as nchar(50)) from foo;
select cast(r as nchar varying(50)) from foo;
select cast(d as int) from foo;
select cast(d as smallint) from foo;
select cast(d as numeric(5,2)) from foo;
select cast(d as float) from foo;
select cast(d as double) from foo;
select cast(d as monetary) from foo;
select cast(d as char(50)) from foo;
select cast(d as varchar(50)) from foo;
select cast(d as nchar(50)) from foo;
select cast(d as nchar varying(50)) from foo;
select cast($12.34 as int) from class db_user;
select cast(m as int) from foo;
select cast($12.34 as smallint) from class db_user;
select cast(m as smallint) from foo;
select cast($12.34 as numeric(7,2)) from class db_user;
select cast(m as numeric(7,2)) from foo;
select cast($12.34 as double) from class db_user;
select cast(m as double) from foo;
select cast($12.34 as float) from class db_user;
select cast(m as float) from foo;
select cast($12.34 as char(50)) from class db_user;
select cast(m as char(50)) from foo;
select cast($12.34 as varchar(50)) from class db_user;
select cast(m as varchar(50)) from foo;
select cast($12.34 as nchar(50)) from class db_user;
select cast(m as nchar(50)) from foo;
select cast($12.34 as nchar varying(50)) from class db_user;
select cast(m as nchar varying(50)) from foo;
select cast('123' as int) from class db_user;
select cast('123' as smallint) from class db_user;
select cast('123' as numeric(7,2)) from class db_user;
select cast('123' as float) from class db_user;
select cast('123' as double) from class db_user;
select cast('123' as monetary) from class db_user;
select cast('123' as char(5)) from class db_user;
select cast('123' as varchar(5)) from class db_user;
select cast(N'123' as nchar(5)) from class db_user;
select cast(N'123' as nchar varying(5)) from class db_user;
select cast(b'101' as bit(16)) from class db_user;
select cast(b'101' as bit varying(16)) from class db_user;
select cast('1/1/94' as date) from class db_user;
select cast('11:00' as time) from class db_user;
select cast('1/1/1994 11:00' as timestamp) from class db_user;
select cast(b'10101' as bit(16)) from class db_user;
select cast(b as bit(16)) from foo;
select cast(b'10101' as bit varying(16)) from class db_user;
select cast(b as bit varying(16)) from foo;
select cast(b'10101' as char(50)) from class db_user;
select cast(b as char(50)) from foo;
select cast(b'10101' as varchar(50)) from class db_user;
select cast(b as varchar(50)) from foo;
select cast(b'10101' as nchar(50)) from class db_user;
select cast(b as nchar(50)) from foo;
select cast(b'10101' as nchar varying(50)) from class db_user;
select cast(b as nchar varying(50)) from foo;
select cast(vb as bit(16)) from foo;
select cast(vb as bit varying(16)) from foo;
select cast(vb as char(50)) from foo;
select cast(vb as varchar(50)) from foo;
select cast(vb as nchar(50)) from foo;
select cast(vb as nchar varying(50)) from foo;
select cast(date '10/09/1994' as date) from class db_user;
select cast(dt as date) from foo;
select cast(date '10/09/1994' as timestamp) from class db_user;
select cast(dt as timestamp) from foo;
select cast(date '10/09/1994' as char(50)) from class db_user;
select cast(dt as char(50)) from foo;
select cast(date '10/09/1994' as varchar(50)) from class db_user;
select cast(dt as varchar(50)) from foo;
select cast(date '10/09/1994' as nchar(50)) from class db_user;
select cast(dt as nchar(50)) from foo;
select cast(date '10/09/1994' as nchar varying(50)) from class db_user;
select cast(dt as nchar varying(50)) from foo;
select cast(time '12:33 PM' as time) from class db_user;
select cast(t as time) from foo;
select cast(time '12:33 PM' as char(50)) from class db_user;
select cast(t as char(50)) from foo;
select cast(time '12:33 PM' as varchar(50)) from class db_user;
select cast(t as varchar(50)) from foo;
select cast(time '12:33 PM' as nchar(50)) from class db_user;
select cast(t as nchar(50)) from foo;
select cast(time '12:33 PM' as nchar varying(50)) from class db_user;
select cast(t as nchar varying(50)) from foo;
select cast(timestamp '01/14/1994 12:34 PM' as timestamp)
from class db_user;
select cast(ut as timestamp)
from foo;
select cast(timestamp '01/14/1994 12:34 PM' as time)
from class db_user;
select cast(ut as time)
from foo;
select cast(timestamp '01/14/1994 12:34 PM' as date)
from class db_user;
select cast(ut as date)
from foo;
select cast(timestamp '01/14/1994 12:34 PM' as char(50))
from class db_user;
select cast(ut as char(50))
from foo;
select cast(timestamp '01/14/1994 12:34 PM' as varchar(50))
from class db_user;
select cast(ut as varchar(50))
from foo;
select cast(timestamp '01/14/1994 12:34 PM' as nchar(50))
from class db_user;
select cast(ut as nchar(50))
from foo;
select cast(timestamp '01/14/1994 12:34 PM' as nchar varying(50))
from class db_user;
select cast(ut as nchar varying(50))
from foo;
select cast(set{1,2} as set) from class db_user;
select cast(si as set) from foo;
select cast(set{1,2} as multiset) from class db_user;
select cast(si as multiset) from foo;
select cast(multiset{1,2} as set) from class db_user;
select cast(ms as set) from foo;
select cast(multiset{1,2} as multiset) from class db_user;
select cast(ms as multiset) from foo;
select cast(sequence{1,2} as sequence) from class db_user;
select cast(sq as sequence) from foo;
drop foo;
rollback;
|
prompt --application/shared_components/navigation/lists/public_application_links
begin
-- Manifest
-- LIST: Public Application Links
-- Manifest End
wwv_flow_api.component_begin (
p_version_yyyy_mm_dd=>'2021.10.15'
,p_release=>'21.2.6'
,p_default_workspace_id=>18303204396897713
,p_default_application_id=>402
,p_default_id_offset=>0
,p_default_owner=>'BLOG_040000'
);
wwv_flow_api.create_list(
p_id=>wwv_flow_api.id(43181213072992711)
,p_name=>'Public Application Links'
,p_list_type=>'SQL_QUERY'
,p_list_query=>wwv_flow_string.join(wwv_flow_t_varchar2(
'with q1 as(',
' select 1 as display_seq',
' ,apex_lang.message(',
' ''BLOG_PUB_APP_LINK_HOME''',
' ) as list_label',
' ,blog_url.get_tab(',
' p_app_id => attribute_value',
' ,p_app_page_id => ''home''',
' ,p_canonical => ''YES''',
' ) as list_link',
' ,''fa-home'' as list_icon',
' from blog_settings',
' where 1 = 1',
' and attribute_name = ''G_PUB_APP_ID''',
' union all',
' select 2 as display_seq',
' ,apex_lang.message(',
' ''BLOG_PUB_APP_LINK_SITEMAP''',
' ) as list_label',
' ,blog_url.get_sitemap_index(',
' p_app_id => :G_PUB_APP_ID',
' ) as list_link',
' ,''fa-sitemap'' as list_icon',
' from dual',
' where 1 = 1',
' and apex_util.get_build_option_status(',
' p_application_id => :G_PUB_APP_ID',
' ,p_build_option_name => ''BLOG_FEATURE_SITEMAP''',
' ) = ''INCLUDE''',
' union all',
' select 3 as display_seq',
' ,apex_lang.message(',
' ''BLOG_PUB_APP_LINK_RSS''',
' ) as list_label',
' ,#OWNER#.blog_url.get_rss(',
' p_app_id => :G_PUB_APP_ID',
' ,p_app_page_id => ''PGM''',
' ) as list_link',
' ,''fa-rss'' as list_icon',
' from blog_settings',
' where 1 = 1',
' and attribute_name = ''G_RSS_URL''',
' and apex_util.get_build_option_status(',
' p_application_id => :G_PUB_APP_ID',
' ,p_build_option_name => ''BLOG_FEATURE_RSS''',
' ) = ''INCLUDE''',
')',
'select null as link_level',
' ,q1.list_label',
' ,q1.list_link',
' ,''N'' is_current',
' ,q1.list_icon as list_image',
' ,null as image_attribute',
' ,null as image_alt_attribute',
' ,q1.list_link as attribute1',
' ,null as attribute2',
' ,''target="_blank"'' as attribute3',
'from q1',
'order by q1.display_seq',
''))
,p_list_status=>'PUBLIC'
);
wwv_flow_api.component_end;
end;
/
|
SELECT pstate || ' has the city ' || pcity AS "TOWNS" FROM people ORDER BY pstate ASC, pcity DESC; |
/*Query with multiple JOINs
Exercise: join multiple tables with two or more JOINs (15 min)
Notes: Work in groups of three.
Use the PostgreSQL Shell terminal to restore the text file readychef.sql file using the "/i filename".
Instructions:*/
-- tables
SELECT *
FROM da_readychef.events
LIMIT 100
SELECT *
FROM da_readychef.meals
LIMIT 100
SELECT *
FROM da_readychef.referrals
LIMIT 100
SELECT *
FROM da_readychef.users
LIMIT 100
SELECT *
FROM da_readychef.visits
LIMIT 100
--1. Create a query that returns the count of the visits for each userID.
SELECT userid, COUNT(*)
FROM da_readychef.visits
GROUP BY userid
ORDER BY 2
--2. Add to the query so that the user's name is returned instead of the userID.
SELECT u.campaign_id, COUNT(v.userid)
FROM da_readychef.visits v
INNER JOIN da_readychef.users u ON v.userid = u.userid
GROUP BY campaign_id
ORDER BY 2
--3.Modify the query so that only users that had an event are returned.
SELECT u.campaign_id, event, COUNT(v.userid)
FROM da_readychef.visits v
INNER JOIN da_readychef.users u ON v.userid = u.userid
INNER JOIN da_readychef.events e ON v.userid = e.userid
GROUP BY campaign_id, event
ORDER BY 1 |
<filename>back/src/main/resources/data.sql
insert into hd_admin (username, password,createtime) values ('admin', '<PASSWORD>',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('儿科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('妇产科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('内科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('中医科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('骨科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('消化内科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('男科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('外科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('耳鼻喉科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('心理科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('眼科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('营养科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('神经内科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('肿瘤内科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('口腔科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into `hd_doctor_department`(`title`,`img`,`createtime`) values ('心内科','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg',now());
insert into hd_user (mobile,username, password,avatar, createtime,content) values ('15057190640','hd10001', 'e10adc3949ba59abbe56e057f20f883e','/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg', now(),'');
insert into hd_user (mobile,username, password, createtime,content) values ('15057190642','hd10002', 'e10adc3949ba59abbe56e057f20f883e', now(),'');
insert into hd_user (mobile,username, password, createtime,content) values ('15057190643','hd10003', 'e<PASSWORD>', now(),'');
insert into hd_user (mobile,username, password, createtime,content) values ('15057190644','hd10004', 'e<PASSWORD>', now(),'');
insert into hd_user (mobile,username, password, createtime,content) values ('15057190645','hd10005', '<PASSWORD>', now(),'');
insert into hd_user (mobile,username, password, createtime,content) values ('15057190646','hd10006', '<PASSWORD>', now(),'');
insert into hd_user (mobile,username, password, createtime,content) values ('15057190647','hd10007', 'e<PASSWORD>abbe56e057f20f883e', now(),'');
insert into hd_user (mobile,username, password, createtime,content) values ('15057190648','hd10008', 'e10adc3949ba59abbe56e057f20f883e', now(),'');
insert into hd_user (mobile,username, password, createtime,content) values ('15057190649','hd10009', 'e10adc3949ba5<PASSWORD>56e057f20f883e', now(),'');
insert into hd_user (mobile,username, password, createtime,content) values ('15057190650','hd10010','e<PASSWORD>', now(),'');
insert into hd_user (mobile,username, password, createtime,content) values ('15057190651','hd10011', 'e<PASSWORD>', now(),'');
insert into hd_user (realname,mobile,username, password, createtime,content,isdoctor,department,hospital,`level`,goodat,`money`,`duration`) values ('王医生1','15057190652','hd10012', 'e1<PASSWORD>', now(),'',1,3,'人民医院','主任医师','擅长内科',2000,10);
insert into hd_user (realname,mobile,username, password, createtime,content,isdoctor,department,hospital,`level`,goodat,`money`,`duration`) values ('王医生2','15057190653','hd10013', 'e10adc3949ba59abbe56e057f20f883e', now(),'',1,8,'人民医院','主任医师','擅长外科',3000,15);
insert into hd_user (realname,mobile,username, password, createtime,content,isdoctor,department,hospital,`level`,goodat,`money`,`duration`) values ('王医生3','15057190654','hd10014', 'e10adc3949ba59abbe56e057f20f883e', now(),'',1,3,'人民医院','主任医师','擅长内科',1500,12);
insert into hd_user (realname,mobile,username, password, createtime,content,isdoctor,department,hospital,`level`,goodat,`money`,`duration`) values ('王医生4','15057190655','hd10015', 'e10adc3949ba59abbe56e057f20f883e', now(),'',1,1,'人民医院','主任医师','擅长儿科',2000,10);
insert into hd_user (realname,mobile,username, password, createtime,content,isdoctor,department,hospital,`level`,goodat,`money`,`duration`) values ('王医生5','15057190656','hd10016', '<PASSWORD>', now(),'',1,3,'人民医院','主任医师','擅长内科',2000,10);
insert into hd_user (realname,mobile,username, password, createtime,content,isdoctor,department,hospital,`level`,goodat,`money`,`duration`) values ('王医生6','15057190657','hd10017','e10adc3949ba59abbe56e057f20f883e', now(),'',1,3,'人民医院','主任医师','擅长内科',1500,12);
insert into hd_user (realname,mobile,username, password, createtime,content,isdoctor,department,hospital,`level`,goodat,`money`,`duration`) values ('王医生7','15057190658','hd10018', '<PASSWORD>', now(),'',1,3,'人民医院','主任医师','擅长内科',1800,15);
insert into hd_user (realname,mobile,username, password, createtime,content,isdoctor,department,hospital,`level`,goodat,`money`,`duration`) values ('王医生8','15057190659','hd10019', 'e10<PASSWORD>394<PASSWORD>', now(),'',1,3,'人民医院','主任医师','擅长内科',2400,18);
insert into hd_user (realname,mobile,username, password, createtime,content,isdoctor,department,hospital,`level`,goodat,`money`,`duration`) values ('王医生9','15057190660','hd10020', 'e10<PASSWORD>3<PASSWORD>', now(),'',1,3,'人民医院','主任医师','擅长内科',2500,15);
insert into hd_user (realname,mobile,username, password, createtime,content,isdoctor,department,hospital,`level`,goodat,`money`,`duration`) values ('王医生10','15057190661','hd10021', 'e10adc3949ba59abbe56e057f20f883e', now(),'',1,3,'人民医院','主任医师','擅长内科',1600,12);
insert into `hd_treatment_order`(`orderid`,`userid`,`doctorid`,`money`,`duration`,`createtime`,`state`) values ('1000001556899032',1,12,2000,10,now(),0);
insert into `hd_treatment_order`(`orderid`,`userid`,`doctorid`,`money`,`duration`,`createtime`,`state`) values ('1000001814621575',1,12,2000,10,now(),0);
insert into `hd_treatment_order`(`orderid`,`userid`,`doctorid`,`money`,`duration`,`createtime`,`state`) values ('1000000419839389',1,12,2000,10,now(),0);
insert into `hd_treatment_order`(`orderid`,`userid`,`doctorid`,`money`,`duration`,`createtime`,`state`) values ('1000001001799851',1,12,2000,10,now(),0);
insert into `hd_treatment_order`(`orderid`,`userid`,`doctorid`,`money`,`duration`,`createtime`,`state`) values ('1000000146524839',1,12,2000,10,now(),0);
insert into `hd_treatment_order`(`orderid`,`userid`,`doctorid`,`money`,`duration`,`createtime`,`state`) values ('1000001473789764',1,12,2000,10,now(),0);
insert into `hd_treatment_order`(`orderid`,`userid`,`doctorid`,`money`,`duration`,`createtime`,`state`) values ('1000000556433802',1,12,2000,10,now(),0);
insert into `hd_treatment_order`(`orderid`,`userid`,`doctorid`,`money`,`duration`,`createtime`,`state`) values ('1000000613496243',1,12,2000,10,now(),0);
insert into `hd_treatment_order`(`orderid`,`userid`,`doctorid`,`money`,`duration`,`createtime`,`state`) values ('1000001491945635',1,12,2000,10,now(),0);
insert into `hd_treatment_order`(`orderid`,`userid`,`doctorid`,`money`,`duration`,`createtime`,`state`) values ('1000000274037818',1,12,2000,10,now(),0);
insert into `hd_treatment_order`(`orderid`,`userid`,`doctorid`,`money`,`duration`,`createtime`,`state`) values ('1000001772560398',1,12,2000,10,now(),0);
insert into hd_user_address (userid, realname,mobile,province,city,area,address, createtime) values (1,'陈东谱', 18329123270,'湖北省','武穴市','余川镇','龟山村3组47号', now());
insert into hd_user_address (userid, realname,mobile,province,city,area,address, createtime) values (1,'陈东谱', 15057190640,'湖北省','武穴市','余川镇','龟山村3组47号', now());
insert into hd_user_address (userid, realname,mobile,province,city,area,address, createtime) values (1,'陈东谱', 15057190641,'湖北省','武穴市','余川镇','龟山村3组47号', now());
insert into hd_user_address (userid, realname,mobile,province,city,area,address, createtime) values (1,'陈东谱', 15057190642,'湖北省','武穴市','余川镇','龟山村3组47号', now());
insert into hd_user_address (userid, realname,mobile,province,city,area,address, createtime) values (1,'陈东谱', 15057190643,'湖北省','武穴市','余川镇','龟山村3组47号', now());
insert into hd_user_address (userid, realname,mobile,province,city,area,address, createtime) values (1,'陈东谱', 15057190644,'湖北省','武穴市','余川镇','龟山村3组47号', now());
insert into hd_user_address (userid, realname,mobile,province,city,area,address, createtime) values (1,'陈东谱', 15057190645,'湖北省','武穴市','余川镇','龟山村3组47号', now());
insert into hd_user_address (userid, realname,mobile,province,city,area,address, createtime) values (1,'陈东谱', 15057190646,'湖北省','武穴市','余川镇','龟山村3组47号', now());
insert into hd_user_address (userid, realname,mobile,province,city,area,address, createtime) values (1,'陈东谱', 15057190647,'湖北省','武穴市','余川镇','龟山村3组47号', now());
insert into hd_user_address (userid, realname,mobile,province,city,area,address, createtime) values (1,'陈东谱', 15057190648,'湖北省','武穴市','余川镇','龟山村3组47号', now());
insert into hd_user_address (userid, realname,mobile,province,city,area,address, createtime) values (1,'陈东谱', 15057190649,'湖北省','武穴市','余川镇','龟山村3组47号', now());
insert into hd_article_category (title,createtime) values ('饮食健康',now());
insert into hd_article_category (title,createtime) values ('两性健康',now());
insert into hd_article_category (title,createtime) values ('孕产育儿',now());
insert into hd_article_category (title,createtime) values ('常见疾病',now());
insert into hd_user_article (userid,categoryid,title, img, content,createtime,readnum,likenum) values (1,1,'武汉,加油', 'http://','武汉一定要挺住,向白衣天使致敬,你们辛苦了,熬过这个艰难的时刻,武汉加油!',now(),1,1);
insert into hd_user_article (userid,categoryid,title, img, content,createtime,author,keyword,state) values (1,1,'武汉,加油01', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','武汉一定要挺住,向白衣天使致敬,你们辛苦了,熬过这个艰难的时刻,武汉加油!',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title, img, content,createtime,author,keyword,state) values (1,1,'武汉,加油02', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','武汉一定要挺住,向白衣天使致敬,你们辛苦了,熬过这个艰难的时刻,武汉加油!',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title, img, content,createtime,author,keyword,state) values (1,1,'武汉,加油03', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','武汉一定要挺住,向白衣天使致敬,你们辛苦了,熬过这个艰难的时刻,武汉加油!',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title, img, content,createtime,author,keyword,state) values (1,1,'武汉,加油04', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','武汉一定要挺住,向白衣天使致敬,你们辛苦了,熬过这个艰难的时刻,武汉加油!',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title, img, content,createtime,author,keyword,state) values (1,1,'武汉,加油05', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','武汉一定要挺住,向白衣天使致敬,你们辛苦了,熬过这个艰难的时刻,武汉加油!',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title, img, content,createtime,author,keyword,state) values (1,1,'武汉,加油06', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','武汉一定要挺住,向白衣天使致敬,你们辛苦了,熬过这个艰难的时刻,武汉加油!',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title, img, content,createtime,author,keyword,state) values (1,1,'武汉,加油07', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','武汉一定要挺住,向白衣天使致敬,你们辛苦了,熬过这个艰难的时刻,武汉加油!',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title, img, content,createtime,author,keyword,state) values (1,1,'武汉,加油08', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','武汉一定要挺住,向白衣天使致敬,你们辛苦了,熬过这个艰难的时刻,武汉加油!',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title, img, content,createtime,author,keyword,state) values (1,1,'武汉,加油09', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','武汉一定要挺住,向白衣天使致敬,你们辛苦了,熬过这个艰难的时刻,武汉加油!',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title,type, img, content,createtime,author,keyword,state) values (1,1,'野生动物',1, '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title,type, img, content,createtime,author,keyword,state) values (1,1,'野生动物01',1, '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title,type, img, content,createtime,author,keyword,state) values (1,1,'野生动物02',1, '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title,type, img, content,createtime,author,keyword,state) values (1,1,'野生动物03',1, '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title,type, img, content,createtime,author,keyword,state) values (1,1,'野生动物04',1, '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title,type, img, content,createtime,author,keyword,state) values (1,1,'野生动物05',1, '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title,type, img, content,createtime,author,keyword,state) values (1,1,'野生动物06',1, '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title,type, img, content,createtime,author,keyword,state) values (1,1,'野生动物07',1, '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title,type, img, content,createtime,author,keyword,state) values (1,1,'野生动物08',1, '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now(),'陈东谱','武汉',1);
insert into hd_user_article (userid,categoryid,title,type, img, content,createtime,author,keyword,state) values (1,1,'野生动物09',1, '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now(),'陈东谱','武汉',1);
insert into hd_user_article_read (userid,aid) values (1,1);
insert into hd_user_article_read (userid,aid) values (1,2);
insert into hd_user_article_read (userid,aid) values (1,3);
insert into hd_user_article_read (userid,aid) values (1,4);
insert into hd_user_article_read (userid,aid) values (1,5);
insert into hd_user_article_read (userid,aid) values (1,6);
insert into hd_user_article_read (userid,aid) values (1,7);
insert into hd_user_article_read (userid,aid) values (1,8);
insert into hd_user_concern (userid,concernid) values (1,2);
insert into hd_user_concern (userid,concernid) values (1,3);
insert into hd_user_concern (userid,concernid) values (1,4);
insert into hd_user_concern (userid,concernid) values (1,5);
insert into hd_user_concern (userid,concernid) values (1,6);
insert into hd_user_concern (userid,concernid) values (1,7);
insert into hd_user_concern (userid,concernid) values (2,1);
insert into hd_user_concern (userid,concernid) values (3,1);
insert into hd_user_concern (userid,concernid) values (4,1);
insert into hd_user_concern (userid,concernid) values (8,1);
insert into hd_user_concern (userid,concernid) values (9,1);
insert into hd_user_concern (userid,concernid) values (10,1);
insert into hd_user_video (userid,title, img, video,createtime) values (1,'apple分享视频', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now());
insert into hd_user_video (userid,title, img, video,createtime) values (1,'野生动物', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now());
insert into hd_user_video (userid,title, img, video,createtime) values (1,'野生动物01', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now());
insert into hd_user_video (userid,title, img, video,createtime) values (1,'野生动物02', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now());
insert into hd_user_video (userid,title, img, video,createtime) values (1,'野生动物03', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now());
insert into hd_user_video (userid,title, img, video,createtime) values (1,'野生动物04', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now());
insert into hd_user_video (userid,title, img, video,createtime) values (1,'野生动物05', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now());
insert into hd_user_video (userid,title, img, video,createtime) values (1,'野生动物06', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now());
insert into hd_user_video (userid,title, img, video,createtime) values (1,'野生动物07', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now());
insert into hd_user_video (userid,title, img, video,createtime) values (1,'野生动物08', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now());
insert into hd_user_video (userid,title, img, video,createtime) values (1,'野生动物09', '/imgupload/d8744c4f60894af59ee233c4aaccba4e.jpg','/movupload/4fd6bb372dc8427eb856d2bbd2704a96.wmv',now());
insert into hd_user_article_collect (userid,aid) values (1,1);
insert into hd_user_article_collect (userid,aid) values (1,2);
insert into hd_user_article_collect (userid,aid) values (1,3);
insert into hd_user_article_collect (userid,aid) values (1,4);
insert into hd_user_article_collect (userid,aid) values (1,5);
insert into hd_user_article_collect (userid,aid) values (1,6);
insert into hd_user_article_collect (userid,aid) values (1,7);
insert into hd_user_test (userid,title, content,createtime) values (1,'测评标题01', '测评介绍01',now());
insert into hd_user_test (userid,title, content,createtime) values (1,'测评标题02', '测评介绍02',now());
insert into hd_user_test (userid,title, content,createtime) values (1,'测评标题03', '测评介绍03',now());
insert into hd_user_test (userid,title, content,createtime) values (1,'测评标题04', '测评介绍04',now());
insert into hd_user_test (userid,title, content,createtime) values (1,'测评标题05', '测评介绍05',now());
insert into hd_user_test (userid,title, content,createtime) values (1,'测评标题06', '测评介绍06',now());
insert into hd_user_test (userid,title, content,createtime) values (1,'测评标题07', '测评介绍07',now());
insert into hd_user_test (userid,title, content,createtime) values (1,'测评标题08', '测评介绍08',now());
insert into hd_user_test (userid,title, content,createtime) values (1,'测评标题09', '测评介绍09',now());
insert into hd_user_question (userid,title, type,score,createtime) values (1,'你选择网购的主要原因01?',0,10,now());
insert into hd_user_question (userid,title, type,score,createtime) values (1,'你选择网购的主要原因02?',1,10,now());
insert into hd_user_question (userid,title, type,score,createtime) values (1,'你选择网购的主要原因03?',0,10,now());
insert into hd_user_question (userid,title, type,score,createtime) values (1,'你选择网购的主要原因04?',0,10,now());
insert into hd_user_question (userid,title, type,score,createtime) values (1,'你选择网购的主要原因05?',1,10,now());
insert into hd_user_question (userid,title, type,score,createtime) values (1,'你选择网购的主要原因06?',1,10,now());
insert into hd_user_question (userid,title, type,score,createtime) values (1,'你选择网购的主要原因07?',0,10,now());
insert into hd_user_question (userid,title, type,score,createtime) values (1,'你选择网购的主要原因08?',0,10,now());
insert into hd_user_question (userid,title, type,score,createtime) values (1,'你选择网购的主要原因09?',0,10,now());
insert into hd_user_question_choice (questionid,choice) values (1,'方便快捷');
insert into hd_user_question_choice (questionid,choice) values (1,'品类齐全');
insert into hd_user_question_choice (questionid,choice) values (1,'价格便宜');
insert into hd_user_question_choice (questionid,choice) values (2,'方便快捷');
insert into hd_user_question_choice (questionid,choice) values (2,'品类齐全');
insert into hd_user_question_choice (questionid,choice) values (2,'价格便宜');
insert into hd_user_question_choice (questionid,choice) values (3,'方便快捷');
insert into hd_user_question_choice (questionid,choice) values (3,'品类齐全');
insert into hd_user_question_choice (questionid,choice) values (3,'价格便宜');
insert into hd_user_question_choice (questionid,choice) values (4,'方便快捷');
insert into hd_user_question_choice (questionid,choice) values (4,'品类齐全');
insert into hd_user_question_choice (questionid,choice) values (4,'价格便宜');
insert into hd_user_question_choice (questionid,choice) values (5,'方便快捷');
insert into hd_user_question_choice (questionid,choice) values (5,'品类齐全');
insert into hd_user_question_choice (questionid,choice) values (5,'价格便宜');
insert into hd_user_question_choice (questionid,choice) values (6,'方便快捷');
insert into hd_user_question_choice (questionid,choice) values (6,'品类齐全');
insert into hd_user_question_choice (questionid,choice) values (6,'价格便宜');
insert into hd_user_question_choice (questionid,choice) values (7,'方便快捷');
insert into hd_user_question_choice (questionid,choice) values (7,'品类齐全');
insert into hd_user_question_choice (questionid,choice) values (7,'价格便宜');
insert into hd_user_question_choice (questionid,choice) values (8,'方便快捷');
insert into hd_user_question_choice (questionid,choice) values (8,'品类齐全');
insert into hd_user_question_choice (questionid,choice) values (8,'价格便宜');
insert into hd_user_question_choice (questionid,choice) values (9,'方便快捷');
insert into hd_user_question_choice (questionid,choice) values (9,'品类齐全');
insert into hd_user_question_choice (questionid,choice) values (9,'价格便宜');
insert into hd_user_test_question (testid,questionid) values (1,1);
insert into hd_user_test_question (testid,questionid) values (1,2);
insert into hd_user_test_question (testid,questionid) values (1,3);
insert into hd_user_test_question (testid,questionid) values (2,1);
insert into hd_user_test_question (testid,questionid) values (2,2);
insert into hd_user_test_question (testid,questionid) values (2,3);
insert into hd_user_test_question (testid,questionid) values (3,1);
insert into hd_user_test_question (testid,questionid) values (3,2);
insert into hd_user_test_question (testid,questionid) values (3,3);
insert into hd_user_test_question (testid,questionid) values (4,1);
insert into hd_user_test_question (testid,questionid) values (4,2);
insert into hd_user_test_question (testid,questionid) values (4,3);
insert into hd_user_question_answer (questionid,choiceid) values (1,2);
insert into hd_user_question_answer (questionid,choiceid) values (2,4);
insert into hd_user_question_answer (questionid,choiceid) values (2,5);
insert into hd_user_question_answer (questionid,choiceid) values (3,9);
insert into hd_user_question_answer (questionid,choiceid) values (4,10);
insert into hd_user_question_answer (questionid,choiceid) values (5,14);
insert into hd_user_question_answer (questionid,choiceid) values (5,15);
insert into hd_user_question_answer (questionid,choiceid) values (6,16);
insert into hd_user_question_answer (questionid,choiceid) values (6,17);
insert into hd_user_question_answer (questionid,choiceid) values (7,19);
insert into hd_user_question_answer (questionid,choiceid) values (8,22);
insert into hd_user_question_answer (questionid,choiceid) values (9,27);
insert into `hd_user_test_report`(`testid`,`score`,`title`,`content`,`createtime`) values (1,30,'很差','需要锻炼加强营养',now());
insert into `hd_user_test_report`(`testid`,`score`,`title`,`content`,`createtime`) values (1,50,'一般','需要锻炼',now());
insert into `hd_user_test_report`(`testid`,`score`,`title`,`content`,`createtime`) values (1,70,'很棒','需要继续保持',now());
insert into `hd_user_test_log`(`userid`,`testid`,`title`,`content`,`createtime`,`score`,`result`) values (1,1,'测评标题01','测评介绍01',now(),10,'{\"packUserQuestionList\":[{\"result\":true,\"userQuestion\":{\"createtime\":1582104240000,\"id\":1,\"score\":10,\"title\":\"你选择网购的主要原因01?\",\"type\":0,\"userid\":1},\"userQuestionAnswerList\":[{\"choiceid\":2,\"questionid\":1}],\"userQuestionChoiceList\":[{\"choice\":\"方便快捷\",\"id\":1,\"questionid\":1},{\"choice\":\"品类齐全\",\"id\":2,\"questionid\":1},{\"choice\":\"价格便宜\",\"id\":3,\"questionid\":1}],\"yourAnswer\":[2]},{\"result\":false,\"userQuestion\":{\"createtime\":1582104240000,\"id\":3,\"score\":10,\"title\":\"你选择网购的主要原因03?\",\"type\":0,\"userid\":1},\"userQuestionAnswerList\":[{\"choiceid\":9,\"questionid\":3}],\"userQuestionChoiceList\":[{\"choice\":\"方便快捷\",\"id\":7,\"questionid\":3},{\"choice\":\"品类齐全\",\"id\":8,\"questionid\":3},{\"choice\":\"价格便宜\",\"id\":9,\"questionid\":3}],\"yourAnswer\":[6]},{\"result\":false,\"userQuestion\":{\"createtime\":1582104240000,\"id\":2,\"score\":10,\"title\":\"你选择网购的主要原因02?\",\"type\":1,\"userid\":1},\"userQuestionAnswerList\":[{\"choiceid\":4,\"questionid\":2},{\"choiceid\":5,\"questionid\":2}],\"userQuestionChoiceList\":[{\"choice\":\"方便快捷\",\"id\":4,\"questionid\":2},{\"choice\":\"品类齐全\",\"id\":5,\"questionid\":2},{\"choice\":\"价格便宜\",\"id\":6,\"questionid\":2}],\"yourAnswer\":[3,4]}],\"resultReport\":{\"content\":\"需要锻炼加强营养\",\"createtime\":1582104242000,\"id\":1,\"score\":30,\"testid\":1,\"title\":\"很差\"},\"userTestReportList\":[{\"content\":\"需要锻炼加强营养\",\"createtime\":1582104242000,\"id\":1,\"score\":30,\"testid\":1,\"title\":\"很差\"},{\"content\":\"需要锻炼\",\"createtime\":1582104242000,\"id\":2,\"score\":50,\"testid\":1,\"title\":\"一般\"},{\"content\":\"需要继续保持\",\"createtime\":1582104242000,\"id\":3,\"score\":70,\"testid\":1,\"title\":\"很棒\"}]}');
insert into `hd_user_test_log`(`userid`,`testid`,`title`,`content`,`createtime`,`score`,`result`) values (1,1,'测评标题01','测评介绍01',now(),10,'{\"packUserQuestionList\":[{\"result\":true,\"userQuestion\":{\"createtime\":1582104240000,\"id\":1,\"score\":10,\"title\":\"你选择网购的主要原因01?\",\"type\":0,\"userid\":1},\"userQuestionAnswerList\":[{\"choiceid\":2,\"questionid\":1}],\"userQuestionChoiceList\":[{\"choice\":\"方便快捷\",\"id\":1,\"questionid\":1},{\"choice\":\"品类齐全\",\"id\":2,\"questionid\":1},{\"choice\":\"价格便宜\",\"id\":3,\"questionid\":1}],\"yourAnswer\":[2]},{\"result\":false,\"userQuestion\":{\"createtime\":1582104240000,\"id\":3,\"score\":10,\"title\":\"你选择网购的主要原因03?\",\"type\":0,\"userid\":1},\"userQuestionAnswerList\":[{\"choiceid\":9,\"questionid\":3}],\"userQuestionChoiceList\":[{\"choice\":\"方便快捷\",\"id\":7,\"questionid\":3},{\"choice\":\"品类齐全\",\"id\":8,\"questionid\":3},{\"choice\":\"价格便宜\",\"id\":9,\"questionid\":3}],\"yourAnswer\":[6]},{\"result\":false,\"userQuestion\":{\"createtime\":1582104240000,\"id\":2,\"score\":10,\"title\":\"你选择网购的主要原因02?\",\"type\":1,\"userid\":1},\"userQuestionAnswerList\":[{\"choiceid\":4,\"questionid\":2},{\"choiceid\":5,\"questionid\":2}],\"userQuestionChoiceList\":[{\"choice\":\"方便快捷\",\"id\":4,\"questionid\":2},{\"choice\":\"品类齐全\",\"id\":5,\"questionid\":2},{\"choice\":\"价格便宜\",\"id\":6,\"questionid\":2}],\"yourAnswer\":[3,4]}],\"resultReport\":{\"content\":\"需要锻炼加强营养\",\"createtime\":1582104242000,\"id\":1,\"score\":30,\"testid\":1,\"title\":\"很差\"},\"userTestReportList\":[{\"content\":\"需要锻炼加强营养\",\"createtime\":1582104242000,\"id\":1,\"score\":30,\"testid\":1,\"title\":\"很差\"},{\"content\":\"需要锻炼\",\"createtime\":1582104242000,\"id\":2,\"score\":50,\"testid\":1,\"title\":\"一般\"},{\"content\":\"需要继续保持\",\"createtime\":1582104242000,\"id\":3,\"score\":70,\"testid\":1,\"title\":\"很棒\"}]}');
insert into `hd_user_test_log`(`userid`,`testid`,`title`,`content`,`createtime`,`score`,`result`) values (1,1,'测评标题01','测评介绍01',now(),10,'{\"packUserQuestionList\":[{\"result\":true,\"userQuestion\":{\"createtime\":1582104240000,\"id\":1,\"score\":10,\"title\":\"你选择网购的主要原因01?\",\"type\":0,\"userid\":1},\"userQuestionAnswerList\":[{\"choiceid\":2,\"questionid\":1}],\"userQuestionChoiceList\":[{\"choice\":\"方便快捷\",\"id\":1,\"questionid\":1},{\"choice\":\"品类齐全\",\"id\":2,\"questionid\":1},{\"choice\":\"价格便宜\",\"id\":3,\"questionid\":1}],\"yourAnswer\":[2]},{\"result\":false,\"userQuestion\":{\"createtime\":1582104240000,\"id\":3,\"score\":10,\"title\":\"你选择网购的主要原因03?\",\"type\":0,\"userid\":1},\"userQuestionAnswerList\":[{\"choiceid\":9,\"questionid\":3}],\"userQuestionChoiceList\":[{\"choice\":\"方便快捷\",\"id\":7,\"questionid\":3},{\"choice\":\"品类齐全\",\"id\":8,\"questionid\":3},{\"choice\":\"价格便宜\",\"id\":9,\"questionid\":3}],\"yourAnswer\":[6]},{\"result\":false,\"userQuestion\":{\"createtime\":1582104240000,\"id\":2,\"score\":10,\"title\":\"你选择网购的主要原因02?\",\"type\":1,\"userid\":1},\"userQuestionAnswerList\":[{\"choiceid\":4,\"questionid\":2},{\"choiceid\":5,\"questionid\":2}],\"userQuestionChoiceList\":[{\"choice\":\"方便快捷\",\"id\":4,\"questionid\":2},{\"choice\":\"品类齐全\",\"id\":5,\"questionid\":2},{\"choice\":\"价格便宜\",\"id\":6,\"questionid\":2}],\"yourAnswer\":[3,4]}],\"resultReport\":{\"content\":\"需要锻炼加强营养\",\"createtime\":1582104242000,\"id\":1,\"score\":30,\"testid\":1,\"title\":\"很差\"},\"userTestReportList\":[{\"content\":\"需要锻炼加强营养\",\"createtime\":1582104242000,\"id\":1,\"score\":30,\"testid\":1,\"title\":\"很差\"},{\"content\":\"需要锻炼\",\"createtime\":1582104242000,\"id\":2,\"score\":50,\"testid\":1,\"title\":\"一般\"},{\"content\":\"需要继续保持\",\"createtime\":1582104242000,\"id\":3,\"score\":70,\"testid\":1,\"title\":\"很棒\"}]}');
insert into hd_point_task (point,title, type,createtime) values (10,'马上签到,领取签到奖励10',0, now());
insert into hd_point_task (point,title, type,createtime) values (20,'马上签到,领取签到奖励20',0, now());
insert into hd_point_task (point,title, type,createtime) values (30,'马上签到,领取签到奖励30',0,now());
insert into hd_point_task (point,title, type,createtime) values (40,'马上签到,领取签到奖励40',0, now());
insert into hd_user_msg (userid,msg, type,otherid,createtime) values (1,'密码修改成功',0,0,now());
insert into hd_user_msg (userid,msg, type,otherid,createtime) values (1,'密码修改成功',0,0,now());
insert into hd_user_msg (userid,msg, type,otherid,createtime) values (1,'密码修改成功',0,0,now());
insert into hd_user_msg (userid,msg, type,otherid,createtime) values (1,'密码修改成功',0,0,now());
insert into hd_user_msg (userid,msg, type,otherid,createtime) values (1,'密码修改成功',0,0,now());
insert into hd_user_msg (userid,msg, type,otherid,createtime) values (1,'密码修改成功',0,0,now());
insert into hd_user_msg (userid,msg, type,otherid,createtime) values (1,'密码修改成功',0,0,now());
insert into hd_user_msg (userid,msg, type,otherid,createtime) values (1,'密码修改成功',0,0,now());
insert into hd_user_msg (userid,msg, type,otherid,createtime) values (1,'密码修改成功',0,0,now());
insert into hd_user_msg (userid,msg, type,otherid,createtime) values (1,'密码修改成功',0,0,now());
insert into `hd_user_task_log` (`userid`, `taskid`, `title`, `point`, `createtime`) values('1','1','马上签到,领取签到奖励10','10',now());
insert into `hd_user_task_log` (`userid`, `taskid`, `title`, `point`, `createtime`) values('1','1','马上签到,领取签到奖励10','10',now());
insert into `hd_user_task_log` (`userid`, `taskid`, `title`, `point`, `createtime`) values('1','1','马上签到,领取签到奖励10','10',now());
insert into `hd_user_task_log` (`userid`, `taskid`, `title`, `point`, `createtime`) values('1','1','马上签到,领取签到奖励10','10',now());
insert into `hd_user_task_log` (`userid`, `taskid`, `title`, `point`, `createtime`) values('1','1','马上签到,领取签到奖励10','10',now());
insert into `hd_user_task_log` (`userid`, `taskid`, `title`, `point`, `createtime`) values('1','1','马上签到,领取签到奖励10','10',now());
insert into `hd_user_task_log` (`userid`, `taskid`, `title`, `point`, `createtime`) values('1','1','马上签到,领取签到奖励10','10',now());
insert into `hd_user_task_log` (`userid`, `taskid`, `title`, `point`, `createtime`) values('1','1','马上签到,领取签到奖励10','10',now());
insert into `hd_user_task_log` (`userid`, `taskid`, `title`, `point`, `createtime`) values('1','1','马上签到,领取签到奖励10','10',now());
insert into `hd_user_task_log` (`userid`, `taskid`, `title`, `point`, `createtime`) values('1','1','马上签到,领取签到奖励10','10',now());
insert into `hd_user_cash_log` (`userid`, `money`, `bank`, `card`, `createtime`) values('21',100092,'北京银行','62312321312313',now());
insert into `hd_user_cash_log` (`userid`, `money`, `bank`, `card`, `createtime`) values('21',100093,'北京银行','62312321312313',now());
insert into `hd_user_cash_log` (`userid`, `money`, `bank`, `card`, `createtime`) values('21',100094,'北京银行','62312321312313',now());
insert into `hd_user_cash_log` (`userid`, `money`, `bank`, `card`, `createtime`) values('21',100098,'北京银行','62312321312313',now());
insert into `hd_user_cash_log` (`userid`, `money`, `bank`, `card`, `createtime`) values('21',100099,'北京银行','62312321312313',now());
insert into `hd_user_cash_log` (`userid`, `money`, `bank`, `card`, `createtime`) values('21',100098,'北京银行','62312321312313',now());
insert into `hd_user_cash_log` (`userid`, `money`, `bank`, `card`, `createtime`) values('21',100097,'北京银行','62312321312313',now());
insert into `hd_user_cash_log` (`userid`, `money`, `bank`, `card`, `createtime`) values('21',100096,'北京银行','62312321312313',now());
insert into `hd_user_cash_log` (`userid`, `money`, `bank`, `card`, `createtime`) values('21',100095,'北京银行','62312321312313',now());
insert into `hd_user_cash_log` (`userid`, `money`, `bank`, `card`, `createtime`) values('21',100094,'北京银行','62312321312313',now());
insert into `hd_user_article_comment`(`userid`,`articleid`,`comment`,`createtime`,`state`) values (1,1,'文章写的很棒!',now(),0);
insert into `hd_user_article_comment`(`userid`,`articleid`,`comment`,`createtime`,`state`) values (1,1,'文章写的很棒!',now(),0);
insert into `hd_user_article_comment`(`userid`,`articleid`,`comment`,`createtime`,`state`) values (1,1,'文章写的很棒!',now(),0);
insert into `hd_user_article_comment`(`userid`,`articleid`,`comment`,`createtime`,`state`) values (1,1,'文章写的很棒!',now(),0);
insert into `hd_user_article_comment`(`userid`,`articleid`,`comment`,`createtime`,`state`) values (1,1,'文章写的很棒!',now(),0);
insert into `hd_user_article_comment`(`userid`,`articleid`,`comment`,`createtime`,`state`) values (1,1,'文章写的很棒!',now(),0);
insert into `hd_user_article_comment`(`userid`,`articleid`,`comment`,`createtime`,`state`) values (1,1,'文章写的很棒!',now(),0);
insert into `hd_user_article_comment`(`userid`,`articleid`,`comment`,`createtime`,`state`) values (1,1,'文章写的很棒!',now(),0);
insert into `hd_user_article_comment`(`userid`,`articleid`,`comment`,`createtime`,`state`) values (1,1,'文章写的很棒!',now(),0);
insert into hd_user_article_comment_like (userid,articleid,commentid) values (1,1,1);
insert into hd_user_article_comment_like (userid,articleid,commentid) values (1,1,2);
insert into hd_user_article_comment_like (userid,articleid,commentid) values (1,1,3);
insert into hd_user_article_comment_like (userid,articleid,commentid) values (1,1,4);
insert into hd_user_article_comment_like (userid,articleid,commentid) values (1,1,5);
insert into hd_user_article_comment_like (userid,articleid,commentid) values (1,1,6);
insert into hd_user_article_comment_like (userid,articleid,commentid) values (1,1,7); |
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: maintenance/tables.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/site_identifiers (
si_type VARBINARY(32) NOT NULL,
si_key VARBINARY(32) NOT NULL,
si_site INT UNSIGNED NOT NULL,
INDEX si_site (si_site),
INDEX si_key (si_key),
PRIMARY KEY(si_type, si_key)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/updatelog (
ul_key VARCHAR(255) NOT NULL,
ul_value BLOB DEFAULT NULL,
PRIMARY KEY(ul_key)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/actor (
actor_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
actor_user INT UNSIGNED DEFAULT NULL,
actor_name VARBINARY(255) NOT NULL,
UNIQUE INDEX actor_user (actor_user),
UNIQUE INDEX actor_name (actor_name),
PRIMARY KEY(actor_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/user_former_groups (
ufg_user INT UNSIGNED DEFAULT 0 NOT NULL,
ufg_group VARBINARY(255) DEFAULT '' NOT NULL,
PRIMARY KEY(ufg_user, ufg_group)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/bot_passwords (
bp_user INT UNSIGNED NOT NULL,
bp_app_id VARBINARY(32) NOT NULL,
bp_password TINYBLOB NOT NULL,
bp_token BINARY(32) DEFAULT '' NOT NULL,
bp_restrictions BLOB NOT NULL,
bp_grants BLOB NOT NULL,
PRIMARY KEY(bp_user, bp_app_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/comment (
comment_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
comment_hash INT NOT NULL,
comment_text BLOB NOT NULL,
comment_data BLOB DEFAULT NULL,
INDEX comment_hash (comment_hash),
PRIMARY KEY(comment_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/slots (
slot_revision_id BIGINT UNSIGNED NOT NULL,
slot_role_id SMALLINT UNSIGNED NOT NULL,
slot_content_id BIGINT UNSIGNED NOT NULL,
slot_origin BIGINT UNSIGNED NOT NULL,
INDEX slot_revision_origin_role (
slot_revision_id, slot_origin, slot_role_id
),
PRIMARY KEY(slot_revision_id, slot_role_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/site_stats (
ss_row_id INT UNSIGNED NOT NULL,
ss_total_edits BIGINT UNSIGNED DEFAULT NULL,
ss_good_articles BIGINT UNSIGNED DEFAULT NULL,
ss_total_pages BIGINT UNSIGNED DEFAULT NULL,
ss_users BIGINT UNSIGNED DEFAULT NULL,
ss_active_users BIGINT UNSIGNED DEFAULT NULL,
ss_images BIGINT UNSIGNED DEFAULT NULL,
PRIMARY KEY(ss_row_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/user_properties (
up_user INT UNSIGNED NOT NULL,
up_property VARBINARY(255) NOT NULL,
up_value BLOB DEFAULT NULL,
INDEX up_property (up_property),
PRIMARY KEY(up_user, up_property)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/log_search (
ls_field VARBINARY(32) NOT NULL,
ls_value VARCHAR(255) NOT NULL,
ls_log_id INT UNSIGNED DEFAULT 0 NOT NULL,
INDEX ls_log_id (ls_log_id),
PRIMARY KEY(ls_field, ls_value, ls_log_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/change_tag (
ct_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
ct_rc_id INT UNSIGNED DEFAULT NULL,
ct_log_id INT UNSIGNED DEFAULT NULL,
ct_rev_id INT UNSIGNED DEFAULT NULL,
ct_params BLOB DEFAULT NULL,
ct_tag_id INT UNSIGNED NOT NULL,
UNIQUE INDEX ct_rc_tag_id (ct_rc_id, ct_tag_id),
UNIQUE INDEX ct_log_tag_id (ct_log_id, ct_tag_id),
UNIQUE INDEX ct_rev_tag_id (ct_rev_id, ct_tag_id),
INDEX ct_tag_id_id (
ct_tag_id, ct_rc_id, ct_rev_id, ct_log_id
),
PRIMARY KEY(ct_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/content (
content_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
content_size INT UNSIGNED NOT NULL,
content_sha1 VARBINARY(32) NOT NULL,
content_model SMALLINT UNSIGNED NOT NULL,
content_address VARBINARY(255) NOT NULL,
PRIMARY KEY(content_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/l10n_cache (
lc_lang VARBINARY(35) NOT NULL,
lc_key VARCHAR(255) NOT NULL,
lc_value MEDIUMBLOB NOT NULL,
PRIMARY KEY(lc_lang, lc_key)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/module_deps (
md_module VARBINARY(255) NOT NULL,
md_skin VARBINARY(32) NOT NULL,
md_deps MEDIUMBLOB NOT NULL,
PRIMARY KEY(md_module, md_skin)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/redirect (
rd_from INT UNSIGNED DEFAULT 0 NOT NULL,
rd_namespace INT DEFAULT 0 NOT NULL,
rd_title VARBINARY(255) DEFAULT '' NOT NULL,
rd_interwiki VARCHAR(32) DEFAULT NULL,
rd_fragment VARBINARY(255) DEFAULT NULL,
INDEX rd_ns_title (rd_namespace, rd_title, rd_from),
PRIMARY KEY(rd_from)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/pagelinks (
pl_from INT UNSIGNED DEFAULT 0 NOT NULL,
pl_namespace INT DEFAULT 0 NOT NULL,
pl_title VARBINARY(255) DEFAULT '' NOT NULL,
pl_from_namespace INT DEFAULT 0 NOT NULL,
INDEX pl_namespace (pl_namespace, pl_title, pl_from),
INDEX pl_backlinks_namespace (
pl_from_namespace, pl_namespace,
pl_title, pl_from
),
PRIMARY KEY(pl_from, pl_namespace, pl_title)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/templatelinks (
tl_from INT UNSIGNED DEFAULT 0 NOT NULL,
tl_namespace INT DEFAULT 0 NOT NULL,
tl_title VARBINARY(255) DEFAULT '' NOT NULL,
tl_from_namespace INT DEFAULT 0 NOT NULL,
INDEX tl_namespace (tl_namespace, tl_title, tl_from),
INDEX tl_backlinks_namespace (
tl_from_namespace, tl_namespace,
tl_title, tl_from
),
PRIMARY KEY(tl_from, tl_namespace, tl_title)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/imagelinks (
il_from INT UNSIGNED DEFAULT 0 NOT NULL,
il_to VARBINARY(255) DEFAULT '' NOT NULL,
il_from_namespace INT DEFAULT 0 NOT NULL,
INDEX il_to (il_to, il_from),
INDEX il_backlinks_namespace (
il_from_namespace, il_to, il_from
),
PRIMARY KEY(il_from, il_to)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/langlinks (
ll_from INT UNSIGNED DEFAULT 0 NOT NULL,
ll_lang VARBINARY(35) DEFAULT '' NOT NULL,
ll_title VARBINARY(255) DEFAULT '' NOT NULL,
INDEX ll_lang (ll_lang, ll_title),
PRIMARY KEY(ll_from, ll_lang)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/iwlinks (
iwl_from INT UNSIGNED DEFAULT 0 NOT NULL,
iwl_prefix VARBINARY(32) DEFAULT '' NOT NULL,
iwl_title VARBINARY(255) DEFAULT '' NOT NULL,
INDEX iwl_prefix_title_from (iwl_prefix, iwl_title, iwl_from),
INDEX iwl_prefix_from_title (iwl_prefix, iwl_from, iwl_title),
PRIMARY KEY(iwl_from, iwl_prefix, iwl_title)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/category (
cat_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
cat_title VARBINARY(255) NOT NULL,
cat_pages INT DEFAULT 0 NOT NULL,
cat_subcats INT DEFAULT 0 NOT NULL,
cat_files INT DEFAULT 0 NOT NULL,
UNIQUE INDEX cat_title (cat_title),
INDEX cat_pages (cat_pages),
PRIMARY KEY(cat_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/watchlist_expiry (
we_item INT UNSIGNED NOT NULL,
we_expiry BINARY(14) NOT NULL,
INDEX we_expiry (we_expiry),
PRIMARY KEY(we_item)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/change_tag_def (
ctd_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
ctd_name VARBINARY(255) NOT NULL,
ctd_user_defined TINYINT(1) NOT NULL,
ctd_count BIGINT UNSIGNED DEFAULT 0 NOT NULL,
UNIQUE INDEX ctd_name (ctd_name),
INDEX ctd_count (ctd_count),
INDEX ctd_user_defined (ctd_user_defined),
PRIMARY KEY(ctd_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/ipblocks_restrictions (
ir_ipb_id INT NOT NULL,
ir_type TINYINT(4) NOT NULL,
ir_value INT NOT NULL,
INDEX ir_type_value (ir_type, ir_value),
PRIMARY KEY(ir_ipb_id, ir_type, ir_value)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/querycache (
qc_type VARBINARY(32) NOT NULL,
qc_value INT UNSIGNED DEFAULT 0 NOT NULL,
qc_namespace INT DEFAULT 0 NOT NULL,
qc_title VARBINARY(255) DEFAULT '' NOT NULL,
INDEX qc_type (qc_type, qc_value)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/querycachetwo (
qcc_type VARBINARY(32) NOT NULL,
qcc_value INT UNSIGNED DEFAULT 0 NOT NULL,
qcc_namespace INT DEFAULT 0 NOT NULL,
qcc_title VARBINARY(255) DEFAULT '' NOT NULL,
qcc_namespacetwo INT DEFAULT 0 NOT NULL,
qcc_titletwo VARBINARY(255) DEFAULT '' NOT NULL,
INDEX qcc_type (qcc_type, qcc_value),
INDEX qcc_title (
qcc_type, qcc_namespace, qcc_title
),
INDEX qcc_titletwo (
qcc_type, qcc_namespacetwo, qcc_titletwo
)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/page_restrictions (
pr_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
pr_page INT NOT NULL,
pr_type VARBINARY(60) NOT NULL,
pr_level VARBINARY(60) NOT NULL,
pr_cascade TINYINT NOT NULL,
pr_user INT UNSIGNED DEFAULT NULL,
pr_expiry VARBINARY(14) DEFAULT NULL,
UNIQUE INDEX pr_pagetype (pr_page, pr_type),
INDEX pr_typelevel (pr_type, pr_level),
INDEX pr_level (pr_level),
INDEX pr_cascade (pr_cascade),
PRIMARY KEY(pr_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/user_groups (
ug_user INT UNSIGNED DEFAULT 0 NOT NULL,
ug_group VARBINARY(255) DEFAULT '' NOT NULL,
ug_expiry VARBINARY(14) DEFAULT NULL,
INDEX ug_group (ug_group),
INDEX ug_expiry (ug_expiry),
PRIMARY KEY(ug_user, ug_group)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/querycache_info (
qci_type VARBINARY(32) DEFAULT '' NOT NULL,
qci_timestamp BINARY(14) DEFAULT '19700101000000' NOT NULL,
PRIMARY KEY(qci_type)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/watchlist (
wl_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
wl_user INT UNSIGNED NOT NULL,
wl_namespace INT DEFAULT 0 NOT NULL,
wl_title VARBINARY(255) DEFAULT '' NOT NULL,
wl_notificationtimestamp BINARY(14) DEFAULT NULL,
UNIQUE INDEX wl_user (wl_user, wl_namespace, wl_title),
INDEX wl_namespace_title (wl_namespace, wl_title),
INDEX wl_user_notificationtimestamp (
wl_user, wl_notificationtimestamp
),
PRIMARY KEY(wl_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/sites (
site_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
site_global_key VARBINARY(64) NOT NULL,
site_type VARBINARY(32) NOT NULL,
site_group VARBINARY(32) NOT NULL,
site_source VARBINARY(32) NOT NULL,
site_language VARBINARY(35) NOT NULL,
site_protocol VARBINARY(32) NOT NULL,
site_domain VARCHAR(255) NOT NULL,
site_data BLOB NOT NULL,
site_forward TINYINT(1) NOT NULL,
site_config BLOB NOT NULL,
UNIQUE INDEX site_global_key (site_global_key),
INDEX site_type (site_type),
INDEX site_group (site_group),
INDEX site_source (site_source),
INDEX site_language (site_language),
INDEX site_protocol (site_protocol),
INDEX site_domain (site_domain),
INDEX site_forward (site_forward),
PRIMARY KEY(site_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/user_newtalk (
user_id INT UNSIGNED DEFAULT 0 NOT NULL,
user_ip VARBINARY(40) DEFAULT '' NOT NULL,
user_last_timestamp BINARY(14) DEFAULT NULL,
INDEX un_user_id (user_id),
INDEX un_user_ip (user_ip)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/interwiki (
iw_prefix VARCHAR(32) NOT NULL,
iw_url BLOB NOT NULL,
iw_api BLOB NOT NULL,
iw_wikiid VARCHAR(64) NOT NULL,
iw_local TINYINT(1) NOT NULL,
iw_trans TINYINT DEFAULT 0 NOT NULL,
PRIMARY KEY(iw_prefix)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/protected_titles (
pt_namespace INT NOT NULL,
pt_title VARBINARY(255) NOT NULL,
pt_user INT UNSIGNED NOT NULL,
pt_reason_id BIGINT UNSIGNED NOT NULL,
pt_timestamp BINARY(14) NOT NULL,
pt_expiry VARBINARY(14) NOT NULL,
pt_create_perm VARBINARY(60) NOT NULL,
INDEX pt_timestamp (pt_timestamp),
PRIMARY KEY(pt_namespace, pt_title)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/externallinks (
el_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
el_from INT UNSIGNED DEFAULT 0 NOT NULL,
el_to BLOB NOT NULL,
el_index BLOB NOT NULL,
el_index_60 VARBINARY(60) NOT NULL,
INDEX el_from (
el_from,
el_to(40)
),
INDEX el_to (
el_to(60),
el_from
),
INDEX el_index (
el_index(60)
),
INDEX el_index_60 (el_index_60, el_id),
INDEX el_from_index_60 (el_from, el_index_60, el_id),
PRIMARY KEY(el_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/ip_changes (
ipc_rev_id INT UNSIGNED DEFAULT 0 NOT NULL,
ipc_rev_timestamp BINARY(14) NOT NULL,
ipc_hex VARBINARY(35) DEFAULT '' NOT NULL,
INDEX ipc_rev_timestamp (ipc_rev_timestamp),
INDEX ipc_hex_time (ipc_hex, ipc_rev_timestamp),
PRIMARY KEY(ipc_rev_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/revision_comment_temp (
revcomment_rev INT UNSIGNED NOT NULL,
revcomment_comment_id BIGINT UNSIGNED NOT NULL,
UNIQUE INDEX revcomment_rev (revcomment_rev),
PRIMARY KEY(
revcomment_rev, revcomment_comment_id
)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/revision_actor_temp (
revactor_rev INT UNSIGNED NOT NULL,
revactor_actor BIGINT UNSIGNED NOT NULL,
revactor_timestamp BINARY(14) NOT NULL,
revactor_page INT UNSIGNED NOT NULL,
UNIQUE INDEX revactor_rev (revactor_rev),
INDEX actor_timestamp (
revactor_actor, revactor_timestamp
),
INDEX page_actor_timestamp (
revactor_page, revactor_actor, revactor_timestamp
),
PRIMARY KEY(revactor_rev, revactor_actor)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/page_props (
pp_page INT NOT NULL,
pp_propname VARBINARY(60) NOT NULL,
pp_value BLOB NOT NULL,
pp_sortkey FLOAT DEFAULT NULL,
UNIQUE INDEX pp_propname_page (pp_propname, pp_page),
UNIQUE INDEX pp_propname_sortkey_page (pp_propname, pp_sortkey, pp_page),
PRIMARY KEY(pp_page, pp_propname)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/job (
job_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
job_cmd VARBINARY(60) DEFAULT '' NOT NULL,
job_namespace INT NOT NULL,
job_title VARBINARY(255) NOT NULL,
job_timestamp BINARY(14) DEFAULT NULL,
job_params MEDIUMBLOB NOT NULL,
job_random INT UNSIGNED DEFAULT 0 NOT NULL,
job_attempts INT UNSIGNED DEFAULT 0 NOT NULL,
job_token VARBINARY(32) DEFAULT '' NOT NULL,
job_token_timestamp BINARY(14) DEFAULT NULL,
job_sha1 VARBINARY(32) DEFAULT '' NOT NULL,
INDEX job_sha1 (job_sha1),
INDEX job_cmd_token (job_cmd, job_token, job_random),
INDEX job_cmd_token_id (job_cmd, job_token, job_id),
INDEX job_cmd (
job_cmd,
job_namespace,
job_title,
job_params(128)
),
INDEX job_timestamp (job_timestamp),
PRIMARY KEY(job_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/slot_roles (
role_id INT AUTO_INCREMENT NOT NULL,
role_name VARBINARY(64) NOT NULL,
UNIQUE INDEX role_name (role_name),
PRIMARY KEY(role_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/content_models (
model_id INT AUTO_INCREMENT NOT NULL,
model_name VARBINARY(64) NOT NULL,
UNIQUE INDEX model_name (model_name),
PRIMARY KEY(model_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/categorylinks (
cl_from INT UNSIGNED DEFAULT 0 NOT NULL,
cl_to VARBINARY(255) DEFAULT '' NOT NULL,
cl_sortkey VARBINARY(230) DEFAULT '' NOT NULL,
cl_sortkey_prefix VARBINARY(255) DEFAULT '' NOT NULL,
cl_timestamp TIMESTAMP NOT NULL,
cl_collation VARBINARY(32) DEFAULT '' NOT NULL,
cl_type ENUM('page', 'subcat', 'file') DEFAULT 'page' NOT NULL,
INDEX cl_sortkey (
cl_to, cl_type, cl_sortkey, cl_from
),
INDEX cl_timestamp (cl_to, cl_timestamp),
INDEX cl_collation_ext (
cl_collation, cl_to, cl_type, cl_from
),
PRIMARY KEY(cl_from, cl_to)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/logging (
log_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
log_type VARBINARY(32) DEFAULT '' NOT NULL,
log_action VARBINARY(32) DEFAULT '' NOT NULL,
log_timestamp BINARY(14) DEFAULT '19700101000000' NOT NULL,
log_actor BIGINT UNSIGNED NOT NULL,
log_namespace INT DEFAULT 0 NOT NULL,
log_title VARBINARY(255) DEFAULT '' NOT NULL,
log_page INT UNSIGNED DEFAULT NULL,
log_comment_id BIGINT UNSIGNED NOT NULL,
log_params BLOB NOT NULL,
log_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL,
INDEX log_type_time (log_type, log_timestamp),
INDEX log_actor_time (log_actor, log_timestamp),
INDEX log_page_time (
log_namespace, log_title, log_timestamp
),
INDEX log_times (log_timestamp),
INDEX log_actor_type_time (
log_actor, log_type, log_timestamp
),
INDEX log_page_id_time (log_page, log_timestamp),
INDEX log_type_action (
log_type, log_action, log_timestamp
),
PRIMARY KEY(log_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/uploadstash (
us_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
us_user INT UNSIGNED NOT NULL,
us_key VARCHAR(255) NOT NULL,
us_orig_path VARCHAR(255) NOT NULL,
us_path VARCHAR(255) NOT NULL,
us_source_type VARCHAR(50) DEFAULT NULL,
us_timestamp BINARY(14) NOT NULL,
us_status VARCHAR(50) NOT NULL,
us_chunk_inx INT UNSIGNED DEFAULT NULL,
us_props BLOB DEFAULT NULL,
us_size INT UNSIGNED NOT NULL,
us_sha1 VARCHAR(31) NOT NULL,
us_mime VARCHAR(255) DEFAULT NULL,
us_media_type ENUM(
'UNKNOWN', 'BITMAP', 'DRAWING', 'AUDIO',
'VIDEO', 'MULTIMEDIA', 'OFFICE',
'TEXT', 'EXECUTABLE', 'ARCHIVE',
'3D'
) DEFAULT NULL,
us_image_width INT UNSIGNED DEFAULT NULL,
us_image_height INT UNSIGNED DEFAULT NULL,
us_image_bits SMALLINT UNSIGNED DEFAULT NULL,
INDEX us_user (us_user),
UNIQUE INDEX us_key (us_key),
INDEX us_timestamp (us_timestamp),
PRIMARY KEY(us_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/filearchive (
fa_id INT AUTO_INCREMENT NOT NULL,
fa_name VARBINARY(255) DEFAULT '' NOT NULL,
fa_archive_name VARBINARY(255) DEFAULT '',
fa_storage_group VARBINARY(16) DEFAULT NULL,
fa_storage_key VARBINARY(64) DEFAULT '',
fa_deleted_user INT DEFAULT NULL,
fa_deleted_timestamp BINARY(14) DEFAULT NULL,
fa_deleted_reason_id BIGINT UNSIGNED NOT NULL,
fa_size INT UNSIGNED DEFAULT 0,
fa_width INT DEFAULT 0,
fa_height INT DEFAULT 0,
fa_metadata MEDIUMBLOB DEFAULT NULL,
fa_bits INT DEFAULT 0,
fa_media_type ENUM(
'UNKNOWN', 'BITMAP', 'DRAWING', 'AUDIO',
'VIDEO', 'MULTIMEDIA', 'OFFICE',
'TEXT', 'EXECUTABLE', 'ARCHIVE',
'3D'
) DEFAULT NULL,
fa_major_mime ENUM(
'unknown', 'application', 'audio',
'image', 'text', 'video', 'message',
'model', 'multipart', 'chemical'
) DEFAULT 'unknown',
fa_minor_mime VARBINARY(100) DEFAULT 'unknown',
fa_description_id BIGINT UNSIGNED NOT NULL,
fa_actor BIGINT UNSIGNED NOT NULL,
fa_timestamp BINARY(14) DEFAULT NULL,
fa_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL,
fa_sha1 VARBINARY(32) DEFAULT '' NOT NULL,
INDEX fa_name (fa_name, fa_timestamp),
INDEX fa_storage_group (
fa_storage_group, fa_storage_key
),
INDEX fa_deleted_timestamp (fa_deleted_timestamp),
INDEX fa_actor_timestamp (fa_actor, fa_timestamp),
INDEX fa_sha1 (
fa_sha1(10)
),
PRIMARY KEY(fa_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/text (
old_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
old_text MEDIUMBLOB NOT NULL,
old_flags TINYBLOB NOT NULL,
PRIMARY KEY(old_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/oldimage (
oi_name VARBINARY(255) DEFAULT '' NOT NULL,
oi_archive_name VARBINARY(255) DEFAULT '' NOT NULL,
oi_size INT UNSIGNED DEFAULT 0 NOT NULL,
oi_width INT DEFAULT 0 NOT NULL,
oi_height INT DEFAULT 0 NOT NULL,
oi_bits INT DEFAULT 0 NOT NULL,
oi_description_id BIGINT UNSIGNED NOT NULL,
oi_actor BIGINT UNSIGNED NOT NULL,
oi_timestamp BINARY(14) NOT NULL,
oi_metadata MEDIUMBLOB NOT NULL,
oi_media_type ENUM(
'UNKNOWN', 'BITMAP', 'DRAWING', 'AUDIO',
'VIDEO', 'MULTIMEDIA', 'OFFICE',
'TEXT', 'EXECUTABLE', 'ARCHIVE',
'3D'
) DEFAULT NULL,
oi_major_mime ENUM(
'unknown', 'application', 'audio',
'image', 'text', 'video', 'message',
'model', 'multipart', 'chemical'
) DEFAULT 'unknown' NOT NULL,
oi_minor_mime VARBINARY(100) DEFAULT 'unknown' NOT NULL,
oi_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL,
oi_sha1 VARBINARY(32) DEFAULT '' NOT NULL,
INDEX oi_actor_timestamp (oi_actor, oi_timestamp),
INDEX oi_name_timestamp (oi_name, oi_timestamp),
INDEX oi_name_archive_name (
oi_name,
oi_archive_name(14)
),
INDEX oi_sha1 (
oi_sha1(10)
),
INDEX oi_timestamp (oi_timestamp)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/objectcache (
keyname VARBINARY(255) DEFAULT '' NOT NULL,
value MEDIUMBLOB DEFAULT NULL,
exptime BINARY(14) NOT NULL,
modtoken VARCHAR(17) DEFAULT '00000000000000000' NOT NULL,
flags INT UNSIGNED DEFAULT NULL,
INDEX exptime (exptime),
PRIMARY KEY(keyname)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/ipblocks (
ipb_id INT AUTO_INCREMENT NOT NULL,
ipb_address TINYBLOB NOT NULL,
ipb_user INT UNSIGNED DEFAULT 0 NOT NULL,
ipb_by_actor BIGINT UNSIGNED NOT NULL,
ipb_reason_id BIGINT UNSIGNED NOT NULL,
ipb_timestamp BINARY(14) NOT NULL,
ipb_auto TINYINT(1) DEFAULT 0 NOT NULL,
ipb_anon_only TINYINT(1) DEFAULT 0 NOT NULL,
ipb_create_account TINYINT(1) DEFAULT 1 NOT NULL,
ipb_enable_autoblock TINYINT(1) DEFAULT 1 NOT NULL,
ipb_expiry VARBINARY(14) NOT NULL,
ipb_range_start TINYBLOB NOT NULL,
ipb_range_end TINYBLOB NOT NULL,
ipb_deleted TINYINT(1) DEFAULT 0 NOT NULL,
ipb_block_email TINYINT(1) DEFAULT 0 NOT NULL,
ipb_allow_usertalk TINYINT(1) DEFAULT 0 NOT NULL,
ipb_parent_block_id INT DEFAULT NULL,
ipb_sitewide TINYINT(1) DEFAULT 1 NOT NULL,
UNIQUE INDEX ipb_address_unique (
ipb_address(255),
ipb_user,
ipb_auto
),
INDEX ipb_user (ipb_user),
INDEX ipb_range (
ipb_range_start(8),
ipb_range_end(8)
),
INDEX ipb_timestamp (ipb_timestamp),
INDEX ipb_expiry (ipb_expiry),
INDEX ipb_parent_block_id (ipb_parent_block_id),
PRIMARY KEY(ipb_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/image (
img_name VARBINARY(255) DEFAULT '' NOT NULL,
img_size INT UNSIGNED DEFAULT 0 NOT NULL,
img_width INT DEFAULT 0 NOT NULL,
img_height INT DEFAULT 0 NOT NULL,
img_metadata MEDIUMBLOB NOT NULL,
img_bits INT DEFAULT 0 NOT NULL,
img_media_type ENUM(
'UNKNOWN', 'BITMAP', 'DRAWING', 'AUDIO',
'VIDEO', 'MULTIMEDIA', 'OFFICE',
'TEXT', 'EXECUTABLE', 'ARCHIVE',
'3D'
) DEFAULT NULL,
img_major_mime ENUM(
'unknown', 'application', 'audio',
'image', 'text', 'video', 'message',
'model', 'multipart', 'chemical'
) DEFAULT 'unknown' NOT NULL,
img_minor_mime VARBINARY(100) DEFAULT 'unknown' NOT NULL,
img_description_id BIGINT UNSIGNED NOT NULL,
img_actor BIGINT UNSIGNED NOT NULL,
img_timestamp BINARY(14) NOT NULL,
img_sha1 VARBINARY(32) DEFAULT '' NOT NULL,
INDEX img_actor_timestamp (img_actor, img_timestamp),
INDEX img_size (img_size),
INDEX img_timestamp (img_timestamp),
INDEX img_sha1 (
img_sha1(10)
),
INDEX img_media_mime (
img_media_type, img_major_mime, img_minor_mime
),
PRIMARY KEY(img_name)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/recentchanges (
rc_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
rc_timestamp BINARY(14) NOT NULL,
rc_actor BIGINT UNSIGNED NOT NULL,
rc_namespace INT DEFAULT 0 NOT NULL,
rc_title VARBINARY(255) DEFAULT '' NOT NULL,
rc_comment_id BIGINT UNSIGNED NOT NULL,
rc_minor TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_bot TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_new TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_cur_id INT UNSIGNED DEFAULT 0 NOT NULL,
rc_this_oldid INT UNSIGNED DEFAULT 0 NOT NULL,
rc_last_oldid INT UNSIGNED DEFAULT 0 NOT NULL,
rc_type TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_source VARBINARY(16) DEFAULT '' NOT NULL,
rc_patrolled TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_ip VARBINARY(40) DEFAULT '' NOT NULL,
rc_old_len INT DEFAULT NULL,
rc_new_len INT DEFAULT NULL,
rc_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rc_logid INT UNSIGNED DEFAULT 0 NOT NULL,
rc_log_type VARBINARY(255) DEFAULT NULL,
rc_log_action VARBINARY(255) DEFAULT NULL,
rc_params BLOB DEFAULT NULL,
INDEX rc_timestamp (rc_timestamp),
INDEX rc_namespace_title_timestamp (
rc_namespace, rc_title, rc_timestamp
),
INDEX rc_cur_id (rc_cur_id),
INDEX rc_new_name_timestamp (
rc_new, rc_namespace, rc_timestamp
),
INDEX rc_ip (rc_ip),
INDEX rc_ns_actor (rc_namespace, rc_actor),
INDEX rc_actor (rc_actor, rc_timestamp),
INDEX rc_name_type_patrolled_timestamp (
rc_namespace, rc_type, rc_patrolled,
rc_timestamp
),
INDEX rc_this_oldid (rc_this_oldid),
PRIMARY KEY(rc_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/archive (
ar_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
ar_namespace INT DEFAULT 0 NOT NULL,
ar_title VARBINARY(255) DEFAULT '' NOT NULL,
ar_comment_id BIGINT UNSIGNED NOT NULL,
ar_actor BIGINT UNSIGNED NOT NULL,
ar_timestamp BINARY(14) NOT NULL,
ar_minor_edit TINYINT DEFAULT 0 NOT NULL,
ar_rev_id INT UNSIGNED NOT NULL,
ar_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL,
ar_len INT UNSIGNED DEFAULT NULL,
ar_page_id INT UNSIGNED DEFAULT NULL,
ar_parent_id INT UNSIGNED DEFAULT NULL,
ar_sha1 VARBINARY(32) DEFAULT '' NOT NULL,
INDEX ar_name_title_timestamp (
ar_namespace, ar_title, ar_timestamp
),
INDEX ar_actor_timestamp (ar_actor, ar_timestamp),
UNIQUE INDEX ar_revid_uniq (ar_rev_id),
PRIMARY KEY(ar_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/page (
page_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
page_namespace INT NOT NULL,
page_title VARBINARY(255) NOT NULL,
page_restrictions TINYBLOB DEFAULT NULL,
page_is_redirect TINYINT UNSIGNED DEFAULT 0 NOT NULL,
page_is_new TINYINT UNSIGNED DEFAULT 0 NOT NULL,
page_random DOUBLE PRECISION UNSIGNED NOT NULL,
page_touched BINARY(14) NOT NULL,
page_links_updated VARBINARY(14) DEFAULT NULL,
page_latest INT UNSIGNED NOT NULL,
page_len INT UNSIGNED NOT NULL,
page_content_model VARBINARY(32) DEFAULT NULL,
page_lang VARBINARY(35) DEFAULT NULL,
UNIQUE INDEX page_name_title (page_namespace, page_title),
INDEX page_random (page_random),
INDEX page_len (page_len),
INDEX page_redirect_namespace_len (
page_is_redirect, page_namespace,
page_len
),
PRIMARY KEY(page_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/user (
user_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
user_name VARBINARY(255) DEFAULT '' NOT NULL,
user_real_name VARBINARY(255) DEFAULT '' NOT NULL,
user_password TINYBLOB NOT NULL,
user_newpassword TINYBLOB NOT NULL,
user_newpass_time BINARY(14) DEFAULT NULL,
user_email TINYTEXT NOT NULL,
user_touched BINARY(14) NOT NULL,
user_token BINARY(32) DEFAULT '' NOT NULL,
user_email_authenticated BINARY(14) DEFAULT NULL,
user_email_token BINARY(32) DEFAULT NULL,
user_email_token_expires BINARY(14) DEFAULT NULL,
user_registration BINARY(14) DEFAULT NULL,
user_editcount INT DEFAULT NULL,
user_password_expires VARBINARY(14) DEFAULT NULL,
UNIQUE INDEX user_name (user_name),
INDEX user_email_token (user_email_token),
INDEX user_email (
user_email(50)
),
PRIMARY KEY(user_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/revision (
rev_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
rev_page INT UNSIGNED NOT NULL,
rev_comment_id BIGINT UNSIGNED DEFAULT 0 NOT NULL,
rev_actor BIGINT UNSIGNED DEFAULT 0 NOT NULL,
rev_timestamp BINARY(14) NOT NULL,
rev_minor_edit TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rev_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL,
rev_len INT UNSIGNED DEFAULT NULL,
rev_parent_id INT UNSIGNED DEFAULT NULL,
rev_sha1 VARBINARY(32) DEFAULT '' NOT NULL,
INDEX rev_page_id (rev_page, rev_id),
INDEX rev_timestamp (rev_timestamp),
INDEX rev_page_timestamp (rev_page, rev_timestamp),
INDEX rev_actor_timestamp (rev_actor, rev_timestamp, rev_id),
INDEX rev_page_actor_timestamp (
rev_page, rev_actor, rev_timestamp
),
PRIMARY KEY(rev_id)
) /*$wgDBTableOptions*/;
CREATE TABLE /*_*/searchindex (
si_page INT UNSIGNED NOT NULL,
si_title VARCHAR(255) DEFAULT '' NOT NULL,
si_text MEDIUMTEXT NOT NULL,
UNIQUE INDEX si_page (si_page),
FULLTEXT INDEX si_title (si_title),
FULLTEXT INDEX si_text (si_text)
) ENGINE = MyISAM DEFAULT CHARSET = utf8;
|
create table demo (
id int primary key auto_increment,
name varchar(19) not null
)
|
<reponame>nhankun/banhang123
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Máy chủ: 127.0.0.1
-- Thời gian đã tạo: Th12 10, 2019 lúc 03:47 PM
-- Phiên bản máy phục vụ: 10.4.8-MariaDB
-- Phiên bản PHP: 7.3.11
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 */;
--
-- Cơ sở dữ liệu: `banhang123`
--
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `categories`
--
CREATE TABLE `categories` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`icon` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `categories`
--
INSERT INTO `categories` (`id`, `name`, `icon`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Phone', NULL, 1, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(2, 'Laptop', NULL, 1, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(3, 'Iphone', NULL, 1, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(4, 'Ipad', NULL, 1, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED 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;
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `images`
--
CREATE TABLE `images` (
`id` bigint(20) UNSIGNED NOT NULL,
`product_id` bigint(20) UNSIGNED NOT NULL,
`link` text COLLATE utf8mb4_unicode_ci NOT NULL,
`title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `images`
--
INSERT INTO `images` (`id`, `product_id`, `link`, `title`, `created_at`, `updated_at`, `deleted_at`) VALUES
(43, 1, 'uploads/products/1/general/product15759010610.jpg', 'dsd sds123', '2019-12-09 07:17:41', '2019-12-09 07:17:41', NULL),
(44, 1, 'uploads/products/1/general/product15759011280.jpg', 'dsd sds123', '2019-12-09 07:18:48', '2019-12-09 07:18:48', NULL),
(45, 1, 'uploads/products/1/general/product15759767240.jpg', 'dsd sds123', '2019-12-10 04:18:44', '2019-12-10 04:18:44', NULL),
(46, 1, 'uploads/products/1/general/product15759771370.jpg', 'dsd sds123', '2019-12-10 04:25:37', '2019-12-10 04:25:37', NULL),
(47, 1, 'uploads/products/1/general/product15759771371.jpg', 'dsd sds123', '2019-12-10 04:25:37', '2019-12-10 04:25:37', NULL),
(48, 1, 'uploads/products/1/general/product15759771372.jpg', 'dsd sds123', '2019-12-10 04:25:37', '2019-12-10 04:25:37', NULL),
(49, 1, 'uploads/products/1/general/product15759833660.jpg', 'dsd sds123', '2019-12-10 06:09:26', '2019-12-10 06:09:26', NULL),
(50, 1, 'uploads/products/1/general/product15759833661.jpg', 'dsd sds123', '2019-12-10 06:09:26', '2019-12-10 06:09:26', NULL),
(51, 1, 'uploads/products/1/general/product15759848150.jpg', 'dsd sds123', '2019-12-10 06:33:35', '2019-12-10 06:33:35', NULL),
(52, 1, 'uploads/products/1/general/product15759848210.jpg', 'dsd sds123', '2019-12-10 06:33:41', '2019-12-10 06:33:41', NULL);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(118, '2014_10_12_000000_create_users_table', 1),
(119, '2014_10_12_100000_create_password_resets_table', 1),
(120, '2019_08_19_000000_create_failed_jobs_table', 1),
(121, '2019_10_23_125732_create_categories_table', 1),
(122, '2019_10_23_125813_create_providers_table', 1),
(123, '2019_10_23_125938_create_property_defaults_table', 1),
(124, '2019_10_23_130003_create_products_table', 1),
(125, '2019_10_23_130013_create_images_table', 1),
(126, '2019_10_23_130034_create_properties_table', 1);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `products`
--
CREATE TABLE `products` (
`id` bigint(20) UNSIGNED NOT NULL,
`category_id` bigint(20) UNSIGNED NOT NULL,
`provider_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`quantity` int(11) DEFAULT NULL,
`price` double DEFAULT NULL,
`description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` tinyint(1) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `products`
--
INSERT INTO `products` (`id`, `category_id`, `provider_id`, `name`, `quantity`, `price`, `description`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 2, 2, 'dsd sds123', 12123, 50000123, 'sdsdabc', 0, '2019-12-06 09:30:26', '2019-12-07 07:53:54', NULL);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `properties`
--
CREATE TABLE `properties` (
`id` bigint(20) UNSIGNED NOT NULL,
`product_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`value` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`sort` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `property_defaults`
--
CREATE TABLE `property_defaults` (
`id` bigint(20) UNSIGNED NOT NULL,
`category_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`value` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`sort` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `property_defaults`
--
INSERT INTO `property_defaults` (`id`, `category_id`, `name`, `value`, `sort`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Màn hình', NULL, 1, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(2, 1, 'Camera trước', NULL, 2, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(3, 1, 'Camera sau', NULL, 3, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(4, 1, 'Ram', NULL, 4, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(5, 1, 'Bộ nhớ trong', NULL, 5, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(6, 1, 'CPU', NULL, 6, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(7, 1, 'GPU', NULL, 7, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(8, 1, 'Dung lượng PIN', NULL, 8, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(9, 1, 'Hệ điều hành', NULL, 9, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(10, 1, 'Sim', NULL, 10, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `providers`
--
CREATE TABLE `providers` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`address` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`tel` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`website` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Đang đổ dữ liệu cho bảng `providers`
--
INSERT INTO `providers` (`id`, `name`, `image`, `address`, `email`, `tel`, `website`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Asus', 'uploads/defaults/providers/images/asusLogo.png', '<NAME>', '<EMAIL>', '18006588', 'https://www.asus.com/vn/', 1, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(2, 'Dell', 'uploads/defaults/providers/images/dellLogo.png', 'Mỹ', '<EMAIL>', '842838221366', 'http://www1.ap.dell.com/content/default.aspx?c=vn&l=en&s=&s=gen&~ck=cr', 1, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL),
(3, 'HP', 'uploads/defaults/providers/images/hpLogo.png', '<NAME>', '<EMAIL>', '1800588868', 'https://www8.hp.com/vn/vi/products/laptops-tablets.html', 1, '2019-12-06 09:30:03', '2019-12-06 09:30:03', NULL);
-- --------------------------------------------------------
--
-- Cấu trúc bảng cho bảng `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(191) 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;
--
-- Chỉ mục cho các bảng đã đổ
--
--
-- Chỉ mục cho bảng `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
--
-- Chỉ mục cho bảng `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`);
--
-- Chỉ mục cho bảng `images`
--
ALTER TABLE `images`
ADD PRIMARY KEY (`id`),
ADD KEY `images_product_id_foreign` (`product_id`);
--
-- Chỉ mục cho bảng `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Chỉ mục cho bảng `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Chỉ mục cho bảng `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id`),
ADD KEY `products_category_id_foreign` (`category_id`),
ADD KEY `products_provider_id_foreign` (`provider_id`);
--
-- Chỉ mục cho bảng `properties`
--
ALTER TABLE `properties`
ADD PRIMARY KEY (`id`),
ADD KEY `properties_product_id_foreign` (`product_id`);
--
-- Chỉ mục cho bảng `property_defaults`
--
ALTER TABLE `property_defaults`
ADD PRIMARY KEY (`id`),
ADD KEY `property_defaults_category_id_foreign` (`category_id`);
--
-- Chỉ mục cho bảng `providers`
--
ALTER TABLE `providers`
ADD PRIMARY KEY (`id`);
--
-- Chỉ mục cho bảng `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT cho các bảng đã đổ
--
--
-- AUTO_INCREMENT cho bảng `categories`
--
ALTER TABLE `categories`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT cho bảng `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT cho bảng `images`
--
ALTER TABLE `images`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;
--
-- AUTO_INCREMENT cho bảng `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=127;
--
-- AUTO_INCREMENT cho bảng `products`
--
ALTER TABLE `products`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT cho bảng `properties`
--
ALTER TABLE `properties`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT cho bảng `property_defaults`
--
ALTER TABLE `property_defaults`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT cho bảng `providers`
--
ALTER TABLE `providers`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT cho bảng `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- Các ràng buộc cho các bảng đã đổ
--
--
-- Các ràng buộc cho bảng `images`
--
ALTER TABLE `images`
ADD CONSTRAINT `images_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;
--
-- Các ràng buộc cho bảng `products`
--
ALTER TABLE `products`
ADD CONSTRAINT `products_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `products_provider_id_foreign` FOREIGN KEY (`provider_id`) REFERENCES `providers` (`id`) ON DELETE CASCADE;
--
-- Các ràng buộc cho bảng `properties`
--
ALTER TABLE `properties`
ADD CONSTRAINT `properties_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;
--
-- Các ràng buộc cho bảng `property_defaults`
--
ALTER TABLE `property_defaults`
ADD CONSTRAINT `property_defaults_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`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 */;
|
<filename>DB-15 jan.sql
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jan 15, 2016 at 06:11 AM
-- Server version: 10.1.8-MariaDB
-- PHP Version: 5.6.14
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: `rdforge`
--
-- --------------------------------------------------------
--
-- Table structure for table `cutting_item_des`
--
CREATE TABLE `cutting_item_des` (
`cutting_id` int(10) NOT NULL,
`item_des` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cutting_item_des`
--
INSERT INTO `cutting_item_des` (`cutting_id`, `item_des`) VALUES
(1, 'this is cutting type description.'),
(3, 'cut it nicely'),
(3, '456'),
(4, 'dhvajhak');
-- --------------------------------------------------------
--
-- Table structure for table `cutting_records`
--
CREATE TABLE `cutting_records` (
`cutting_id` int(7) NOT NULL,
`date` date NOT NULL,
`raw_mat_size` varchar(25) NOT NULL,
`heat_no` varchar(25) NOT NULL,
`quantity` int(10) NOT NULL,
`weight_per_piece` int(10) NOT NULL,
`total_weight` int(10) NOT NULL,
`size` varchar(25) NOT NULL,
`pressure` varchar(25) NOT NULL,
`type` varchar(25) NOT NULL,
`schedule` varchar(25) NOT NULL,
`available_weight_cutting` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cutting_records`
--
INSERT INTO `cutting_records` (`cutting_id`, `date`, `raw_mat_size`, `heat_no`, `quantity`, `weight_per_piece`, `total_weight`, `size`, `pressure`, `type`, `schedule`, `available_weight_cutting`) VALUES
(2, '2015-12-07', '50x40', '1234589', 789, 10, 7890, '5', '200 pa', 'dddd', 'ssdf', 7890),
(3, '2016-01-12', '50x40', '1234589', 100, 14, 1400, '', '', '', '', 1400);
-- --------------------------------------------------------
--
-- Table structure for table `cutting_remarks`
--
CREATE TABLE `cutting_remarks` (
`cutting_id` int(11) NOT NULL,
`remarks` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cutting_remarks`
--
INSERT INTO `cutting_remarks` (`cutting_id`, `remarks`) VALUES
(1, 'remarks to ache hai'),
(3, 'remarks are always welcomed'),
(4, 'jabcakjal');
-- --------------------------------------------------------
--
-- Table structure for table `drilling_records`
--
CREATE TABLE `drilling_records` (
`drilling_id` int(10) NOT NULL,
`work_order_no` int(10) NOT NULL,
`date` date NOT NULL,
`item` varchar(25) NOT NULL,
`heat_no` varchar(25) NOT NULL,
`quantity` varchar(25) NOT NULL,
`machine_name` varchar(25) NOT NULL,
`employee_name` varchar(25) NOT NULL,
`grade` varchar(10) NOT NULL,
`remarks` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `drilling_records`
--
INSERT INTO `drilling_records` (`drilling_id`, `work_order_no`, `date`, `item`, `heat_no`, `quantity`, `machine_name`, `employee_name`, `grade`, `remarks`) VALUES
(2, 3, '2015-12-25', '3/1', '1245689', '', '', '', '', ''),
(4, 2, '2015-12-25', '2/1', '1245689', '', '', '', '', ''),
(5, 12, '2016-01-15', '12/1', '1245689', '100', 'gaurav', '', '', '');
-- --------------------------------------------------------
--
-- Table structure for table `drilling_remarks`
--
CREATE TABLE `drilling_remarks` (
`drilling_id` int(10) NOT NULL,
`remarks` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `forging_records`
--
CREATE TABLE `forging_records` (
`forging_id` int(7) NOT NULL,
`heat_no` varchar(20) NOT NULL,
`quantity` int(10) NOT NULL,
`date` date NOT NULL,
`weight_per_piece` int(10) NOT NULL,
`size` varchar(20) NOT NULL,
`pressure` varchar(20) NOT NULL,
`type` varchar(20) NOT NULL,
`schedule` varchar(20) NOT NULL,
`total_weight` int(15) NOT NULL,
`remarks` text NOT NULL,
`available_weight_forging` int(15) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `forging_records`
--
INSERT INTO `forging_records` (`forging_id`, `heat_no`, `quantity`, `date`, `weight_per_piece`, `size`, `pressure`, `type`, `schedule`, `total_weight`, `remarks`, `available_weight_forging`) VALUES
(3, '1245689', 1, '1970-01-01', 10, '5', '200 pa', 'dddd', 'ssdf', 10, '', 10),
(4, '1245689', 10, '2015-12-16', 100, '5', '200 pa', 'dddd', 'hfeiw', 1000, 'remarks form the user are good', 1000),
(6, '1245689', 10, '2015-12-16', 100, '5', '200 pa', 'dddd', 'hfeiw', 1000, 'remarks form the user are good', 1000),
(7, '1245689', 10, '2015-12-16', 100, '5', '200 pa', 'dddd', 'hfeiw', 1000, 'remarks form the user are good', 1000),
(8, '1245689', 10, '2015-12-16', 100, '5', '200 pa', 'dddd', 'hfeiw', 1000, 'remarks form the user are good', 1000),
(9, '1245689', 10, '2015-12-16', 100, '5', '200 pa', 'dddd', 'hfeiw', 1000, 'remarks form the user are good', 1000),
(10, '1234589', 10, '2015-12-16', 100, '5', '200 pa', 'dddd', 'hfeiw', 1000, 'remarks form the user are good', 1000);
-- --------------------------------------------------------
--
-- Table structure for table `inspection_details`
--
CREATE TABLE `inspection_details` (
`work_order_no` int(10) NOT NULL,
`inspection` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `logbook`
--
CREATE TABLE `logbook` (
`log_id` int(8) NOT NULL,
`date` date NOT NULL,
`time` time NOT NULL,
`category` varchar(15) NOT NULL,
`details` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `machining_records`
--
CREATE TABLE `machining_records` (
`mach_id` int(7) NOT NULL,
`date` date NOT NULL,
`work_order_no` varchar(25) NOT NULL,
`item` varchar(25) NOT NULL,
`heat_no` varchar(25) NOT NULL,
`quantity` int(11) DEFAULT NULL,
`machine_name` varchar(25) NOT NULL,
`grade` varchar(10) NOT NULL,
`weight` int(10) NOT NULL,
`remarks` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `machining_records`
--
INSERT INTO `machining_records` (`mach_id`, `date`, `work_order_no`, `item`, `heat_no`, `quantity`, `machine_name`, `grade`, `weight`, `remarks`) VALUES
(2, '0000-00-00', '2', '2/1', '1245689', 1, '', 'SSSH', 1, 'good'),
(3, '0000-00-00', '2', '2/1', '1245689', 1, '', 'SSSH', 1, 'good'),
(5, '0000-00-00', '3', '3/1', '1245689', 0, '', 'SSSH', 0, ''),
(6, '0000-00-00', '3', '3/1', '1245689', 0, '', 'SSSH', 0, ''),
(12, '0000-00-00', '3', '3/1', '1245689', 0, '', 'SSSH', 0, ''),
(13, '0000-00-00', '2', '2/1', '1245689', 0, '', 'SSSH', 0, '');
-- --------------------------------------------------------
--
-- Table structure for table `master_description_type`
--
CREATE TABLE `master_description_type` (
`id` int(7) NOT NULL,
`type` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `master_description_type`
--
INSERT INTO `master_description_type` (`id`, `type`) VALUES
(1, 'dddd');
-- --------------------------------------------------------
--
-- Table structure for table `master_grades`
--
CREATE TABLE `master_grades` (
`id` int(7) NOT NULL,
`grade_name` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `master_grades`
--
INSERT INTO `master_grades` (`id`, `grade_name`) VALUES
(1, 'SSSH');
-- --------------------------------------------------------
--
-- Table structure for table `master_manufacturers`
--
CREATE TABLE `master_manufacturers` (
`id` int(7) NOT NULL,
`manufacturer_name` varchar(25) NOT NULL,
`item` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `master_manufacturers`
--
INSERT INTO `master_manufacturers` (`id`, `manufacturer_name`, `item`) VALUES
(1, 'RD-Forge', 'Round'),
(2, 'akgec', 'Ingot'),
(3, 'ims', 'Ingot'),
(4, 'hitech', 'Ingot');
-- --------------------------------------------------------
--
-- Table structure for table `master_pressure`
--
CREATE TABLE `master_pressure` (
`id` int(3) NOT NULL,
`pressure` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `master_pressure`
--
INSERT INTO `master_pressure` (`id`, `pressure`) VALUES
(1, '200 pa'),
(2, '300 pa'),
(3, '400 pa');
-- --------------------------------------------------------
--
-- Table structure for table `master_schedule`
--
CREATE TABLE `master_schedule` (
`id` int(7) NOT NULL,
`schedule` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `master_schedule`
--
INSERT INTO `master_schedule` (`id`, `schedule`) VALUES
(2, 'hfeiw'),
(3, 'abcd'),
(4, 'efgh');
-- --------------------------------------------------------
--
-- Table structure for table `master_sizes`
--
CREATE TABLE `master_sizes` (
`id` int(7) NOT NULL,
`size` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `master_sizes`
--
INSERT INTO `master_sizes` (`id`, `size`) VALUES
(1, '50x40');
-- --------------------------------------------------------
--
-- Table structure for table `master_std_size`
--
CREATE TABLE `master_std_size` (
`id` int(7) NOT NULL,
`std_size` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `master_std_size`
--
INSERT INTO `master_std_size` (`id`, `std_size`) VALUES
(1, '5');
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`migration`, `batch`) VALUES
('2016_01_02_075149_create_cutting_item_des_table', 0),
('2016_01_02_075149_create_cutting_records_table', 0),
('2016_01_02_075149_create_cutting_remarks_table', 0),
('2016_01_02_075149_create_drilling_records_table', 0),
('2016_01_02_075149_create_drilling_remarks_table', 0),
('2016_01_02_075149_create_forging_records_table', 0),
('2016_01_02_075149_create_inspection_details_table', 0),
('2016_01_02_075149_create_logbook_table', 0),
('2016_01_02_075149_create_machining_records_table', 0),
('2016_01_02_075149_create_master_description_type_table', 0),
('2016_01_02_075149_create_master_grades_table', 0),
('2016_01_02_075149_create_master_manufacturers_table', 0),
('2016_01_02_075149_create_master_pressure_table', 0),
('2016_01_02_075149_create_master_schedule_table', 0),
('2016_01_02_075149_create_master_sizes_table', 0),
('2016_01_02_075149_create_master_std_size_table', 0),
('2016_01_02_075149_create_packing_instructions_table', 0),
('2016_01_02_075149_create_raw_material_table', 0),
('2016_01_02_075149_create_remarks_table', 0),
('2016_01_02_075149_create_search_selection_table', 0),
('2016_01_02_075149_create_seration_records_table', 0),
('2016_01_02_075149_create_seration_remarks_table', 0),
('2016_01_02_075149_create_testing_instructions_table', 0),
('2016_01_02_075149_create_users_table', 0),
('2016_01_02_075149_create_work_order_details_table', 0),
('2016_01_02_075149_create_work_order_material_details_table', 0);
-- --------------------------------------------------------
--
-- Table structure for table `packing_instructions`
--
CREATE TABLE `packing_instructions` (
`work_order_no` int(10) NOT NULL,
`pac_ins` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `raw_material`
--
CREATE TABLE `raw_material` (
`internal_no` int(10) NOT NULL,
`receipt_code` text NOT NULL,
`date` date NOT NULL,
`size` varchar(10) NOT NULL,
`manufacturer` varchar(25) NOT NULL,
`heat_no` text NOT NULL,
`weight` int(10) NOT NULL,
`left_over_weight` varchar(10) NOT NULL,
`pur_order_no` text NOT NULL,
`pur_order_date` date NOT NULL,
`invoice_no` text NOT NULL,
`invoice_date` date NOT NULL,
`material_grade` text NOT NULL,
`raw_material_type` varchar(25) NOT NULL,
`available_weight` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `raw_material`
--
INSERT INTO `raw_material` (`internal_no`, `receipt_code`, `date`, `size`, `manufacturer`, `heat_no`, `weight`, `left_over_weight`, `pur_order_no`, `pur_order_date`, `invoice_no`, `invoice_date`, `material_grade`, `raw_material_type`, `available_weight`) VALUES
(8, '12456', '2015-12-09', '50x40', 'akgec', '1234589', 46463, '100', '', '1970-01-01', '', '1970-01-01', 'SSSH', 'Round', 100),
(9, '14256', '2016-01-14', '50x40', 'ims', '4686', 100, '', '68616', '2016-01-21', '', '1970-01-01', 'SSSH', 'Round', 100),
(10, '', '1970-01-01', '50x40', 'ims', '', 0, '', '', '1970-01-01', '', '1970-01-01', 'SSSH', 'Ingot', 0),
(11, '', '1970-01-01', '50x40', 'akgec', '', 0, '', '', '1970-01-01', '', '1970-01-01', 'SSSH', 'Ingot', 0),
(12, '', '1970-01-01', '50x40', 'hitech', '', 0, '', '', '1970-01-01', '', '1970-01-01', 'SSSH', 'Ingot', 0),
(13, '', '1970-01-01', '50x40', 'ims', '', 0, '', '', '1970-01-01', '', '1970-01-01', 'SSSH', 'Ingot', 0);
-- --------------------------------------------------------
--
-- Table structure for table `remarks`
--
CREATE TABLE `remarks` (
`work_order_no` int(10) NOT NULL,
`remarks` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `search_selection`
--
CREATE TABLE `search_selection` (
`search_id` int(5) NOT NULL,
`category` varchar(30) NOT NULL,
`options` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `search_selection`
--
INSERT INTO `search_selection` (`search_id`, `category`, `options`) VALUES
(1, 'Raw Material', 'Heat no'),
(2, 'Raw Material', 'Manufacturer');
-- --------------------------------------------------------
--
-- Table structure for table `seration_records`
--
CREATE TABLE `seration_records` (
`seration_id` int(10) NOT NULL,
`date` date NOT NULL,
`work_order_no` varchar(25) NOT NULL,
`item` varchar(25) NOT NULL,
`heat_no` varchar(25) NOT NULL,
`quantity` int(10) NOT NULL,
`machine_name` varchar(25) NOT NULL,
`employee_name` varchar(25) NOT NULL,
`grade` varchar(10) NOT NULL,
`weight` int(10) NOT NULL,
`remarks` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `seration_remarks`
--
CREATE TABLE `seration_remarks` (
`seration_id` int(10) NOT NULL,
`remarks` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `testing_instructions`
--
CREATE TABLE `testing_instructions` (
`work_order_no` int(10) NOT NULL,
`testing_ins` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(7) NOT NULL,
`username` varchar(20) NOT NULL,
`password` varchar(64) NOT NULL,
`remember_token` varchar(100) DEFAULT NULL,
`updated_at` varchar(255) DEFAULT NULL,
`role` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `remember_token`, `updated_at`, `role`) VALUES
(1, 'gaurav123', <PASSWORD>', '<PASSWORD>SGWyybydY0E1Q1VH6qRzTk', '2015-12-02 11:14:42', 0),
(2, 'admin', '$2a$10$CuHKyEbvKAt06kAgITp9IegTq/kMePhbDS56eZiKmOe.p9vMam.HK', 'fQ8joi8AW9l54kShfcAkXDoCkqMXbMYx4pAzIvbkUiuG9ihCO9slzpl6mfC2', '2015-12-02 17:02:15', 1),
(3, 'gaurav1188', '$2a$10$CuHKyEbvKAt06kAgITp9IegTq/kMePhbDS56eZiKmOe.p9vMam.HK', NULL, NULL, 2),
(4, 'abcd', '$2a$10$CuHKyEbvKAt06kAgITp9IegTq/kMePhbDS56eZiKmOe.p9vMam.HK', 'WYkzmRKbJocz32pYAOGL4sw5yM1WIH9qpWxBfVHE8GnibsuNd1KsSE4TVkRr', '2015-12-27 08:10:32', 3),
(5, 'efgh', '$2a$10$CuHKyEbvKAt06kAgITp9IegTq/kMePhbDS56eZiKmOe.p9vMam.HK', NULL, NULL, 4),
(6, 'ijkl', '$2a$10$CuHKyEbvKAt06kAgITp9IegTq/kMePhbDS56eZiKmOe.p9vMam.HK', NULL, NULL, 5),
(7, 'mnop', '$2a$10$CuHKyEbvKAt06kAgITp9IegTq/kMePhbDS56eZiKmOe.p9vMam.HK', 'xrvYR4KyjM9QJ8vkJqKjxHGv6iPyOSYhXjhviDsyLvYlTkfagEuURpxIaE6R', '2015-12-02 16:57:06', 5),
(8, 'qrst', '$2a$10$CuHKyEbvKAt06kAgITp9IegTq/kMePhbDS56eZiKmOe.p9vMam.HK', 'u1FgWsmtuQEyT4as6GrJxqXrXHoicANCebSKb5OoAhgB0tzW84hfCzBIj1tb', '2015-12-22 10:02:22', 6);
-- --------------------------------------------------------
--
-- Table structure for table `work_order_details`
--
CREATE TABLE `work_order_details` (
`work_order_no` int(7) NOT NULL,
`purchase_order_no` varchar(40) DEFAULT NULL,
`customer_name` varchar(20) NOT NULL,
`purchase_order_date` date NOT NULL,
`required_delivery_date` date NOT NULL,
`inspection` varchar(40) NOT NULL,
`packing_instruction` varchar(40) NOT NULL,
`testing_instruction` varchar(40) NOT NULL,
`quatation_no` varchar(20) NOT NULL,
`remarks` varchar(40) NOT NULL,
`status` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `work_order_details`
--
INSERT INTO `work_order_details` (`work_order_no`, `purchase_order_no`, `customer_name`, `purchase_order_date`, `required_delivery_date`, `inspection`, `packing_instruction`, `testing_instruction`, `quatation_no`, `remarks`, `status`) VALUES
(6, '46656', 'vbfsklns', '2015-12-16', '2015-12-16', 'vfsuak', 'fhlhskl', 'hislhwlk', '7656', 'vfaeugvkjsavhal fhaoihaljabjk', '0'),
(7, '124567899', '<NAME>', '2015-12-23', '2015-12-16', 'gdsjgsakjh', 'fgkjafhvksa', 'vjhvjayinsful', '12456789', 'dbsjabvsahs', '0'),
(8, '124567899', '<NAME>', '2015-12-23', '2016-11-12', 'gdsjgsakjh', 'fgkjafhvksa', 'vjhvjayinsful', '12456789', 'dbsjabvsahs', '0'),
(9, '12456', '<NAME>', '2016-01-08', '1970-01-01', '', '', '', '', '', '0'),
(10, '12456', '<NAME>', '2016-01-08', '1970-01-01', '', '', '', '', '', '0'),
(11, '', '', '1970-01-01', '1970-01-01', '', '', '', '', '', '0'),
(12, '', '', '1970-01-01', '1970-01-01', '', '', '', '', '', '0'),
(13, '', 'gaurav arora', '2016-01-06', '1970-01-01', '', '', '', '', '', '0'),
(14, '', 'gaurav arora ji', '2016-01-06', '1970-01-01', '', '', '', '', '', '0');
-- --------------------------------------------------------
--
-- Table structure for table `work_order_material_details`
--
CREATE TABLE `work_order_material_details` (
`work_id` int(5) NOT NULL,
`work_order_no` int(15) NOT NULL,
`item_no` varchar(10) NOT NULL,
`material_grade` varchar(5) NOT NULL,
`size` varchar(30) NOT NULL,
`pressure` varchar(30) NOT NULL,
`type` varchar(30) NOT NULL,
`schedule` varchar(30) NOT NULL,
`quantity` int(5) NOT NULL,
`weight` int(5) NOT NULL,
`remarks` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `work_order_material_details`
--
INSERT INTO `work_order_material_details` (`work_id`, `work_order_no`, `item_no`, `material_grade`, `size`, `pressure`, `type`, `schedule`, `quantity`, `weight`, `remarks`) VALUES
(10, 6, '6/1', 'SSSH', '5', '200 pa', 'dddd', 'abcd', 0, 0, ''),
(11, 6, ' 6/2', 'SSSH', '5', '300 pa', 'dddd', 'abcd', 0, 0, ''),
(12, 6, ' 6/3', 'SSSH', '5', '400 pa', 'dddd', 'abcd', 0, 0, ''),
(13, 6, '6/1', 'SSSH', '5', '200 pa', 'dddd', 'abcd', 0, 0, ''),
(14, 6, ' 6/2', 'SSSH', '5', '300 pa', 'dddd', 'hfeiw', 0, 0, ''),
(15, 6, ' 6/3', 'SSSH', '5', '400 pa', 'dddd', 'hfeiw', 0, 0, ''),
(16, 6, '6/1', 'SSSH', '5', '200 pa', 'dddd', 'abcd', 0, 0, ''),
(17, 6, '6/1', 'SSSH', '5', '200 pa', 'dddd', 'abcd', 0, 0, ''),
(18, 7, '7/1', 'SSSH', '5', '400 pa', 'dddd', 'hfeiw', 12, 100, 'bfuhs'),
(19, 7, ' 7/2', 'SSSH', '5', '200 pa', 'dddd', 'hfeiw', 15, 455, 'fvbsj'),
(20, 7, '7/1', 'SSSH', '5', '400 pa', 'dddd', 'hfeiw', 12, 100, 'bfuhs'),
(21, 7, '7/1', 'SSSH', '5', '400 pa', 'dddd', 'hfeiw', 12, 100, 'bfuhs'),
(22, 9, '9/1', 'SSSH', '5', '200 pa', 'dddd', 'hfeiw', 0, 0, ''),
(23, 9, ' 9/2', 'SSSH', '5', '200 pa', 'dddd', 'hfeiw', 0, 0, ''),
(24, 11, '11/1', 'SSSH', '5', '200 pa', 'dddd', 'hfeiw', 0, 0, ''),
(25, 11, '11/1', 'SSSH', '5', '200 pa', 'dddd', 'hfeiw', 0, 0, ''),
(26, 12, '12/1', 'SSSH', '5', '200 pa', 'dddd', 'hfeiw', 0, 0, ''),
(27, 13, '13/1', 'SSSH', '5', '200 pa', 'dddd', 'hfeiw', 0, 0, ''),
(28, 13, ' 13/2', 'SSSH', '5', '200 pa', 'dddd', 'hfeiw', 0, 0, ''),
(29, 14, '14/1', 'SSSH', '5', '200 pa', 'dddd', 'hfeiw', 0, 0, ''),
(30, 14, ' 14/2', 'SSSH', '5', '200 pa', 'dddd', 'hfeiw', 0, 0, ''),
(31, 14, ' 14/3', 'SSSH', '5', '200 pa', 'dddd', 'hfeiw', 0, 0, '');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cutting_records`
--
ALTER TABLE `cutting_records`
ADD PRIMARY KEY (`cutting_id`);
--
-- Indexes for table `cutting_remarks`
--
ALTER TABLE `cutting_remarks`
ADD PRIMARY KEY (`cutting_id`);
--
-- Indexes for table `drilling_records`
--
ALTER TABLE `drilling_records`
ADD PRIMARY KEY (`drilling_id`);
--
-- Indexes for table `drilling_remarks`
--
ALTER TABLE `drilling_remarks`
ADD PRIMARY KEY (`drilling_id`);
--
-- Indexes for table `forging_records`
--
ALTER TABLE `forging_records`
ADD PRIMARY KEY (`forging_id`);
--
-- Indexes for table `logbook`
--
ALTER TABLE `logbook`
ADD PRIMARY KEY (`log_id`);
--
-- Indexes for table `machining_records`
--
ALTER TABLE `machining_records`
ADD PRIMARY KEY (`mach_id`);
--
-- Indexes for table `master_description_type`
--
ALTER TABLE `master_description_type`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `master_grades`
--
ALTER TABLE `master_grades`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `master_manufacturers`
--
ALTER TABLE `master_manufacturers`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `master_pressure`
--
ALTER TABLE `master_pressure`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `master_schedule`
--
ALTER TABLE `master_schedule`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `master_sizes`
--
ALTER TABLE `master_sizes`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `master_std_size`
--
ALTER TABLE `master_std_size`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `raw_material`
--
ALTER TABLE `raw_material`
ADD PRIMARY KEY (`internal_no`);
--
-- Indexes for table `search_selection`
--
ALTER TABLE `search_selection`
ADD PRIMARY KEY (`search_id`);
--
-- Indexes for table `seration_records`
--
ALTER TABLE `seration_records`
ADD PRIMARY KEY (`seration_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `work_order_details`
--
ALTER TABLE `work_order_details`
ADD PRIMARY KEY (`work_order_no`);
--
-- Indexes for table `work_order_material_details`
--
ALTER TABLE `work_order_material_details`
ADD PRIMARY KEY (`work_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `cutting_records`
--
ALTER TABLE `cutting_records`
MODIFY `cutting_id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `cutting_remarks`
--
ALTER TABLE `cutting_remarks`
MODIFY `cutting_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `drilling_records`
--
ALTER TABLE `drilling_records`
MODIFY `drilling_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `forging_records`
--
ALTER TABLE `forging_records`
MODIFY `forging_id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `logbook`
--
ALTER TABLE `logbook`
MODIFY `log_id` int(8) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `machining_records`
--
ALTER TABLE `machining_records`
MODIFY `mach_id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `master_description_type`
--
ALTER TABLE `master_description_type`
MODIFY `id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `master_grades`
--
ALTER TABLE `master_grades`
MODIFY `id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `master_manufacturers`
--
ALTER TABLE `master_manufacturers`
MODIFY `id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `master_pressure`
--
ALTER TABLE `master_pressure`
MODIFY `id` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `master_schedule`
--
ALTER TABLE `master_schedule`
MODIFY `id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `master_sizes`
--
ALTER TABLE `master_sizes`
MODIFY `id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `master_std_size`
--
ALTER TABLE `master_std_size`
MODIFY `id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `raw_material`
--
ALTER TABLE `raw_material`
MODIFY `internal_no` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `search_selection`
--
ALTER TABLE `search_selection`
MODIFY `search_id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `seration_records`
--
ALTER TABLE `seration_records`
MODIFY `seration_id` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `work_order_details`
--
ALTER TABLE `work_order_details`
MODIFY `work_order_no` int(7) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `work_order_material_details`
--
ALTER TABLE `work_order_material_details`
MODIFY `work_id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 20-10-2017 a las 20:51:51
-- Versión del servidor: 10.1.25-MariaDB
-- Versión de PHP: 7.1.7
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 */;
--
-- Base de datos: `miempresa`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `catelementos`
--
CREATE TABLE `catelementos` (
`Id` int(11) NOT NULL,
`Catalogo` varchar(200) COLLATE utf8_spanish2_ci NOT NULL,
`IdElemento` int(11) NOT NULL,
`Elemento` varchar(200) COLLATE utf8_spanish2_ci NOT NULL,
`NombreCorto` varchar(12) COLLATE utf8_spanish2_ci NOT NULL,
`IdElementoPadre` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish2_ci;
--
-- Volcado de datos para la tabla `catelementos`
--
INSERT INTO `catelementos` (`Id`, `Catalogo`, `IdElemento`, `Elemento`, `NombreCorto`, `IdElementoPadre`) VALUES
(1, 'CatTipoUsuario', 1, 'Administrador', 'ADMIN', NULL),
(2, 'CatTipoUsuario', 2, 'Auditor', 'AUDI', NULL),
(3, 'CatTipoUsuario', 3, 'Común', 'COM', NULL),
(4, 'CatSexo', 1, 'Masculino', 'M', NULL),
(5, 'CatSexo', 2, 'Femenino', 'F', NULL),
(6, 'CatTipoExcel', 1, 'Mensual SUA', 'MSUA', NULL),
(7, 'CatTipoExcel', 2, 'Mensual IDSE', 'MIDSE', NULL),
(8, 'CatTipoExcel', 3, 'Mensual XML', 'MXML', NULL),
(9, 'CatTipoExcel', 4, 'Bimestral SUA', 'BSUA', NULL),
(10, 'CatTipoExcel', 5, 'Bimestral IDSE', 'BIDSE', NULL),
(11, 'CatTipoExcel', 6, 'Bimestral XML', 'BXML', NULL);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `catelementos`
--
ALTER TABLE `catelementos`
ADD PRIMARY KEY (`Id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `catelementos`
--
ALTER TABLE `catelementos`
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;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 */;
|
INSERT INTO articles(
slug,
title,
content,
author_id
) values(
'post-1',
'Test 1',
'# head 1
# Highlight.js
[](https://travis-ci.org/isagalaev/highlight.js)
Highlight.js is a syntax highlighter written in JavaScript. It works in
the browser as well as on the server. It works with pretty much any
markup, doesn’t depend on any framework and has automatic language
detection.
## Getting Started
The bare minimum for using highlight.js on a web page is linking to the
library along with one of the styles and calling
```html
<link rel="stylesheet" href="/path/to/styles/default.css">
<script src="/path/to/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
```
This will find and highlight code inside of `<pre><code>` tags; it tries
to detect the language automatically. If automatic detection doesn’t
work for you, you can specify the language in the `class` attribute:
```html
<pre><code class="html">...</code></pre>
```
**UU**',
1
);
INSERT INTO articles(
slug,
title,
content,
author_id
) values(
'post-2',
'Test 2',
'## head 2
`Block 2`
Test
__I__
**UU**
',
2
);
INSERT INTO articles(
slug,
title,
content,
author_id
) values(
'post-3',
'Test 3',
'### HEAD 3
```python
Block 3
TESTSTST
```
Test
_I_**UU**',
2
);
|
<gh_stars>1-10
SET DEFINE OFF;
CREATE TABLE AFW_17_PROPR_COURL_ENTRA
(
SEQNC NUMBER(18),
REF_COURL_ENTRA NUMBER(16),
NOM VARCHAR2(100 BYTE),
VALR VARCHAR2(4000 BYTE),
DATE_CREAT DATE,
UTILS_CREAT VARCHAR2(123 BYTE),
DATE_MODFC DATE,
UTILS_MODFC VARCHAR2(123 BYTE)
)
LOGGING
NOCOMPRESS
NOCACHE
MONITORING
/
|
DROP TABLE IF EXISTS books;
CREATE TABLE books (
id SERIAL PRIMARY KEY,
author VARCHAR(255),
title VARCHAR(255),
isbn VARCHAR(255),
image_url VARCHAR(255),
description TEXT,
bookshelf VARCHAR(255)
);
INSERT INTO books (author, title, isbn, image_url, description, bookshelf)
VALUES ('<NAME>', 'The Shining', '9780385528863', 'http://books.google.com/books/content?id=8VnJLu3AvvQC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api',
'With an excerpt from the sequel, Doctor Sleep. Terrible events occur at an isolated hotel in the off season, when a small boy with psychic powers struggles to hold his own against the forces of evil that are driving his father insane.', 'horror');
INSERT INTO books (author, title, isbn, image_url, description, bookshelf)
VALUES ('<NAME>', 'Dune', '9780575081505','http://books.google.com/books/content?id=deRpPwAACAAJ&printsec=frontcover&img=1&zoom=5&source=gbs_api',
'The Duke of Atreides has been manoeuvred by his arch-enemy, <NAME>, into administering the desert planet of Dune. Although it is almost completely without water, Dune is a planet of fabulous wealth, for it is the only source of a drug prized throughout the Galactic Empire. The Duke and his son, Paul, are expecting treachery, and it duly comes - but from a shockingly unexpected place. Then Paul succeeds his father, and he becomes a catalyst for the native people of Dune, whose knowledge of the ecology of the planet gives them vast power. They have been waiting for a leader like <NAME>, a leader who can harness that force ... DUNE: one of the most brilliant science fiction novels ever written, as engrossing and heart-rending today as it was when it was first published half a century ago. Joint winner of the HUGO AWARD for best novel, 1966 Winner of the NEBULA AWARD for best novel, 1965', 'SciFi'); |
<filename>CongressManager/Hawaso.Database/dbo/Stored Procedures/CongressesDelete.sql
-- 해당 글을 지우는 저장 프로시저(답변글이 있으면 업데이트하고 없으면 지운다.): CongressesDelete
Create Proc dbo.CongressesDelete
@Id Int,
@Password NVarChar(255) -- 암호 매개변수 추가
As
Declare @cnt Int
Select @cnt = Count(*) From Congresses
Where Id = @Id And Password = @Password
If @cnt = 0
Begin
Return 0 -- 번호와 암호가 맞는게 없으면 0을 반환
End
Declare @AnswerNum Int
Declare @RefOrder Int
Declare @Ref Int
Declare @ParentNum Int
Select
@AnswerNum = AnswerNum, @RefOrder = RefOrder,
@Ref = Ref, @ParentNum = ParentNum
From Congresses
Where Id = @Id
If @AnswerNum = 0
Begin
-- 답변 글이 없으면 바로 삭제
If @RefOrder > 0
Begin
UPDATE Congresses SET RefOrder = RefOrder - 1
WHERE Ref = @Ref AND RefOrder > @RefOrder
UPDATE Congresses SET AnswerNum = AnswerNum - 1 WHERE Id = @ParentNum
End
Delete Congresses Where Id = @Id
Delete Congresses
WHERE
Id = @ParentNum AND ModifyIp = N'((DELETED))' AND AnswerNum = 0
End
Else
Begin
-- 답변 글이 있으면 삭제하지 않고 내용만 Null 값으로 업데이트
Update Congresses
Set
Name = N'(Unknown)', Email = '', Password = '',
Title = N'(삭제된 글입니다.)',
Content = N'(삭제된 글입니다. '
+ N'현재 답변이 포함되어 있기 때문에 내용만 삭제되었습니다.)',
ModifyIp = N'((DELETED))', FileName = '',
FileSize = 0, CommentCount = 0
Where Id = @Id
End
Go
|
select col.table_name,
col.column_name,
col.data_type
from sys.all_tab_columns col
inner join sys.all_tables t
on col.owner = t.owner
and col.table_name = t.table_name
where col.data_type in ('BLOB', 'CLOB', 'NCLOB', 'BFILE')
and col.owner = 'W_DEMO_000'
order by col.table_name, col.column_name;
|
sp_configure 'show advanced options', 1;
reconfigure;
go
sp_configure 'clr enabled', 1;
reconfigure with override;
go
alter database current set trustworthy on;
exec sp_changedbowner @loginame = sa, @map = false;
go |
<filename>Features/IntegrationPlatform-svn/Core/TfsMigrationDBConsolidation/Tfs_Integration/Schema Objects/Tables/Keys/dbo.WI_TYPE_MAP_COLLECTION.PK_WITypeMapCollection.pkey.sql
ALTER TABLE [dbo].[WI_TYPE_MAP_COLLECTION]
ADD CONSTRAINT [PK_WITypeMapCollection]
PRIMARY KEY (Id) |
<filename>db_archive/sql_archive/1021__drop_table_f_dw_yo_rekrytointihaut.sql
--
-- DROP TABLE f_yo_rekrytointihaut
--
USE [ANTERO]
GO
IF EXISTS
(SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='dw'
AND TABLE_NAME='f_yo_rekrytointihaut')
BEGIN
DROP TABLE [dw].[f_yo_rekrytointihaut]
END
|
<filename>airbyte-integrations/bases/base-normalization/integration_tests/normalization_test_output/mysql/test_nested_streams/second_output/airbyte_ctes/test_normalization/nested_stream_with_co_3mn___with__quotes_ab3.sql
create view _airbyte_test_normalization.`nested_stream_with_co_3mn___with__quotes_ab3__dbt_tmp` as (
-- SQL model to build a hash column based on the values of this record
select
md5(cast(concat(coalesce(cast(_airbyte_partition_hashid as char), ''), '-', coalesce(cast(currency as char), '')) as char)) as _airbyte_column___with__quotes_hashid,
tmp.*
from _airbyte_test_normalization.`nested_stream_with_co_3mn___with__quotes_ab2` tmp
-- column___with__quotes at nested_stream_with_complex_columns_resulting_into_long_names/partition/column`_'with"_quotes
where 1 = 1
);
|
/* Formatted on 12-17-2018 10:09:25 AM (QP5 v5.126.903.23003) */
DROP TABLE SEC.SEC_SECURITY_POLICIES CASCADE CONSTRAINTS PURGE;
CREATE TABLE SEC.SEC_SECURITY_POLICIES (
POLICY_ID NUMBER NOT NULL,
POLICY_NAME VARCHAR2 (100),
MAX_FAILED_LGN_ATTMPTS NUMBER,
PSWD_EXPIRY_DAYS NUMBER,
AUTO_UNLOCKING_TIME_MINS NUMBER,
PSWD_REQUIRE_CAPS VARCHAR2 (1 BYTE),
PSWD_REQUIRE_SMALL VARCHAR2 (1 BYTE),
PSWD_REQUIRE_DGT VARCHAR2 (1 BYTE),
PSWD_REQUIRE_WILD VARCHAR2 (1 BYTE),
PSWD_REQRMNT_COMBNTNS VARCHAR2 (5 BYTE), -- POSSIBILITIES INCLUDE...
IS_DEFAULT VARCHAR2 (1 BYTE),
CREATED_BY NUMBER NOT NULL,
CREATION_DATE VARCHAR2 (21) NOT NULL,
LAST_UPDATE_BY NUMBER NOT NULL,
LAST_UPDATE_DATE VARCHAR2 (21) NOT NULL,
OLD_PSWD_CNT_TO_DISALLOW NUMBER,
PSWD_MIN_LENGTH NUMBER,
PSWD_MAX_LENGTH NUMBER,
MAX_NO_RECS_TO_DSPLY NUMBER,
ALLOW_REPEATING_CHARS VARCHAR2 (1 BYTE),
ALLOW_USRNAME_IN_PSWDS VARCHAR2 (1 BYTE),
SESSION_TIMEOUT NUMBER NOT NULL
)
TABLESPACE RHODB
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
CREATE UNIQUE INDEX SEC.IDX_POLICY_ID
ON SEC.SEC_SECURITY_POLICIES (POLICY_ID)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
DROP SEQUENCE SEC.SEC_SECURITY_POLICIES_SEQ;
CREATE SEQUENCE SEC.SEC_SECURITY_POLICIES_SEQ
START WITH 1
MAXVALUE 9223372036854775807
MINVALUE 1
NOCYCLE
CACHE 20
ORDER;
ALTER TABLE SEC.SEC_SECURITY_POLICIES ADD (
CONSTRAINT PK_POLICY_ID
PRIMARY KEY
(POLICY_ID));
CREATE UNIQUE INDEX SEC.IDX_POLICY_NAME
ON SEC.SEC_SECURITY_POLICIES (POLICY_NAME)
LOGGING
TABLESPACE RHODB
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
NOPARALLEL;
CREATE OR REPLACE TRIGGER SEC.SEC_SECURITY_POLICIES_TRG
BEFORE INSERT
ON SEC.SEC_SECURITY_POLICIES
FOR EACH ROW
-- OPTIONALLY RESTRICT THIS TRIGGER TO FIRE ONLY WHEN REALLY NEEDED
WHEN (NEW.POLICY_ID IS NULL)
DECLARE
V_ID SEC.SEC_SECURITY_POLICIES.POLICY_ID%TYPE;
BEGIN
SELECT SEC.SEC_SECURITY_POLICIES_SEQ.NEXTVAL INTO V_ID FROM DUAL;
:NEW.POLICY_ID := V_ID;
END SEC_SECURITY_POLICIES_TRG; |
CREATE TABLE IF NOT EXISTS code_layer (
layerid INT UNSIGNED NOT NULL PRIMARY KEY,
layer VARCHAR(256) NOT NULL UNIQUE) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS code_program (
programid INT UNSIGNED NOT NULL PRIMARY KEY,
program VARCHAR(256) NOT NULL UNIQUE,
enabled BOOLEAN NOT NULL DEFAULT TRUE,
layerid INT UNSIGNED NOT NULL,
CONSTRAINT layerid_cp FOREIGN KEY (layerid) REFERENCES code_layer (layerid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS code_program_launch (
priority INT UNSIGNED NOT NULL PRIMARY KEY,
programid INT UNSIGNED NOT NULL,
parameters VARCHAR(1024) DEFAULT NULL,
wait BOOLEAN NOT NULL DEFAULT TRUE,
enabled BOOLEAN NOT NULL DEFAULT TRUE,
CONSTRAINT programid_cpl FOREIGN KEY (programid) REFERENCES code_program (programid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS code_program_query (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
programid INT UNSIGNED NOT NULL,
stage INT UNSIGNED NOT NULL,
priority INT UNSIGNED NOT NULL,
parameter VARCHAR(256) DEFAULT NULL,
tablename VARCHAR(256) DEFAULT NULL,
query VARCHAR(8192) NOT NULL DEFAULT '',
enabled BOOLEAN NOT NULL DEFAULT TRUE,
nrepeat SMALLINT UNSIGNED NOT NULL DEFAULT 1,
UNIQUE KEY psp (programid, stage, priority),
KEY stage (stage),
KEY priority (priority),
CONSTRAINT programid_cpq FOREIGN KEY (programid) REFERENCES code_program (programid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS code_action (
actionid INT UNSIGNED NOT NULL PRIMARY KEY,
action VARCHAR(256) NOT NULL UNIQUE) ENGINE=InnoDB;
|
-- 1. Elimine la tabla "clientes", si existe:
DROP TABLE IF EXISTS clientes;
-- 2. Créela con la siguiente estructura:
CREATE TABLE clientes (
codigo INT UNSIGNED AUTO_INCREMENT,
nombre VARCHAR(30) NOT NULL,
domicilio VARCHAR(30),
ciudad VARCHAR(20),
provincia VARCHAR (20),
telefono VARCHAR(11),
PRIMARY KEY(codigo)
);
-- 3. Ingrese algunos registros:
INSERT INTO clientes (nombre,domicilio,ciudad,provincia,telefono)
VALUES ('<NAME>', 'Colon 111', 'Córdoba','Cordoba','null');
INSERT INTO clientes (nombre,domicilio,ciudad,provincia,telefono)
VALUES ('<NAME>', 'San Martin 222', 'Cruz del Eje','Cordoba','4578585');
INSERT INTO clientes (nombre,domicilio,ciudad,provincia,telefono)
VALUES ('<NAME>', 'Rivadavia 333', 'Villa Maria','Cordoba','4578445');
INSERT INTO clientes (nombre,domicilio,ciudad,provincia,telefono)
VALUES ('<NAME>', 'Sarmiento 444', 'Rosario','Santa Fe',NULL);
INSERT INTO clientes (nombre,domicilio,ciudad,provincia,telefono)
VALUES ('<NAME>', 'San Martin 555', 'Cruz del Eje','Cordoba','4253685');
INSERT INTO clientes (nombre,domicilio,ciudad,provincia,telefono)
VALUES ('<NAME>', 'San Martin 666', 'Santa Fe','Santa Fe','0345252525');
INSERT INTO clientes (nombre,domicilio,ciudad,provincia,telefono)
VALUES ('<NAME>', 'Alem 777', 'Villa del Rosario','Cordoba','4554455');
INSERT INTO clientes (nombre,domicilio,ciudad,provincia,telefono)
VALUES ('<NAME>', 'Irigoyen 888', 'Cruz del Eje','Cordoba',NULL);
INSERT INTO clientes (nombre,domicilio,ciudad,provincia,telefono)
VALUES ('<NAME>', 'San Martin 999', 'Cordoba','Cordoba','4223366');
INSERT INTO clientes (nombre,domicilio,ciudad,provincia,telefono)
VALUES ('<NAME>', 'San Martin 1010', 'Posadas','Misiones','0457858745');
-- 4. Obtenga el total de los registros (10):
SELECT COUNT(*) FROM clientes;
-- 5. Obtenga el total de los registros que no tienen valor nulo en los teléfonos (8):
SELECT COUNT(telefono) FROM clientes;
-- 6. Obtenga la cantidad de clientes agrupados por ciudad y provincia, ordenados por provincia:
SELECT ciudad, provincia, COUNT(*) FROM clientes GROUP BY ciudad, provincia;
|
\set ECHO none
\ir sql/configs/mysql_parameters.conf
\set ECHO all
\i sql/14.0/ported_postgres_fdw.sql |
<filename>sql_reconversion/metas.sql
update metas set gobernacion_meta = gobernacion_meta / 1000000, saar_meta = saar_meta / 1000000 |
<filename>models/intg_claim_transaction_incr.sql
{{
config(
materialized='incremental'
, tags=["incr"]
, unique_key='claim_pk'
)
}}
select
claim_transaction_key
, trans_date
, trans_set_type
, trans_set_userid
, ts_updatetime
, trans_type
, trans_authorised
, t_updatetime
, trans_desc
, trans_amount
, tl_updatetime
, updatetime
, dbt_valid_from
, dbt_valid_to
, dbt_updated_at
, concat(claim_transaction_key, '~', dbt_valid_from) as claim_pk
, coalesce(dbt_valid_to, dbt_updated_at) as claim_last_updated
from {{ ref('intg_claim_transaction_batch') }}
{% if is_incremental() %}
-- this filter will only be applied on an incremental run
where coalesce(dbt_valid_to, dbt_updated_at) > (select max(claim_last_updated) from {{ this }})
{% endif %} |
<filename>tests/queries/0_stateless/02307_join_get_array_null.sql<gh_stars>1000+
drop table if exists id_val;
create table id_val(id Int32, val Array(Int32)) engine Join(ANY, LEFT, id) settings join_use_nulls = 1;
select joinGet(id_val, 'val', toInt32(number)) from numbers(1);
drop table id_val;
|
<reponame>HaoQiangJiang/file-manage
/*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 50718
Source Host : localhost:3306
Source Database : file
Target Server Type : MYSQL
Target Server Version : 50718
File Encoding : 65001
Date: 2019-09-27 11:18:38
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for codes
-- ----------------------------
DROP TABLE IF EXISTS `codes`;
CREATE TABLE `codes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(255) DEFAULT NULL,
`email` varchar(255) NOT NULL,
PRIMARY KEY (`id`,`email`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of codes
-- ----------------------------
INSERT INTO `codes` VALUES ('7', 'ac431c0f065e47cd94874813eb1e34f2', '<EMAIL>');
-- ----------------------------
-- Table structure for t_file
-- ----------------------------
DROP TABLE IF EXISTS `t_file`;
CREATE TABLE `t_file` (
`file_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '文件唯一标识',
`type_id` int(11) DEFAULT NULL COMMENT '文件所属类别ID',
`file_name` varchar(255) DEFAULT NULL COMMENT '文件上传后服务器返回的名称',
`file_describer` varchar(255) DEFAULT NULL COMMENT '资源详细描述',
`file_path` varchar(255) DEFAULT NULL COMMENT '文件路径',
`file_label` varchar(255) DEFAULT NULL COMMENT '文件标签',
`file_img_path` varchar(255) DEFAULT NULL COMMENT '文件配图路径',
`create_time` datetime DEFAULT NULL,
`last_update_time` datetime DEFAULT NULL,
`file_suffix` varchar(255) DEFAULT NULL,
`file_size` bigint(255) DEFAULT NULL COMMENT '文件大小,以byte为单位',
`file_title` varchar(255) DEFAULT NULL COMMENT '资源标题',
`exe_name` varchar(255) DEFAULT NULL COMMENT '可执行程序名称,仅当filetype为exe时填写该字段',
`img_name` varchar(255) DEFAULT NULL COMMENT '图片上传后服务器返回的名称',
PRIMARY KEY (`file_id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_file
-- ----------------------------
INSERT INTO `t_file` VALUES ('2', '4', '53cdd1f7c1f21.jpg', null, 'D:\\FileUpload1569226939801.jpg', null, null, '2019-09-23 16:22:20', '2019-09-23 16:22:20', '.jpg', '235257', null, null, null);
INSERT INTO `t_file` VALUES ('3', '4', '53cdd1f7c1f21.jpg', null, 'D:\\FileUpload1569227116743.jpg', null, null, '2019-09-23 16:25:17', '2019-09-23 16:25:17', '.jpg', '235257', null, null, null);
INSERT INTO `t_file` VALUES ('4', '4', '53cdd1f7c1f21.jpg', null, 'D:\\FileUpload1569233197975.jpg', null, null, '2019-09-23 18:06:38', '2019-09-23 18:06:38', '.jpg', '235257', null, null, null);
INSERT INTO `t_file` VALUES ('5', '5', 'sys_user.sql', null, 'D:\\FileUpload\\1569289579361', null, null, null, null, '.sql', '1159', null, null, null);
INSERT INTO `t_file` VALUES ('6', '6', 'pom.xml', 'wwwwww', 'D:\\FileUpload\\1569297357349', null, null, null, null, '.xml', '2466', 'qqqqqqq', 'eeeedd', null);
INSERT INTO `t_file` VALUES ('7', null, null, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO `t_file` VALUES ('8', null, null, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO `t_file` VALUES ('9', null, null, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO `t_file` VALUES ('10', null, null, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO `t_file` VALUES ('11', null, null, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO `t_file` VALUES ('12', null, null, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO `t_file` VALUES ('13', null, null, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO `t_file` VALUES ('14', null, null, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO `t_file` VALUES ('17', '1', 'xxxxx.exe', '资源描述1', null, null, null, '2019-09-26 03:02:00', null, null, '123456', '资源1', '资源1.exe', '资源1配图');
INSERT INTO `t_file` VALUES ('18', '1', '资源2', '资源56', null, null, null, '2019-09-26 06:39:33', null, null, '123', '资源56', null, '资源2');
-- ----------------------------
-- Table structure for t_file_img
-- ----------------------------
DROP TABLE IF EXISTS `t_file_img`;
CREATE TABLE `t_file_img` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`file_id` int(11) NOT NULL COMMENT '上传文件唯一标识',
`img_id` int(11) NOT NULL COMMENT '配图文件唯一标识',
`create_time` datetime DEFAULT NULL,
`last_update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_file_img
-- ----------------------------
-- ----------------------------
-- Table structure for t_type
-- ----------------------------
DROP TABLE IF EXISTS `t_type`;
CREATE TABLE `t_type` (
`type_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '类别唯一标识',
`type_name` varchar(255) DEFAULT NULL COMMENT '类别名称',
`type_describer` varchar(2550) DEFAULT NULL COMMENT '类别描述',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`last_update_time` datetime DEFAULT NULL,
PRIMARY KEY (`type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_type
-- ----------------------------
INSERT INTO `t_type` VALUES ('1', 'exe', 'exe文件', '2019-09-25 09:24:41', null);
INSERT INTO `t_type` VALUES ('2', 'mp4', 'mp4文件', '2019-09-25 09:25:07', null);
INSERT INTO `t_type` VALUES ('3', 'doc', 'doc文件', '2019-09-25 02:44:13', null);
INSERT INTO `t_type` VALUES ('4', 'jpg', 'jpg文件', '2019-09-26 10:11:39', null);
INSERT INTO `t_type` VALUES ('5', 'sql', 'sql文件', '2019-09-26 10:39:17', null);
INSERT INTO `t_type` VALUES ('6', 'xml', 'xml文件', '2019-09-26 10:39:41', null);
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` varchar(255) NOT NULL,
`username` varchar(255) NOT NULL,
`passwd` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`usertype` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES ('84926da17933484c90f60a1696a648f5', '123456', 'e<PASSWORD>', '<EMAIL>', '2');
INSERT INTO `users` VALUES ('9ed2e37a95cb4962961b16a18f15f06d', '165153', '8d515e45f2066cbe6926a116105550d2', '1651654132', '2');
INSERT INTO `users` VALUES ('c267c5e2e8564e368c61a5fb59ea3426', '464135', '34a97642542b2a28abfe718fecc492f9', '46845132132', '2');
INSERT INTO `users` VALUES ('dbb<PASSWORD>', 'admin', '<PASSWORD>', '<EMAIL>', '1');
|
ALTER TABLE "C##LIQUIBASE".posts MODIFY inserted_date CONSTRAINT test_notNull NOT NULL |
<reponame>nenadnoveljic/tpt-oracle
-- Copyright 2018 <NAME>. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
--------------------------------------------------------------------------------
--
-- File name: demos/fetch.sql "<SQL to execute>"
--
-- Purpose: Advanced Oracle Troubleshooting Seminar demo script
--
-- Shows effect of arraysize to fetch lengths and
-- in which execution/fetching stage data access work is done
--
-- Author: <NAME> ( http://www.tanelpoder.com )
--
-- Copyright: (c) 2007-2009 <NAME>
--
--------------------------------------------------------------------------------
set termout off
drop table t;
create table t as
select
rownum a
, CAST(rownum as CHAR(2000)) b
from
dual
connect by
level <= 50
/
create index i on t(a);
exec dbms_stats.gather_table_stats(user, 'T');
--set arraysize 5
col fetch_command new_value fetch_command
select replace(replace(replace('&1', '*', '\*'),'/','\/'),'>','\>') fetch_command from dual;
-- hard parse
clear buffer
1 &1
/
alter session set sql_trace=true;
@ti
set termout off
clear buffer
1 &1
/
set termout on
prompt TRACE OUTPUT:
prompt _________________________________
prompt
host "grep -A 99999 -B1 '&fetch_command' &trc | sed -e '/&fetch_command/p;/PARS/p;/EXEC/p;/FETCH/p;d'"
--select * from table(dbms_xplan.display_cursor(null,null, 'ALLSTATS LAST'));
|
<filename>engine/schema/src/main/resources/META-INF/db/schema-222to224.sql<gh_stars>1000+
-- 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.
--;
-- Schema upgrade from 2.2.2 to 2.2.4;
--;
CREATE TABLE IF NOT EXISTS `cloud`.`version` (
`id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id',
`version` char(40) NOT NULL UNIQUE COMMENT 'version',
`updated` datetime NOT NULL COMMENT 'Date this version table was updated',
`step` char(32) NOT NULL COMMENT 'Step in the upgrade to this version',
PRIMARY KEY (`id`),
INDEX `i_version__version`(`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `cloud`.`op_host_capacity` ADD COLUMN `cluster_id` bigint unsigned AFTER `pod_id`;
ALTER TABLE `cloud`.`op_host_capacity` ADD CONSTRAINT `fk_op_host_capacity__cluster_id` FOREIGN KEY `fk_op_host_capacity__cluster_id` (`cluster_id`) REFERENCES `cloud`.`cluster`(`id`) ON DELETE CASCADE;
ALTER TABLE `cloud`.`op_host_capacity` ADD INDEX `i_op_host_capacity__cluster_id`(`cluster_id`);
ALTER TABLE `cloud`.`usage_event` ADD COLUMN `resource_type` varchar(32);
CREATE TABLE `cloud`.`domain_network_ref` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`domain_id` bigint unsigned NOT NULL COMMENT 'domain id',
`network_id` bigint unsigned NOT NULL COMMENT 'network id',
PRIMARY KEY (`id`),
CONSTRAINT `fk_domain_network_ref__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE,
CONSTRAINT `fk_domain_network_ref__networks_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `cloud`.`nics` MODIFY `ip4_address` char(40);
ALTER TABLE `cloud`.`op_lock` MODIFY `ip` char(40) NOT NULL;
ALTER TABLE `cloud`.`volumes` MODIFY `host_ip` char(40);
ALTER TABLE `cloud`.`op_dc_ip_address_alloc` MODIFY `ip_address` char(40) NOT NULL;
ALTER TABLE `cloud`.`op_dc_link_local_ip_address_alloc` MODIFY `ip_address` char(40) NOT NULL;
ALTER TABLE `cloud`.`host` MODIFY `private_ip_address` char(40) NOT NULL;
ALTER TABLE `cloud`.`host` MODIFY `storage_ip_address` char(40) NOT NULL;
ALTER TABLE `cloud`.`host` MODIFY `storage_ip_address_2` char(40);
ALTER TABLE `cloud`.`host` MODIFY `public_ip_address` char(40);
ALTER TABLE `cloud`.`mshost` MODIFY `service_ip` char(40) NOT NULL;
ALTER TABLE `cloud`.`user_statistics` MODIFY `public_ip_address` char(40);
ALTER TABLE `cloud`.`vm_instance` MODIFY `private_ip_address` char(40);
ALTER TABLE `cloud`.`user_vm` MODIFY `guest_ip_address` char(40);
ALTER TABLE `cloud`.`domain_router` MODIFY `public_ip_address` char(40);
ALTER TABLE `cloud`.`domain_router` MODIFY `guest_ip_address` char(40);
ALTER TABLE `cloud`.`console_proxy` MODIFY `public_ip_address` char(40) UNIQUE;
ALTER TABLE `cloud`.`secondary_storage_vm` MODIFY `public_ip_address` char(40) UNIQUE;
ALTER TABLE `cloud`.`remote_access_vpn` MODIFY `local_ip` char(40) NOT NULL;
ALTER TABLE `cloud`.`user_ip_address` MODIFY `public_ip_address` char(40) NOT NULL;
#Commented out these lines because they have to be done inside java.;
#ALTER TABLE `cloud`.`networks` DROP FOREIGN KEY `fk_networks__related`;
#ALTER TABLE `cloud`.`networks` ADD CONSTRAINT `fk_networks__related` FOREIGN KEY(`related`) REFERENCES `networks`(`id`) ON DELETE CASCADE;
ALTER TABLE `cloud`.`cluster` ADD COLUMN `removed` datetime COMMENT 'date removed if not null';
ALTER TABLE `cloud`.`cluster` MODIFY `name` varchar(255) COMMENT 'name for the cluster';
ALTER TABLE `cloud`.`network_offerings` MODIFY `guest_type` char(32);
UPDATE `cloud`.`network_offerings` SET `nw_rate`=0, `mc_rate`=0 WHERE system_only=1 and guest_type IS NULL;
UPDATE `cloud`.`network_offerings` SET `default`=1 WHERE system_only=1;
ALTER TABLE `cloud`.`data_center` ADD COLUMN `allocation_state` varchar(32) NOT NULL DEFAULT 'Enabled';
ALTER TABLE `cloud`.`data_center` ADD INDEX `i_data_center__allocation_state`(`allocation_state`);
ALTER TABLE `cloud`.`cluster` ADD COLUMN `allocation_state` varchar(32) NOT NULL DEFAULT 'Enabled';
ALTER TABLE `cloud`.`cluster` ADD INDEX `i_cluster__allocation_state`(`allocation_state`);
ALTER TABLE `cloud`.`host_pod_ref` ADD COLUMN `allocation_state` varchar(32) NOT NULL DEFAULT 'Enabled';
ALTER TABLE `cloud`.`host_pod_ref` ADD INDEX `i_host_pod_ref__allocation_state`(`allocation_state`);
ALTER TABLE `cloud`.`host` ADD COLUMN `allocation_state` varchar(32) NOT NULL DEFAULT 'Enabled';
ALTER TABLE `cloud`.`host` ADD INDEX `i_host__allocation_state`(`allocation_state`);
ALTER TABLE `cloud`.`domain` ADD INDEX `i_domain__path`(`path`);
CREATE TABLE `cloud`.`data_center_details` (
`id` bigint unsigned NOT NULL auto_increment,
`dc_id` bigint unsigned NOT NULL COMMENT 'dc id',
`name` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `fk_dc_details__dc_id` FOREIGN KEY (`dc_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `cloud`.`op_host_capacity` MODIFY `used_capacity` bigint signed NOT NULL;
ALTER TABLE `cloud`.`op_host_capacity` MODIFY `reserved_capacity` bigint signed NOT NULL;
ALTER TABLE `cloud`.`op_host_capacity` MODIFY `total_capacity` bigint signed NOT NULL;
INSERT IGNORE INTO `cloud`.`configuration` VALUES
('Advanced','DEFAULT','management-server','control.cidr','169.254.0.0/16','Changes the cidr for the control network traffic. Defaults to using link local. Must be unique within pods'),
('Advanced','DEFAULT','management-server','control.gateway','169.254.0.1','gateway for the control network traffic'),
('Advanced','DEFAULT','AgentManager','cmd.wait','7200','Time (in seconds) to wait for some heavy time-consuming commands'),
('Console Proxy','DEFAULT','AgentManager','consoleproxy.cpu.mhz','500','CPU speed (in MHz) used to create new console proxy VMs'),
('Console Proxy','DEFAULT','AgentManager','consoleproxy.disable.rpfilter','true','disable rp_filter on console proxy VM public interface'),
('Console Proxy','DEFAULT','AgentManager','consoleproxy.launch.max','10','maximum number of console proxy instances per zone can be launched'),
('Console Proxy','DEFAULT','AgentManager','consoleproxy.restart','true','Console proxy restart flag, defaulted to true'),
('Console Proxy','DEFAULT','AgentManager','consoleproxy.url.domain','realhostip.com','Console proxy url domain'),
('Advanced','DEFAULT','management-server','extract.url.cleanup.interval','120','The interval (in seconds) to wait before cleaning up the extract URL\'s '),
('Network','DEFAULT','AgentManager','guest.ip.network','10.1.1.1','The network address of the guest virtual network. Virtual machines will be assigned an IP in this subnet.'),
('Network','DEFAULT','AgentManager','guest.netmask','255.255.255.0','The netmask of the guest virtual network.'),
('Network','DEFAULT','management-server','guest.vlan.bits','12','The number of bits to reserve for the VLAN identifier in the guest subnet.'),
('Advanced','DEFAULT','management-server','host.capacity.checker.interval','3600','Time (in seconds) to wait before recalculating host\'s capacity'),
('Advanced','DEFAULT','management-server','host.capacity.checker.wait','3600','Time (in seconds) to wait before starting host capacity background checker'),
('Advanced','DEFAULT','management-server','host.capacityType.to.order.clusters','CPU','The host capacity type (CPU or RAM) is used by deployment planner to order clusters during VM resource allocation'),
('Advanced','DEFAULT','management-server','job.cancel.threshold.minutes','60','Time (in minutes) for async-jobs to be forcely cancelled if it has been in process for long'),
('Advanced','DEFAULT','management-server','kvm.private.network.device',NULL,'Specify the private bridge on host for private network'),
('Advanced','DEFAULT','management-server','kvm.public.network.device',NULL,'Specify the public bridge on host for public network'),
('Advanced','DEFAULT','management-server','network.gc.interval','600','Seconds to wait before checking for networks to shutdown'),
('Advanced','DEFAULT','management-server','network.gc.wait','600','Time (in seconds) to wait before shutting down a network that\'s not in used'),
('Network','DEFAULT','management-server','open.vswitch.tunnel.network','false','enable/disable open vswitch tunnel network(no vlan)'),
('Network','DEFAULT','management-server','open.vswitch.vlan.network','false','enable/disable vlan remapping of open vswitch network'),
('Advanced','DEFAULT','none','router.cpu.mhz','500','Default CPU speed (MHz) for router VM.'),
('Advanced','DEFAULT','none','router.template.id','1','Default ID for template.'),
('Advanced','DEFAULT','AgentManager','secstorage.vm.cpu.mhz','500','CPU speed (in MHz) used to create new secondary storage vms'),
('Snapshots','DEFAULT','none','snapshot.delta.max','16','max delta snapshots between two full snapshots.'),
('Advanced','DEFAULT','management-server','system.vm.auto.reserve.capacity','true','Indicates whether or not to automatically reserver system VM standby capacity.'),
('Advanced','DEFAULT','management-server','use.user.concentrated.pod.allocation','true','If true, deployment planner applies the user concentration heuristic during VM resource allocation'),
('Advanced','DEFAULT','management-server','vm.op.cancel.interval','3600','Time (in seconds) to wait before cancelling a operation'),
('Advanced','DEFAULT','management-server','vm.op.cleanup.interval','86400','Interval to run the thread that cleans up the vm operations (in seconds)'),
('Advanced','DEFAULT','management-server','vm.op.cleanup.wait','3600','Time (in seconds) to wait before cleanuping up any vm work items'),
('Advanced','DEFAULT','management-server','vm.op.lock.state.retry','5','Times to retry locking the state of a VM for operations'),
('Advanced','DEFAULT','management-server','vm.op.wait.interval','120','Time (in seconds) to wait before checking if a previous operation has succeeded'),
('Advanced','DEFAULT','management-server','vm.stats.interval','60000','The interval (in milliseconds) when vm stats are retrieved from agents.'),
('Advanced','DEFAULT','management-server','vm.tranisition.wait.interval','3600','Time (in seconds) to wait before taking over a VM in transition state'),
('Advanced','DEFAULT','management-server','vmware.guest.vswitch',NULL,'Specify the vSwitch on host for guest network'),
('Advanced','DEFAULT','management-server','vmware.private.vswitch',NULL,'Specify the vSwitch on host for private network'),
('Advanced','DEFAULT','management-server','vmware.public.vswitch',NULL,'Specify the vSwitch on host for public network'),
('Advanced','DEFAULT','management-server','vmware.service.console','Service Console','Specify the service console network name (ESX host only)'),
('Advanced','DEFAULT','AgentManager','xapiwait','600','Time (in seconds) to wait for XAPI to return'),
('Account Defaults','DEFAULT','management-server','max.account.user.vms','20','The default maximum number of user VMs that can be deployed for an account'),
('Account Defaults','DEFAULT','management-server','max.account.public.ips','20','The default maximum number of public IPs that can be consumed by an account'),
('Account Defaults','DEFAULT','management-server','max.account.templates','20','The default maximum number of templates that can be deployed for an account'),
('Account Defaults','DEFAULT','management-server','max.account.snapshots','20','The default maximum number of snapshots that can be created for an account'),
('Account Defaults','DEFAULT','management-server','max.account.volumes','20','The default maximum number of volumes that can be created for an account');
ALTER TABLE `cloud`.`op_dc_ip_address_alloc` CHANGE COLUMN `instance_id` `nic_id` bigint unsigned DEFAULT NULL;
ALTER TABLE `cloud`.`op_dc_link_local_ip_address_alloc` CHANGE COLUMN `instance_id` `nic_id` bigint unsigned DEFAULT NULL;
DELETE FROM `cloud`.`sequence` WHERE name='snapshots_seq';
UPDATE `cloud`.`service_offering` s, `cloud`.`disk_offering` d SET s.ha_enabled=1 where s.id=d.id and d.system_use=1;
UPDATE `cloud`.`data_center` SET is_security_group_enabled=1 WHERE networktype='Basic';
UPDATE `cloud`.`networks` SET is_security_group_enabled=1 WHERE guru_name='DirectPodBasedNetworkGuru';
UPDATE `cloud`.`nics` SET ip_type='Ip4';
UPDATE `cloud`.`nics` SET broadcast_uri='vlan://untagged', isolation_uri='ec2://untagged', strategy='Create' where reserver_name='DirectPodBasedNetworkGuru';
DELETE FROM `cloud`.`configuration` where name='schema.level';
DELETE FROM `cloud`.`configuration` where name='direct.attach.security.groups.enabled';
ALTER TABLE `cloud`.`domain` MODIFY COLUMN `path` varchar(255) NOT NULL;
ALTER TABLE `cloud`.`network_offerings` ADD INDEX `i_network_offerings__removed`(`removed`);
ALTER TABLE `cloud`.`nics` ADD INDEX `i_nics__removed`(`removed`);
ALTER TABLE `cloud`.`snapshot_schedule` DROP KEY `volume_id`;
ALTER TABLE `cloud`.`snapshot_schedule` ADD UNIQUE KEY `volume_id` (`volume_id`,`policy_id`);
ALTER TABLE `cloud`.`storage_pool` MODIFY COLUMN `uuid` varchar(255) UNIQUE;
ALTER TABLE `cloud`.`user_statistics` DROP KEY `account_id`;
ALTER TABLE `cloud`.`user_statistics` ADD UNIQUE KEY `account_id` (`account_id`,`data_center_id`, `public_ip_address`, `device_id`,`device_type`);
ALTER TABLE `cloud`.`usage_event` ADD INDEX `i_usage_event__created`(`created`);
UPDATE `cloud`.`vm_instance` SET ha_enabled=0 WHERE type='ConsoleProxy';
UPDATE service_offering SET ha_enabled=0 WHERE id=(SELECT id FROM disk_offering WHERE name LIKE '%console proxy%' AND system_use=1);
ALTER TABLE `cloud`.`storage_pool_details` DROP KEY `i_storage_pool_details__name__value`;
ALTER TABLE `cloud`.`storage_pool_details` ADD INDEX `i_storage_pool_details__name__value`(`name`(128), `value`(128));
DROP TABLE `cloud`.`load_balancer`;
UPDATE `cloud`.`nics` SET strategy='Create' where reserver_name='DirectNetworkGuru';
UPDATE storage_pool SET cluster_id=(SELECT cluster_id FROM host INNER JOIN storage_pool_host_ref WHERE host.id=storage_pool_host_ref.host_id AND storage_pool_host_ref.pool_id=storage_pool.id) WHERE pool_type='LVM';
UPDATE `cloud`.`host` SET resource='com.cloud.hypervisor.xen.resource.XenServer56FP1Resource' WHERE resource='com.cloud.hypervisor.xen.resource.XenServer56FP1PremiumResource';
|
<reponame>bopopescu/peloton
/*
This table tracks job update state change events.
Table is partitioned on update ID and within that partition
update state change events are sorted by descending create timestamp order.
*/
CREATE TABLE IF NOT EXISTS job_update_events (
update_id uuid,
type text,
state text,
create_time timeuuid,
PRIMARY KEY (update_id, create_time)
) WITH CLUSTERING ORDER BY (create_time DESC)
AND bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb': '64', 'unchecked_tombstone_compaction': 'true'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0;
|
<reponame>firebird631/siis<filename>sql/initpg.sql
-- initial, create tables for postgresql
-- usage example :
-- $ psql -h localhost -U root -W -p 5432
-- > CREATE DATABASE siis;
-- > CREATE USER siis WITH ENCRYPTED PASSWORD '<PASSWORD>';
-- > GRANT ALL PRIVILEGES ON DATABASE siis TO siis;
-- > CREATE EXTENSION timescaledb;
-- $ psql -h localhost -d siis -U siis -W -p 5432 -a -q -f initpg.sql
-- market
CREATE TABLE IF NOT EXISTS market(
id SERIAL PRIMARY KEY,
broker_id VARCHAR(255) NOT NULL, market_id VARCHAR(255) NOT NULL, symbol VARCHAR(32) NOT NULL,
market_type INTEGER NOT NULL DEFAULT 0, unit_type INTEGER NOT NULL DEFAULT 0, contract_type INTEGER NOT NULL DEFAULT 0,
trade_type INTEGER NOT NULL DEFAULT 0, orders INTEGER NOT NULL DEFAULT 0,
base VARCHAR(32) NOT NULL, base_display VARCHAR(32) NOT NULL, base_precision VARCHAR(32) NOT NULL,
quote VARCHAR(32) NOT NULL, quote_display VARCHAR(32) NOT NULL, quote_precision VARCHAR(32) NOT NULL,
expiry VARCHAR(32) NOT NULL, timestamp BIGINT NOT NULL,
lot_size VARCHAR(32) NOT NULL, contract_size VARCHAR(32) NOT NULL, base_exchange_rate VARCHAR(32) NOT NULL,
value_per_pip VARCHAR(32) NOT NULL, one_pip_means VARCHAR(32) NOT NULL, margin_factor VARCHAR(32) NOT NULL DEFAULT '1.0',
min_size VARCHAR(32) NOT NULL, max_size VARCHAR(32) NOT NULL, step_size VARCHAR(32) NOT NULL,
min_notional VARCHAR(32) NOT NULL, max_notional VARCHAR(32) NOT NULL, step_notional VARCHAR(32) NOT NULL,
min_price VARCHAR(32) NOT NULL, max_price VARCHAR(32) NOT NULL, step_price VARCHAR(32) NOT NULL,
maker_fee VARCHAR(32) NOT NULL DEFAULT '0', taker_fee VARCHAR(32) NOT NULL DEFAULT '0',
maker_commission VARCHAR(32) NOT NULL DEFAULT '0', taker_commission VARCHAR(32) NOT NULL DEFAULT '0',
UNIQUE(broker_id, market_id));
-- asset
CREATE TABLE IF NOT EXISTS asset(
id SERIAL PRIMARY KEY,
broker_id VARCHAR(255) NOT NULL, account_id VARCHAR(255) NOT NULL, asset_id VARCHAR(255) NOT NULL,
last_trade_id VARCHAR(32) NOT NULL, timestamp BIGINT NOT NULL,
quantity VARCHAR(32) NOT NULL, price VARCHAR(32) NOT NULL, quote_symbol VARCHAR(32) NOT NULL,
UNIQUE(broker_id, account_id, asset_id));
-- ohlc
CREATE TABLE IF NOT EXISTS ohlc(
id SERIAL PRIMARY KEY,
broker_id VARCHAR(255) NOT NULL, market_id VARCHAR(255) NOT NULL,
timestamp BIGINT NOT NULL, timeframe INTEGER NOT NULL,
bid_open VARCHAR(32) NOT NULL, bid_high VARCHAR(32) NOT NULL, bid_low VARCHAR(32) NOT NULL, bid_close VARCHAR(32) NOT NULL,
ask_open VARCHAR(32) NOT NULL, ask_high VARCHAR(32) NOT NULL, ask_low VARCHAR(32) NOT NULL, ask_close VARCHAR(32) NOT NULL,
volume VARCHAR(48) NOT NULL,
UNIQUE(broker_id, market_id, timestamp, timeframe));
-- liquidation
CREATE TABLE IF NOT EXISTS liquidation(
id SERIAL PRIMARY KEY,
broker_id VARCHAR(255) NOT NULL, market_id VARCHAR(255) NOT NULL,
timestamp BIGINT NOT NULL,
direction INTEGER NOT NULL,
price VARCHAR(32) NOT NULL,
quantity VARCHAR(32) NOT NULL);
-- user_trade
CREATE TABLE IF NOT EXISTS user_trade(
id SERIAL PRIMARY KEY,
broker_id VARCHAR(255) NOT NULL, account_id VARCHAR(255) NOT NULL, market_id VARCHAR(255) NOT NULL,
strategy_id VARCHAR(255) NOT NULL,
trade_id INTEGER NOT NULL,
trade_type INTEGER NOT NULL,
data TEXT NOT NULL DEFAULT '{}',
operations TEXT NOT NULL DEFAULT '{}',
UNIQUE(broker_id, account_id, market_id, strategy_id, trade_id));
-- user_trader
CREATE TABLE IF NOT EXISTS user_trader(
id SERIAL PRIMARY KEY,
broker_id VARCHAR(255) NOT NULL, account_id VARCHAR(255) NOT NULL, market_id VARCHAR(255) NOT NULL,
strategy_id VARCHAR(255) NOT NULL,
activity INTEGER NOT NULL DEFAULT 1,
data TEXT NOT NULL DEFAULT '{}',
regions TEXT NOT NULL DEFAULT '[]',
alerts TEXT NOT NULL DEFAULT '[]',
UNIQUE(broker_id, account_id, market_id, strategy_id));
-- user_closed_trade
CREATE TABLE IF NOT EXISTS user_closed_trade(
id SERIAL PRIMARY KEY,
broker_id VARCHAR(255) NOT NULL, account_id VARCHAR(255) NOT NULL, market_id VARCHAR(255) NOT NULL,
strategy_id VARCHAR(255) NOT NULL,
timestamp BIGINT NOT NULL,
data TEXT NOT NULL DEFAULT '{}');
CREATE INDEX IF NOT EXISTS idx_user_closed_trade_all on user_closed_trade(broker_id, account_id, market_id, strategy_id);
|
<filename>openGaussBase/testcase/KEYWORDS/Compress/Opengauss_Function_Keyword_Compress_Case0028.sql
-- @testpoint: opengauss关键字compress(非保留),作为同义词对象名,部分测试点合理报错
--前置条件
drop table if exists compress_test;
create table compress_test(id int,name varchar(10));
--关键字不带引号-成功
drop synonym if exists compress;
create synonym compress for compress_test;
insert into compress values (1,'ada'),(2, 'bob');
update compress set compress.name='cici' where compress.id=2;
select * from compress;
drop synonym if exists compress;
--关键字带双引号-成功
drop synonym if exists "compress";
create synonym "compress" for compress_test;
drop synonym if exists "compress";
--关键字带单引号-合理报错
drop synonym if exists 'compress';
create synonym 'compress' for compress_test;
insert into 'compress' values (1,'ada'),(2, 'bob');
update 'compress' set 'compress'.name='cici' where 'compress'.id=2;
select * from 'compress';
--关键字带反引号-合理报错
drop synonym if exists `compress`;
create synonym `compress` for compress_test;
insert into `compress` values (1,'ada'),(2, 'bob');
update `compress` set `compress`.name='cici' where `compress`.id=2;
select * from `compress`;
drop table if exists compress_test; |
DROP DATABASE IF EXISTS nr_icecream_db;
CREATE DATABASE nr_icecream_db; |
select * from
mp3s
where f_md5 in (
select f_md5
from (
select f_size,f_md5,count(*) c from mp3s group by f_size,f_md5
) cc where c>1
) order by f_title desc
select *
from mp3s
group by f_size,f_md5
having count(*) > 1
;
SELECT mp3s.* FROM mp3s INNER JOIN (
SELECT f_md5,f_size,COUNT(*) c FROM mp3s GROUP BY f_md5,f_size HAVING COUNT(*)>1) as m2
ON mp3s.f_md5 = m2.f_md5 and mp3s.f_size = m2.f_size
order by f_artist
;
|
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"email" TEXT NOT NULL,
"domain" TEXT NOT NULL,
"givenName" TEXT,
"familyName" TEXT,
"googleAccessToken" TEXT NOT NULL,
"isOwner" BOOLEAN NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
<reponame>Hackathons-xavo95/MLHPrime-backend<filename>database/functions/list_keys.sql
DROP FUNCTION list_keys(id INT);
CREATE TYPE key_info AS (key_name TEXT, key TEXT);
CREATE FUNCTION list_keys(p_id INT) RETURNS SETOF key_info as 'SELECT key_name, key
FROM keys_collection WHERE user_id = p_id;' language 'sql'; |
-- -----------------------------------------------------------------------------------
-- File Name : https://oracle-base.com/dba/10g/jobs_running.sql
-- Author : <NAME>
-- Description : Displays scheduler information for running jobs.
-- Requirements : Access to the DBA views.
-- Call Syntax : @jobs_running
-- Last Modified: 27/07/2005
-- -----------------------------------------------------------------------------------
SET LINESIZE 200
COLUMN owner FORMAT A20
COLUMN elapsed_time FORMAT A30
SELECT owner,
job_name,
running_instance,
elapsed_time,
session_id
FROM dba_scheduler_running_jobs
ORDER BY owner, job_name; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.