text stringlengths 6 9.38M |
|---|
-- #ForeignKey#
SELECT
CON.Connector_ID, CON.Start_Object_ID, START_OBJ.Name, OPE_SRC.Name
, CON.End_Object_ID, END_OBJ.Name, OPE_DST.Name, PARAM_SRC.Name
, PARAM_DST.Name
FROM
(T_OPERATIONPARAMS AS PARAM_SRC
INNER JOIN ((((T_CONNECTOR AS CON
INNER JOIN T_OBJECT AS START_OBJ ON CON.Start_Object_ID = START_OBJ.Object_ID)
INNER JOIN T_OBJECT AS END_OBJ ON CON.End_Object_ID = END_OBJ.Object_ID)
INNER JOIN T_OPERATION AS OPE_SRC ON CON.SourceRole = OPE_SRC.Name)
INNER JOIN T_OPERATION AS OPE_DST ON CON.DestRole = OPE_DST.Name) ON PARAM_SRC.OperationID = OPE_SRC.OperationID)
INNER JOIN T_OPERATIONPARAMS AS PARAM_DST ON OPE_DST.OperationID = PARAM_DST.OperationID
where
CON.Start_Object_ID = /*objectId*/31 |
-- dbms_stat_funcs
select lpad(to_char(min(salary),'9,999.99'),25) "min", lpad(to_char(max(salary),'999,999,999.99'),25) "max",
lpad(to_char(avg(salary),'9,999.99'),25) "avg", lpad(to_char(variance(salary),'999,999,999.99'),25) "var",
lpad(to_char(stddev(salary),'9,999.99'),25) "stddev" from employees;
/
-- 2,100.00, 24,000.00, 6,461.83, 15,284,813.67, 3,909.58
declare
sig number := 3;
s dbms_stat_funcs.SummaryType;
begin
dbms_stat_funcs.summary('HR','EMPLOYEES', 'SALARY', sig, s);
dbms_output.put_line('Min: '||lpad(to_char(s.min,'9,999.99'), 25));
dbms_output.put_line('Max: '||lpad(to_char(s.max(salary),'999,999,999.99'),25));
dbms_output.put_line('Mean: '||lpad(to_char(s.mean(salary),'9,999.99'),25));
dbms_output.put_line('Variance: '||lpad(to_char(s.variance(salary),'999,999,999.99'),25));
dbms_output.put_line('Std Dev: '||lpad(to_char(s.stddev(salary),'9,999.99'),25));
end;
/* Error report -
ORA-06550: line 8, column 58:
PLS-00224: object 'S.MAX' must be of type function or array to be used this way
*/ |
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema onlineauction
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema onlineauction
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `onlineauction` DEFAULT CHARACTER SET utf8 ;
USE `onlineauction` ;
-- -----------------------------------------------------
-- Table `onlineauction`.`user`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `onlineauction`.`user` (
`user_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'числовой идентификатор пользователя',
`login` VARCHAR(70) NOT NULL COMMENT 'логин пользователя',
`password` VARCHAR(100) NOT NULL COMMENT 'пароль пользователя, хэшируется sha-2',
`email` VARCHAR(100) NOT NULL,
`image` LONGBLOB NULL DEFAULT NULL COMMENT 'изображение пользователя в профиле',
`first_name` VARCHAR(200) NULL DEFAULT NULL COMMENT 'имя пользователя',
`second_name` VARCHAR(200) NULL DEFAULT NULL COMMENT 'фамилия пользователя',
`telephone_number` VARCHAR(15) NULL DEFAULT NULL,
`country` CHAR(2) NULL DEFAULT NULL COMMENT 'двухбуквенный идентификатор страныпроживания пользователя',
`address` VARCHAR(150) NULL DEFAULT NULL COMMENT 'адрес пользователя',
`gender` ENUM('M', 'W') NOT NULL DEFAULT 'M' COMMENT 'гендер пользователя',
`date_of_birth` DATE NULL DEFAULT NULL COMMENT 'дата рождения пользователя',
`registration_date` DATE NULL DEFAULT NULL COMMENT 'дата регистрации пользователя',
`role` ENUM('user', 'admin', 'ban') NOT NULL DEFAULT 'user' COMMENT 'роль пользователя в системе',
`balance` INT(11) NULL DEFAULT '0',
PRIMARY KEY (`user_id`),
UNIQUE INDEX `login_UNIQUE` (`login` ASC),
UNIQUE INDEX `email_UNIQUE` (`email` ASC))
ENGINE = InnoDB
AUTO_INCREMENT = 25
DEFAULT CHARACTER SET = utf8
COMMENT = 'Данные о пользователе в системе';
-- -----------------------------------------------------
-- Table `onlineauction`.`lot`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `onlineauction`.`lot` (
`lot_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'числовой идентификатор лота',
`user_id` INT(10) UNSIGNED NOT NULL COMMENT 'владелец лота',
`end_date` DATETIME NOT NULL COMMENT 'дата и время окончания торгов',
`lot_section` VARCHAR(30) NOT NULL COMMENT 'тип товара. Критерий сортировки и поиска.',
`auction_type` VARCHAR(30) NOT NULL COMMENT 'тип аукциона(анлийский, блиц и тд)',
`begin_price` INT(11) NOT NULL COMMENT 'начальная цена лота',
`min_bet` INT(11) NOT NULL COMMENT 'минимальная разность ставки и цены товара',
`winner` INT(10) UNSIGNED NULL DEFAULT NULL,
`status` VARCHAR(15) NULL DEFAULT NULL,
PRIMARY KEY (`lot_id`, `user_id`),
INDEX `fk_Lot_User1_idx` (`user_id` ASC),
INDEX `lot_ibfk_1` (`winner` ASC),
CONSTRAINT `fk_Lot_User1`
FOREIGN KEY (`user_id`)
REFERENCES `onlineauction`.`user` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `lot_ibfk_1`
FOREIGN KEY (`winner`)
REFERENCES `onlineauction`.`bet` (`bet_id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
AUTO_INCREMENT = 24
DEFAULT CHARACTER SET = utf8
COMMENT = 'Лот на аукционе';
-- -----------------------------------------------------
-- Table `onlineauction`.`bet`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `onlineauction`.`bet` (
`bet_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'числовой идентификатор ставки',
`user_id` INT(10) UNSIGNED NOT NULL COMMENT 'идентификатор пользователя',
`lot_id` INT(10) UNSIGNED NOT NULL COMMENT 'идентификатор лота',
`bet_price` INT(10) UNSIGNED NOT NULL COMMENT 'сумма ставки',
`bet_date` DATETIME NOT NULL COMMENT 'дата и время ставки',
PRIMARY KEY (`bet_id`, `user_id`, `lot_id`),
INDEX `fk_Bet_User1_idx` (`user_id` ASC),
INDEX `fk_Bet_Lot1_idx` (`lot_id` ASC),
CONSTRAINT `fk_Bet_Lot1`
FOREIGN KEY (`lot_id`)
REFERENCES `onlineauction`.`lot` (`lot_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_Bet_User1`
FOREIGN KEY (`user_id`)
REFERENCES `onlineauction`.`user` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 19
DEFAULT CHARACTER SET = utf8
COMMENT = 'Ставки на лот';
-- -----------------------------------------------------
-- Table `onlineauction`.`langs`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `onlineauction`.`langs` (
`lang` CHAR(2) NOT NULL COMMENT 'двухбуквенный идентификатор языка',
`lang_name` VARCHAR(30) NOT NULL COMMENT 'полное название языка',
PRIMARY KEY (`lang`),
UNIQUE INDEX `lang_name_UNIQUE` (`lang_name` ASC))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COMMENT = 'Таблица языков, используемых в системе';
-- -----------------------------------------------------
-- Table `onlineauction`.`lot_comment`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `onlineauction`.`lot_comment` (
`comment_text` VARCHAR(255) NOT NULL,
`user_id` INT(10) UNSIGNED NOT NULL COMMENT 'пользователь, оставивший комментарий',
`lot_id` INT(10) UNSIGNED NOT NULL COMMENT 'комментарий на какой лот',
`date` DATETIME NOT NULL,
INDEX `fk_Lot_comment_User1_idx` (`user_id` ASC),
INDEX `fk_Lot_comment_Lot1_idx` (`lot_id` ASC),
CONSTRAINT `fk_Lot_comment_Lot1`
FOREIGN KEY (`lot_id`)
REFERENCES `onlineauction`.`lot` (`lot_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_Lot_comment_User1`
FOREIGN KEY (`user_id`)
REFERENCES `onlineauction`.`user` (`user_id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COMMENT = 'Комментарии о лоте';
-- -----------------------------------------------------
-- Table `onlineauction`.`lot_image`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `onlineauction`.`lot_image` (
`image_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'числовой идентификатор изображения',
`lot_id` INT(10) UNSIGNED NOT NULL COMMENT 'идентификатор лота',
`lot_image` LONGBLOB NOT NULL COMMENT 'изображение лота',
PRIMARY KEY (`image_id`, `lot_id`),
INDEX `fk_Lot_image_Lot1_idx` (`lot_id` ASC),
CONSTRAINT `lot_image_lot__fk`
FOREIGN KEY (`lot_id`)
REFERENCES `onlineauction`.`lot` (`lot_id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
AUTO_INCREMENT = 3
DEFAULT CHARACTER SET = utf8
COMMENT = 'Таблица с изображениями лотов';
-- -----------------------------------------------------
-- Table `onlineauction`.`online_purse`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `onlineauction`.`online_purse` (
`payment_system` VARCHAR(20) NOT NULL COMMENT 'название интернет платежной системы',
`purse_number` VARCHAR(45) NOT NULL COMMENT 'номер кошелька пользователя',
`user_id` INT(10) UNSIGNED NOT NULL COMMENT 'владелец онлайн кошелька',
PRIMARY KEY (`payment_system`, `purse_number`, `user_id`),
INDEX `fk_Online_purse_User1_idx` (`user_id` ASC),
CONSTRAINT `fk_Online_purse_User1`
FOREIGN KEY (`user_id`)
REFERENCES `onlineauction`.`user` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COMMENT = 'Данные про интернет кошельки пользователей';
-- -----------------------------------------------------
-- Table `onlineauction`.`t_lot`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `onlineauction`.`t_lot` (
`lot_id` INT(10) UNSIGNED NOT NULL COMMENT 'идентификатор лота',
`lang` CHAR(2) NOT NULL COMMENT 'идентификатор языка',
`lot_name` VARCHAR(200) NOT NULL COMMENT 'название лота',
`lot_description` BLOB NULL DEFAULT NULL COMMENT 'описание лота',
PRIMARY KEY (`lot_id`, `lang`),
INDEX `fk_t_Lot_Langs1_idx` (`lang` ASC),
CONSTRAINT `fk_t_Lot_Langs1`
FOREIGN KEY (`lang`)
REFERENCES `onlineauction`.`langs` (`lang`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_t_Lot_Lot1`
FOREIGN KEY (`lot_id`)
REFERENCES `onlineauction`.`lot` (`lot_id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COMMENT = 'таблица с переводами полей таблицы Lot на разные языки';
-- -----------------------------------------------------
-- Table `onlineauction`.`user_comment`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `onlineauction`.`user_comment` (
`comment_text` VARCHAR(255) NOT NULL COMMENT 'текст комментария',
`user_sender` INT(10) UNSIGNED NOT NULL COMMENT 'пользователь, оставивший комментарий',
`user_recipient` INT(10) UNSIGNED NOT NULL COMMENT 'пользователь о ком комментарий',
`date` DATETIME NULL DEFAULT NULL,
INDEX `fk_user_comment_User1_idx` (`user_sender` ASC),
INDEX `fk_user_comment_User2_idx` (`user_recipient` ASC),
CONSTRAINT `fk_user_comment_User1`
FOREIGN KEY (`user_sender`)
REFERENCES `onlineauction`.`user` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_user_comment_User2`
FOREIGN KEY (`user_recipient`)
REFERENCES `onlineauction`.`user` (`user_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COMMENT = 'Комментарии о пользователе';
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
-- SERVER PROPERTIES
SELECT
SERVERPROPERTY('MachineName') as Host,
SERVERPROPERTY('InstanceName') as Instance,
SERVERPROPERTY('Edition') as Edition, /*shows 32 bit or 64 bit*/
SERVERPROPERTY('ProductLevel') as ProductLevel, /* RTM or SP1 etc*/
Case SERVERPROPERTY('IsClustered') when 1 then 'CLUSTERED' else
'STANDALONE' end as ServerType,
@@VERSION as VersionNumber
-- SERVER CONFIGURATION
SELECT * from sys.configurations order by NAME
-- LOGINS WITH SA PERMISSIONS
SELECT l.name, l.denylogin, l.isntname, l.isntgroup, l.isntuser
FROM master.dbo.syslogins l
WHERE l.sysadmin = 1 OR l.securityadmin = 1
--TRACE FLAGS ON
DBCC TRACESTATUS(-1);
-- DATABASE LIST
SELECT name,compatibility_level,recovery_model_desc,state_desc FROM sys.databases
-- DATABASE FILE LOCATIONS
SELECT db_name(database_id) as DatabaseName,name,type_desc,physical_name FROM sys.master_files
-- SHOW MULTIPLE FILE GROUPS
EXEC master.dbo.sp_MSforeachdb @command1 = 'USE [?] SELECT * FROM sys.filegroups'
-- LAST GOOD BACKUP
SELECT db.name,
case when MAX(b.backup_finish_date) is NULL then 'No Backup' else convert(varchar(100),
MAX(b.backup_finish_date)) end AS last_backup_finish_date
FROM sys.databases db
LEFT OUTER JOIN msdb.dbo.backupset b ON db.name = b.database_name AND b.type = 'D'
WHERE db.database_id NOT IN (2)
GROUP BY db.name
ORDER BY 2 DESC
-- BACKUP LOCATIONS
SELECT Distinct physical_device_name FROM msdb.dbo.backupmediafamily |
CREATE TABLE servers (
id integer primary key,
serverNameJP text,
serverNameUS text,
dataCenter text,
region text,
created_at,
updated_at
);
insert into servers values(1,"Ramuh","Ramuh"," "," "," "," ");
|
create trigger trg_before_upd_vent before update on ventas
for each row
execute procedure f_validar_vent()
;
\q
|
--
DROP TABLE SYSFUNCTIONS;
--
CREATE TABLE SYSFUNCTIONS
(
SYSFUNCTION_NAME varchar(24) PRIMARY KEY,
SYSFUNCTION_CODE NUMERIC UNIQUE,
GENERIC_FUNC_TYPE varchar(24),
DESCRIPTION18 varchar(128) NOT NULL UNIQUE
);
|
--保存从网站获得的原始的未经转换的数据。暂时不使用此表
create table sto_realtime_original (
code varchar(10),
str1 varchar(15),str2 varchar(15),str3 varchar(15),str4 varchar(15),str5 varchar(15),
str6 varchar(15),str7 varchar(15),str8 varchar(15),str9 varchar(15),str10 varchar(15),
str11 varchar(15),str12 varchar(15),str13 varchar(15),str14 varchar(15),str15 varchar(15),
str16 varchar(15),str17 varchar(15),str18 varchar(15),str19 varchar(15),str20 varchar(15),
str21 varchar(15),str22 varchar(15),str23 varchar(15),str24 varchar(15),str25 varchar(15),
str26 varchar(15),str27 varchar(15),str28 varchar(15),str29 varchar(15),str30 varchar(15),
str31 varchar(15),str32 varchar(15),str33 varchar(15),str34 varchar(15),str35 varchar(15),
time_ varchar(10),
source varchar(10),
flag varchar(2)
);
create table sto_realtime (
code varchar(10),
yClose varchar(15),tOpen varchar(15),now varchar(15),high varchar(15),low varchar(15),deals varchar(20),
dealsum varchar(15),
time_ varchar(10),
source varchar(10),
flag varchar(2)
);
create table sto_day (
code varchar(10),
date_ date,open_ varchar(15),high varchar(15),low varchar(15),close_ varchar(15),volume varchar(20),factor varchar(15),
source varchar(10),
PRIMARY KEY(code,date_)
);
create table sto_day_tmp (
code varchar(10),
date_ date,open_ varchar(15),high varchar(15),low varchar(15),close_ varchar(15),volume varchar(20),factor varchar(15),
source varchar(10),
PRIMARY KEY(code,date_)
);
create table sto_code (
code varchar(10),
name varchar(50),
market varchar(10),
source varchar(10),
valid varchar(1),
flag varchar(2), --01:stop 99:获取错误
type_ varchar(2), --1:指数
code_sina varchar(15),
code_yahoo varchar(15),
PRIMARY KEY(code,market)
);
create table dd_code (
code varchar(20),
desc_cn varchar(30),
source varchar(10),
valid varchar(1),
flag varchar(2)
);
create table dd_value (
code varchar(20),
codeValue varchar(20),
value_desc_cn varchar(30),
valid varchar(1)
);
create table sto_day_mid (
code varchar(10),
date_ date,open_ varchar(15),high varchar(15),low varchar(15),close_ varchar(15),volume varchar(20),
source varchar(10),
flag varchar(2),
step int
);
create table sto_operation (
sn int,
code varchar(10),
oper varchar(2), --操作,买(1) or 卖(2), 0表示不操作
num int, --操作数量
price decimal, --单价
sum decimal, --操作总价
total int, --当前拥有数量
remain decimal, --余额
flag varchar(2),
date_ date
);
create table sto_oper_sum (
code varchar(10),
name varchar(50),
buys int, --买入次数
sells int, --卖出次数
times int, --total 为0的次数(即卖光了)
winTimes int, --赢利次数
loseTimes int, --亏损次数
lastRemain decimal, --最后一次卖光时的余额
minRemain decimal, --最小余额,即最大投资
flag varchar(2) --最后一次卖过时情况,01 表示数据过好还过坏,即认为是异常数据
);
--20180525 历史数据下载进度表,记录下载到了哪一天。主要是因为不少股会停牌,
--不能确定下载到哪一天。
--- **** 第一次要先初始化:insert into his_data_progress(code) select code from sto_code;
create table his_data_progress (
code varchar(10),
lastDate date
);
--20151022
--alter table sto_code add code_sina varchar(15);
--20151028
--alter table sto_code add code_yahoo varchar(15);
update sto_code t set code_sina=(select market||code from sto_code where code=t.code and market=t.market);
--20151106
create index on sto_day_tmp (code);
truncate table sto_realtime_original;
truncate table sto_realtime;
truncate table sto_day;
truncate table sto_code;
truncate table dd_code;
truncate table dd_value;
truncate table sto_operation;
truncate table sto_oper_sum;
drop table sto_realtime_original;
drop table sto_realtime;
drop table sto_day;
drop table sto_code;
drop table dd_code;
drop table dd_value;
drop table sto_operation;
drop table sto_oper_sum; |
-- Checklist 22
SELECT * FROM TABLE(SELECT E.especializacao FROM tb_especializada E); |
DELIMITER //
Create Trigger upd_login
BEFORE UPDATE ON users FOR EACH ROW
BEGIN
IF NEW.userLogin = OLD.userLogin THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'same name';
ELSEIF NEW.userLogin in (select userLogin from users) THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'same name in database';
END IF;
END // |
--
-- Table structure for table `invoice`
--
DROP TABLE IF EXISTS `invoice`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `invoice` (
`id` int NOT NULL AUTO_INCREMENT,
`transaction_id` int NOT NULL,
`subject` varchar(100) NOT NULL,
`amount` int NOT NULL,
`due_date` date NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`deleted_at` datetime DEFAULT NULL,
`deleted_by` int DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `transaction_id` (`transaction_id`),
CONSTRAINT `invoice_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `transaction` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
|
-- Copyright 2015 Silicon Valley Data Science.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
USE hadoopsummit2015;
SELECT
COUNT(*)
FROM
${table};
SELECT
COUNT(*)
FROM
${table}
WHERE
user_name NOT LIKE 'a%'
AND ip LIKE '%65%'
AND url NOT LIKE '%biz%'
AND referer LIKE '%com%'
AND agent LIKE '%Firefox%';
SELECT
COUNT(*)
FROM
${table}
WHERE
ip NOT LIKE '%12%'
AND user_name LIKE 's%'
AND unix_time LIKE '%12%'
AND time LIKE '%2%'
AND url LIKE '%com%'
AND domain NOT LIKE '%org%'
AND page NOT LIKE '%privacy%'
AND port LIKE '%5%'
AND referer NOT LIKE '%biz%'
AND agent LIKE '%Safari%';
|
/* Create Comments, Sequences and Triggers for Autonumber Columns */
COMMENT ON COLUMN "ADM_TUSUA"."USUA_USUA" IS 'id de tabla usuarios'
;
COMMENT ON COLUMN "ADM_TUSUA"."USUA_NOMB" IS 'nombre de acceso al sistema'
;
COMMENT ON COLUMN "ADM_TUSUA"."USUA_PASS" IS 'Contraseña de acceso al sistema'
;
COMMENT ON COLUMN "ADM_TUSUA"."USUA_CREA" IS 'id del usuario que creóel registro'
;
COMMENT ON COLUMN "ADM_TUSUA"."USUA_UPDA" IS 'id del usuario que actulizó el registro'
;
COMMENT ON COLUMN "ADM_TUSUA"."USUA_ESTA" IS 'Estado del usuario'
;
COMMENT ON COLUMN "ADM_TUSUA"."USUA_FUIN" IS 'Fecha del último ingreso'
;
COMMENT ON COLUMN "ADM_TUSUA"."USUA_APELL" IS 'Apellido del usuario'
;
COMMENT ON COLUMN "ADM_TUSUA"."USUA_NUSU" IS 'Nombre de autenticación del usuario'
;
COMMENT ON COLUMN "ADM_TUSUA"."USUA_EMAI" IS 'Email del usuario'
;
COMMENT ON COLUMN "ADM_TUSUA"."USUA_TELE" IS 'Telefono de contacto del usuario'
;
COMMENT ON COLUMN "ADM_TUSUA"."USUA_NIDE" IS 'Número de identificación del usuario'
; |
-- phpMyAdmin SQL Dump
-- version 4.1.9
-- http://www.phpmyadmin.net
--
-- Host: localhost:8889
-- Generation Time: Mar 22, 2014 at 03:25 AM
-- Server version: 5.5.34
-- PHP Version: 5.5.10
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: `dossier_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`teamID` int(11) unsigned DEFAULT NULL,
`user_n` char(32) NOT NULL,
`user_p` char(64) NOT NULL,
`salt` char(8) NOT NULL,
`first_name` char(32) NOT NULL,
`last_name` char(32) NOT NULL,
`email` text NOT NULL,
`phone` char(32) DEFAULT NULL,
`city` char(32) DEFAULT NULL,
`state` char(32) DEFAULT NULL,
`zipcode` mediumint(6) DEFAULT NULL,
`avatar` text,
`role` char(32) DEFAULT NULL,
`stable` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_n` (`user_n`),
KEY `teamID` (`teamID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=28 ;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `teamID`, `user_n`, `user_p`, `salt`, `first_name`, `last_name`, `email`, `phone`, `city`, `state`, `zipcode`, `avatar`, `role`, `stable`) VALUES
(11, NULL, 'student', '1bb683a667421569331ec524f095bbc37e8351118b2ae7cb50d17aacf535f487', '264c8c38', 'Slicky', 'Coder', 'student@fullsail.edu', NULL, 'Orlando', 'FL', 32792, NULL, NULL, ''),
(5, NULL, 'codeinfused', '01756509456b8ed2112b0c034c315b458d9fc4baae65c4e636eba1cb4a5f688b', '11054932', 'Michael', 'Smotherman', 'msmotherman@fullsail.com', '555-555-5555', NULL, NULL, NULL, NULL, NULL, ''),
(27, NULL, 'curlylox', '0103ce24337a5bc8d5aec19690cbb467356ca42b76c3b31a452211201dc7d66a', '1434f376', 'Tara', 'Thorne', 'curlylox1982@gmail.com', '', 'Chambersburg', 'PA', 17201, '', NULL, 'Nightshade Stables');
/*!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 SESSIONS (id,value , timeStamp, sourceName ) values
(6, '176', '2015-11-07 10:29:34.177', 'Loop11');
insert into BOUNCES ('id','value' , 'timeStamp', 'sourceName' ) values
(6, '25', '2015-11-08 10:29:34.177', 'LATTE');
|
/*
DataBase Name: DB
USERNAME=root
PASSWORD=root
*/
create database db;
use db;
create table student
(
Roll_no int auto_increment,
first_name varchar(50),
last_name varchar(50),
email varchar(50),
gender varchar(6),
date_of_birth varchar(50),
address varchar(50),
contact_no varchar(15),
CONSTRAINT STUDENT_PK PRIMARY KEY (Roll_no)
);
create table admin(user varchar(20),password varchar(20));
insert into admin(user,password) values ("admin","admin");
|
-- -----------------------------------------------------------------------------------
-- File Name : https://oracle-base.com/dba/monitoring/user_roles.sql
-- Author : Tim Hall
-- Description : Displays a list of all roles and privileges granted to the specified user.
-- Requirements : Access to the DBA views.
-- Call Syntax : @user_roles (username)
-- Last Modified: 26/06/2023
-- -----------------------------------------------------------------------------------
set serveroutput on
set verify off
select a.granted_role,
a.admin_option
from dba_role_privs a
where a.grantee = upper('&1')
order by a.granted_role;
select a.privilege,
a.admin_option
from dba_sys_privs a
where a.grantee = upper('&1')
order by a.privilege;
set verify on
|
SELECT * FROM products
WHERE category = $1
ORDER BY name; |
/* Friend Event table */
/*
CREATE TABLE FriendEvent
(
EventID int,
FriendID int,
FOREIGN KEY (EventID) REFERENCES Event(EventID),
FOREIGN KEY (FriendID) REFERENCES Friends(FriendID)
);
*/
INSERT INTO FriendEvent
VALUES (1, 1);
INSERT INTO FriendEvent
VALUES (1, 2);
INSERT INTO FriendEvent
VALUES (2, 3); |
-- Copyright 2019 Google LLC
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- https://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
CREATE TABLE archives (
-- Opaque ID. Alias to the SQLite rowid.
id INTEGER PRIMARY KEY,
-- Filename. No directories are stored, only the filename itself.
filename TEXT NOT NULL,
-- SHA256 hash of the data, stored as a hex string.
hash TEXT NOT NULL,
-- The date at which the archive was last modified, according to the
-- filesystem.
modified_time DATETIME NOT NULL,
-- The type of the archive. One of "Metadata" or "PhotoData".
archive_type TEXT NOT NULL,
-- The sequence number of this archive. Metadata archives appear to be able to
-- have more than one part, and the photo data can be spread across many
-- archives.
sequence_num INTEGER NOT NULL
)
|
declare
v_pos Integer;
v_posNext Integer;
v_posDelimiter Integer;
v_inputStr nclob;
v_strPortion nvarchar2(255);
v_strOrder nvarchar2(255);
v_strField nvarchar2(255);
v_counter Integer;
v_strFields nclob;
v_strOrders nclob;
begin
v_inputStr := :inputStr;
v_pos := -1;
v_posNext := -1;
v_counter := 0;
v_strFields := '';
while (true)
loop
if (v_counter = 0) then
v_pos := 0;
select instr(v_inputStr, '|', 1, v_counter+1) into v_posNext from dual;
select substr(v_inputStr, v_pos + 1, v_posNext - v_pos - 1) into v_strPortion from dual;
select instr(v_strPortion, ':', 1, 1) into v_posDelimiter from dual;
select substr(v_strPortion, 1, v_posDelimiter - 1) into v_strOrder from dual;
select substr(v_strPortion, v_posDelimiter + 1, length(v_strPortion) - v_posDelimiter) into v_strField from dual;
v_strFields := v_strField;
v_strOrders := v_strOrder;
v_counter := v_counter + 1;
end if;
select instr(v_inputStr, '|', 1, v_counter) into v_pos from dual;
if (v_pos = 0) then
exit;
end if;
select instr(v_inputStr, '|', 1, v_counter+1) into v_posNext from dual;
if (v_pos > 0 AND v_posNext = 0) then
v_posNext := length(v_inputStr) + 1;
end if;
select substr(v_inputStr, v_pos + 1, v_posNext - v_pos - 1) into v_strPortion from dual;
select instr(v_strPortion, ':', 1, 1) into v_posDelimiter from dual;
select substr(v_strPortion, 1, v_posDelimiter - 1) into v_strOrder from dual;
select substr(v_strPortion, v_posDelimiter + 1, length(v_strPortion) - v_posDelimiter) into v_strField from dual;
if (v_strFields is null) then
v_strFields := v_strFields || v_strField;
else
v_strFields := v_strFields || ',' || v_strField;
end if;
if (v_strOrders is null) then
v_strOrders := v_strOrders || v_strOrder;
else
v_strOrders := v_strOrders || ',' || v_strOrder;
end if;
v_counter := v_counter + 1;
end loop;
:fields := v_strFields;
:orders := v_strOrders;
end;
|
drop database university;
CREATE DATABASE IF NOT EXISTS university;
USE university;
CREATE TABLE IF NOT EXISTS faculty
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
) DEFAULT CHARACTER SET utf8mb4
COLLATE `utf8mb4_unicode_ci`
ENGINE = InnoDB
;
INSERT INTO faculty (id, name) VALUES
(1, 'RTF'),
(2, 'MMF'),
(3, 'FST');
CREATE TABLE IF NOT EXISTS `group`
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
faculty_id INT NOT NULL,
PRIMARY KEY (id)
) DEFAULT CHARACTER SET utf8mb4
COLLATE `utf8mb4_unicode_ci`
ENGINE = InnoDB
;
INSERT INTO `group` (id, name, faculty_id) VALUES
(1, 'RT-11', 1),
(2, 'RT-12', 1),
(3, 'RT-13', 1),
(4, 'MM-11', 2),
(5, 'MM-12', 2),
(6, 'MM-13', 2),
(7, 'SR-11', 3),
(8, 'SR-12', 3),
(9, 'SR-13', 3);
CREATE TABLE IF NOT EXISTS student
(
id INT NOT NULL AUTO_INCREMENT,
last_name VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
middle_name VARCHAR(255) DEFAULT NULL,
age INT NOT NULL,
group_id INT NOT NULL,
PRIMARY KEY (id)
) DEFAULT CHARACTER SET utf8mb4
COLLATE `utf8mb4_unicode_ci`
ENGINE = InnoDB
;
INSERT INTO student (id, last_name, name, middle_name, age, `group_id`) VALUES
(1, 'Васютин', 'Анатолий', 'Иванович', 18, 1),
(2, 'Чувиков', 'Якуб', 'Дмитриевич', 20, 1),
(3, 'Иванов', 'Олег', 'Васильевич', 19, 1),
(4, 'Древнев', 'иван', 'Эдуардович', 18, 1),
(5, 'Дворников', 'Федов', 'Викторович', 19, 1),
(6, 'Лагутова', 'Елена', 'Вячеславовна', 29, 2),
(7, 'Лагутова', 'Лариса', 'Вячеславовна', 19, 2),
(8, 'Стратов', 'Сергей', 'Петрович', 20, 2),
(9, 'Лещев', 'Михаил', 'Петрович', 19, 2),
(10, 'Мухина', 'Анна', 'Сергеевна', 21, 2),
(11, 'Азарова', 'Ирина', 'Николаевна', 22, 3),
(12, 'Аспидов', 'Геннадий', 'Олегович', 28, 3),
(13, 'Смолянинов', 'Андрей', 'Сергеевич', 21, 3),
(14, 'Должикова', 'Зоя', 'Ивановна', 18, 3),
(15, 'Смехова', 'Инна', 'Ивановна', 20, 3),
(16, 'Минеев', 'Андрей', 'Георгиевич', 18, 4),
(17, 'Гарин', 'Дмитрий', 'Анатольевич', 15, 4),
(18, 'Санников', 'Петр', 'Игоревич', 20, 4),
(19, 'Громов', 'Михаил', 'Викторович', 23, 4),
(20, 'Логинов', 'Максим', 'Ильич', 18, 4),
(21, 'Васильева', 'Екатерина', 'Эдуардовна', 19, 5),
(22, 'Норин', 'Константин', 'Павлович', 22, 5),
(23, 'Кропотов', 'Павел', 'Александрович', 21, 5),
(24, 'Бабатьев', 'Владимир', 'Владимирович', 18, 5),
(25, 'Рощин', 'Лев', 'Сергеевич', 19, 5),
(26, 'Бакрылова', 'Жанна', 'Владимировна', 18, 6),
(27, 'Воропаева', 'Арина', 'Романовна', 19, 6),
(28, 'Полевщиков', 'Александр', 'Романович', 19, 6),
(29, 'Царев', 'Вадим', 'Андреевич', 21, 6),
(30, 'Дюженкова', 'Виктория', 'Даниловна', 17, 6),
(31, 'Доронина', 'Елена', 'Павловна', 22, 7),
(32, 'Кузаев', 'Алексей', 'Юрьевич', 18, 7),
(33, 'Дворецкова', 'Елизавета', 'Алексеевна', 19, 7),
(34, 'Пашина', 'Анастасия', 'Ивановна', 20, 7),
(35, 'Дубровина', 'Елена', 'Сергеевна', 22, 7),
(36, 'Никонова', 'Галина', 'Николаевна', 20, 8),
(37, 'Шапиро', 'Оксана', 'Вадимовна', 22, 8),
(38, 'Фаммус', 'Наталья', 'Александровна', 20, 8),
(39, 'Агапова', 'Диана', 'Васильевна', 19, 8),
(40, 'Кононов', 'Иван', 'Григорьевич', 20, 8),
(41, 'Березкина', 'Наталья', 'Станиславовна', 21, 9),
(42, 'Яницкий', 'Евгений', 'Юрьевич', 15, 9),
(43, 'Яшкардин', 'Дмитрий', 'Романович', 21, 9),
(44, 'Остальцев', 'Юрий', 'Максимович', 21, 9),
(45, 'Мошкин', 'Антон', 'Дмитриевич', 20, 9);
-- получение всех студентов в возрасте 19 лет.
SELECT
id,
last_name AS "Last name",
name AS "Name",
middle_name AS "Middle name",
age AS "Age"
FROM
student
WHERE
age LIKE 19;
-- получение всех студентов из конкретной группы.
SELECT
student.last_name AS "Last name",
student.name AS "Name",
student.middle_name AS "Middle name",
`group`.name AS "Group"
FROM
`group`
JOIN
student
ON
student.group_id = `group`.id
WHERE
`group`.name = 'MM-13';
-- получение всех студентов из конкретного факультета.
SELECT
student.last_name AS "Last name",
student.name AS "Name",
student.middle_name AS "Middle name",
faculty.name AS "Faculty"
FROM
faculty
JOIN
`group`
ON
`group`.faculty_id = faculty.id
JOIN
student
ON
student.group_id = `group`.id
WHERE
faculty.name = 'RTF';
-- получение факультета и группы конкретного студента.
SELECT
student.last_name AS "Last name",
student.name AS "Name",
student.middle_name AS "Middle name",
faculty.name AS "Faculty",
`group`.name AS "Group"
FROM
student
JOIN
`group`
ON
`group`.id = student.group_id
JOIN
faculty
ON
faculty.id = `group`.faculty_id
WHERE
student.last_name = 'Кононов' AND student.name = 'Иван' AND student.middle_name = 'Григорьевич'; |
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 22, 2013 at 01:38 PM
-- 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: `library`
--
CREATE DATABASE `library` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `library`;
-- --------------------------------------------------------
--
-- Table structure for table `book`
--
CREATE TABLE IF NOT EXISTS `book` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`author` varchar(255) NOT NULL,
`subject_id` int(11) NOT NULL,
`price` int(11) DEFAULT NULL,
`published_date` date NOT NULL,
`entry_date` date NOT NULL,
`isbn` varchar(13) NOT NULL,
`cover_photo` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `subject_id` (`subject_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `borrow`
--
CREATE TABLE IF NOT EXISTS `borrow` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`book_id` int(11) NOT NULL,
`remarks` varchar(255) DEFAULT NULL,
`issued` date NOT NULL,
`returned` date NOT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `book_id` (`book_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
CREATE TABLE IF NOT EXISTS `category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `permission`
--
CREATE TABLE IF NOT EXISTS `permission` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`resource_id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
`permissions` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `resource_id` (`resource_id`),
KEY `role_id` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `queue`
--
CREATE TABLE IF NOT EXISTS `queue` (
`id` int(11) NOT NULL,
`book_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`reserve_date` date NOT NULL,
KEY `book_id` (`book_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `resource`
--
CREATE TABLE IF NOT EXISTS `resource` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `role`
--
CREATE TABLE IF NOT EXISTS `role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `subject`
--
CREATE TABLE IF NOT EXISTS `subject` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`category_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `category_id` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`gender` enum('male','female','other') NOT NULL,
`address` varchar(255) NOT NULL,
`phone` int(25) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`image` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `book`
--
ALTER TABLE `book`
ADD CONSTRAINT `book_ibfk_1` FOREIGN KEY (`subject_id`) REFERENCES `subject` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `borrow`
--
ALTER TABLE `borrow`
ADD CONSTRAINT `borrow_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `borrow_ibfk_2` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `permission`
--
ALTER TABLE `permission`
ADD CONSTRAINT `permission_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `permission_ibfk_1` FOREIGN KEY (`resource_id`) REFERENCES `resource` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `queue`
--
ALTER TABLE `queue`
ADD CONSTRAINT `queue_ibfk_1` FOREIGN KEY (`book_id`) REFERENCES `book` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `queue_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `subject`
--
ALTER TABLE `subject`
ADD CONSTRAINT `subject_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
-- Join view Employee/Job showing salary
-- Sorting by salary and last name
Select Concat(Lastname,', ', Firstname) as 'Name', Description, Format(Salary, 'C') as 'Salary'
From Employee
Join Job
on JobId = Job.Id
--Where Not ((Description = 'VP') or (Salary > 100000))
order by job.salary desc;
|
delete from HtmlLabelIndex where id=28286
/
delete from HtmlLabelInfo where indexid=28286
/
INSERT INTO HtmlLabelIndex values(28286,'签到/退明细')
/
INSERT INTO HtmlLabelInfo VALUES(28286,'签到/退明细',7)
/
INSERT INTO HtmlLabelInfo VALUES(28286,'sign in/out detail',8)
/
INSERT INTO HtmlLabelInfo VALUES(28286,'簽到/退明細',9)
/
|
--@Autor: Flores Fuentes Kevin y Torres Verástegui José Antonio
--@Fecha de creación: 16/06/2020
--@descripción: Creacion de tabla(s) externa(s)
prompt conectando como sys
connect sys/system as sysdba
--creando un objeto de tipo directory
prompt creando directorio tmp_dir
create or replace directory tmp_dir as '/tmp/Proy';
--dando permisos
grant read, write on directory tmp_dir to fftv_proy_admin;
connect fftv_proy_admin/admin
prompt creando tabla externa
-- Tabla que contiene los vehiculos antiguos que no se guardan en la base
create table vehiculos_antiguos(
vehiculo_id number(10,0) null,
num_serie varchar2(40) null,
placa_id number(10,0) null
)
organization external(
type oracle_loader
default directory tmp_dir
access parameters(
records delimited by newline
badfile tmp_dir:'vehiculos_antiguos_bad.log'
logfile tmp_dir:'vehiculos_antiguos.log'
fields terminated by '#'
lrtrim
missing field values are null
(
vehiculo_id,num_serie,placa_id
)
)
location('vehiculos_antiguos.csv')
)
reject limit unlimited;
prompt creando el directorio /tmp/Proy en caso de no existir
!mkdir -p /tmp/Proy
!chmod 777 /tmp/Proy
!cp vehiculos_antiguos.csv /tmp/Proy
prompt probando mostrar los datos
select * from vehiculos_antiguos;
prompt Listo!.
disconnect; |
CREATE TABLE users (
username VARCHAR(25) PRIMARY KEY,
password TEXT NOT NULL,
first_name TEXT NOT NULL,
last_name TEXT NOT NULL
);
CREATE TABLE monsters (
slug VARCHAR(50) PRIMARY KEY,
cr VARCHAR(5) NOT NULL,
size VARCHAR(10) NOT NULL,
type VARCHAR(30) NOT NULL,
name TEXT NOT NULL
);
CREATE TABLE encounters (
id SERIAL PRIMARY KEY,
username VARCHAR(25) REFERENCES users ON DELETE CASCADE,
name VARCHAR(25),
description TEXT
);
CREATE TABLE monster_encounters(
monster_name TEXT REFERENCES monsters ON DELETE CASCADE,
encounter_id INTEGER REFERENCES encounters ON DELETE CASCADE,
number_of INTEGER NOT NULL
);
INSERT INTO users (username, password, first_name, last_name)
VALUES ('testuser',
'$2b$12$AZH7virni5jlTTiGgEg4zu3lSvAw68qVEfSIOjJ3RqtbJbdW/Oi5q',
'Test',
'User');
INSERT INTO monsters (slug, cr, size, type, name)
VALUES ('aatxe', '5', 'Large', 'celestial', 'Aatxe'),
('aboleth', '10', 'Large', 'aberration', 'Aboleth'),
('aboleth-nihilith', '12', 'Large', 'undead', 'Aboleth, Nihilith'),
('abominable-beauty', '11', 'Medium', 'fey', 'Abominable Beauty'),
('accursed-defiler', '4', 'Medium', 'undead', 'Accursed Defiler'),
('acid-ant', '1/4', 'Small', 'monstrosity', 'Acid Ant'),
('acolyte', '1/4', 'Medium', 'humanoid', 'Acolyte'),
('adult-black-dragon', '14', 'Huge', 'dragon', 'Adult Black Dragon'),
('adult-blue-dragon', '16', 'Huge', 'dragon', 'Adult Blue Dragon'),
('adult-brass-dragon', '13', 'Huge', 'dragon', 'Adult Brass Dragon'),
('adult-bronze-dragon', '15', 'Huge', 'dragon', 'Adult Bronze Dragon'),
('adult-cave-dragon', '16', 'Huge', 'dragon', 'Adult Cave Dragon'),
('adult-copper-dragon', '14', 'Huge', 'dragon', 'Adult Copper Dragon'),
('adult-flame-dragon', '16', 'Huge', 'dragon', 'Adult Flame Dragon'),
('adult-gold-dragon', '17', 'Huge', 'dragon', 'Adult Gold Dragon'),
('adult-green-dragon', '15', 'Huge', 'dragon', 'Adult Green Dragon'),
('adult-light-dragon', '16', 'Huge', 'dragon', 'Adult Light Dragon'),
('adult-mithral-dragon', '14', 'Huge', 'dragon', 'Adult Mithral Dragon'),
('adult-red-dragon', '17', 'Huge', 'dragon', 'Adult Red Dragon'),
('adult-rime-worm', '6', 'Large', 'elemental', 'Adult Rime Worm'),
('adult-sea-dragon', '16', 'Huge', 'dragon', 'Adult Sea Dragon'),
('adult-silver-dragon', '16', 'Huge', 'dragon', 'Adult Silver Dragon'),
('adult-void-dragon', '14', 'Huge', 'dragon', 'Adult Void Dragon'),
('adult-wasteland-dragon', '17', 'Huge', 'dragon', 'Adult Wasteland Dragon'),
('adult-white-dragon', '13', 'Huge', 'dragon', 'Adult White Dragon'),
('adult-wind-dragon', '17', 'Huge', 'dragon', 'Adult Wind Dragon'),
('agnibarra', '1', 'Small', 'monstrosity', 'Agnibarra'),
('ahu-nixta', '3', 'Large', 'aberration', 'Ahu-Nixta'),
('ahuizotl', '2', 'Small', 'monstrosity', 'Ahuizotl'),
('air-elemental', '5', 'Large', 'elemental', 'Air Elemental'),
('akyishigal-demon-lord-of-cockroaches', '12', 'Large', 'fiend', 'Akyishigal, Demon Lord Of Cockroaches'),
('al-aeshma-genie', '9', 'Large', 'elemental', 'Al-Aeshma Genie'),
('ala', '8', 'Medium', 'fey', 'Ala'),
('alabaster-tree', '7', 'Huge', 'celestial', 'Alabaster Tree'),
('albino-death-weasel', '1', 'Large', 'beast', 'Albino Death Weasel'),
('alchemical-apprentice', '1', 'Small', 'ooze', 'Alchemical Apprentice'),
('alchemical-golem', '9', 'Large', 'construct', 'Alchemical Golem'),
('alchemist-archer', '10', 'Medium', 'humanoid', 'Alchemist Archer'),
('alehouse-drake', '1/2', 'Tiny', 'dragon', 'Alehouse Drake'),
('algorith', '10', 'Medium', 'construct', 'Algorith'),
('alkonost', '1/2', 'Small', 'monstrosity', 'Alkonost'),
('alliumite', '1/4', 'Small', 'plant', 'Alliumite'),
('alnaar', '9', 'Large', 'fiend', 'Alnaar'),
('alp', '1', 'Small', 'fey', 'Alp'),
('alpha-yek', '9', 'Medium', 'fiend', 'Alpha Yek'),
('alquam-demon-lord-of-night', '21', 'Huge', 'fiend', 'Alquam, Demon Lord Of Night'),
('alseid', '1/2', 'Medium', 'monstrosity', 'Alseid'),
('alseid-grovekeeper', '3', 'Medium', 'monstrosity', 'Alseid Grovekeeper'),
('altar-flame-golem', '10', 'Large', 'construct', 'Altar Flame Golem'),
('ammut', '9', 'Large', 'celestial', 'Ammut'),
('amphiptere', '3', 'Medium', 'beast', 'Amphiptere'),
('ancient-black-dragon', '21', 'Gargantuan', 'dragon', 'Ancient Black Dragon'),
('ancient-blue-dragon', '23', 'Gargantuan', 'dragon', 'Ancient Blue Dragon'),
('ancient-brass-dragon', '20', 'Gargantuan', 'dragon', 'Ancient Brass Dragon'),
('ancient-bronze-dragon', '22', 'Gargantuan', 'dragon', 'Ancient Bronze Dragon'),
('ancient-copper-dragon', '21', 'Gargantuan', 'dragon', 'Ancient Copper Dragon'),
('ancient-flame-dragon', '24', 'Gargantuan', 'dragon', 'Ancient Flame Dragon'),
('ancient-gold-dragon', '24', 'Gargantuan', 'dragon', 'Ancient Gold Dragon'),
('ancient-green-dragon', '22', 'Gargantuan', 'dragon', 'Ancient Green Dragon'),
('ancient-light-dragon', '22', 'Gargantuan', 'dragon', 'Ancient Light Dragon'),
('ancient-mandriano', '8', 'Huge', 'plant', 'Ancient Mandriano'),
('ancient-mithral-dragon', '18', 'Gargantuan', 'dragon', 'Ancient Mithral Dragon'),
('ancient-red-dragon', '24', 'Gargantuan', 'dragon', 'Ancient Red Dragon'),
('ancient-sea-dragon', '22', 'Gargantuan', 'dragon', 'Ancient Sea Dragon'),
('ancient-silver-dragon', '23', 'Gargantuan', 'dragon', 'Ancient Silver Dragon'),
('ancient-titan', '12', 'Gargantuan', 'celestial', 'Ancient Titan'),
('ancient-void-dragon', '24', 'Gargantuan', 'dragon', 'Ancient Void Dragon'),
('ancient-wasteland-dragon', '23', 'Gargantuan', 'dragon', 'Ancient Wasteland Dragon'),
('ancient-white-dragon', '20', 'Gargantuan', 'dragon', 'Ancient White Dragon'),
('ancient-wind-dragon', '22', 'Gargantuan', 'dragon', 'Ancient Wind Dragon'),
('andrenjinyi', '15', 'Gargantuan', 'celestial', 'Andrenjinyi'),
('androsphinx', '17', 'Large', 'monstrosity', 'Androsphinx'),
('angatra', '6', 'Medium', 'undead', 'Angatra'),
('angel-chained', '8', 'Medium', 'celestial', 'Angel, Chained'),
('angler-worm', '4', 'Huge', 'monstrosity', 'Angler Worm'),
('animated-armor', '1', 'Medium', 'construct', 'Animated Armor'),
('ankheg', '2', 'Large', 'monstrosity', 'Ankheg'),
('ankou-soul-herald', '21', 'Gargantuan', 'dragon', 'Ankou Soul Herald'),
('ankou-soul-seeker', '8', 'Large', 'dragon', 'Ankou Soul Seeker'),
('anophiloi', '1', 'Small', 'monstrosity', 'Anophiloi'),
('anubian', '2', 'Medium', 'elemental', 'Anubian'),
('apau-perape', '6', 'Large', 'fiend', 'Apau Perape'),
('ape', '1/2', 'Medium', 'beast', 'Ape'),
('arbeyach', '21', 'Large', 'fiend', 'Arbeyach'),
('arborcyte', '8', 'Large', 'plant', 'Arborcyte'),
('arboreal-grappler', '3', 'Medium', 'aberration', 'Arboreal Grappler'),
('arcamag', '2', 'Tiny', 'monstrosity', 'Arcamag'),
('arcanaphage', '4', 'Medium', 'monstrosity', 'Arcanaphage'),
('archaeopteryx', '1/4', 'Tiny', 'beast', 'Archaeopteryx'),
('archmage', '12', 'Medium', 'humanoid', 'Archmage'),
('aridni', '5', 'Small', 'fey', 'Aridni'),
('armory-golem', '7', 'Large', 'construct', 'Armory Golem'),
('asanbosam', '5', 'Large', 'aberration', 'Asanbosam'),
('ash-drake', '4', 'Small', 'dragon', 'Ash Drake'),
('assassin', '8', 'Medium', 'humanoid', 'Assassin'),
('astral-snapper', '3', 'Medium', 'aberration', 'Astral Snapper'),
('automata-devil', '10', 'Large', 'fiend', 'Automata Devil'),
('avatar-of-boreas', '17', 'Medium', 'elemental', 'Avatar Of Boreas'),
('avatar-of-shoth', '21', 'Gargantuan', 'aberration', 'Avatar of Shoth'),
('awakened-shrub', '0', 'Small', 'plant', 'Awakened Shrub'),
('awakened-tree', '2', 'Huge', 'plant', 'Awakened Tree'),
('axe-beak', '1/4', 'Large', 'beast', 'Axe Beak'),
('azeban', '4', 'Medium', 'fey', 'Azeban'),
('azer', '2', 'Medium', 'elemental', 'Azer'),
('azi-dahaka', '14', 'Huge', 'dragon', 'Azi Dahaka'),
('azza-gremlin', '1/4', 'Small', 'fey', 'Azza Gremlin'),
('baba-yagas-horsemen-black-night', '11', 'Medium', 'fey', 'Baba Yaga''s Horsemen, Black Night'),
('baba-yagas-horsemen-bright-day', '11', 'Medium', 'fey', 'Baba Yaga''s Horsemen, Bright Day'),
('baba-yagas-horsemen-red-sun', '11', 'Medium', 'fey', 'Baba Yaga''s Horsemen, Red Sun'),
('baboon', '0', 'Small', 'beast', 'Baboon'),
('badger', '0', 'Tiny', 'beast', 'Badger'),
('bagiennik', '3', 'Medium', 'aberration', 'Bagiennik'),
('balor', '19', 'Huge', 'fiend', 'Balor'),
('bandit', '1/8', 'Medium', 'humanoid', 'Bandit'),
('bandit-captain', '2', 'Medium', 'humanoid', 'Bandit Captain'),
('bandit-lord', '4', 'Medium', 'Humanoid (Any Race)', 'Bandit Lord'),
('bar-brawl', '3', 'Huge', 'humanoids', 'Bar Brawl'),
('barbed-devil', '5', 'Medium', 'fiend', 'Barbed Devil'),
('barong', '17', 'Large', 'celestial', 'Barong'),
('basilisk', '3', 'Medium', 'monstrosity', 'Basilisk'),
('bastet-temple-cat', '1', 'Small', 'monstrosity', 'Bastet Temple Cat'),
('bat', '0', 'Tiny', 'beast', 'Bat'),
('bathhouse-drake', '3', 'Medium', 'dragon', 'Bathhouse Drake'),
('bear-king', '12', 'Medium', 'fey', 'Bear King'),
('bearded-devil', '3', 'Medium', 'fiend', 'Bearded Devil'),
('bearfolk', '3', 'Medium', 'humanoid', 'Bearfolk'),
('bearfolk-chieftain', '6', 'Medium', 'humanoid', 'Bearfolk Chieftain'),
('bearmit-crab', '2', 'Large', 'monstrosity', 'Bearmit Crab'),
('beggar-ghoul', '1/2', 'Medium', 'undead', 'Beggar Ghoul'),
('behir', '11', 'Huge', 'monstrosity', 'Behir'),
('behtu', '2', 'Small', 'humanoid', 'Behtu'),
('beli', '2', 'Small', 'fey', 'Beli'),
('bereginyas', '4', 'Tiny', 'fey', 'Bereginyas'),
('berserker', '2', 'Medium', 'humanoid', 'Berserker'),
('berstuc', '11', 'Large', 'fiend', 'Berstuc'),
('bilwis', '1', 'Medium', 'elemental', 'Bilwis'),
('black-bear', '1/2', 'Medium', 'beast', 'Black Bear'),
('black-dragon-wyrmling', '2', 'Medium', 'dragon', 'Black Dragon Wyrmling'),
('black-knight-commander', '5', 'Medium', 'Humanoid (Any Race)', 'Black Knight Commander'),
('black-pudding', '4', 'Large', 'ooze', 'Black Pudding'),
('black-sun-orc', '2', 'Medium', 'humanoid', 'Black Sun Orc'),
('black-sun-priestess', '3', 'Medium', 'humanoid', 'Black Sun Priestess'),
('blemmyes', '8', 'Large', 'monstrosity', 'Blemmyes'),
('blink-dog', '1/4', 'Medium', 'fey', 'Blink Dog'),
('blood-elemental', '5', 'Large', 'elemental', 'Blood Elemental'),
('blood-giant', '8', 'Huge', 'giant', 'Blood Giant'),
('blood-hag', '11', 'Medium', 'fey', 'Blood Hag'),
('blood-hawk', '1/8', 'Small', 'beast', 'Blood Hawk'),
('blood-ooze', '6', 'Large', 'ooze', 'Blood Ooze'),
('blood-zombie', '2', 'Medium', 'undead', 'Blood Zombie'),
('bloody-bones', '3', 'Medium', 'monstrosity', 'Bloody Bones'),
('blue-dragon-wyrmling', '3', 'Medium', 'dragon', 'Blue Dragon Wyrmling'),
('boar', '1/4', 'Medium', 'beast', 'Boar'),
('boloti', '1', 'Tiny', 'fey', 'Boloti'),
('bone-collective', '8', 'Small', 'undead', 'Bone Collective'),
('bone-crab', '1/2', 'Small', 'beast', 'Bone Crab'),
('bone-devil', '12', 'Large', 'fiend', 'Bone Devil'),
('bone-golem', '7', 'Medium', 'construct', 'Bone Golem'),
('bone-swarm', '10', 'Large', 'swarm of Tiny undead', 'Bone Swarm'),
('bonepowder-ghoul', '12', 'Small', 'undead', 'Bonepowder Ghoul'),
('bookkeeper', '1/8', 'Tiny', 'construct', 'Bookkeeper'),
('boot-grabber', '1/2', 'Small', 'aberration', 'Boot Grabber'),
('bouda', '5', 'Medium', 'fiend', 'Bouda'),
('brass-dragon-wyrmling', '1', 'Medium', 'dragon', 'Brass Dragon Wyrmling'),
('bronze-dragon-wyrmling', '2', 'Medium', 'dragon', 'Bronze Dragon Wyrmling'),
('bronze-golem', '3', 'Large', 'construct', 'Bronze Golem'),
('broodiken', '1', 'Tiny', 'construct', 'Broodiken'),
('brown-bear', '1', 'Large', 'beast', 'Brown Bear'),
('bucca', '1/2', 'Tiny', 'fey', 'Bucca'),
('bugbear', '1', 'Medium', 'humanoid', 'Bugbear'),
('bukavac', '9', 'Large', 'monstrosity', 'Bukavac'),
('bulette', '5', 'Large', 'monstrosity', 'Bulette'),
('buraq', '11', 'Medium', 'celestial', 'Buraq'),
('burrowling', '1/2', 'Small', 'humanoid', 'Burrowling'),
('cactid', '3', 'Large', 'plant', 'Cactid'),
('cacus-giant', '6', 'Huge', 'giant', 'Cacus Giant'),
('camazotz-demon-lord-of-bats-and-fire', '22', 'Large', 'fiend', 'Camazotz, Demon Lord Of Bats And Fire'),
('cambium', '14', 'Large', 'fiend', 'Cambium'),
('camel', '1/8', 'Large', 'beast', 'Camel'),
('carbuncle', '1', 'Small', 'monstrosity', 'Carbuncle'),
('carrion-beetle', '4', 'Large', 'beast', 'Carrion Beetle'),
('cat', '0', 'Tiny', 'beast', 'Cat'),
('cats-of-ulthar', '4', 'Huge', 'beasts', 'Cats of Ulthar'),
('cauldronborn', '2', 'Small', 'construct', 'Cauldronborn'),
('cave-dragon-wyrmling', '2', 'Medium', 'dragon', 'Cave Dragon Wyrmling'),
('cave-giant', '10', 'Huge', 'giant', 'Cave Giant'),
('cavelight-moss', '4', 'Large', 'plant', 'Cavelight Moss'),
('centaur', '2', 'Large', 'monstrosity', 'Centaur'),
('centaur-chieftain', '5', 'Large', 'monstrosity', 'Centaur Chieftain'),
('chain-devil', '11', 'Medium', 'fiend', 'Chain Devil'),
('chaos-spawn-goblin', '1/2', 'Small', 'humanoid', 'Chaos-Spawn Goblin'),
('chelicerae', '7', 'Large', 'aberration', 'Chelicerae'),
('chernomoi', '1', 'Tiny', 'fey', 'Chernomoi'),
('child-of-the-briar', '1', 'Tiny', 'plant', 'Child Of The Briar'),
('child-of-yggdrasil', '6', 'Large', 'aberration', 'Child of Yggdrasil'),
('chimera', '6', 'Large', 'monstrosity', 'Chimera'),
('chort-devil', '12', 'Medium', 'fiend', 'Chort Devil'),
('chronalmental', '8', 'Large', 'elemental', 'Chronalmental'),
('chuhaister', '7', 'Large', 'giant', 'Chuhaister'),
('chupacabra', '1/2', 'Small', 'monstrosity', 'Chupacabra'),
('chuul', '4', 'Large', 'aberration', 'Chuul'),
('cikavak', '1/8', 'Tiny', 'fey', 'Cikavak'),
('cipactli', '5', 'Medium', 'fiend', 'Cipactli'),
('city-watch-captain', '4', 'Medium', 'Humanoid (Any Race)', 'City Watch Captain'),
('clacking-skeleton', '2', 'Medium', 'undead', 'Clacking Skeleton'),
('clay-golem', '9', 'Large', 'construct', 'Clay Golem'),
('cloaker', '8', 'Large', 'aberration', 'Cloaker'),
('clockwork-abomination', '5', 'Large', 'construct', 'Clockwork Abomination'),
('clockwork-assassin', '6', 'Medium', 'construct', 'Clockwork Assassin'),
('clockwork-beetle', '1/2', 'Tiny', 'construct', 'Clockwork Beetle'),
('clockwork-beetle-swarm', '3', 'Large', 'Swarm of Tiny constructs', 'Clockwork Beetle Swarm'),
('clockwork-hound', '2', 'Medium', 'construct', 'Clockwork Hound'),
('clockwork-huntsman', '3', 'Medium', 'construct', 'Clockwork Huntsman'),
('clockwork-myrmidon', '6', 'Large', 'construct', 'Clockwork Myrmidon'),
('clockwork-servant', '1/8', 'Medium', 'construct', 'Clockwork Servant'),
('clockwork-soldier', '1', 'Medium', 'construct', 'Clockwork Soldier'),
('clockwork-watchman', '1/2', 'Medium', 'construct', 'Clockwork Watchman'),
('cloud-giant', '9', 'Huge', 'giant', 'Cloud Giant'),
('clurichaun', '1/4', 'Tiny', 'fey', 'Clurichaun'),
('cobbleswarm', '2', 'Medium', 'swarm of Tiny monstrosities', 'Cobbleswarm'),
('cockatrice', '1/2', 'Small', 'monstrosity', 'Cockatrice'),
('commoner', '0', 'Medium', 'humanoid', 'Commoner'),
('constrictor-snake', '1/4', 'Large', 'beast', 'Constrictor Snake'),
('copper-dragon-wyrmling', '1', 'Medium', 'dragon', 'Copper Dragon Wyrmling'),
('coral-drake', '7', 'Medium', 'dragon', 'Coral Drake'),
('corpse-mound', '11', 'Huge', 'undead', 'Corpse Mound'),
('corpse-thief', '1/2', 'Medium', 'humanoid', 'Corpse Thief'),
('corrupting-ooze', '5', 'Large', 'ooze', 'Corrupting Ooze'),
('couatl', '4', 'Medium', 'celestial', 'Couatl'),
('crab', '0', 'Tiny', 'beast', 'Crab'),
('crimson-drake', '1', 'Tiny', 'dragon', 'Crimson Drake'),
('crimson-mist', '6', 'Medium', 'undead', 'Crimson Mist'),
('crocodile', '1/2', 'Large', 'beast', 'Crocodile'),
('crypt-spider', '2', 'Medium', 'beast', 'Crypt Spider'),
('crystalline-devil', '6', 'Medium', 'fiend', 'Crystalline Devil'),
('cueyatl', '1/2', 'Small', 'humanoid', 'Cueyatl'),
('cueyatl-moon-priest', '5', 'Small', 'humanoid', 'Cueyatl Moon Priest'),
('cueyatl-sea-priest', '1', 'Small', 'humanoid', 'Cueyatl Sea Priest'),
('cueyatl-warrior', '1', 'Small', 'humanoid', 'Cueyatl Warrior'),
('cult-fanatic', '2', 'Medium', 'humanoid', 'Cult Fanatic'),
('cultist', '1/8', 'Medium', 'humanoid', 'Cultist'),
('darakhul-high-priestess', '9', 'Medium', 'undead', 'Darakhul High Priestess'),
('darakhul-shadowmancer', '4', 'Medium', 'undead', 'Darakhul Shadowmancer'),
('dark-eye', '3', 'Medium', 'humanoid', 'Dark Eye'),
('dark-father', '4', 'Large', 'undead', 'Dark Father'),
('dark-servant', '1', 'Medium', 'humanoid', 'Dark Servant'),
('dark-voice', '5', 'Medium', 'humanoid', 'Dark Voice'),
('darkmantle', '1/2', 'Small', 'monstrosity', 'Darkmantle'),
('dau', '4', 'Small', 'fey', 'Dau'),
('death-butterfly-swarm', '4', 'Large', 'swarm of tiny beasts', 'Death Butterfly Swarm'),
('death-dog', '1', 'Medium', 'monstrosity', 'Death Dog'),
('deathcap-myconid', '4', 'Medium', 'plant', 'Deathcap Myconid'),
('deathsworn-elf', '6', 'Medium', 'humanoid', 'Deathsworn Elf'),
('deathwisp', '7', 'Medium', 'undead', 'Deathwisp'),
('deep-drake', '9', 'Large', 'dragon', 'Deep Drake'),
('deep-gnome-svirfneblin', '1/2', 'Small', 'humanoid', 'Deep Gnome (Svirfneblin)'),
('deep-one', '2', 'Medium', 'humanoid', 'Deep One'),
('deep-one-archimandrite', '8', 'Large', 'humanoid', 'Deep One Archimandrite'),
('deep-one-hybrid-priest', '4', 'Medium', 'humanoid', 'Deep One Hybrid Priest'),
('deer', '0', 'Medium', 'beast', 'Deer'),
('degenerate-titan', '8', 'Huge', 'giant', 'Degenerate Titan'),
('derro-fetal-savant', '4', 'Tiny', 'humanoid', 'Derro Fetal Savant'),
('derro-shadow-antipaladin', '5', 'Small', 'humanoid', 'Derro Shadow Antipaladin'),
('desert-giant', '9', 'Huge', 'giant', 'Desert Giant'),
('desert-troll', '6', 'Large', 'giant', 'Desert Troll'),
('deva', '10', 'Medium', 'celestial', 'Deva'),
('devil-bough', '6', 'Huge', 'fiend', 'Devil Bough'),
('devil-shark', '13', 'Gargantuan', 'monstrosity', 'Devil Shark'),
('devilbound-gnomish-prince', '9', 'Small', 'Humanoid', 'Devilbound Gnomish Prince'),
('dhampir', '1', 'Medium', 'humanoid', 'Dhampir'),
('dhampir-commander', '7', 'Medium', 'humanoid', 'Dhampir Commander'),
('dipsa', '1/4', 'Tiny', 'ooze', 'Dipsa'),
('dire-wolf', '1', 'Large', 'beast', 'Dire Wolf'),
('dissimortuum', '7', 'Medium', 'undead', 'Dissimortuum'),
('djinni', '11', 'Large', 'elemental', 'Djinni'),
('dogmole', '1', 'Medium', 'beast', 'Dogmole'),
('dogmole-juggernaut', '5', 'Large', 'monstrosity', 'Dogmole Juggernaut'),
('domovoi', '4', 'Medium', 'fey', 'Domovoi'),
('doom-golem', '10', 'Large', 'construct', 'Doom Golem'),
('doppelganger', '3', 'Medium', 'monstrosity', 'Doppelganger'),
('doppelrat', '2', 'Tiny', 'monstrosity', 'Doppelrat'),
('dorreq', '4', 'Medium', 'aberration', 'Dorreq'),
('dracotaur', '6', 'Large', 'dragon', 'Dracotaur'),
('draft-horse', '1/4', 'Large', 'beast', 'Draft Horse'),
('dragon-eel', '12', 'Huge', 'dragon', 'Dragon Eel'),
('dragon-turtle', '17', 'Gargantuan', 'dragon', 'Dragon Turtle'),
('dragonleaf-tree', '8', 'Large', 'plant', 'Dragonleaf Tree'),
('drakon', '5', 'Large', 'beast', 'Drakon'),
('dream-eater', '5', 'Medium', 'fiend', 'Dream Eater'),
('dream-squire', '2', 'Medium', 'fey', 'Dream Squire'),
('dream-wraith', '5', 'Medium', 'undead', 'Dream Wraith'),
('dretch', '1/4', 'Small', 'fiend', 'Dretch'),
('drider', '6', 'Large', 'monstrosity', 'Drider'),
('droth', '12', 'Huge', 'aberration', 'Droth'),
('drow', '1/4', 'Medium', 'humanoid', 'Drow'),
('drowned-maiden', '5', 'Medium', 'undead', 'Drowned Maiden'),
('druid', '2', 'Medium', 'humanoid', 'Druid'),
('dryad', '1', 'Medium', 'fey', 'Dryad'),
('duergar', '1', 'Medium', 'humanoid', 'Duergar'),
('dullahan', '11', 'Large', 'fey', 'Dullahan'),
('dune-mimic', '8', 'Huge', 'monstrosity', 'Dune Mimic'),
('duskthorn-dryad', '3', 'Medium', 'fey', 'Duskthorn Dryad'),
('dust-goblin', '1/4', 'Small', 'humanoid', 'Dust Goblin'),
('dust-goblin-chieftain', '3', 'Small', 'humanoid', 'Dust Goblin Chieftain'),
('dust-mephit', '1/2', 'Small', 'elemental', 'Dust Mephit'),
('dvarapala', '5', 'Huge', 'giant', 'Dvarapala'),
('dwarven-ringmage', '7', 'Medium', 'Humanoid', 'Dwarven Ringmage'),
('eagle', '0', 'Small', 'beast', 'Eagle'),
('eala', '2', 'Small', 'monstrosity', 'Eala'),
('earth-elemental', '5', 'Large', 'elemental', 'Earth Elemental'),
('eater-of-dust-yakat-shi', '9', 'Medium', 'aberration', 'Eater Of Dust (Yakat-Shi)'),
('echo', '6', 'Medium', 'fiend', 'Echo'),
('ecstatic-bloom', '11', 'Huge', 'celestial', 'Ecstatic Bloom'),
('edimmu', '4', 'Medium', 'undead', 'Edimmu'),
('edjet', '3', 'Medium', 'humanoid', 'Edjet'),
('eel-hound', '2', 'Medium', 'fey', 'Eel Hound'),
('efreeti', '11', 'Large', 'elemental', 'Efreeti'),
('einherjar', '7', 'Medium', 'humanoid', 'Einherjar'),
('elder-ghost-boar', '6', 'Huge', 'monstrosity', 'Elder Ghost Boar'),
('elder-shadow-drake', '7', 'Large', 'dragon', 'Elder Shadow Drake'),
('eleinomae', '5', 'Medium', 'fey', 'Eleinomae'),
('elemental-locus', '17', 'Gargantuan', 'elemental', 'Elemental Locus'),
('elementalist', '2', 'Medium', 'humanoid', 'Elementalist'),
('elephant', '4', 'Huge', 'beast', 'Elephant'),
('elite-kobold', '1', 'Small', 'humanoid', 'Elite Kobold'),
('elk', '1/4', 'Large', 'beast', 'Elk'),
('elophar', '4', 'Large', 'undead', 'Elophar'),
('elvish-veteran-archer', '3', 'Medium', 'Humanoid', 'Elvish Veteran Archer'),
('emerald-eye', '1', 'Tiny', 'construct', 'Emerald Eye'),
('emerald-order-cult-leader', '8', 'Medium', 'Humanoid (any race)', 'Emerald Order Cult Leader'),
('emperor-of-the-ghouls', '20', 'Medium', 'undead', 'Emperor Of The Ghouls'),
('empty-cloak', '1/2', 'Medium', 'construct', 'Empty Cloak'),
('enchanter', '7', 'Medium', 'humanoid', 'Enchanter'),
('eonic-drifter', '1', 'Medium', 'humanoid', 'Eonic Drifter'),
('erina-defender', '1', 'Small', 'humanoid', 'Erina Defender'),
('erina-scrounger', '1/4', 'Small', 'humanoid', 'Erina Scrounger'),
('erinyes', '12', 'Medium', 'fiend', 'Erinyes'),
('ettercap', '2', 'Medium', 'monstrosity', 'Ettercap'),
('ettin', '4', 'Large', 'giant', 'Ettin'),
('execrable-shrub', '1/2', 'Medium', 'fiend', 'Execrable Shrub'),
('exploding-toad', '1/4', 'Tiny', 'monstrosity', 'Exploding Toad'),
('eye-golem', '11', 'Large', 'construct', 'Eye Golem'),
('eye-of-the-gods', '1', 'Small', 'celestial', 'Eye of the Gods'),
('fang-of-the-great-wolf', '3', 'Large', 'monstrosity', 'Fang of the Great Wolf'),
('far-darrig', '3', 'Small', 'fey', 'Far Darrig'),
('far-wanderer', '3', 'Medium', 'aberration', 'Far Wanderer'),
('fate-eater', '6', 'Medium', 'aberration', 'Fate Eater'),
('fear-liath', '2', 'Large', 'undead', 'Fear Liath'),
('fear-smith', '10', 'Medium', 'fey', 'Fear Smith'),
('fellforged', '5', 'Medium', 'construct', 'Fellforged'),
('fext', '6', 'Medium', 'undead', 'Fext'),
('fey-drake', '6', 'Small', 'dragon', 'Fey Drake'),
('feyward-tree', '8', 'Huge', 'construct', 'Feyward Tree'),
('fidele-angel', '5', 'Medium', 'celestial', 'Fidele Angel'),
('fierstjerren', '5', 'Medium', 'undead', 'Fierstjerren'),
('fire-dancer-swarm', '7', 'Medium', 'swarm of Tiny elementals', 'Fire Dancer Swarm'),
('fire-elemental', '5', 'Large', 'elemental', 'Fire Elemental'),
('fire-giant', '9', 'Huge', 'giant', 'Fire Giant'),
('fire-imp', '1/2', 'Tiny', 'fiend', 'Fire Imp'),
('firebird', '4', 'Small', 'celestial', 'Firebird'),
('firegeist', '2', 'Small', 'elemental', 'Firegeist'),
('flab-giant', '4', 'Large', 'giant', 'Flab Giant'),
('flame-dragon-wyrmling', '3', 'Medium', 'dragon', 'Flame Dragon Wyrmling'),
('flame-eater-swarm', '2', 'Medium', 'beasts', 'Flame Eater Swarm'),
('flame-scourged-scion', '9', 'Huge', 'aberration', 'Flame-Scourged Scion'),
('flesh-golem', '5', 'Medium', 'construct', 'Flesh Golem'),
('flesh-reaver', '1/2', 'Medium', 'undead', 'Flesh Reaver'),
('fleshpod-hornet', '6', 'Large', 'beast', 'Fleshpod Hornet'),
('flutterflesh', '12', 'Large', 'undead', 'Flutterflesh'),
('flying-polyp', '11', 'Huge', 'aberration', 'Flying Polyp'),
('flying-snake', '1/8', 'Tiny', 'beast', 'Flying Snake'),
('flying-sword', '1/4', 'Small', 'construct', 'Flying Sword'),
('folk-of-leng', '2', 'Medium', 'humanoid', 'Folk Of Leng'),
('forest-drake', '2', 'Small', 'dragon', 'Forest Drake'),
('forest-marauder', '4', 'Large', 'giant', 'Forest Marauder'),
('foxfire-ooze', '10', 'Large', 'ooze', 'Foxfire Ooze'),
('foxin', '1/2', 'Small', 'fey', 'Foxin'),
('fractal-golem', '8', 'Large', 'construct', 'Fractal Golem'),
('fragrite', '6', 'Medium', 'elemental', 'Fragrite'),
('fraughashar', '1/2', 'Small', 'fey', 'Fraughashar'),
('frog', '0', 'Tiny', 'beast', 'Frog'),
('frost-giant', '8', 'Huge', 'giant', 'Frost Giant'),
('frostveil', '4', 'Medium', 'plant', 'Frostveil'),
('fulad-zereh', '9', 'Huge', 'fiend', 'Fulad-Zereh'),
('fulminar', '9', 'Large', 'elemental', 'Fulminar'),
('gaki', '8', 'Medium', 'undead', 'Gaki'),
('gargoctopus', '5', 'Large', 'monstrosity', 'Gargoctopus'),
('gargoyle', '2', 'Medium', 'elemental', 'Gargoyle'),
('garroter-crab', '1/4', 'Tiny', 'beast', 'Garroter Crab'),
('gbahali-postosuchus', '6', 'Huge', 'beast', 'Gbahali (Postosuchus)'),
('gearforged-templar', '6', 'Medium', 'humanoid', 'Gearforged Templar'),
('gelatinous-cube', '2', 'Large', 'ooze', 'Gelatinous Cube'),
('gerridae', '1', 'Large', 'fey', 'Gerridae'),
('ghast', '2', 'Medium', 'undead', 'Ghast'),
('ghast-of-leng', '3', 'Large', 'aberration', 'Ghast of Leng'),
('ghost', '4', 'Medium', 'undead', 'Ghost'),
('ghost-boar', '3', 'Large', 'monstrosity', 'Ghost Boar'),
('ghost-dragon', '11', 'Large', 'undead', 'Ghost Dragon'),
('ghost-dwarf', '6', 'Medium', 'undead', 'Ghost Dwarf'),
('ghost-knight', '6', 'Medium', 'undead', 'Ghost Knight'),
('ghostwalk-spider', '9', 'Large', 'monstrosity', 'Ghostwalk Spider'),
('ghoul', '1', 'Medium', 'undead', 'Ghoul'),
('ghoul-darakhul', '3', 'Medium', 'undead', 'Ghoul, Darakhul'),
('ghoul-imperial', '4', 'Medium', 'undead', 'Ghoul, Imperial'),
('ghoul-iron', '5', 'Medium', 'undead', 'Ghoul, Iron'),
('ghoulsteed', '3', 'Large', 'undead', 'Ghoulsteed'),
('giant-albino-bat', '3', 'Huge', 'monstrosity', 'Giant Albino Bat'),
('giant-ant', '2', 'Large', 'beast', 'Giant Ant'),
('giant-ant-queen', '4', 'Large', 'beast', 'Giant Ant Queen'),
('giant-ape', '7', 'Huge', 'beast', 'Giant Ape'),
('giant-badger', '1/4', 'Medium', 'beast', 'Giant Badger'),
('giant-bat', '1/4', 'Large', 'beast', 'Giant Bat'),
('giant-boar', '2', 'Large', 'beast', 'Giant Boar'),
('giant-centipede', '1/4', 'Small', 'beast', 'Giant Centipede'),
('giant-constrictor-snake', '2', 'Huge', 'beast', 'Giant Constrictor Snake'),
('giant-crab', '1/8', 'Medium', 'beast', 'Giant Crab'),
('giant-crocodile', '5', 'Huge', 'beast', 'Giant Crocodile'),
('giant-eagle', '1', 'Large', 'beast', 'Giant Eagle'),
('giant-elk', '2', 'Huge', 'beast', 'Giant Elk'),
('giant-fire-beetle', '0', 'Small', 'beast', 'Giant Fire Beetle'),
('giant-frog', '1/4', 'Medium', 'beast', 'Giant Frog'),
('giant-goat', '1/2', 'Large', 'beast', 'Giant Goat'),
('giant-hyena', '1', 'Large', 'beast', 'Giant Hyena'),
('giant-lizard', '1/4', 'Large', 'beast', 'Giant Lizard'),
('giant-moth', '1/8', 'Small', 'beast', 'Giant Moth'),
('giant-octopus', '1', 'Large', 'beast', 'Giant Octopus'),
('giant-owl', '1/4', 'Large', 'beast', 'Giant Owl'),
('giant-poisonous-snake', '1/4', 'Medium', 'beast', 'Giant Poisonous Snake'),
('giant-rat', '1/8', 'Small', 'beast', 'Giant Rat'),
('giant-rat-diseased', '1/8', 'Small', 'beast', 'Giant Rat (Diseased)'),
('giant-scorpion', '3', 'Large', 'beast', 'Giant Scorpion'),
('giant-sea-horse', '1/2', 'Large', 'beast', 'Giant Sea Horse'),
('giant-shark', '5', 'Huge', 'beast', 'Giant Shark'),
('giant-shark-bowl', '8', 'Huge', 'ooze', 'Giant Shark Bowl'),
('giant-sloth', '7', 'Large', 'beast', 'Giant Sloth'),
('giant-spider', '1', 'Large', 'beast', 'Giant Spider'),
('giant-toad', '1', 'Large', 'beast', 'Giant Toad'),
('giant-vampire-bat', '2', 'Large', 'beast', 'Giant Vampire Bat'),
('giant-vulture', '1', 'Large', 'beast', 'Giant Vulture'),
('giant-wasp', '1/2', 'Medium', 'beast', 'Giant Wasp'),
('giant-weasel', '1/8', 'Medium', 'beast', 'Giant Weasel'),
('giant-wolf-spider', '1/4', 'Medium', 'beast', 'Giant Wolf Spider'),
('gibbering-mouther', '2', 'Medium', 'aberration', 'Gibbering Mouther'),
('gilded-devil', '7', 'Medium', 'fiend', 'Gilded Devil'),
('glabrezu', '9', 'Large', 'fiend', 'Glabrezu'),
('gladiator', '5', 'Medium', 'humanoid', 'Gladiator'),
('glass-gator', '1', 'Large', 'beast', 'Glass Gator'),
('glass-golem', '2', 'Small', 'construct', 'Glass Golem'),
('gloomflower', '3', 'Tiny', 'plant', 'Gloomflower'),
('gnarljak', '6', 'Small', 'construct', 'Gnarljak'),
('gnoll', '1/2', 'Medium', 'humanoid', 'Gnoll'),
('gnoll-havoc-runner', '3', 'Medium', 'humanoid', 'Gnoll Havoc Runner'),
('gnoll-slaver', '3', 'Medium', 'humanoid', 'Gnoll Slaver'),
('goat', '0', 'Medium', 'beast', 'Goat'),
('goat-man', '3', 'Medium', 'monstrosity', 'Goat-Man'),
('goblin', '1/4', 'Small', 'humanoid', 'Goblin'),
('gold-dragon-wyrmling', '3', 'Medium', 'dragon', 'Gold Dragon Wyrmling'),
('goliath-longlegs', '7', 'Gargantuan', 'monstrosity', 'Goliath Longlegs'),
('goreling', '1/4', 'Small', 'undead', 'Goreling'),
('gorgon', '5', 'Large', 'monstrosity', 'Gorgon'),
('grave-behemoth', '10', 'Huge', 'undead', 'Grave Behemoth'),
('gray-ooze', '1/2', 'Medium', 'ooze', 'Gray Ooze'),
('gray-thirster', '2', 'Medium', 'undead', 'Gray Thirster'),
('great-mandrake', '1', 'Tiny', 'plant', 'Great Mandrake'),
('greater-death-butterfly-swarm', '6', 'Huge', 'swarm of tiny beasts', 'Greater Death Butterfly Swarm'),
('greater-rakshasa', '15', 'Medium', 'fiend', 'Greater Rakshasa'),
('greater-scrag', '7', 'Large', 'monstrosity', 'Greater Scrag'),
('green-abyss-orc', '1/2', 'Medium', 'humanoid', 'Green Abyss Orc'),
('green-dragon-wyrmling', '2', 'Medium', 'dragon', 'Green Dragon Wyrmling'),
('green-hag', '3', 'Medium', 'fey', 'Green Hag'),
('green-knight-of-the-woods', '6', 'Medium', 'fey', 'Green Knight of the Woods'),
('grick', '2', 'Medium', 'monstrosity', 'Grick'),
('griffon', '2', 'Large', 'monstrosity', 'Griffon'),
('grim-jester', '11', 'Medium', 'undead', 'Grim Jester'),
('grimlock', '1/4', 'Medium', 'humanoid', 'Grimlock'),
('grindylow', '1', 'Medium', 'aberration', 'Grindylow'),
('guard', '1/8', 'Medium', 'humanoid', 'Guard'),
('guardian-naga', '10', 'Large', 'monstrosity', 'Guardian Naga'),
('gug', '12', 'Huge', 'giant', 'Gug'),
('gugalanna', '21', 'Huge', 'celestial', 'Gugalanna'),
('gulon', '6', 'Large', 'monstrosity', 'Gulon'),
('gumienniki', '1', 'Small', 'fiend', 'Gumienniki'),
('gynosphinx', '11', 'Large', 'monstrosity', 'Gynosphinx'),
('gypsosphinx', '14', 'Large', 'monstrosity', 'Gypsosphinx'),
('hair-golem', '1/4', 'Small', 'construct', 'Hair Golem'),
('half-red-dragon-veteran', '5', 'Medium', 'humanoid', 'Half-Red Dragon Veteran'),
('hallowed-reed', '1/2', 'Medium', 'celestial', 'Hallowed Reed'),
('harpy', '1', 'Medium', 'monstrosity', 'Harpy'),
('haugbui', '13', 'Medium', 'undead', 'Haugbui'),
('haunted-giant', '6', 'Huge', 'giant', 'Haunted Giant'),
('hawk', '0', 'Tiny', 'beast', 'Hawk'),
('heavy-cavalry', '2', 'Medium', 'humanoid', 'Heavy Cavalry'),
('hell-hound', '3', 'Medium', 'fiend', 'Hell Hound'),
('herald-of-blood', '12', 'Huge', 'fiend', 'Herald Of Blood'),
('herald-of-darkness', '7', 'Large', 'fiend', 'Herald Of Darkness'),
('hezrou', '8', 'Large', 'fiend', 'Hezrou'),
('hierophant-lich', '9', 'Medium', 'undead', 'Hierophant Lich'),
('hill-giant', '5', 'Huge', 'giant', 'Hill Giant'),
('hippogriff', '1', 'Large', 'monstrosity', 'Hippogriff'),
('hoard-golem', '12', 'Huge', 'construct', 'Hoard Golem'); |
delete from HtmlLabelIndex where id=19309
/
delete from HtmlLabelInfo where indexid=19309
/
INSERT INTO HtmlLabelIndex values(19309,'收(发)文单位')
/
INSERT INTO HtmlLabelInfo VALUES(19309,'收(发)文单位',7)
/
INSERT INTO HtmlLabelInfo VALUES(19309,'Receive Unit',8)
/ |
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.5.10
-- Dumped by pg_dump version 9.5.10
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: auth_group; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE auth_group (
id integer NOT NULL,
name character varying(80) NOT NULL
);
ALTER TABLE auth_group OWNER TO netbox;
--
-- Name: auth_group_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE auth_group_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_group_id_seq OWNER TO netbox;
--
-- Name: auth_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE auth_group_id_seq OWNED BY auth_group.id;
--
-- Name: auth_group_permissions; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE auth_group_permissions (
id integer NOT NULL,
group_id integer NOT NULL,
permission_id integer NOT NULL
);
ALTER TABLE auth_group_permissions OWNER TO netbox;
--
-- Name: auth_group_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE auth_group_permissions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_group_permissions_id_seq OWNER TO netbox;
--
-- Name: auth_group_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE auth_group_permissions_id_seq OWNED BY auth_group_permissions.id;
--
-- Name: auth_permission; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE auth_permission (
id integer NOT NULL,
name character varying(255) NOT NULL,
content_type_id integer NOT NULL,
codename character varying(100) NOT NULL
);
ALTER TABLE auth_permission OWNER TO netbox;
--
-- Name: auth_permission_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE auth_permission_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_permission_id_seq OWNER TO netbox;
--
-- Name: auth_permission_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE auth_permission_id_seq OWNED BY auth_permission.id;
--
-- Name: auth_user; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE auth_user (
id integer NOT NULL,
password character varying(128) NOT NULL,
last_login timestamp with time zone,
is_superuser boolean NOT NULL,
username character varying(150) NOT NULL,
first_name character varying(30) NOT NULL,
last_name character varying(30) NOT NULL,
email character varying(254) NOT NULL,
is_staff boolean NOT NULL,
is_active boolean NOT NULL,
date_joined timestamp with time zone NOT NULL
);
ALTER TABLE auth_user OWNER TO netbox;
--
-- Name: auth_user_groups; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE auth_user_groups (
id integer NOT NULL,
user_id integer NOT NULL,
group_id integer NOT NULL
);
ALTER TABLE auth_user_groups OWNER TO netbox;
--
-- Name: auth_user_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE auth_user_groups_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_user_groups_id_seq OWNER TO netbox;
--
-- Name: auth_user_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE auth_user_groups_id_seq OWNED BY auth_user_groups.id;
--
-- Name: auth_user_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE auth_user_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_user_id_seq OWNER TO netbox;
--
-- Name: auth_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE auth_user_id_seq OWNED BY auth_user.id;
--
-- Name: auth_user_user_permissions; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE auth_user_user_permissions (
id integer NOT NULL,
user_id integer NOT NULL,
permission_id integer NOT NULL
);
ALTER TABLE auth_user_user_permissions OWNER TO netbox;
--
-- Name: auth_user_user_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE auth_user_user_permissions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE auth_user_user_permissions_id_seq OWNER TO netbox;
--
-- Name: auth_user_user_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE auth_user_user_permissions_id_seq OWNED BY auth_user_user_permissions.id;
--
-- Name: circuits_circuit; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE circuits_circuit (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
cid character varying(50) NOT NULL,
install_date date,
commit_rate integer,
comments text NOT NULL,
provider_id integer NOT NULL,
type_id integer NOT NULL,
tenant_id integer,
description character varying(100) NOT NULL,
CONSTRAINT circuits_circuit_commit_rate_check CHECK ((commit_rate >= 0))
);
ALTER TABLE circuits_circuit OWNER TO netbox;
--
-- Name: circuits_circuit_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE circuits_circuit_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE circuits_circuit_id_seq OWNER TO netbox;
--
-- Name: circuits_circuit_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE circuits_circuit_id_seq OWNED BY circuits_circuit.id;
--
-- Name: circuits_circuittermination; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE circuits_circuittermination (
id integer NOT NULL,
term_side character varying(1) NOT NULL,
port_speed integer NOT NULL,
upstream_speed integer,
xconnect_id character varying(50) NOT NULL,
pp_info character varying(100) NOT NULL,
circuit_id integer NOT NULL,
interface_id integer,
site_id integer NOT NULL,
CONSTRAINT circuits_circuittermination_port_speed_check CHECK ((port_speed >= 0)),
CONSTRAINT circuits_circuittermination_upstream_speed_check CHECK ((upstream_speed >= 0))
);
ALTER TABLE circuits_circuittermination OWNER TO netbox;
--
-- Name: circuits_circuittermination_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE circuits_circuittermination_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE circuits_circuittermination_id_seq OWNER TO netbox;
--
-- Name: circuits_circuittermination_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE circuits_circuittermination_id_seq OWNED BY circuits_circuittermination.id;
--
-- Name: circuits_circuittype; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE circuits_circuittype (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL
);
ALTER TABLE circuits_circuittype OWNER TO netbox;
--
-- Name: circuits_circuittype_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE circuits_circuittype_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE circuits_circuittype_id_seq OWNER TO netbox;
--
-- Name: circuits_circuittype_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE circuits_circuittype_id_seq OWNED BY circuits_circuittype.id;
--
-- Name: circuits_provider; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE circuits_provider (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
asn bigint,
account character varying(30) NOT NULL,
portal_url character varying(200) NOT NULL,
noc_contact text NOT NULL,
admin_contact text NOT NULL,
comments text NOT NULL
);
ALTER TABLE circuits_provider OWNER TO netbox;
--
-- Name: circuits_provider_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE circuits_provider_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE circuits_provider_id_seq OWNER TO netbox;
--
-- Name: circuits_provider_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE circuits_provider_id_seq OWNED BY circuits_provider.id;
--
-- Name: dcim_consoleport; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_consoleport (
id integer NOT NULL,
name character varying(50) NOT NULL,
connection_status boolean,
cs_port_id integer,
device_id integer NOT NULL
);
ALTER TABLE dcim_consoleport OWNER TO netbox;
--
-- Name: dcim_consoleport_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_consoleport_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_consoleport_id_seq OWNER TO netbox;
--
-- Name: dcim_consoleport_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_consoleport_id_seq OWNED BY dcim_consoleport.id;
--
-- Name: dcim_consoleporttemplate; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_consoleporttemplate (
id integer NOT NULL,
name character varying(50) NOT NULL,
device_type_id integer NOT NULL
);
ALTER TABLE dcim_consoleporttemplate OWNER TO netbox;
--
-- Name: dcim_consoleporttemplate_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_consoleporttemplate_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_consoleporttemplate_id_seq OWNER TO netbox;
--
-- Name: dcim_consoleporttemplate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_consoleporttemplate_id_seq OWNED BY dcim_consoleporttemplate.id;
--
-- Name: dcim_consoleserverport; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_consoleserverport (
id integer NOT NULL,
name character varying(50) NOT NULL,
device_id integer NOT NULL
);
ALTER TABLE dcim_consoleserverport OWNER TO netbox;
--
-- Name: dcim_consoleserverport_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_consoleserverport_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_consoleserverport_id_seq OWNER TO netbox;
--
-- Name: dcim_consoleserverport_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_consoleserverport_id_seq OWNED BY dcim_consoleserverport.id;
--
-- Name: dcim_consoleserverporttemplate; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_consoleserverporttemplate (
id integer NOT NULL,
name character varying(50) NOT NULL,
device_type_id integer NOT NULL
);
ALTER TABLE dcim_consoleserverporttemplate OWNER TO netbox;
--
-- Name: dcim_consoleserverporttemplate_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_consoleserverporttemplate_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_consoleserverporttemplate_id_seq OWNER TO netbox;
--
-- Name: dcim_consoleserverporttemplate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_consoleserverporttemplate_id_seq OWNED BY dcim_consoleserverporttemplate.id;
--
-- Name: dcim_device; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_device (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
name character varying(64),
serial character varying(50) NOT NULL,
"position" smallint,
face smallint,
status smallint NOT NULL,
comments text NOT NULL,
device_role_id integer NOT NULL,
device_type_id integer NOT NULL,
platform_id integer,
rack_id integer,
primary_ip4_id integer,
primary_ip6_id integer,
tenant_id integer,
asset_tag character varying(50),
site_id integer NOT NULL,
cluster_id integer,
CONSTRAINT dcim_device_face_check CHECK ((face >= 0)),
CONSTRAINT dcim_device_position_check CHECK (("position" >= 0)),
CONSTRAINT dcim_device_status_4f698226_check CHECK ((status >= 0))
);
ALTER TABLE dcim_device OWNER TO netbox;
--
-- Name: dcim_device_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_device_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_device_id_seq OWNER TO netbox;
--
-- Name: dcim_device_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_device_id_seq OWNED BY dcim_device.id;
--
-- Name: dcim_devicebay; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_devicebay (
id integer NOT NULL,
name character varying(50) NOT NULL,
device_id integer NOT NULL,
installed_device_id integer
);
ALTER TABLE dcim_devicebay OWNER TO netbox;
--
-- Name: dcim_devicebay_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_devicebay_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_devicebay_id_seq OWNER TO netbox;
--
-- Name: dcim_devicebay_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_devicebay_id_seq OWNED BY dcim_devicebay.id;
--
-- Name: dcim_devicebaytemplate; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_devicebaytemplate (
id integer NOT NULL,
name character varying(50) NOT NULL,
device_type_id integer NOT NULL
);
ALTER TABLE dcim_devicebaytemplate OWNER TO netbox;
--
-- Name: dcim_devicebaytemplate_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_devicebaytemplate_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_devicebaytemplate_id_seq OWNER TO netbox;
--
-- Name: dcim_devicebaytemplate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_devicebaytemplate_id_seq OWNED BY dcim_devicebaytemplate.id;
--
-- Name: dcim_devicerole; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_devicerole (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
color character varying(6) NOT NULL,
vm_role boolean NOT NULL
);
ALTER TABLE dcim_devicerole OWNER TO netbox;
--
-- Name: dcim_devicerole_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_devicerole_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_devicerole_id_seq OWNER TO netbox;
--
-- Name: dcim_devicerole_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_devicerole_id_seq OWNED BY dcim_devicerole.id;
--
-- Name: dcim_devicetype; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_devicetype (
id integer NOT NULL,
model character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
u_height smallint NOT NULL,
is_full_depth boolean NOT NULL,
is_console_server boolean NOT NULL,
is_pdu boolean NOT NULL,
is_network_device boolean NOT NULL,
manufacturer_id integer NOT NULL,
subdevice_role boolean,
part_number character varying(50) NOT NULL,
comments text NOT NULL,
interface_ordering smallint NOT NULL,
CONSTRAINT dcim_devicetype_interface_ordering_check CHECK ((interface_ordering >= 0)),
CONSTRAINT dcim_devicetype_u_height_check CHECK ((u_height >= 0))
);
ALTER TABLE dcim_devicetype OWNER TO netbox;
--
-- Name: dcim_devicetype_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_devicetype_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_devicetype_id_seq OWNER TO netbox;
--
-- Name: dcim_devicetype_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_devicetype_id_seq OWNED BY dcim_devicetype.id;
--
-- Name: dcim_interface; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_interface (
id integer NOT NULL,
name character varying(64) NOT NULL,
form_factor smallint NOT NULL,
mgmt_only boolean NOT NULL,
description character varying(100) NOT NULL,
device_id integer,
mac_address macaddr,
lag_id integer,
enabled boolean NOT NULL,
mtu smallint,
virtual_machine_id integer,
CONSTRAINT dcim_interface_form_factor_check CHECK ((form_factor >= 0)),
CONSTRAINT dcim_interface_mtu_check CHECK ((mtu >= 0))
);
ALTER TABLE dcim_interface OWNER TO netbox;
--
-- Name: dcim_interface_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_interface_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_interface_id_seq OWNER TO netbox;
--
-- Name: dcim_interface_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_interface_id_seq OWNED BY dcim_interface.id;
--
-- Name: dcim_interfaceconnection; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_interfaceconnection (
id integer NOT NULL,
connection_status boolean NOT NULL,
interface_a_id integer NOT NULL,
interface_b_id integer NOT NULL
);
ALTER TABLE dcim_interfaceconnection OWNER TO netbox;
--
-- Name: dcim_interfaceconnection_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_interfaceconnection_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_interfaceconnection_id_seq OWNER TO netbox;
--
-- Name: dcim_interfaceconnection_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_interfaceconnection_id_seq OWNED BY dcim_interfaceconnection.id;
--
-- Name: dcim_interfacetemplate; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_interfacetemplate (
id integer NOT NULL,
name character varying(64) NOT NULL,
form_factor smallint NOT NULL,
mgmt_only boolean NOT NULL,
device_type_id integer NOT NULL,
CONSTRAINT dcim_interfacetemplate_form_factor_check CHECK ((form_factor >= 0))
);
ALTER TABLE dcim_interfacetemplate OWNER TO netbox;
--
-- Name: dcim_interfacetemplate_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_interfacetemplate_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_interfacetemplate_id_seq OWNER TO netbox;
--
-- Name: dcim_interfacetemplate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_interfacetemplate_id_seq OWNED BY dcim_interfacetemplate.id;
--
-- Name: dcim_inventoryitem; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_inventoryitem (
id integer NOT NULL,
name character varying(50) NOT NULL,
part_id character varying(50) NOT NULL,
serial character varying(50) NOT NULL,
discovered boolean NOT NULL,
device_id integer NOT NULL,
parent_id integer,
manufacturer_id integer,
asset_tag character varying(50),
description character varying(100) NOT NULL
);
ALTER TABLE dcim_inventoryitem OWNER TO netbox;
--
-- Name: dcim_manufacturer; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_manufacturer (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL
);
ALTER TABLE dcim_manufacturer OWNER TO netbox;
--
-- Name: dcim_manufacturer_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_manufacturer_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_manufacturer_id_seq OWNER TO netbox;
--
-- Name: dcim_manufacturer_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_manufacturer_id_seq OWNED BY dcim_manufacturer.id;
--
-- Name: dcim_module_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_module_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_module_id_seq OWNER TO netbox;
--
-- Name: dcim_module_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_module_id_seq OWNED BY dcim_inventoryitem.id;
--
-- Name: dcim_platform; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_platform (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
rpc_client character varying(30) NOT NULL,
napalm_driver character varying(50) NOT NULL
);
ALTER TABLE dcim_platform OWNER TO netbox;
--
-- Name: dcim_platform_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_platform_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_platform_id_seq OWNER TO netbox;
--
-- Name: dcim_platform_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_platform_id_seq OWNED BY dcim_platform.id;
--
-- Name: dcim_poweroutlet; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_poweroutlet (
id integer NOT NULL,
name character varying(50) NOT NULL,
device_id integer NOT NULL
);
ALTER TABLE dcim_poweroutlet OWNER TO netbox;
--
-- Name: dcim_poweroutlet_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_poweroutlet_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_poweroutlet_id_seq OWNER TO netbox;
--
-- Name: dcim_poweroutlet_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_poweroutlet_id_seq OWNED BY dcim_poweroutlet.id;
--
-- Name: dcim_poweroutlettemplate; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_poweroutlettemplate (
id integer NOT NULL,
name character varying(50) NOT NULL,
device_type_id integer NOT NULL
);
ALTER TABLE dcim_poweroutlettemplate OWNER TO netbox;
--
-- Name: dcim_poweroutlettemplate_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_poweroutlettemplate_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_poweroutlettemplate_id_seq OWNER TO netbox;
--
-- Name: dcim_poweroutlettemplate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_poweroutlettemplate_id_seq OWNED BY dcim_poweroutlettemplate.id;
--
-- Name: dcim_powerport; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_powerport (
id integer NOT NULL,
name character varying(50) NOT NULL,
connection_status boolean,
device_id integer NOT NULL,
power_outlet_id integer
);
ALTER TABLE dcim_powerport OWNER TO netbox;
--
-- Name: dcim_powerport_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_powerport_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_powerport_id_seq OWNER TO netbox;
--
-- Name: dcim_powerport_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_powerport_id_seq OWNED BY dcim_powerport.id;
--
-- Name: dcim_powerporttemplate; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_powerporttemplate (
id integer NOT NULL,
name character varying(50) NOT NULL,
device_type_id integer NOT NULL
);
ALTER TABLE dcim_powerporttemplate OWNER TO netbox;
--
-- Name: dcim_powerporttemplate_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_powerporttemplate_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_powerporttemplate_id_seq OWNER TO netbox;
--
-- Name: dcim_powerporttemplate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_powerporttemplate_id_seq OWNED BY dcim_powerporttemplate.id;
--
-- Name: dcim_rack; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_rack (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
name character varying(50) NOT NULL,
facility_id character varying(50),
u_height smallint NOT NULL,
comments text NOT NULL,
group_id integer,
site_id integer NOT NULL,
tenant_id integer,
type smallint,
width smallint NOT NULL,
role_id integer,
desc_units boolean NOT NULL,
serial character varying(50) NOT NULL,
CONSTRAINT dcim_rack_type_check CHECK ((type >= 0)),
CONSTRAINT dcim_rack_u_height_check CHECK ((u_height >= 0)),
CONSTRAINT dcim_rack_width_check CHECK ((width >= 0))
);
ALTER TABLE dcim_rack OWNER TO netbox;
--
-- Name: dcim_rack_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_rack_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_rack_id_seq OWNER TO netbox;
--
-- Name: dcim_rack_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_rack_id_seq OWNED BY dcim_rack.id;
--
-- Name: dcim_rackgroup; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_rackgroup (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
site_id integer NOT NULL
);
ALTER TABLE dcim_rackgroup OWNER TO netbox;
--
-- Name: dcim_rackgroup_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_rackgroup_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_rackgroup_id_seq OWNER TO netbox;
--
-- Name: dcim_rackgroup_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_rackgroup_id_seq OWNED BY dcim_rackgroup.id;
--
-- Name: dcim_rackreservation; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_rackreservation (
id integer NOT NULL,
units smallint[] NOT NULL,
created timestamp with time zone NOT NULL,
description character varying(100) NOT NULL,
rack_id integer NOT NULL,
user_id integer NOT NULL
);
ALTER TABLE dcim_rackreservation OWNER TO netbox;
--
-- Name: dcim_rackreservation_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_rackreservation_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_rackreservation_id_seq OWNER TO netbox;
--
-- Name: dcim_rackreservation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_rackreservation_id_seq OWNED BY dcim_rackreservation.id;
--
-- Name: dcim_rackrole; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_rackrole (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
color character varying(6) NOT NULL
);
ALTER TABLE dcim_rackrole OWNER TO netbox;
--
-- Name: dcim_rackrole_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_rackrole_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_rackrole_id_seq OWNER TO netbox;
--
-- Name: dcim_rackrole_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_rackrole_id_seq OWNED BY dcim_rackrole.id;
--
-- Name: dcim_region; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_region (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
lft integer NOT NULL,
rght integer NOT NULL,
tree_id integer NOT NULL,
level integer NOT NULL,
parent_id integer,
CONSTRAINT dcim_region_level_check CHECK ((level >= 0)),
CONSTRAINT dcim_region_lft_check CHECK ((lft >= 0)),
CONSTRAINT dcim_region_rght_check CHECK ((rght >= 0)),
CONSTRAINT dcim_region_tree_id_check CHECK ((tree_id >= 0))
);
ALTER TABLE dcim_region OWNER TO netbox;
--
-- Name: dcim_region_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_region_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_region_id_seq OWNER TO netbox;
--
-- Name: dcim_region_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_region_id_seq OWNED BY dcim_region.id;
--
-- Name: dcim_site; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE dcim_site (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
facility character varying(50) NOT NULL,
asn bigint,
physical_address character varying(200) NOT NULL,
shipping_address character varying(200) NOT NULL,
comments text NOT NULL,
tenant_id integer,
contact_email character varying(254) NOT NULL,
contact_name character varying(50) NOT NULL,
contact_phone character varying(20) NOT NULL,
region_id integer
);
ALTER TABLE dcim_site OWNER TO netbox;
--
-- Name: dcim_site_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE dcim_site_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE dcim_site_id_seq OWNER TO netbox;
--
-- Name: dcim_site_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE dcim_site_id_seq OWNED BY dcim_site.id;
--
-- Name: django_admin_log; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE django_admin_log (
id integer NOT NULL,
action_time timestamp with time zone NOT NULL,
object_id text,
object_repr character varying(200) NOT NULL,
action_flag smallint NOT NULL,
change_message text NOT NULL,
content_type_id integer,
user_id integer NOT NULL,
CONSTRAINT django_admin_log_action_flag_check CHECK ((action_flag >= 0))
);
ALTER TABLE django_admin_log OWNER TO netbox;
--
-- Name: django_admin_log_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE django_admin_log_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE django_admin_log_id_seq OWNER TO netbox;
--
-- Name: django_admin_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE django_admin_log_id_seq OWNED BY django_admin_log.id;
--
-- Name: django_content_type; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE django_content_type (
id integer NOT NULL,
app_label character varying(100) NOT NULL,
model character varying(100) NOT NULL
);
ALTER TABLE django_content_type OWNER TO netbox;
--
-- Name: django_content_type_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE django_content_type_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE django_content_type_id_seq OWNER TO netbox;
--
-- Name: django_content_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE django_content_type_id_seq OWNED BY django_content_type.id;
--
-- Name: django_migrations; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE django_migrations (
id integer NOT NULL,
app character varying(255) NOT NULL,
name character varying(255) NOT NULL,
applied timestamp with time zone NOT NULL
);
ALTER TABLE django_migrations OWNER TO netbox;
--
-- Name: django_migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE django_migrations_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE django_migrations_id_seq OWNER TO netbox;
--
-- Name: django_migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE django_migrations_id_seq OWNED BY django_migrations.id;
--
-- Name: django_session; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE django_session (
session_key character varying(40) NOT NULL,
session_data text NOT NULL,
expire_date timestamp with time zone NOT NULL
);
ALTER TABLE django_session OWNER TO netbox;
--
-- Name: extras_customfield; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE extras_customfield (
id integer NOT NULL,
type smallint NOT NULL,
name character varying(50) NOT NULL,
label character varying(50) NOT NULL,
description character varying(100) NOT NULL,
required boolean NOT NULL,
is_filterable boolean NOT NULL,
"default" character varying(100) NOT NULL,
weight smallint NOT NULL,
CONSTRAINT extras_customfield_type_check CHECK ((type >= 0)),
CONSTRAINT extras_customfield_weight_check CHECK ((weight >= 0))
);
ALTER TABLE extras_customfield OWNER TO netbox;
--
-- Name: extras_customfield_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE extras_customfield_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE extras_customfield_id_seq OWNER TO netbox;
--
-- Name: extras_customfield_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE extras_customfield_id_seq OWNED BY extras_customfield.id;
--
-- Name: extras_customfield_obj_type; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE extras_customfield_obj_type (
id integer NOT NULL,
customfield_id integer NOT NULL,
contenttype_id integer NOT NULL
);
ALTER TABLE extras_customfield_obj_type OWNER TO netbox;
--
-- Name: extras_customfield_obj_type_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE extras_customfield_obj_type_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE extras_customfield_obj_type_id_seq OWNER TO netbox;
--
-- Name: extras_customfield_obj_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE extras_customfield_obj_type_id_seq OWNED BY extras_customfield_obj_type.id;
--
-- Name: extras_customfieldchoice; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE extras_customfieldchoice (
id integer NOT NULL,
value character varying(100) NOT NULL,
weight smallint NOT NULL,
field_id integer NOT NULL,
CONSTRAINT extras_customfieldchoice_weight_check CHECK ((weight >= 0))
);
ALTER TABLE extras_customfieldchoice OWNER TO netbox;
--
-- Name: extras_customfieldchoice_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE extras_customfieldchoice_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE extras_customfieldchoice_id_seq OWNER TO netbox;
--
-- Name: extras_customfieldchoice_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE extras_customfieldchoice_id_seq OWNED BY extras_customfieldchoice.id;
--
-- Name: extras_customfieldvalue; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE extras_customfieldvalue (
id integer NOT NULL,
obj_id integer NOT NULL,
serialized_value character varying(255) NOT NULL,
field_id integer NOT NULL,
obj_type_id integer NOT NULL,
CONSTRAINT extras_customfieldvalue_obj_id_check CHECK ((obj_id >= 0))
);
ALTER TABLE extras_customfieldvalue OWNER TO netbox;
--
-- Name: extras_customfieldvalue_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE extras_customfieldvalue_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE extras_customfieldvalue_id_seq OWNER TO netbox;
--
-- Name: extras_customfieldvalue_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE extras_customfieldvalue_id_seq OWNED BY extras_customfieldvalue.id;
--
-- Name: extras_exporttemplate; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE extras_exporttemplate (
id integer NOT NULL,
name character varying(100) NOT NULL,
template_code text NOT NULL,
mime_type character varying(15) NOT NULL,
file_extension character varying(15) NOT NULL,
content_type_id integer NOT NULL,
description character varying(200) NOT NULL
);
ALTER TABLE extras_exporttemplate OWNER TO netbox;
--
-- Name: extras_exporttemplate_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE extras_exporttemplate_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE extras_exporttemplate_id_seq OWNER TO netbox;
--
-- Name: extras_exporttemplate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE extras_exporttemplate_id_seq OWNED BY extras_exporttemplate.id;
--
-- Name: extras_graph; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE extras_graph (
id integer NOT NULL,
type smallint NOT NULL,
weight smallint NOT NULL,
name character varying(100) NOT NULL,
source character varying(500) NOT NULL,
link character varying(200) NOT NULL,
CONSTRAINT extras_graph_type_check CHECK ((type >= 0)),
CONSTRAINT extras_graph_weight_check CHECK ((weight >= 0))
);
ALTER TABLE extras_graph OWNER TO netbox;
--
-- Name: extras_graph_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE extras_graph_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE extras_graph_id_seq OWNER TO netbox;
--
-- Name: extras_graph_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE extras_graph_id_seq OWNED BY extras_graph.id;
--
-- Name: extras_imageattachment; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE extras_imageattachment (
id integer NOT NULL,
object_id integer NOT NULL,
image character varying(100) NOT NULL,
image_height smallint NOT NULL,
image_width smallint NOT NULL,
name character varying(50) NOT NULL,
created timestamp with time zone NOT NULL,
content_type_id integer NOT NULL,
CONSTRAINT extras_imageattachment_image_height_check CHECK ((image_height >= 0)),
CONSTRAINT extras_imageattachment_image_width_check CHECK ((image_width >= 0)),
CONSTRAINT extras_imageattachment_object_id_check CHECK ((object_id >= 0))
);
ALTER TABLE extras_imageattachment OWNER TO netbox;
--
-- Name: extras_imageattachment_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE extras_imageattachment_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE extras_imageattachment_id_seq OWNER TO netbox;
--
-- Name: extras_imageattachment_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE extras_imageattachment_id_seq OWNED BY extras_imageattachment.id;
--
-- Name: extras_reportresult; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE extras_reportresult (
id integer NOT NULL,
report character varying(255) NOT NULL,
created timestamp with time zone NOT NULL,
failed boolean NOT NULL,
data jsonb NOT NULL,
user_id integer
);
ALTER TABLE extras_reportresult OWNER TO netbox;
--
-- Name: extras_reportresult_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE extras_reportresult_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE extras_reportresult_id_seq OWNER TO netbox;
--
-- Name: extras_reportresult_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE extras_reportresult_id_seq OWNED BY extras_reportresult.id;
--
-- Name: extras_topologymap; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE extras_topologymap (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
device_patterns text NOT NULL,
description character varying(100) NOT NULL,
site_id integer
);
ALTER TABLE extras_topologymap OWNER TO netbox;
--
-- Name: extras_topologymap_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE extras_topologymap_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE extras_topologymap_id_seq OWNER TO netbox;
--
-- Name: extras_topologymap_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE extras_topologymap_id_seq OWNED BY extras_topologymap.id;
--
-- Name: extras_useraction; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE extras_useraction (
id integer NOT NULL,
"time" timestamp with time zone NOT NULL,
object_id integer,
action smallint NOT NULL,
message text NOT NULL,
content_type_id integer NOT NULL,
user_id integer NOT NULL,
CONSTRAINT extras_useraction_action_check CHECK ((action >= 0)),
CONSTRAINT extras_useraction_object_id_check CHECK ((object_id >= 0))
);
ALTER TABLE extras_useraction OWNER TO netbox;
--
-- Name: extras_useraction_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE extras_useraction_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE extras_useraction_id_seq OWNER TO netbox;
--
-- Name: extras_useraction_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE extras_useraction_id_seq OWNED BY extras_useraction.id;
--
-- Name: ipam_aggregate; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE ipam_aggregate (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
family smallint NOT NULL,
prefix cidr NOT NULL,
date_added date,
description character varying(100) NOT NULL,
rir_id integer NOT NULL,
CONSTRAINT ipam_aggregate_family_check CHECK ((family >= 0))
);
ALTER TABLE ipam_aggregate OWNER TO netbox;
--
-- Name: ipam_aggregate_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE ipam_aggregate_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ipam_aggregate_id_seq OWNER TO netbox;
--
-- Name: ipam_aggregate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE ipam_aggregate_id_seq OWNED BY ipam_aggregate.id;
--
-- Name: ipam_ipaddress; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE ipam_ipaddress (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
family smallint NOT NULL,
address inet NOT NULL,
description character varying(100) NOT NULL,
interface_id integer,
nat_inside_id integer,
vrf_id integer,
tenant_id integer,
status smallint NOT NULL,
role smallint,
CONSTRAINT ipam_ipaddress_family_check CHECK ((family >= 0)),
CONSTRAINT ipam_ipaddress_role_check CHECK ((role >= 0)),
CONSTRAINT ipam_ipaddress_status_check CHECK ((status >= 0))
);
ALTER TABLE ipam_ipaddress OWNER TO netbox;
--
-- Name: ipam_ipaddress_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE ipam_ipaddress_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ipam_ipaddress_id_seq OWNER TO netbox;
--
-- Name: ipam_ipaddress_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE ipam_ipaddress_id_seq OWNED BY ipam_ipaddress.id;
--
-- Name: ipam_prefix; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE ipam_prefix (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
family smallint NOT NULL,
prefix cidr NOT NULL,
status smallint NOT NULL,
description character varying(100) NOT NULL,
role_id integer,
site_id integer,
vlan_id integer,
vrf_id integer,
tenant_id integer,
is_pool boolean NOT NULL,
CONSTRAINT ipam_prefix_family_check CHECK ((family >= 0)),
CONSTRAINT ipam_prefix_status_check CHECK ((status >= 0))
);
ALTER TABLE ipam_prefix OWNER TO netbox;
--
-- Name: ipam_prefix_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE ipam_prefix_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ipam_prefix_id_seq OWNER TO netbox;
--
-- Name: ipam_prefix_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE ipam_prefix_id_seq OWNED BY ipam_prefix.id;
--
-- Name: ipam_rir; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE ipam_rir (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
is_private boolean NOT NULL
);
ALTER TABLE ipam_rir OWNER TO netbox;
--
-- Name: ipam_rir_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE ipam_rir_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ipam_rir_id_seq OWNER TO netbox;
--
-- Name: ipam_rir_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE ipam_rir_id_seq OWNED BY ipam_rir.id;
--
-- Name: ipam_role; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE ipam_role (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
weight smallint NOT NULL,
CONSTRAINT ipam_role_weight_check CHECK ((weight >= 0))
);
ALTER TABLE ipam_role OWNER TO netbox;
--
-- Name: ipam_role_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE ipam_role_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ipam_role_id_seq OWNER TO netbox;
--
-- Name: ipam_role_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE ipam_role_id_seq OWNED BY ipam_role.id;
--
-- Name: ipam_service; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE ipam_service (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
name character varying(30) NOT NULL,
protocol smallint NOT NULL,
port integer NOT NULL,
description character varying(100) NOT NULL,
device_id integer,
virtual_machine_id integer,
CONSTRAINT ipam_service_port_check CHECK ((port >= 0)),
CONSTRAINT ipam_service_protocol_check CHECK ((protocol >= 0))
);
ALTER TABLE ipam_service OWNER TO netbox;
--
-- Name: ipam_service_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE ipam_service_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ipam_service_id_seq OWNER TO netbox;
--
-- Name: ipam_service_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE ipam_service_id_seq OWNED BY ipam_service.id;
--
-- Name: ipam_service_ipaddresses; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE ipam_service_ipaddresses (
id integer NOT NULL,
service_id integer NOT NULL,
ipaddress_id integer NOT NULL
);
ALTER TABLE ipam_service_ipaddresses OWNER TO netbox;
--
-- Name: ipam_service_ipaddresses_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE ipam_service_ipaddresses_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ipam_service_ipaddresses_id_seq OWNER TO netbox;
--
-- Name: ipam_service_ipaddresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE ipam_service_ipaddresses_id_seq OWNED BY ipam_service_ipaddresses.id;
--
-- Name: ipam_vlan; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE ipam_vlan (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
vid smallint NOT NULL,
name character varying(64) NOT NULL,
status smallint NOT NULL,
role_id integer,
site_id integer,
group_id integer,
description character varying(100) NOT NULL,
tenant_id integer,
CONSTRAINT ipam_vlan_status_check CHECK ((status >= 0)),
CONSTRAINT ipam_vlan_vid_check CHECK ((vid >= 0))
);
ALTER TABLE ipam_vlan OWNER TO netbox;
--
-- Name: ipam_vlan_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE ipam_vlan_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ipam_vlan_id_seq OWNER TO netbox;
--
-- Name: ipam_vlan_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE ipam_vlan_id_seq OWNED BY ipam_vlan.id;
--
-- Name: ipam_vlangroup; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE ipam_vlangroup (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL,
site_id integer
);
ALTER TABLE ipam_vlangroup OWNER TO netbox;
--
-- Name: ipam_vlangroup_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE ipam_vlangroup_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ipam_vlangroup_id_seq OWNER TO netbox;
--
-- Name: ipam_vlangroup_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE ipam_vlangroup_id_seq OWNED BY ipam_vlangroup.id;
--
-- Name: ipam_vrf; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE ipam_vrf (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
name character varying(50) NOT NULL,
rd character varying(21) NOT NULL,
description character varying(100) NOT NULL,
enforce_unique boolean NOT NULL,
tenant_id integer
);
ALTER TABLE ipam_vrf OWNER TO netbox;
--
-- Name: ipam_vrf_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE ipam_vrf_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE ipam_vrf_id_seq OWNER TO netbox;
--
-- Name: ipam_vrf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE ipam_vrf_id_seq OWNED BY ipam_vrf.id;
--
-- Name: secrets_secret; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE secrets_secret (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
name character varying(100) NOT NULL,
ciphertext bytea NOT NULL,
hash character varying(128) NOT NULL,
device_id integer NOT NULL,
role_id integer NOT NULL
);
ALTER TABLE secrets_secret OWNER TO netbox;
--
-- Name: secrets_secret_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE secrets_secret_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE secrets_secret_id_seq OWNER TO netbox;
--
-- Name: secrets_secret_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE secrets_secret_id_seq OWNED BY secrets_secret.id;
--
-- Name: secrets_secretrole; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE secrets_secretrole (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL
);
ALTER TABLE secrets_secretrole OWNER TO netbox;
--
-- Name: secrets_secretrole_groups; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE secrets_secretrole_groups (
id integer NOT NULL,
secretrole_id integer NOT NULL,
group_id integer NOT NULL
);
ALTER TABLE secrets_secretrole_groups OWNER TO netbox;
--
-- Name: secrets_secretrole_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE secrets_secretrole_groups_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE secrets_secretrole_groups_id_seq OWNER TO netbox;
--
-- Name: secrets_secretrole_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE secrets_secretrole_groups_id_seq OWNED BY secrets_secretrole_groups.id;
--
-- Name: secrets_secretrole_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE secrets_secretrole_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE secrets_secretrole_id_seq OWNER TO netbox;
--
-- Name: secrets_secretrole_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE secrets_secretrole_id_seq OWNED BY secrets_secretrole.id;
--
-- Name: secrets_secretrole_users; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE secrets_secretrole_users (
id integer NOT NULL,
secretrole_id integer NOT NULL,
user_id integer NOT NULL
);
ALTER TABLE secrets_secretrole_users OWNER TO netbox;
--
-- Name: secrets_secretrole_users_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE secrets_secretrole_users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE secrets_secretrole_users_id_seq OWNER TO netbox;
--
-- Name: secrets_secretrole_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE secrets_secretrole_users_id_seq OWNED BY secrets_secretrole_users.id;
--
-- Name: secrets_sessionkey; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE secrets_sessionkey (
id integer NOT NULL,
cipher bytea NOT NULL,
hash character varying(128) NOT NULL,
created timestamp with time zone NOT NULL,
userkey_id integer NOT NULL
);
ALTER TABLE secrets_sessionkey OWNER TO netbox;
--
-- Name: secrets_sessionkey_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE secrets_sessionkey_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE secrets_sessionkey_id_seq OWNER TO netbox;
--
-- Name: secrets_sessionkey_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE secrets_sessionkey_id_seq OWNED BY secrets_sessionkey.id;
--
-- Name: secrets_userkey; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE secrets_userkey (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
public_key text NOT NULL,
master_key_cipher bytea,
user_id integer NOT NULL
);
ALTER TABLE secrets_userkey OWNER TO netbox;
--
-- Name: secrets_userkey_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE secrets_userkey_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE secrets_userkey_id_seq OWNER TO netbox;
--
-- Name: secrets_userkey_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE secrets_userkey_id_seq OWNED BY secrets_userkey.id;
--
-- Name: tenancy_tenant; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE tenancy_tenant (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
name character varying(30) NOT NULL,
slug character varying(50) NOT NULL,
description character varying(100) NOT NULL,
comments text NOT NULL,
group_id integer
);
ALTER TABLE tenancy_tenant OWNER TO netbox;
--
-- Name: tenancy_tenant_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE tenancy_tenant_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE tenancy_tenant_id_seq OWNER TO netbox;
--
-- Name: tenancy_tenant_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE tenancy_tenant_id_seq OWNED BY tenancy_tenant.id;
--
-- Name: tenancy_tenantgroup; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE tenancy_tenantgroup (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL
);
ALTER TABLE tenancy_tenantgroup OWNER TO netbox;
--
-- Name: tenancy_tenantgroup_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE tenancy_tenantgroup_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE tenancy_tenantgroup_id_seq OWNER TO netbox;
--
-- Name: tenancy_tenantgroup_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE tenancy_tenantgroup_id_seq OWNED BY tenancy_tenantgroup.id;
--
-- Name: users_token; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE users_token (
id integer NOT NULL,
created timestamp with time zone NOT NULL,
expires timestamp with time zone,
key character varying(40) NOT NULL,
write_enabled boolean NOT NULL,
description character varying(100) NOT NULL,
user_id integer NOT NULL
);
ALTER TABLE users_token OWNER TO netbox;
--
-- Name: users_token_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE users_token_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE users_token_id_seq OWNER TO netbox;
--
-- Name: users_token_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE users_token_id_seq OWNED BY users_token.id;
--
-- Name: virtualization_cluster; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE virtualization_cluster (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
name character varying(100) NOT NULL,
comments text NOT NULL,
group_id integer,
type_id integer NOT NULL,
site_id integer
);
ALTER TABLE virtualization_cluster OWNER TO netbox;
--
-- Name: virtualization_cluster_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE virtualization_cluster_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE virtualization_cluster_id_seq OWNER TO netbox;
--
-- Name: virtualization_cluster_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE virtualization_cluster_id_seq OWNED BY virtualization_cluster.id;
--
-- Name: virtualization_clustergroup; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE virtualization_clustergroup (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL
);
ALTER TABLE virtualization_clustergroup OWNER TO netbox;
--
-- Name: virtualization_clustergroup_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE virtualization_clustergroup_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE virtualization_clustergroup_id_seq OWNER TO netbox;
--
-- Name: virtualization_clustergroup_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE virtualization_clustergroup_id_seq OWNED BY virtualization_clustergroup.id;
--
-- Name: virtualization_clustertype; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE virtualization_clustertype (
id integer NOT NULL,
name character varying(50) NOT NULL,
slug character varying(50) NOT NULL
);
ALTER TABLE virtualization_clustertype OWNER TO netbox;
--
-- Name: virtualization_clustertype_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE virtualization_clustertype_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE virtualization_clustertype_id_seq OWNER TO netbox;
--
-- Name: virtualization_clustertype_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE virtualization_clustertype_id_seq OWNED BY virtualization_clustertype.id;
--
-- Name: virtualization_virtualmachine; Type: TABLE; Schema: public; Owner: netbox
--
CREATE TABLE virtualization_virtualmachine (
id integer NOT NULL,
created date NOT NULL,
last_updated timestamp with time zone NOT NULL,
name character varying(64) NOT NULL,
vcpus smallint,
memory integer,
disk integer,
comments text NOT NULL,
cluster_id integer NOT NULL,
platform_id integer,
primary_ip4_id integer,
primary_ip6_id integer,
tenant_id integer,
status smallint NOT NULL,
role_id integer,
CONSTRAINT virtualization_virtualmachine_disk_check CHECK ((disk >= 0)),
CONSTRAINT virtualization_virtualmachine_memory_check CHECK ((memory >= 0)),
CONSTRAINT virtualization_virtualmachine_status_check CHECK ((status >= 0)),
CONSTRAINT virtualization_virtualmachine_vcpus_check CHECK ((vcpus >= 0))
);
ALTER TABLE virtualization_virtualmachine OWNER TO netbox;
--
-- Name: virtualization_virtualmachine_id_seq; Type: SEQUENCE; Schema: public; Owner: netbox
--
CREATE SEQUENCE virtualization_virtualmachine_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE virtualization_virtualmachine_id_seq OWNER TO netbox;
--
-- Name: virtualization_virtualmachine_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: netbox
--
ALTER SEQUENCE virtualization_virtualmachine_id_seq OWNED BY virtualization_virtualmachine.id;
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_group ALTER COLUMN id SET DEFAULT nextval('auth_group_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_group_permissions ALTER COLUMN id SET DEFAULT nextval('auth_group_permissions_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_permission ALTER COLUMN id SET DEFAULT nextval('auth_permission_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user ALTER COLUMN id SET DEFAULT nextval('auth_user_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user_groups ALTER COLUMN id SET DEFAULT nextval('auth_user_groups_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user_user_permissions ALTER COLUMN id SET DEFAULT nextval('auth_user_user_permissions_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuit ALTER COLUMN id SET DEFAULT nextval('circuits_circuit_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuittermination ALTER COLUMN id SET DEFAULT nextval('circuits_circuittermination_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuittype ALTER COLUMN id SET DEFAULT nextval('circuits_circuittype_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_provider ALTER COLUMN id SET DEFAULT nextval('circuits_provider_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleport ALTER COLUMN id SET DEFAULT nextval('dcim_consoleport_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleporttemplate ALTER COLUMN id SET DEFAULT nextval('dcim_consoleporttemplate_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleserverport ALTER COLUMN id SET DEFAULT nextval('dcim_consoleserverport_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleserverporttemplate ALTER COLUMN id SET DEFAULT nextval('dcim_consoleserverporttemplate_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device ALTER COLUMN id SET DEFAULT nextval('dcim_device_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicebay ALTER COLUMN id SET DEFAULT nextval('dcim_devicebay_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicebaytemplate ALTER COLUMN id SET DEFAULT nextval('dcim_devicebaytemplate_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicerole ALTER COLUMN id SET DEFAULT nextval('dcim_devicerole_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicetype ALTER COLUMN id SET DEFAULT nextval('dcim_devicetype_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interface ALTER COLUMN id SET DEFAULT nextval('dcim_interface_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interfaceconnection ALTER COLUMN id SET DEFAULT nextval('dcim_interfaceconnection_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interfacetemplate ALTER COLUMN id SET DEFAULT nextval('dcim_interfacetemplate_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_inventoryitem ALTER COLUMN id SET DEFAULT nextval('dcim_module_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_manufacturer ALTER COLUMN id SET DEFAULT nextval('dcim_manufacturer_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_platform ALTER COLUMN id SET DEFAULT nextval('dcim_platform_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_poweroutlet ALTER COLUMN id SET DEFAULT nextval('dcim_poweroutlet_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_poweroutlettemplate ALTER COLUMN id SET DEFAULT nextval('dcim_poweroutlettemplate_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_powerport ALTER COLUMN id SET DEFAULT nextval('dcim_powerport_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_powerporttemplate ALTER COLUMN id SET DEFAULT nextval('dcim_powerporttemplate_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rack ALTER COLUMN id SET DEFAULT nextval('dcim_rack_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackgroup ALTER COLUMN id SET DEFAULT nextval('dcim_rackgroup_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackreservation ALTER COLUMN id SET DEFAULT nextval('dcim_rackreservation_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackrole ALTER COLUMN id SET DEFAULT nextval('dcim_rackrole_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_region ALTER COLUMN id SET DEFAULT nextval('dcim_region_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_site ALTER COLUMN id SET DEFAULT nextval('dcim_site_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY django_admin_log ALTER COLUMN id SET DEFAULT nextval('django_admin_log_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY django_content_type ALTER COLUMN id SET DEFAULT nextval('django_content_type_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY django_migrations ALTER COLUMN id SET DEFAULT nextval('django_migrations_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfield ALTER COLUMN id SET DEFAULT nextval('extras_customfield_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfield_obj_type ALTER COLUMN id SET DEFAULT nextval('extras_customfield_obj_type_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfieldchoice ALTER COLUMN id SET DEFAULT nextval('extras_customfieldchoice_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfieldvalue ALTER COLUMN id SET DEFAULT nextval('extras_customfieldvalue_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_exporttemplate ALTER COLUMN id SET DEFAULT nextval('extras_exporttemplate_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_graph ALTER COLUMN id SET DEFAULT nextval('extras_graph_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_imageattachment ALTER COLUMN id SET DEFAULT nextval('extras_imageattachment_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_reportresult ALTER COLUMN id SET DEFAULT nextval('extras_reportresult_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_topologymap ALTER COLUMN id SET DEFAULT nextval('extras_topologymap_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_useraction ALTER COLUMN id SET DEFAULT nextval('extras_useraction_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_aggregate ALTER COLUMN id SET DEFAULT nextval('ipam_aggregate_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_ipaddress ALTER COLUMN id SET DEFAULT nextval('ipam_ipaddress_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_prefix ALTER COLUMN id SET DEFAULT nextval('ipam_prefix_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_rir ALTER COLUMN id SET DEFAULT nextval('ipam_rir_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_role ALTER COLUMN id SET DEFAULT nextval('ipam_role_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_service ALTER COLUMN id SET DEFAULT nextval('ipam_service_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_service_ipaddresses ALTER COLUMN id SET DEFAULT nextval('ipam_service_ipaddresses_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlan ALTER COLUMN id SET DEFAULT nextval('ipam_vlan_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlangroup ALTER COLUMN id SET DEFAULT nextval('ipam_vlangroup_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vrf ALTER COLUMN id SET DEFAULT nextval('ipam_vrf_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secret ALTER COLUMN id SET DEFAULT nextval('secrets_secret_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole ALTER COLUMN id SET DEFAULT nextval('secrets_secretrole_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole_groups ALTER COLUMN id SET DEFAULT nextval('secrets_secretrole_groups_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole_users ALTER COLUMN id SET DEFAULT nextval('secrets_secretrole_users_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_sessionkey ALTER COLUMN id SET DEFAULT nextval('secrets_sessionkey_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_userkey ALTER COLUMN id SET DEFAULT nextval('secrets_userkey_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY tenancy_tenant ALTER COLUMN id SET DEFAULT nextval('tenancy_tenant_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY tenancy_tenantgroup ALTER COLUMN id SET DEFAULT nextval('tenancy_tenantgroup_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY users_token ALTER COLUMN id SET DEFAULT nextval('users_token_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_cluster ALTER COLUMN id SET DEFAULT nextval('virtualization_cluster_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_clustergroup ALTER COLUMN id SET DEFAULT nextval('virtualization_clustergroup_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_clustertype ALTER COLUMN id SET DEFAULT nextval('virtualization_clustertype_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_virtualmachine ALTER COLUMN id SET DEFAULT nextval('virtualization_virtualmachine_id_seq'::regclass);
--
-- Data for Name: auth_group; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY auth_group (id, name) FROM stdin;
\.
--
-- Name: auth_group_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('auth_group_id_seq', 1, false);
--
-- Data for Name: auth_group_permissions; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY auth_group_permissions (id, group_id, permission_id) FROM stdin;
\.
--
-- Name: auth_group_permissions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('auth_group_permissions_id_seq', 1, false);
--
-- Data for Name: auth_permission; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY auth_permission (id, name, content_type_id, codename) FROM stdin;
1 Can add log entry 1 add_logentry
2 Can change log entry 1 change_logentry
3 Can delete log entry 1 delete_logentry
4 Can add group 2 add_group
5 Can change group 2 change_group
6 Can delete group 2 delete_group
7 Can add permission 3 add_permission
8 Can change permission 3 change_permission
9 Can delete permission 3 delete_permission
10 Can add user 4 add_user
11 Can change user 4 change_user
12 Can delete user 4 delete_user
13 Can add content type 5 add_contenttype
14 Can change content type 5 change_contenttype
15 Can delete content type 5 delete_contenttype
16 Can add session 6 add_session
17 Can change session 6 change_session
18 Can delete session 6 delete_session
19 Can add provider 7 add_provider
20 Can change provider 7 change_provider
21 Can delete provider 7 delete_provider
22 Can add circuit termination 8 add_circuittermination
23 Can change circuit termination 8 change_circuittermination
24 Can delete circuit termination 8 delete_circuittermination
25 Can add circuit type 9 add_circuittype
26 Can change circuit type 9 change_circuittype
27 Can delete circuit type 9 delete_circuittype
28 Can add circuit 10 add_circuit
29 Can change circuit 10 change_circuit
30 Can delete circuit 10 delete_circuit
31 Can add device bay template 11 add_devicebaytemplate
32 Can change device bay template 11 change_devicebaytemplate
33 Can delete device bay template 11 delete_devicebaytemplate
34 Can add device bay 12 add_devicebay
35 Can change device bay 12 change_devicebay
36 Can delete device bay 12 delete_devicebay
37 Can add platform 13 add_platform
38 Can change platform 13 change_platform
39 Can delete platform 13 delete_platform
40 Can add rack role 14 add_rackrole
41 Can change rack role 14 change_rackrole
42 Can delete rack role 14 delete_rackrole
43 Can add interface 15 add_interface
44 Can change interface 15 change_interface
45 Can delete interface 15 delete_interface
46 Can add power port template 16 add_powerporttemplate
47 Can change power port template 16 change_powerporttemplate
48 Can delete power port template 16 delete_powerporttemplate
49 Can add console server port 17 add_consoleserverport
50 Can change console server port 17 change_consoleserverport
51 Can delete console server port 17 delete_consoleserverport
52 Can add site 18 add_site
53 Can change site 18 change_site
54 Can delete site 18 delete_site
55 Can add device 19 add_device
56 Can change device 19 change_device
57 Can delete device 19 delete_device
58 Read-only access to devices via NAPALM 19 napalm_read
59 Read/write access to devices via NAPALM 19 napalm_write
60 Can add rack 20 add_rack
61 Can change rack 20 change_rack
62 Can delete rack 20 delete_rack
63 Can add power port 21 add_powerport
64 Can change power port 21 change_powerport
65 Can delete power port 21 delete_powerport
66 Can add interface template 22 add_interfacetemplate
67 Can change interface template 22 change_interfacetemplate
68 Can delete interface template 22 delete_interfacetemplate
69 Can add console port template 23 add_consoleporttemplate
70 Can change console port template 23 change_consoleporttemplate
71 Can delete console port template 23 delete_consoleporttemplate
72 Can add device role 24 add_devicerole
73 Can change device role 24 change_devicerole
74 Can delete device role 24 delete_devicerole
75 Can add rack group 25 add_rackgroup
76 Can change rack group 25 change_rackgroup
77 Can delete rack group 25 delete_rackgroup
78 Can add rack reservation 26 add_rackreservation
79 Can change rack reservation 26 change_rackreservation
80 Can delete rack reservation 26 delete_rackreservation
81 Can add interface connection 27 add_interfaceconnection
82 Can change interface connection 27 change_interfaceconnection
83 Can delete interface connection 27 delete_interfaceconnection
84 Can add inventory item 28 add_inventoryitem
85 Can change inventory item 28 change_inventoryitem
86 Can delete inventory item 28 delete_inventoryitem
87 Can add manufacturer 29 add_manufacturer
88 Can change manufacturer 29 change_manufacturer
89 Can delete manufacturer 29 delete_manufacturer
90 Can add region 30 add_region
91 Can change region 30 change_region
92 Can delete region 30 delete_region
93 Can add console port 31 add_consoleport
94 Can change console port 31 change_consoleport
95 Can delete console port 31 delete_consoleport
96 Can add console server port template 32 add_consoleserverporttemplate
97 Can change console server port template 32 change_consoleserverporttemplate
98 Can delete console server port template 32 delete_consoleserverporttemplate
99 Can add power outlet 33 add_poweroutlet
100 Can change power outlet 33 change_poweroutlet
101 Can delete power outlet 33 delete_poweroutlet
102 Can add device type 34 add_devicetype
103 Can change device type 34 change_devicetype
104 Can delete device type 34 delete_devicetype
105 Can add power outlet template 35 add_poweroutlettemplate
106 Can change power outlet template 35 change_poweroutlettemplate
107 Can delete power outlet template 35 delete_poweroutlettemplate
108 Can add role 36 add_role
109 Can change role 36 change_role
110 Can delete role 36 delete_role
111 Can add service 37 add_service
112 Can change service 37 change_service
113 Can delete service 37 delete_service
114 Can add VLAN group 38 add_vlangroup
115 Can change VLAN group 38 change_vlangroup
116 Can delete VLAN group 38 delete_vlangroup
117 Can add VRF 39 add_vrf
118 Can change VRF 39 change_vrf
119 Can delete VRF 39 delete_vrf
120 Can add IP address 40 add_ipaddress
121 Can change IP address 40 change_ipaddress
122 Can delete IP address 40 delete_ipaddress
123 Can add aggregate 41 add_aggregate
124 Can change aggregate 41 change_aggregate
125 Can delete aggregate 41 delete_aggregate
126 Can add RIR 42 add_rir
127 Can change RIR 42 change_rir
128 Can delete RIR 42 delete_rir
129 Can add VLAN 43 add_vlan
130 Can change VLAN 43 change_vlan
131 Can delete VLAN 43 delete_vlan
132 Can add prefix 44 add_prefix
133 Can change prefix 44 change_prefix
134 Can delete prefix 44 delete_prefix
135 Can add custom field 45 add_customfield
136 Can change custom field 45 change_customfield
137 Can delete custom field 45 delete_customfield
138 Can add user action 46 add_useraction
139 Can change user action 46 change_useraction
140 Can delete user action 46 delete_useraction
141 Can add graph 47 add_graph
142 Can change graph 47 change_graph
143 Can delete graph 47 delete_graph
144 Can add export template 48 add_exporttemplate
145 Can change export template 48 change_exporttemplate
146 Can delete export template 48 delete_exporttemplate
147 Can add image attachment 49 add_imageattachment
148 Can change image attachment 49 change_imageattachment
149 Can delete image attachment 49 delete_imageattachment
150 Can add custom field choice 50 add_customfieldchoice
151 Can change custom field choice 50 change_customfieldchoice
152 Can delete custom field choice 50 delete_customfieldchoice
153 Can add report result 51 add_reportresult
154 Can change report result 51 change_reportresult
155 Can delete report result 51 delete_reportresult
156 Can add topology map 52 add_topologymap
157 Can change topology map 52 change_topologymap
158 Can delete topology map 52 delete_topologymap
159 Can add custom field value 53 add_customfieldvalue
160 Can change custom field value 53 change_customfieldvalue
161 Can delete custom field value 53 delete_customfieldvalue
162 Can add secret 54 add_secret
163 Can change secret 54 change_secret
164 Can delete secret 54 delete_secret
165 Can add user key 55 add_userkey
166 Can change user key 55 change_userkey
167 Can delete user key 55 delete_userkey
168 Can activate user keys for decryption 55 activate_userkey
169 Can add secret role 56 add_secretrole
170 Can change secret role 56 change_secretrole
171 Can delete secret role 56 delete_secretrole
172 Can add session key 57 add_sessionkey
173 Can change session key 57 change_sessionkey
174 Can delete session key 57 delete_sessionkey
175 Can add tenant group 58 add_tenantgroup
176 Can change tenant group 58 change_tenantgroup
177 Can delete tenant group 58 delete_tenantgroup
178 Can add tenant 59 add_tenant
179 Can change tenant 59 change_tenant
180 Can delete tenant 59 delete_tenant
181 Can add cluster group 61 add_clustergroup
182 Can change cluster group 61 change_clustergroup
183 Can delete cluster group 61 delete_clustergroup
184 Can add virtual machine 62 add_virtualmachine
185 Can change virtual machine 62 change_virtualmachine
186 Can delete virtual machine 62 delete_virtualmachine
187 Can add cluster type 63 add_clustertype
188 Can change cluster type 63 change_clustertype
189 Can delete cluster type 63 delete_clustertype
190 Can add cluster 64 add_cluster
191 Can change cluster 64 change_cluster
192 Can delete cluster 64 delete_cluster
\.
--
-- Name: auth_permission_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('auth_permission_id_seq', 198, true);
--
-- Data for Name: auth_user; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY auth_user (id, password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined) FROM stdin;
1 pbkdf2_sha256$36000$NNGnmi6eIfX5$5fve6lQVtFeybbur70kTvl3cObRFJ4mgokNSkbNJIOE= 2018-04-09 09:08:29.14655+00 t netbox t t 2018-04-09 09:07:18.674223+00
\.
--
-- Data for Name: auth_user_groups; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY auth_user_groups (id, user_id, group_id) FROM stdin;
\.
--
-- Name: auth_user_groups_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('auth_user_groups_id_seq', 1, false);
--
-- Name: auth_user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('auth_user_id_seq', 33, true);
--
-- Data for Name: auth_user_user_permissions; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY auth_user_user_permissions (id, user_id, permission_id) FROM stdin;
\.
--
-- Name: auth_user_user_permissions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('auth_user_user_permissions_id_seq', 1, false);
--
-- Data for Name: circuits_circuit; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY circuits_circuit (id, created, last_updated, cid, install_date, commit_rate, comments, provider_id, type_id, tenant_id, description) FROM stdin;
\.
--
-- Name: circuits_circuit_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('circuits_circuit_id_seq', 1, false);
--
-- Data for Name: circuits_circuittermination; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY circuits_circuittermination (id, term_side, port_speed, upstream_speed, xconnect_id, pp_info, circuit_id, interface_id, site_id) FROM stdin;
\.
--
-- Name: circuits_circuittermination_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('circuits_circuittermination_id_seq', 1, false);
--
-- Data for Name: circuits_circuittype; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY circuits_circuittype (id, name, slug) FROM stdin;
1 Internet internet
2 Private WAN private-wan
3 Out-of-Band out-of-band
\.
--
-- Name: circuits_circuittype_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('circuits_circuittype_id_seq', 3, true);
--
-- Data for Name: circuits_provider; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY circuits_provider (id, created, last_updated, name, slug, asn, account, portal_url, noc_contact, admin_contact, comments) FROM stdin;
\.
--
-- Name: circuits_provider_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('circuits_provider_id_seq', 1, false);
--
-- Data for Name: dcim_consoleport; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_consoleport (id, name, connection_status, cs_port_id, device_id) FROM stdin;
\.
--
-- Name: dcim_consoleport_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_consoleport_id_seq', 1, false);
--
-- Data for Name: dcim_consoleporttemplate; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_consoleporttemplate (id, name, device_type_id) FROM stdin;
\.
--
-- Name: dcim_consoleporttemplate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_consoleporttemplate_id_seq', 1, false);
--
-- Data for Name: dcim_consoleserverport; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_consoleserverport (id, name, device_id) FROM stdin;
\.
--
-- Name: dcim_consoleserverport_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_consoleserverport_id_seq', 1, false);
--
-- Data for Name: dcim_consoleserverporttemplate; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_consoleserverporttemplate (id, name, device_type_id) FROM stdin;
\.
--
-- Name: dcim_consoleserverporttemplate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_consoleserverporttemplate_id_seq', 1, false);
--
-- Data for Name: dcim_device; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_device (id, created, last_updated, name, serial, "position", face, status, comments, device_role_id, device_type_id, platform_id, rack_id, primary_ip4_id, primary_ip6_id, tenant_id, asset_tag, site_id, cluster_id) FROM stdin;
\.
--
-- Name: dcim_device_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_device_id_seq', 66, true);
--
-- Data for Name: dcim_devicebay; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_devicebay (id, name, device_id, installed_device_id) FROM stdin;
\.
--
-- Name: dcim_devicebay_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_devicebay_id_seq', 1, false);
--
-- Data for Name: dcim_devicebaytemplate; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_devicebaytemplate (id, name, device_type_id) FROM stdin;
\.
--
-- Name: dcim_devicebaytemplate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_devicebaytemplate_id_seq', 1, false);
--
-- Data for Name: dcim_devicerole; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_devicerole (id, name, slug, color, vm_role) FROM stdin;
1 Console Server console-server 009688 t
2 Core Switch core-switch 2196f3 t
3 Distribution Switch distribution-switch 2196f3 t
4 Access Switch access-switch 2196f3 t
5 Management Switch management-switch ff9800 t
6 Firewall firewall f44336 t
7 Router router 9c27b0 t
8 Server server 9e9e9e t
9 PDU pdu 607d8b t
\.
--
-- Name: dcim_devicerole_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_devicerole_id_seq', 42, true);
--
-- Data for Name: dcim_devicetype; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_devicetype (id, model, slug, u_height, is_full_depth, is_console_server, is_pdu, is_network_device, manufacturer_id, subdevice_role, part_number, comments, interface_ordering) FROM stdin;
\.
--
-- Name: dcim_devicetype_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_devicetype_id_seq', 66, true);
--
-- Data for Name: dcim_interface; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_interface (id, name, form_factor, mgmt_only, description, device_id, mac_address, lag_id, enabled, mtu, virtual_machine_id) FROM stdin;
\.
--
-- Name: dcim_interface_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_interface_id_seq', 1, false);
--
-- Data for Name: dcim_interfaceconnection; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_interfaceconnection (id, connection_status, interface_a_id, interface_b_id) FROM stdin;
\.
--
-- Name: dcim_interfaceconnection_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_interfaceconnection_id_seq', 1, false);
--
-- Data for Name: dcim_interfacetemplate; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_interfacetemplate (id, name, form_factor, mgmt_only, device_type_id) FROM stdin;
\.
--
-- Name: dcim_interfacetemplate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_interfacetemplate_id_seq', 1, false);
--
-- Data for Name: dcim_inventoryitem; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_inventoryitem (id, name, part_id, serial, discovered, device_id, parent_id, manufacturer_id, asset_tag, description) FROM stdin;
\.
--
-- Data for Name: dcim_manufacturer; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_manufacturer (id, name, slug) FROM stdin;
1 APC apc
2 Cisco cisco
3 Dell dell
4 HP hp
5 Juniper juniper
6 Arista arista
7 Opengear opengear
8 Super Micro super-micro
\.
--
-- Name: dcim_manufacturer_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_manufacturer_id_seq', 8, true);
--
-- Name: dcim_module_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_module_id_seq', 1, false);
--
-- Data for Name: dcim_platform; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_platform (id, name, slug, rpc_client, napalm_driver) FROM stdin;
1 Cisco IOS cisco-ios cisco-ios
2 Cisco NX-OS cisco-nx-os
3 Juniper Junos juniper-junos juniper-junos
4 Arista EOS arista-eos
5 Linux linux
6 Opengear opengear opengear
\.
--
-- Name: dcim_platform_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_platform_id_seq', 6, true);
--
-- Data for Name: dcim_poweroutlet; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_poweroutlet (id, name, device_id) FROM stdin;
\.
--
-- Name: dcim_poweroutlet_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_poweroutlet_id_seq', 1, false);
--
-- Data for Name: dcim_poweroutlettemplate; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_poweroutlettemplate (id, name, device_type_id) FROM stdin;
\.
--
-- Name: dcim_poweroutlettemplate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_poweroutlettemplate_id_seq', 1, false);
--
-- Data for Name: dcim_powerport; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_powerport (id, name, connection_status, device_id, power_outlet_id) FROM stdin;
\.
--
-- Name: dcim_powerport_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_powerport_id_seq', 1, false);
--
-- Data for Name: dcim_powerporttemplate; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_powerporttemplate (id, name, device_type_id) FROM stdin;
\.
--
-- Name: dcim_powerporttemplate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_powerporttemplate_id_seq', 1, false);
--
-- Data for Name: dcim_rack; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_rack (id, created, last_updated, name, facility_id, u_height, comments, group_id, site_id, tenant_id, type, width, role_id, desc_units, serial) FROM stdin;
\.
--
-- Name: dcim_rack_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_rack_id_seq', 1, false);
--
-- Data for Name: dcim_rackgroup; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_rackgroup (id, name, slug, site_id) FROM stdin;
\.
--
-- Name: dcim_rackgroup_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_rackgroup_id_seq', 1, false);
--
-- Data for Name: dcim_rackreservation; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_rackreservation (id, units, created, description, rack_id, user_id) FROM stdin;
\.
--
-- Name: dcim_rackreservation_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_rackreservation_id_seq', 1, false);
--
-- Data for Name: dcim_rackrole; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_rackrole (id, name, slug, color) FROM stdin;
\.
--
-- Name: dcim_rackrole_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_rackrole_id_seq', 1, false);
--
-- Data for Name: dcim_region; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_region (id, name, slug, lft, rght, tree_id, level, parent_id) FROM stdin;
\.
--
-- Name: dcim_region_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_region_id_seq', 1, false);
--
-- Data for Name: dcim_site; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY dcim_site (id, created, last_updated, name, slug, facility, asn, physical_address, shipping_address, comments, tenant_id, contact_email, contact_name, contact_phone, region_id) FROM stdin;
\.
--
-- Name: dcim_site_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('dcim_site_id_seq', 66, true);
--
-- Data for Name: django_admin_log; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY django_admin_log (id, action_time, object_id, object_repr, action_flag, change_message, content_type_id, user_id) FROM stdin;
\.
--
-- Name: django_admin_log_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('django_admin_log_id_seq', 1, false);
--
-- Data for Name: django_content_type; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY django_content_type (id, app_label, model) FROM stdin;
1 admin logentry
2 auth group
3 auth permission
4 auth user
5 contenttypes contenttype
6 sessions session
7 circuits provider
8 circuits circuittermination
9 circuits circuittype
10 circuits circuit
11 dcim devicebaytemplate
12 dcim devicebay
13 dcim platform
14 dcim rackrole
15 dcim interface
16 dcim powerporttemplate
17 dcim consoleserverport
18 dcim site
19 dcim device
20 dcim rack
21 dcim powerport
22 dcim interfacetemplate
23 dcim consoleporttemplate
24 dcim devicerole
25 dcim rackgroup
26 dcim rackreservation
27 dcim interfaceconnection
28 dcim inventoryitem
29 dcim manufacturer
30 dcim region
31 dcim consoleport
32 dcim consoleserverporttemplate
33 dcim poweroutlet
34 dcim devicetype
35 dcim poweroutlettemplate
36 ipam role
37 ipam service
38 ipam vlangroup
39 ipam vrf
40 ipam ipaddress
41 ipam aggregate
42 ipam rir
43 ipam vlan
44 ipam prefix
45 extras customfield
46 extras useraction
47 extras graph
48 extras exporttemplate
49 extras imageattachment
50 extras customfieldchoice
51 extras reportresult
52 extras topologymap
53 extras customfieldvalue
54 secrets secret
55 secrets userkey
56 secrets secretrole
57 secrets sessionkey
58 tenancy tenantgroup
59 tenancy tenant
60 users token
61 virtualization clustergroup
62 virtualization virtualmachine
63 virtualization clustertype
64 virtualization cluster
\.
--
-- Name: django_content_type_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('django_content_type_id_seq', 66, true);
--
-- Data for Name: django_migrations; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY django_migrations (id, app, name, applied) FROM stdin;
1 contenttypes 0001_initial 2018-04-09 09:06:45.388595+00
2 auth 0001_initial 2018-04-09 09:06:45.548257+00
3 admin 0001_initial 2018-04-09 09:06:45.609595+00
4 admin 0002_logentry_remove_auto_add 2018-04-09 09:06:45.635902+00
5 contenttypes 0002_remove_content_type_name 2018-04-09 09:06:45.713095+00
6 auth 0002_alter_permission_name_max_length 2018-04-09 09:06:45.741985+00
7 auth 0003_alter_user_email_max_length 2018-04-09 09:06:45.778579+00
8 auth 0004_alter_user_username_opts 2018-04-09 09:06:45.81871+00
9 auth 0005_alter_user_last_login_null 2018-04-09 09:06:45.853709+00
10 auth 0006_require_contenttypes_0002 2018-04-09 09:06:45.857584+00
11 auth 0007_alter_validators_add_error_messages 2018-04-09 09:06:45.894067+00
12 auth 0008_alter_user_username_max_length 2018-04-09 09:06:45.948346+00
13 tenancy 0001_initial 2018-04-09 09:06:46.040559+00
14 dcim 0001_initial 2018-04-09 09:06:46.823948+00
15 ipam 0001_initial 2018-04-09 09:06:47.213182+00
16 dcim 0002_auto_20160622_1821 2018-04-09 09:06:47.816713+00
17 dcim 0003_auto_20160628_1721 2018-04-09 09:06:47.873889+00
18 dcim 0004_auto_20160701_2049 2018-04-09 09:06:48.036574+00
19 dcim 0005_auto_20160706_1722 2018-04-09 09:06:48.078135+00
20 dcim 0006_add_device_primary_ip4_ip6 2018-04-09 09:06:48.160721+00
21 dcim 0007_device_copy_primary_ip 2018-04-09 09:06:48.269354+00
22 dcim 0008_device_remove_primary_ip 2018-04-09 09:06:48.443223+00
23 dcim 0009_site_32bit_asn_support 2018-04-09 09:06:48.494519+00
24 dcim 0010_devicebay_installed_device_set_null 2018-04-09 09:06:48.573561+00
25 dcim 0011_devicetype_part_number 2018-04-09 09:06:48.62289+00
26 dcim 0012_site_rack_device_add_tenant 2018-04-09 09:06:48.787335+00
27 dcim 0013_add_interface_form_factors 2018-04-09 09:06:48.897148+00
28 dcim 0014_rack_add_type_width 2018-04-09 09:06:48.991529+00
29 dcim 0015_rack_add_u_height_validator 2018-04-09 09:06:49.018696+00
30 dcim 0016_module_add_manufacturer 2018-04-09 09:06:49.092003+00
31 dcim 0017_rack_add_role 2018-04-09 09:06:49.190038+00
32 dcim 0018_device_add_asset_tag 2018-04-09 09:06:49.276379+00
33 dcim 0019_new_iface_form_factors 2018-04-09 09:06:49.351335+00
34 dcim 0020_rack_desc_units 2018-04-09 09:06:49.408756+00
35 dcim 0021_add_ff_flexstack 2018-04-09 09:06:49.493934+00
36 dcim 0022_color_names_to_rgb 2018-04-09 09:06:49.64976+00
37 circuits 0001_initial 2018-04-09 09:06:49.761084+00
38 circuits 0002_auto_20160622_1821 2018-04-09 09:06:49.971505+00
39 circuits 0003_provider_32bit_asn_support 2018-04-09 09:06:50.027061+00
40 circuits 0004_circuit_add_tenant 2018-04-09 09:06:50.11495+00
41 circuits 0005_circuit_add_upstream_speed 2018-04-09 09:06:50.17663+00
42 circuits 0006_terminations 2018-04-09 09:06:50.683873+00
43 circuits 0007_circuit_add_description 2018-04-09 09:06:50.745847+00
44 circuits 0008_circuittermination_interface_protect_on_delete 2018-04-09 09:06:50.822087+00
45 circuits 0009_unicode_literals 2018-04-09 09:06:51.160237+00
46 tenancy 0002_tenant_group_optional 2018-04-09 09:06:51.238284+00
47 tenancy 0003_unicode_literals 2018-04-09 09:06:51.28778+00
48 ipam 0002_vrf_add_enforce_unique 2018-04-09 09:06:51.340367+00
49 ipam 0003_ipam_add_vlangroups 2018-04-09 09:06:51.547422+00
50 ipam 0004_ipam_vlangroup_uniqueness 2018-04-09 09:06:51.653618+00
51 ipam 0005_auto_20160725_1842 2018-04-09 09:06:51.746072+00
52 ipam 0006_vrf_vlan_add_tenant 2018-04-09 09:06:51.9061+00
53 ipam 0007_prefix_ipaddress_add_tenant 2018-04-09 09:06:52.199787+00
54 ipam 0008_prefix_change_order 2018-04-09 09:06:52.251604+00
55 ipam 0009_ipaddress_add_status 2018-04-09 09:06:52.330996+00
56 ipam 0010_ipaddress_help_texts 2018-04-09 09:06:52.422756+00
57 ipam 0011_rir_add_is_private 2018-04-09 09:06:52.45845+00
58 ipam 0012_services 2018-04-09 09:06:52.667104+00
59 ipam 0013_prefix_add_is_pool 2018-04-09 09:06:52.828092+00
60 ipam 0014_ipaddress_status_add_deprecated 2018-04-09 09:06:52.877504+00
61 ipam 0015_global_vlans 2018-04-09 09:06:53.063636+00
62 ipam 0016_unicode_literals 2018-04-09 09:06:54.1489+00
63 ipam 0017_ipaddress_roles 2018-04-09 09:06:54.260424+00
64 ipam 0018_remove_service_uniqueness_constraint 2018-04-09 09:06:54.315857+00
65 dcim 0023_devicetype_comments 2018-04-09 09:06:54.418108+00
66 dcim 0024_site_add_contact_fields 2018-04-09 09:06:54.602771+00
67 dcim 0025_devicetype_add_interface_ordering 2018-04-09 09:06:54.664183+00
68 dcim 0026_add_rack_reservations 2018-04-09 09:06:54.770214+00
69 dcim 0027_device_add_site 2018-04-09 09:06:54.865532+00
70 dcim 0028_device_copy_rack_to_site 2018-04-09 09:06:54.971375+00
71 dcim 0029_allow_rackless_devices 2018-04-09 09:06:55.256801+00
72 dcim 0030_interface_add_lag 2018-04-09 09:06:55.397139+00
73 dcim 0031_regions 2018-04-09 09:06:55.518285+00
74 dcim 0032_device_increase_name_length 2018-04-09 09:06:55.568498+00
75 dcim 0033_rackreservation_rack_editable 2018-04-09 09:06:55.664966+00
76 dcim 0034_rename_module_to_inventoryitem 2018-04-09 09:06:55.912975+00
77 dcim 0035_device_expand_status_choices 2018-04-09 09:06:56.13093+00
78 dcim 0036_add_ff_juniper_vcp 2018-04-09 09:06:56.204057+00
79 dcim 0037_unicode_literals 2018-04-09 09:06:57.175098+00
80 dcim 0038_wireless_interfaces 2018-04-09 09:06:57.223515+00
81 dcim 0039_interface_add_enabled_mtu 2018-04-09 09:06:57.305632+00
82 dcim 0040_inventoryitem_add_asset_tag_description 2018-04-09 09:06:57.410426+00
83 dcim 0041_napalm_integration 2018-04-09 09:06:57.712518+00
84 dcim 0042_interface_ff_10ge_cx4 2018-04-09 09:06:57.753613+00
85 dcim 0043_device_component_name_lengths 2018-04-09 09:06:57.989603+00
86 virtualization 0001_virtualization 2018-04-09 09:06:58.222823+00
87 dcim 0044_virtualization 2018-04-09 09:06:58.377399+00
88 dcim 0045_devicerole_vm_role 2018-04-09 09:06:58.432542+00
89 dcim 0046_rack_lengthen_facility_id 2018-04-09 09:06:58.481134+00
90 dcim 0047_more_100ge_form_factors 2018-04-09 09:06:58.543566+00
91 dcim 0048_rack_serial 2018-04-09 09:06:58.607639+00
92 extras 0001_initial 2018-04-09 09:06:59.148396+00
93 extras 0002_custom_fields 2018-04-09 09:06:59.472724+00
94 extras 0003_exporttemplate_add_description 2018-04-09 09:06:59.567569+00
95 extras 0004_topologymap_change_comma_to_semicolon 2018-04-09 09:06:59.705965+00
96 extras 0005_useraction_add_bulk_create 2018-04-09 09:06:59.760308+00
97 extras 0006_add_imageattachments 2018-04-09 09:06:59.878162+00
98 extras 0007_unicode_literals 2018-04-09 09:07:00.355116+00
99 extras 0008_reports 2018-04-09 09:07:00.563608+00
100 ipam 0019_virtualization 2018-04-09 09:07:00.733669+00
101 ipam 0020_ipaddress_add_role_carp 2018-04-09 09:07:00.785391+00
102 secrets 0001_initial 2018-04-09 09:07:01.289521+00
103 secrets 0002_userkey_add_session_key 2018-04-09 09:07:01.687732+00
104 secrets 0003_unicode_literals 2018-04-09 09:07:01.73205+00
105 sessions 0001_initial 2018-04-09 09:07:01.775825+00
106 users 0001_api_tokens 2018-04-09 09:07:01.90968+00
107 users 0002_unicode_literals 2018-04-09 09:07:01.974443+00
108 virtualization 0002_virtualmachine_add_status 2018-04-09 09:07:02.098322+00
109 virtualization 0003_cluster_add_site 2018-04-09 09:07:02.196446+00
110 virtualization 0004_virtualmachine_add_role 2018-04-09 09:07:02.317268+00
\.
--
-- Name: django_migrations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('django_migrations_id_seq', 132, true);
--
-- Data for Name: django_session; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY django_session (session_key, session_data, expire_date) FROM stdin;
tts3bxsidis2mgfkkgv75hd6uykcujpd MTM4ODdkOTIwYzUwNjA4YzlhZDM1NWZlZTkxMDc2YzNkZDg3YjRhYzp7Il9hdXRoX3VzZXJfaGFzaCI6ImIyNmM0NWIyYjA3Y2U4MTVmYTlmODU4ZGJhYjcyMGU3ODBlYzU5YjgiLCJfYXV0aF91c2VyX2JhY2tlbmQiOiJkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZCIsIl9hdXRoX3VzZXJfaWQiOiIxIn0= 2018-04-23 09:08:29.15652+00
\.
--
-- Data for Name: extras_customfield; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY extras_customfield (id, type, name, label, description, required, is_filterable, "default", weight) FROM stdin;
\.
--
-- Name: extras_customfield_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('extras_customfield_id_seq', 1, false);
--
-- Data for Name: extras_customfield_obj_type; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY extras_customfield_obj_type (id, customfield_id, contenttype_id) FROM stdin;
\.
--
-- Name: extras_customfield_obj_type_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('extras_customfield_obj_type_id_seq', 1, false);
--
-- Data for Name: extras_customfieldchoice; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY extras_customfieldchoice (id, value, weight, field_id) FROM stdin;
\.
--
-- Name: extras_customfieldchoice_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('extras_customfieldchoice_id_seq', 1, false);
--
-- Data for Name: extras_customfieldvalue; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY extras_customfieldvalue (id, obj_id, serialized_value, field_id, obj_type_id) FROM stdin;
\.
--
-- Name: extras_customfieldvalue_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('extras_customfieldvalue_id_seq', 1, false);
--
-- Data for Name: extras_exporttemplate; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY extras_exporttemplate (id, name, template_code, mime_type, file_extension, content_type_id, description) FROM stdin;
\.
--
-- Name: extras_exporttemplate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('extras_exporttemplate_id_seq', 1, false);
--
-- Data for Name: extras_graph; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY extras_graph (id, type, weight, name, source, link) FROM stdin;
\.
--
-- Name: extras_graph_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('extras_graph_id_seq', 1, false);
--
-- Data for Name: extras_imageattachment; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY extras_imageattachment (id, object_id, image, image_height, image_width, name, created, content_type_id) FROM stdin;
\.
--
-- Name: extras_imageattachment_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('extras_imageattachment_id_seq', 1, false);
--
-- Data for Name: extras_reportresult; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY extras_reportresult (id, report, created, failed, data, user_id) FROM stdin;
\.
--
-- Name: extras_reportresult_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('extras_reportresult_id_seq', 1, false);
--
-- Data for Name: extras_topologymap; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY extras_topologymap (id, name, slug, device_patterns, description, site_id) FROM stdin;
\.
--
-- Name: extras_topologymap_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('extras_topologymap_id_seq', 1, false);
--
-- Data for Name: extras_useraction; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY extras_useraction (id, "time", object_id, action, message, content_type_id, user_id) FROM stdin;
\.
--
-- Name: extras_useraction_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('extras_useraction_id_seq', 1, false);
--
-- Data for Name: ipam_aggregate; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY ipam_aggregate (id, created, last_updated, family, prefix, date_added, description, rir_id) FROM stdin;
1 2016-08-01 2016-08-01 15:22:20.938+00 4 10.0.0.0/8 \N Private IPv4 space 6
2 2016-08-01 2016-08-01 15:22:32.679+00 4 172.16.0.0/12 \N Private IPv4 space 6
3 2016-08-01 2016-08-01 15:22:42.289+00 4 192.168.0.0/16 \N Private IPv4 space 6
\.
--
-- Name: ipam_aggregate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('ipam_aggregate_id_seq', 3, true);
--
-- Data for Name: ipam_ipaddress; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY ipam_ipaddress (id, created, last_updated, family, address, description, interface_id, nat_inside_id, vrf_id, tenant_id, status, role) FROM stdin;
\.
--
-- Name: ipam_ipaddress_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('ipam_ipaddress_id_seq', 1, false);
--
-- Data for Name: ipam_prefix; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY ipam_prefix (id, created, last_updated, family, prefix, status, description, role_id, site_id, vlan_id, vrf_id, tenant_id, is_pool) FROM stdin;
\.
--
-- Name: ipam_prefix_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('ipam_prefix_id_seq', 1, false);
--
-- Data for Name: ipam_rir; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY ipam_rir (id, name, slug, is_private) FROM stdin;
1 ARIN arin f
2 RIPE ripe f
3 APNIC apnic f
4 LACNIC lacnic f
5 AFRINIC afrinic f
6 RFC 1918 rfc-1918 t
\.
--
-- Name: ipam_rir_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('ipam_rir_id_seq', 6, true);
--
-- Data for Name: ipam_role; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY ipam_role (id, name, slug, weight) FROM stdin;
1 Production production 1000
2 Development development 1000
3 Management management 1000
4 Backup backup 1000
\.
--
-- Name: ipam_role_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('ipam_role_id_seq', 4, true);
--
-- Data for Name: ipam_service; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY ipam_service (id, created, last_updated, name, protocol, port, description, device_id, virtual_machine_id) FROM stdin;
\.
--
-- Name: ipam_service_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('ipam_service_id_seq', 1, false);
--
-- Data for Name: ipam_service_ipaddresses; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY ipam_service_ipaddresses (id, service_id, ipaddress_id) FROM stdin;
\.
--
-- Name: ipam_service_ipaddresses_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('ipam_service_ipaddresses_id_seq', 1, false);
--
-- Data for Name: ipam_vlan; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY ipam_vlan (id, created, last_updated, vid, name, status, role_id, site_id, group_id, description, tenant_id) FROM stdin;
\.
--
-- Name: ipam_vlan_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('ipam_vlan_id_seq', 1, false);
--
-- Data for Name: ipam_vlangroup; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY ipam_vlangroup (id, name, slug, site_id) FROM stdin;
\.
--
-- Name: ipam_vlangroup_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('ipam_vlangroup_id_seq', 1, false);
--
-- Data for Name: ipam_vrf; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY ipam_vrf (id, created, last_updated, name, rd, description, enforce_unique, tenant_id) FROM stdin;
\.
--
-- Name: ipam_vrf_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('ipam_vrf_id_seq', 1, false);
--
-- Data for Name: secrets_secret; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY secrets_secret (id, created, last_updated, name, ciphertext, hash, device_id, role_id) FROM stdin;
\.
--
-- Name: secrets_secret_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('secrets_secret_id_seq', 1, false);
--
-- Data for Name: secrets_secretrole; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY secrets_secretrole (id, name, slug) FROM stdin;
1 Login Credentials login-credentials
2 RADIUS Key radius-key
3 SNMPv2 Community snmpv2-community
4 SNMPv3 Credentials snmpv3-credentials
\.
--
-- Data for Name: secrets_secretrole_groups; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY secrets_secretrole_groups (id, secretrole_id, group_id) FROM stdin;
\.
--
-- Name: secrets_secretrole_groups_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('secrets_secretrole_groups_id_seq', 1, false);
--
-- Name: secrets_secretrole_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('secrets_secretrole_id_seq', 4, true);
--
-- Data for Name: secrets_secretrole_users; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY secrets_secretrole_users (id, secretrole_id, user_id) FROM stdin;
\.
--
-- Name: secrets_secretrole_users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('secrets_secretrole_users_id_seq', 1, false);
--
-- Data for Name: secrets_sessionkey; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY secrets_sessionkey (id, cipher, hash, created, userkey_id) FROM stdin;
\.
--
-- Name: secrets_sessionkey_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('secrets_sessionkey_id_seq', 1, false);
--
-- Data for Name: secrets_userkey; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY secrets_userkey (id, created, last_updated, public_key, master_key_cipher, user_id) FROM stdin;
\.
--
-- Name: secrets_userkey_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('secrets_userkey_id_seq', 1, false);
--
-- Data for Name: tenancy_tenant; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY tenancy_tenant (id, created, last_updated, name, slug, description, comments, group_id) FROM stdin;
\.
--
-- Name: tenancy_tenant_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('tenancy_tenant_id_seq', 1, false);
--
-- Data for Name: tenancy_tenantgroup; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY tenancy_tenantgroup (id, name, slug) FROM stdin;
\.
--
-- Name: tenancy_tenantgroup_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('tenancy_tenantgroup_id_seq', 1, false);
--
-- Data for Name: users_token; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY users_token (id, created, expires, key, write_enabled, description, user_id) FROM stdin;
1 2018-04-09 09:08:43.998263+00 \N 8054b0446b7a2c930230058afb126df65e2f64af t 1
\.
--
-- Name: users_token_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('users_token_id_seq', 33, true);
--
-- Data for Name: virtualization_cluster; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY virtualization_cluster (id, created, last_updated, name, comments, group_id, type_id, site_id) FROM stdin;
\.
--
-- Name: virtualization_cluster_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('virtualization_cluster_id_seq', 1, false);
--
-- Data for Name: virtualization_clustergroup; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY virtualization_clustergroup (id, name, slug) FROM stdin;
\.
--
-- Name: virtualization_clustergroup_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('virtualization_clustergroup_id_seq', 1, false);
--
-- Data for Name: virtualization_clustertype; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY virtualization_clustertype (id, name, slug) FROM stdin;
\.
--
-- Name: virtualization_clustertype_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('virtualization_clustertype_id_seq', 1, false);
--
-- Data for Name: virtualization_virtualmachine; Type: TABLE DATA; Schema: public; Owner: netbox
--
COPY virtualization_virtualmachine (id, created, last_updated, name, vcpus, memory, disk, comments, cluster_id, platform_id, primary_ip4_id, primary_ip6_id, tenant_id, status, role_id) FROM stdin;
\.
--
-- Name: virtualization_virtualmachine_id_seq; Type: SEQUENCE SET; Schema: public; Owner: netbox
--
SELECT pg_catalog.setval('virtualization_virtualmachine_id_seq', 1, false);
--
-- Name: auth_group_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_group
ADD CONSTRAINT auth_group_name_key UNIQUE (name);
--
-- Name: auth_group_permissions_group_id_permission_id_0cd325b0_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_group_permissions
ADD CONSTRAINT auth_group_permissions_group_id_permission_id_0cd325b0_uniq UNIQUE (group_id, permission_id);
--
-- Name: auth_group_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_group_permissions
ADD CONSTRAINT auth_group_permissions_pkey PRIMARY KEY (id);
--
-- Name: auth_group_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_group
ADD CONSTRAINT auth_group_pkey PRIMARY KEY (id);
--
-- Name: auth_permission_content_type_id_codename_01ab375a_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_permission
ADD CONSTRAINT auth_permission_content_type_id_codename_01ab375a_uniq UNIQUE (content_type_id, codename);
--
-- Name: auth_permission_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_permission
ADD CONSTRAINT auth_permission_pkey PRIMARY KEY (id);
--
-- Name: auth_user_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user_groups
ADD CONSTRAINT auth_user_groups_pkey PRIMARY KEY (id);
--
-- Name: auth_user_groups_user_id_group_id_94350c0c_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user_groups
ADD CONSTRAINT auth_user_groups_user_id_group_id_94350c0c_uniq UNIQUE (user_id, group_id);
--
-- Name: auth_user_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user
ADD CONSTRAINT auth_user_pkey PRIMARY KEY (id);
--
-- Name: auth_user_user_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user_user_permissions
ADD CONSTRAINT auth_user_user_permissions_pkey PRIMARY KEY (id);
--
-- Name: auth_user_user_permissions_user_id_permission_id_14a6b632_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user_user_permissions
ADD CONSTRAINT auth_user_user_permissions_user_id_permission_id_14a6b632_uniq UNIQUE (user_id, permission_id);
--
-- Name: auth_user_username_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user
ADD CONSTRAINT auth_user_username_key UNIQUE (username);
--
-- Name: circuits_circuit_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuit
ADD CONSTRAINT circuits_circuit_pkey PRIMARY KEY (id);
--
-- Name: circuits_circuit_provider_id_cid_b6f29862_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuit
ADD CONSTRAINT circuits_circuit_provider_id_cid_b6f29862_uniq UNIQUE (provider_id, cid);
--
-- Name: circuits_circuittermination_circuit_id_term_side_b13efd0e_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuittermination
ADD CONSTRAINT circuits_circuittermination_circuit_id_term_side_b13efd0e_uniq UNIQUE (circuit_id, term_side);
--
-- Name: circuits_circuittermination_interface_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuittermination
ADD CONSTRAINT circuits_circuittermination_interface_id_key UNIQUE (interface_id);
--
-- Name: circuits_circuittermination_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuittermination
ADD CONSTRAINT circuits_circuittermination_pkey PRIMARY KEY (id);
--
-- Name: circuits_circuittype_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuittype
ADD CONSTRAINT circuits_circuittype_name_key UNIQUE (name);
--
-- Name: circuits_circuittype_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuittype
ADD CONSTRAINT circuits_circuittype_pkey PRIMARY KEY (id);
--
-- Name: circuits_circuittype_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuittype
ADD CONSTRAINT circuits_circuittype_slug_key UNIQUE (slug);
--
-- Name: circuits_provider_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_provider
ADD CONSTRAINT circuits_provider_name_key UNIQUE (name);
--
-- Name: circuits_provider_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_provider
ADD CONSTRAINT circuits_provider_pkey PRIMARY KEY (id);
--
-- Name: circuits_provider_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_provider
ADD CONSTRAINT circuits_provider_slug_key UNIQUE (slug);
--
-- Name: dcim_consoleport_cs_port_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleport
ADD CONSTRAINT dcim_consoleport_cs_port_id_key UNIQUE (cs_port_id);
--
-- Name: dcim_consoleport_device_id_name_293786b6_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleport
ADD CONSTRAINT dcim_consoleport_device_id_name_293786b6_uniq UNIQUE (device_id, name);
--
-- Name: dcim_consoleport_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleport
ADD CONSTRAINT dcim_consoleport_pkey PRIMARY KEY (id);
--
-- Name: dcim_consoleporttemplate_device_type_id_name_8208f9ca_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleporttemplate
ADD CONSTRAINT dcim_consoleporttemplate_device_type_id_name_8208f9ca_uniq UNIQUE (device_type_id, name);
--
-- Name: dcim_consoleporttemplate_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleporttemplate
ADD CONSTRAINT dcim_consoleporttemplate_pkey PRIMARY KEY (id);
--
-- Name: dcim_consoleserverport_device_id_name_fb1c5999_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleserverport
ADD CONSTRAINT dcim_consoleserverport_device_id_name_fb1c5999_uniq UNIQUE (device_id, name);
--
-- Name: dcim_consoleserverport_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleserverport
ADD CONSTRAINT dcim_consoleserverport_pkey PRIMARY KEY (id);
--
-- Name: dcim_consoleserverportte_device_type_id_name_a05c974d_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleserverporttemplate
ADD CONSTRAINT dcim_consoleserverportte_device_type_id_name_a05c974d_uniq UNIQUE (device_type_id, name);
--
-- Name: dcim_consoleserverporttemplate_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleserverporttemplate
ADD CONSTRAINT dcim_consoleserverporttemplate_pkey PRIMARY KEY (id);
--
-- Name: dcim_device_asset_tag_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_asset_tag_key UNIQUE (asset_tag);
--
-- Name: dcim_device_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_name_key UNIQUE (name);
--
-- Name: dcim_device_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_pkey PRIMARY KEY (id);
--
-- Name: dcim_device_primary_ip4_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_primary_ip4_id_key UNIQUE (primary_ip4_id);
--
-- Name: dcim_device_primary_ip6_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_primary_ip6_id_key UNIQUE (primary_ip6_id);
--
-- Name: dcim_device_rack_id_position_face_43208a79_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_rack_id_position_face_43208a79_uniq UNIQUE (rack_id, "position", face);
--
-- Name: dcim_devicebay_device_id_name_2475a67b_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicebay
ADD CONSTRAINT dcim_devicebay_device_id_name_2475a67b_uniq UNIQUE (device_id, name);
--
-- Name: dcim_devicebay_installed_device_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicebay
ADD CONSTRAINT dcim_devicebay_installed_device_id_key UNIQUE (installed_device_id);
--
-- Name: dcim_devicebay_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicebay
ADD CONSTRAINT dcim_devicebay_pkey PRIMARY KEY (id);
--
-- Name: dcim_devicebaytemplate_device_type_id_name_8f4899fe_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicebaytemplate
ADD CONSTRAINT dcim_devicebaytemplate_device_type_id_name_8f4899fe_uniq UNIQUE (device_type_id, name);
--
-- Name: dcim_devicebaytemplate_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicebaytemplate
ADD CONSTRAINT dcim_devicebaytemplate_pkey PRIMARY KEY (id);
--
-- Name: dcim_devicerole_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicerole
ADD CONSTRAINT dcim_devicerole_name_key UNIQUE (name);
--
-- Name: dcim_devicerole_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicerole
ADD CONSTRAINT dcim_devicerole_pkey PRIMARY KEY (id);
--
-- Name: dcim_devicerole_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicerole
ADD CONSTRAINT dcim_devicerole_slug_key UNIQUE (slug);
--
-- Name: dcim_devicetype_manufacturer_id_model_17948c0c_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicetype
ADD CONSTRAINT dcim_devicetype_manufacturer_id_model_17948c0c_uniq UNIQUE (manufacturer_id, model);
--
-- Name: dcim_devicetype_manufacturer_id_slug_a0b931cb_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicetype
ADD CONSTRAINT dcim_devicetype_manufacturer_id_slug_a0b931cb_uniq UNIQUE (manufacturer_id, slug);
--
-- Name: dcim_devicetype_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicetype
ADD CONSTRAINT dcim_devicetype_pkey PRIMARY KEY (id);
--
-- Name: dcim_interface_device_id_name_bffc4ec4_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interface
ADD CONSTRAINT dcim_interface_device_id_name_bffc4ec4_uniq UNIQUE (device_id, name);
--
-- Name: dcim_interface_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interface
ADD CONSTRAINT dcim_interface_pkey PRIMARY KEY (id);
--
-- Name: dcim_interfaceconnection_interface_a_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interfaceconnection
ADD CONSTRAINT dcim_interfaceconnection_interface_a_id_key UNIQUE (interface_a_id);
--
-- Name: dcim_interfaceconnection_interface_b_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interfaceconnection
ADD CONSTRAINT dcim_interfaceconnection_interface_b_id_key UNIQUE (interface_b_id);
--
-- Name: dcim_interfaceconnection_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interfaceconnection
ADD CONSTRAINT dcim_interfaceconnection_pkey PRIMARY KEY (id);
--
-- Name: dcim_interfacetemplate_device_type_id_name_3a847237_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interfacetemplate
ADD CONSTRAINT dcim_interfacetemplate_device_type_id_name_3a847237_uniq UNIQUE (device_type_id, name);
--
-- Name: dcim_interfacetemplate_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interfacetemplate
ADD CONSTRAINT dcim_interfacetemplate_pkey PRIMARY KEY (id);
--
-- Name: dcim_inventoryitem_asset_tag_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_inventoryitem
ADD CONSTRAINT dcim_inventoryitem_asset_tag_key UNIQUE (asset_tag);
--
-- Name: dcim_manufacturer_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_manufacturer
ADD CONSTRAINT dcim_manufacturer_name_key UNIQUE (name);
--
-- Name: dcim_manufacturer_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_manufacturer
ADD CONSTRAINT dcim_manufacturer_pkey PRIMARY KEY (id);
--
-- Name: dcim_manufacturer_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_manufacturer
ADD CONSTRAINT dcim_manufacturer_slug_key UNIQUE (slug);
--
-- Name: dcim_module_device_id_parent_id_name_4d8292af_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_inventoryitem
ADD CONSTRAINT dcim_module_device_id_parent_id_name_4d8292af_uniq UNIQUE (device_id, parent_id, name);
--
-- Name: dcim_module_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_inventoryitem
ADD CONSTRAINT dcim_module_pkey PRIMARY KEY (id);
--
-- Name: dcim_platform_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_platform
ADD CONSTRAINT dcim_platform_name_key UNIQUE (name);
--
-- Name: dcim_platform_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_platform
ADD CONSTRAINT dcim_platform_pkey PRIMARY KEY (id);
--
-- Name: dcim_platform_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_platform
ADD CONSTRAINT dcim_platform_slug_key UNIQUE (slug);
--
-- Name: dcim_poweroutlet_device_id_name_981b00c1_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_poweroutlet
ADD CONSTRAINT dcim_poweroutlet_device_id_name_981b00c1_uniq UNIQUE (device_id, name);
--
-- Name: dcim_poweroutlet_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_poweroutlet
ADD CONSTRAINT dcim_poweroutlet_pkey PRIMARY KEY (id);
--
-- Name: dcim_poweroutlettemplate_device_type_id_name_eafbb07d_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_poweroutlettemplate
ADD CONSTRAINT dcim_poweroutlettemplate_device_type_id_name_eafbb07d_uniq UNIQUE (device_type_id, name);
--
-- Name: dcim_poweroutlettemplate_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_poweroutlettemplate
ADD CONSTRAINT dcim_poweroutlettemplate_pkey PRIMARY KEY (id);
--
-- Name: dcim_powerport_device_id_name_948af82c_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_powerport
ADD CONSTRAINT dcim_powerport_device_id_name_948af82c_uniq UNIQUE (device_id, name);
--
-- Name: dcim_powerport_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_powerport
ADD CONSTRAINT dcim_powerport_pkey PRIMARY KEY (id);
--
-- Name: dcim_powerport_power_outlet_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_powerport
ADD CONSTRAINT dcim_powerport_power_outlet_id_key UNIQUE (power_outlet_id);
--
-- Name: dcim_powerporttemplate_device_type_id_name_b4e9689f_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_powerporttemplate
ADD CONSTRAINT dcim_powerporttemplate_device_type_id_name_b4e9689f_uniq UNIQUE (device_type_id, name);
--
-- Name: dcim_powerporttemplate_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_powerporttemplate
ADD CONSTRAINT dcim_powerporttemplate_pkey PRIMARY KEY (id);
--
-- Name: dcim_rack_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rack
ADD CONSTRAINT dcim_rack_pkey PRIMARY KEY (id);
--
-- Name: dcim_rack_site_id_facility_id_2a1d0860_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rack
ADD CONSTRAINT dcim_rack_site_id_facility_id_2a1d0860_uniq UNIQUE (site_id, facility_id);
--
-- Name: dcim_rack_site_id_name_5fde0119_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rack
ADD CONSTRAINT dcim_rack_site_id_name_5fde0119_uniq UNIQUE (site_id, name);
--
-- Name: dcim_rackgroup_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackgroup
ADD CONSTRAINT dcim_rackgroup_pkey PRIMARY KEY (id);
--
-- Name: dcim_rackgroup_site_id_name_c9bd921f_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackgroup
ADD CONSTRAINT dcim_rackgroup_site_id_name_c9bd921f_uniq UNIQUE (site_id, name);
--
-- Name: dcim_rackgroup_site_id_slug_7fbfd118_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackgroup
ADD CONSTRAINT dcim_rackgroup_site_id_slug_7fbfd118_uniq UNIQUE (site_id, slug);
--
-- Name: dcim_rackreservation_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackreservation
ADD CONSTRAINT dcim_rackreservation_pkey PRIMARY KEY (id);
--
-- Name: dcim_rackrole_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackrole
ADD CONSTRAINT dcim_rackrole_name_key UNIQUE (name);
--
-- Name: dcim_rackrole_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackrole
ADD CONSTRAINT dcim_rackrole_pkey PRIMARY KEY (id);
--
-- Name: dcim_rackrole_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackrole
ADD CONSTRAINT dcim_rackrole_slug_key UNIQUE (slug);
--
-- Name: dcim_region_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_region
ADD CONSTRAINT dcim_region_name_key UNIQUE (name);
--
-- Name: dcim_region_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_region
ADD CONSTRAINT dcim_region_pkey PRIMARY KEY (id);
--
-- Name: dcim_region_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_region
ADD CONSTRAINT dcim_region_slug_key UNIQUE (slug);
--
-- Name: dcim_site_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_site
ADD CONSTRAINT dcim_site_name_key UNIQUE (name);
--
-- Name: dcim_site_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_site
ADD CONSTRAINT dcim_site_pkey PRIMARY KEY (id);
--
-- Name: dcim_site_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_site
ADD CONSTRAINT dcim_site_slug_key UNIQUE (slug);
--
-- Name: django_admin_log_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY django_admin_log
ADD CONSTRAINT django_admin_log_pkey PRIMARY KEY (id);
--
-- Name: django_content_type_app_label_model_76bd3d3b_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY django_content_type
ADD CONSTRAINT django_content_type_app_label_model_76bd3d3b_uniq UNIQUE (app_label, model);
--
-- Name: django_content_type_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY django_content_type
ADD CONSTRAINT django_content_type_pkey PRIMARY KEY (id);
--
-- Name: django_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY django_migrations
ADD CONSTRAINT django_migrations_pkey PRIMARY KEY (id);
--
-- Name: django_session_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY django_session
ADD CONSTRAINT django_session_pkey PRIMARY KEY (session_key);
--
-- Name: extras_customfield_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfield
ADD CONSTRAINT extras_customfield_name_key UNIQUE (name);
--
-- Name: extras_customfield_obj_t_customfield_id_contentty_77878958_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfield_obj_type
ADD CONSTRAINT extras_customfield_obj_t_customfield_id_contentty_77878958_uniq UNIQUE (customfield_id, contenttype_id);
--
-- Name: extras_customfield_obj_type_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfield_obj_type
ADD CONSTRAINT extras_customfield_obj_type_pkey PRIMARY KEY (id);
--
-- Name: extras_customfield_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfield
ADD CONSTRAINT extras_customfield_pkey PRIMARY KEY (id);
--
-- Name: extras_customfieldchoice_field_id_value_f959a108_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfieldchoice
ADD CONSTRAINT extras_customfieldchoice_field_id_value_f959a108_uniq UNIQUE (field_id, value);
--
-- Name: extras_customfieldchoice_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfieldchoice
ADD CONSTRAINT extras_customfieldchoice_pkey PRIMARY KEY (id);
--
-- Name: extras_customfieldvalue_field_id_obj_type_id_obj_876f6d9c_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfieldvalue
ADD CONSTRAINT extras_customfieldvalue_field_id_obj_type_id_obj_876f6d9c_uniq UNIQUE (field_id, obj_type_id, obj_id);
--
-- Name: extras_customfieldvalue_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfieldvalue
ADD CONSTRAINT extras_customfieldvalue_pkey PRIMARY KEY (id);
--
-- Name: extras_exporttemplate_content_type_id_name_edca9b9b_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_exporttemplate
ADD CONSTRAINT extras_exporttemplate_content_type_id_name_edca9b9b_uniq UNIQUE (content_type_id, name);
--
-- Name: extras_exporttemplate_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_exporttemplate
ADD CONSTRAINT extras_exporttemplate_pkey PRIMARY KEY (id);
--
-- Name: extras_graph_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_graph
ADD CONSTRAINT extras_graph_pkey PRIMARY KEY (id);
--
-- Name: extras_imageattachment_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_imageattachment
ADD CONSTRAINT extras_imageattachment_pkey PRIMARY KEY (id);
--
-- Name: extras_reportresult_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_reportresult
ADD CONSTRAINT extras_reportresult_pkey PRIMARY KEY (id);
--
-- Name: extras_reportresult_report_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_reportresult
ADD CONSTRAINT extras_reportresult_report_key UNIQUE (report);
--
-- Name: extras_topologymap_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_topologymap
ADD CONSTRAINT extras_topologymap_name_key UNIQUE (name);
--
-- Name: extras_topologymap_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_topologymap
ADD CONSTRAINT extras_topologymap_pkey PRIMARY KEY (id);
--
-- Name: extras_topologymap_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_topologymap
ADD CONSTRAINT extras_topologymap_slug_key UNIQUE (slug);
--
-- Name: extras_useraction_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_useraction
ADD CONSTRAINT extras_useraction_pkey PRIMARY KEY (id);
--
-- Name: ipam_aggregate_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_aggregate
ADD CONSTRAINT ipam_aggregate_pkey PRIMARY KEY (id);
--
-- Name: ipam_ipaddress_nat_inside_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_ipaddress
ADD CONSTRAINT ipam_ipaddress_nat_inside_id_key UNIQUE (nat_inside_id);
--
-- Name: ipam_ipaddress_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_ipaddress
ADD CONSTRAINT ipam_ipaddress_pkey PRIMARY KEY (id);
--
-- Name: ipam_prefix_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_prefix
ADD CONSTRAINT ipam_prefix_pkey PRIMARY KEY (id);
--
-- Name: ipam_rir_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_rir
ADD CONSTRAINT ipam_rir_name_key UNIQUE (name);
--
-- Name: ipam_rir_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_rir
ADD CONSTRAINT ipam_rir_pkey PRIMARY KEY (id);
--
-- Name: ipam_rir_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_rir
ADD CONSTRAINT ipam_rir_slug_key UNIQUE (slug);
--
-- Name: ipam_role_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_role
ADD CONSTRAINT ipam_role_name_key UNIQUE (name);
--
-- Name: ipam_role_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_role
ADD CONSTRAINT ipam_role_pkey PRIMARY KEY (id);
--
-- Name: ipam_role_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_role
ADD CONSTRAINT ipam_role_slug_key UNIQUE (slug);
--
-- Name: ipam_service_ipaddresses_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_service_ipaddresses
ADD CONSTRAINT ipam_service_ipaddresses_pkey PRIMARY KEY (id);
--
-- Name: ipam_service_ipaddresses_service_id_ipaddress_id_d019a805_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_service_ipaddresses
ADD CONSTRAINT ipam_service_ipaddresses_service_id_ipaddress_id_d019a805_uniq UNIQUE (service_id, ipaddress_id);
--
-- Name: ipam_service_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_service
ADD CONSTRAINT ipam_service_pkey PRIMARY KEY (id);
--
-- Name: ipam_vlan_group_id_name_e53919df_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlan
ADD CONSTRAINT ipam_vlan_group_id_name_e53919df_uniq UNIQUE (group_id, name);
--
-- Name: ipam_vlan_group_id_vid_5ca4cc47_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlan
ADD CONSTRAINT ipam_vlan_group_id_vid_5ca4cc47_uniq UNIQUE (group_id, vid);
--
-- Name: ipam_vlan_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlan
ADD CONSTRAINT ipam_vlan_pkey PRIMARY KEY (id);
--
-- Name: ipam_vlangroup_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlangroup
ADD CONSTRAINT ipam_vlangroup_pkey PRIMARY KEY (id);
--
-- Name: ipam_vlangroup_site_id_name_a38e981b_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlangroup
ADD CONSTRAINT ipam_vlangroup_site_id_name_a38e981b_uniq UNIQUE (site_id, name);
--
-- Name: ipam_vlangroup_site_id_slug_6372a304_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlangroup
ADD CONSTRAINT ipam_vlangroup_site_id_slug_6372a304_uniq UNIQUE (site_id, slug);
--
-- Name: ipam_vrf_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vrf
ADD CONSTRAINT ipam_vrf_pkey PRIMARY KEY (id);
--
-- Name: ipam_vrf_rd_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vrf
ADD CONSTRAINT ipam_vrf_rd_key UNIQUE (rd);
--
-- Name: secrets_secret_device_id_role_id_name_f8acc218_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secret
ADD CONSTRAINT secrets_secret_device_id_role_id_name_f8acc218_uniq UNIQUE (device_id, role_id, name);
--
-- Name: secrets_secret_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secret
ADD CONSTRAINT secrets_secret_pkey PRIMARY KEY (id);
--
-- Name: secrets_secretrole_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole_groups
ADD CONSTRAINT secrets_secretrole_groups_pkey PRIMARY KEY (id);
--
-- Name: secrets_secretrole_groups_secretrole_id_group_id_1c7f7ee5_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole_groups
ADD CONSTRAINT secrets_secretrole_groups_secretrole_id_group_id_1c7f7ee5_uniq UNIQUE (secretrole_id, group_id);
--
-- Name: secrets_secretrole_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole
ADD CONSTRAINT secrets_secretrole_name_key UNIQUE (name);
--
-- Name: secrets_secretrole_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole
ADD CONSTRAINT secrets_secretrole_pkey PRIMARY KEY (id);
--
-- Name: secrets_secretrole_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole
ADD CONSTRAINT secrets_secretrole_slug_key UNIQUE (slug);
--
-- Name: secrets_secretrole_users_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole_users
ADD CONSTRAINT secrets_secretrole_users_pkey PRIMARY KEY (id);
--
-- Name: secrets_secretrole_users_secretrole_id_user_id_41832d38_uniq; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole_users
ADD CONSTRAINT secrets_secretrole_users_secretrole_id_user_id_41832d38_uniq UNIQUE (secretrole_id, user_id);
--
-- Name: secrets_sessionkey_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_sessionkey
ADD CONSTRAINT secrets_sessionkey_pkey PRIMARY KEY (id);
--
-- Name: secrets_sessionkey_userkey_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_sessionkey
ADD CONSTRAINT secrets_sessionkey_userkey_id_key UNIQUE (userkey_id);
--
-- Name: secrets_userkey_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_userkey
ADD CONSTRAINT secrets_userkey_pkey PRIMARY KEY (id);
--
-- Name: secrets_userkey_user_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_userkey
ADD CONSTRAINT secrets_userkey_user_id_key UNIQUE (user_id);
--
-- Name: tenancy_tenant_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY tenancy_tenant
ADD CONSTRAINT tenancy_tenant_name_key UNIQUE (name);
--
-- Name: tenancy_tenant_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY tenancy_tenant
ADD CONSTRAINT tenancy_tenant_pkey PRIMARY KEY (id);
--
-- Name: tenancy_tenant_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY tenancy_tenant
ADD CONSTRAINT tenancy_tenant_slug_key UNIQUE (slug);
--
-- Name: tenancy_tenantgroup_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY tenancy_tenantgroup
ADD CONSTRAINT tenancy_tenantgroup_name_key UNIQUE (name);
--
-- Name: tenancy_tenantgroup_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY tenancy_tenantgroup
ADD CONSTRAINT tenancy_tenantgroup_pkey PRIMARY KEY (id);
--
-- Name: tenancy_tenantgroup_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY tenancy_tenantgroup
ADD CONSTRAINT tenancy_tenantgroup_slug_key UNIQUE (slug);
--
-- Name: users_token_key_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY users_token
ADD CONSTRAINT users_token_key_key UNIQUE (key);
--
-- Name: users_token_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY users_token
ADD CONSTRAINT users_token_pkey PRIMARY KEY (id);
--
-- Name: virtualization_cluster_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_cluster
ADD CONSTRAINT virtualization_cluster_name_key UNIQUE (name);
--
-- Name: virtualization_cluster_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_cluster
ADD CONSTRAINT virtualization_cluster_pkey PRIMARY KEY (id);
--
-- Name: virtualization_clustergroup_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_clustergroup
ADD CONSTRAINT virtualization_clustergroup_name_key UNIQUE (name);
--
-- Name: virtualization_clustergroup_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_clustergroup
ADD CONSTRAINT virtualization_clustergroup_pkey PRIMARY KEY (id);
--
-- Name: virtualization_clustergroup_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_clustergroup
ADD CONSTRAINT virtualization_clustergroup_slug_key UNIQUE (slug);
--
-- Name: virtualization_clustertype_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_clustertype
ADD CONSTRAINT virtualization_clustertype_name_key UNIQUE (name);
--
-- Name: virtualization_clustertype_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_clustertype
ADD CONSTRAINT virtualization_clustertype_pkey PRIMARY KEY (id);
--
-- Name: virtualization_clustertype_slug_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_clustertype
ADD CONSTRAINT virtualization_clustertype_slug_key UNIQUE (slug);
--
-- Name: virtualization_virtualmachine_name_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_virtualmachine
ADD CONSTRAINT virtualization_virtualmachine_name_key UNIQUE (name);
--
-- Name: virtualization_virtualmachine_pkey; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_virtualmachine
ADD CONSTRAINT virtualization_virtualmachine_pkey PRIMARY KEY (id);
--
-- Name: virtualization_virtualmachine_primary_ip4_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_virtualmachine
ADD CONSTRAINT virtualization_virtualmachine_primary_ip4_id_key UNIQUE (primary_ip4_id);
--
-- Name: virtualization_virtualmachine_primary_ip6_id_key; Type: CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_virtualmachine
ADD CONSTRAINT virtualization_virtualmachine_primary_ip6_id_key UNIQUE (primary_ip6_id);
--
-- Name: auth_group_name_a6ea08ec_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX auth_group_name_a6ea08ec_like ON auth_group USING btree (name varchar_pattern_ops);
--
-- Name: auth_group_permissions_group_id_b120cbf9; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX auth_group_permissions_group_id_b120cbf9 ON auth_group_permissions USING btree (group_id);
--
-- Name: auth_group_permissions_permission_id_84c5c92e; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX auth_group_permissions_permission_id_84c5c92e ON auth_group_permissions USING btree (permission_id);
--
-- Name: auth_permission_content_type_id_2f476e4b; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX auth_permission_content_type_id_2f476e4b ON auth_permission USING btree (content_type_id);
--
-- Name: auth_user_groups_group_id_97559544; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX auth_user_groups_group_id_97559544 ON auth_user_groups USING btree (group_id);
--
-- Name: auth_user_groups_user_id_6a12ed8b; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX auth_user_groups_user_id_6a12ed8b ON auth_user_groups USING btree (user_id);
--
-- Name: auth_user_user_permissions_permission_id_1fbb5f2c; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX auth_user_user_permissions_permission_id_1fbb5f2c ON auth_user_user_permissions USING btree (permission_id);
--
-- Name: auth_user_user_permissions_user_id_a95ead1b; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX auth_user_user_permissions_user_id_a95ead1b ON auth_user_user_permissions USING btree (user_id);
--
-- Name: auth_user_username_6821ab7c_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX auth_user_username_6821ab7c_like ON auth_user USING btree (username varchar_pattern_ops);
--
-- Name: circuits_circuit_provider_id_d9195418; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX circuits_circuit_provider_id_d9195418 ON circuits_circuit USING btree (provider_id);
--
-- Name: circuits_circuit_tenant_id_812508a5; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX circuits_circuit_tenant_id_812508a5 ON circuits_circuit USING btree (tenant_id);
--
-- Name: circuits_circuit_type_id_1b9f485a; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX circuits_circuit_type_id_1b9f485a ON circuits_circuit USING btree (type_id);
--
-- Name: circuits_circuittermination_circuit_id_257e87e7; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX circuits_circuittermination_circuit_id_257e87e7 ON circuits_circuittermination USING btree (circuit_id);
--
-- Name: circuits_circuittermination_site_id_e6fe5652; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX circuits_circuittermination_site_id_e6fe5652 ON circuits_circuittermination USING btree (site_id);
--
-- Name: circuits_circuittype_name_8256ea9a_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX circuits_circuittype_name_8256ea9a_like ON circuits_circuittype USING btree (name varchar_pattern_ops);
--
-- Name: circuits_circuittype_slug_9b4b3cf9_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX circuits_circuittype_slug_9b4b3cf9_like ON circuits_circuittype USING btree (slug varchar_pattern_ops);
--
-- Name: circuits_provider_name_8f2514f5_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX circuits_provider_name_8f2514f5_like ON circuits_provider USING btree (name varchar_pattern_ops);
--
-- Name: circuits_provider_slug_c3c0aa10_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX circuits_provider_slug_c3c0aa10_like ON circuits_provider USING btree (slug varchar_pattern_ops);
--
-- Name: dcim_consoleport_device_id_f2d90d3c; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_consoleport_device_id_f2d90d3c ON dcim_consoleport USING btree (device_id);
--
-- Name: dcim_consoleporttemplate_device_type_id_075d4015; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_consoleporttemplate_device_type_id_075d4015 ON dcim_consoleporttemplate USING btree (device_type_id);
--
-- Name: dcim_consoleserverport_device_id_d9866581; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_consoleserverport_device_id_d9866581 ON dcim_consoleserverport USING btree (device_id);
--
-- Name: dcim_consoleserverporttemplate_device_type_id_579bdc86; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_consoleserverporttemplate_device_type_id_579bdc86 ON dcim_consoleserverporttemplate USING btree (device_type_id);
--
-- Name: dcim_device_asset_tag_8dac1079_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_device_asset_tag_8dac1079_like ON dcim_device USING btree (asset_tag varchar_pattern_ops);
--
-- Name: dcim_device_cluster_id_cf852f78; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_device_cluster_id_cf852f78 ON dcim_device USING btree (cluster_id);
--
-- Name: dcim_device_device_role_id_682e8188; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_device_device_role_id_682e8188 ON dcim_device USING btree (device_role_id);
--
-- Name: dcim_device_device_type_id_d61b4086; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_device_device_type_id_d61b4086 ON dcim_device USING btree (device_type_id);
--
-- Name: dcim_device_name_cfa61dd8_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_device_name_cfa61dd8_like ON dcim_device USING btree (name varchar_pattern_ops);
--
-- Name: dcim_device_platform_id_468138f1; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_device_platform_id_468138f1 ON dcim_device USING btree (platform_id);
--
-- Name: dcim_device_rack_id_23bde71f; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_device_rack_id_23bde71f ON dcim_device USING btree (rack_id);
--
-- Name: dcim_device_site_id_ff897cf6; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_device_site_id_ff897cf6 ON dcim_device USING btree (site_id);
--
-- Name: dcim_device_tenant_id_dcea7969; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_device_tenant_id_dcea7969 ON dcim_device USING btree (tenant_id);
--
-- Name: dcim_devicebay_device_id_0c8a1218; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_devicebay_device_id_0c8a1218 ON dcim_devicebay USING btree (device_id);
--
-- Name: dcim_devicebaytemplate_device_type_id_f4b24a29; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_devicebaytemplate_device_type_id_f4b24a29 ON dcim_devicebaytemplate USING btree (device_type_id);
--
-- Name: dcim_devicerole_name_1c813306_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_devicerole_name_1c813306_like ON dcim_devicerole USING btree (name varchar_pattern_ops);
--
-- Name: dcim_devicerole_slug_7952643b_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_devicerole_slug_7952643b_like ON dcim_devicerole USING btree (slug varchar_pattern_ops);
--
-- Name: dcim_devicetype_manufacturer_id_a3e8029e; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_devicetype_manufacturer_id_a3e8029e ON dcim_devicetype USING btree (manufacturer_id);
--
-- Name: dcim_devicetype_slug_448745bd; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_devicetype_slug_448745bd ON dcim_devicetype USING btree (slug);
--
-- Name: dcim_devicetype_slug_448745bd_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_devicetype_slug_448745bd_like ON dcim_devicetype USING btree (slug varchar_pattern_ops);
--
-- Name: dcim_interface_device_id_359c6115; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_interface_device_id_359c6115 ON dcim_interface USING btree (device_id);
--
-- Name: dcim_interface_lag_id_ea1a1d12; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_interface_lag_id_ea1a1d12 ON dcim_interface USING btree (lag_id);
--
-- Name: dcim_interface_virtual_machine_id_2afd2d50; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_interface_virtual_machine_id_2afd2d50 ON dcim_interface USING btree (virtual_machine_id);
--
-- Name: dcim_interfacetemplate_device_type_id_4bfcbfab; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_interfacetemplate_device_type_id_4bfcbfab ON dcim_interfacetemplate USING btree (device_type_id);
--
-- Name: dcim_inventoryitem_asset_tag_d3289273_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_inventoryitem_asset_tag_d3289273_like ON dcim_inventoryitem USING btree (asset_tag varchar_pattern_ops);
--
-- Name: dcim_manufacturer_name_841fcd92_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_manufacturer_name_841fcd92_like ON dcim_manufacturer USING btree (name varchar_pattern_ops);
--
-- Name: dcim_manufacturer_slug_00430749_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_manufacturer_slug_00430749_like ON dcim_manufacturer USING btree (slug varchar_pattern_ops);
--
-- Name: dcim_module_device_id_53cfd5be; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_module_device_id_53cfd5be ON dcim_inventoryitem USING btree (device_id);
--
-- Name: dcim_module_manufacturer_id_95322cbb; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_module_manufacturer_id_95322cbb ON dcim_inventoryitem USING btree (manufacturer_id);
--
-- Name: dcim_module_parent_id_bb5d0341; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_module_parent_id_bb5d0341 ON dcim_inventoryitem USING btree (parent_id);
--
-- Name: dcim_platform_name_c2f04255_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_platform_name_c2f04255_like ON dcim_platform USING btree (name varchar_pattern_ops);
--
-- Name: dcim_platform_slug_b0908ae4_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_platform_slug_b0908ae4_like ON dcim_platform USING btree (slug varchar_pattern_ops);
--
-- Name: dcim_poweroutlet_device_id_286351d7; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_poweroutlet_device_id_286351d7 ON dcim_poweroutlet USING btree (device_id);
--
-- Name: dcim_poweroutlettemplate_device_type_id_26b2316c; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_poweroutlettemplate_device_type_id_26b2316c ON dcim_poweroutlettemplate USING btree (device_type_id);
--
-- Name: dcim_powerport_device_id_ef7185ae; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_powerport_device_id_ef7185ae ON dcim_powerport USING btree (device_id);
--
-- Name: dcim_powerporttemplate_device_type_id_1ddfbfcc; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_powerporttemplate_device_type_id_1ddfbfcc ON dcim_powerporttemplate USING btree (device_type_id);
--
-- Name: dcim_rack_group_id_44e90ea9; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_rack_group_id_44e90ea9 ON dcim_rack USING btree (group_id);
--
-- Name: dcim_rack_role_id_62d6919e; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_rack_role_id_62d6919e ON dcim_rack USING btree (role_id);
--
-- Name: dcim_rack_site_id_403c7b3a; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_rack_site_id_403c7b3a ON dcim_rack USING btree (site_id);
--
-- Name: dcim_rack_tenant_id_7cdf3725; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_rack_tenant_id_7cdf3725 ON dcim_rack USING btree (tenant_id);
--
-- Name: dcim_rackgroup_site_id_13520e89; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_rackgroup_site_id_13520e89 ON dcim_rackgroup USING btree (site_id);
--
-- Name: dcim_rackgroup_slug_3f4582a7; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_rackgroup_slug_3f4582a7 ON dcim_rackgroup USING btree (slug);
--
-- Name: dcim_rackgroup_slug_3f4582a7_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_rackgroup_slug_3f4582a7_like ON dcim_rackgroup USING btree (slug varchar_pattern_ops);
--
-- Name: dcim_rackreservation_rack_id_1ebbaa9b; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_rackreservation_rack_id_1ebbaa9b ON dcim_rackreservation USING btree (rack_id);
--
-- Name: dcim_rackreservation_user_id_0785a527; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_rackreservation_user_id_0785a527 ON dcim_rackreservation USING btree (user_id);
--
-- Name: dcim_rackrole_name_9077cfcc_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_rackrole_name_9077cfcc_like ON dcim_rackrole USING btree (name varchar_pattern_ops);
--
-- Name: dcim_rackrole_slug_40bbcd3a_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_rackrole_slug_40bbcd3a_like ON dcim_rackrole USING btree (slug varchar_pattern_ops);
--
-- Name: dcim_region_level_2cee781b; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_region_level_2cee781b ON dcim_region USING btree (level);
--
-- Name: dcim_region_lft_923d059c; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_region_lft_923d059c ON dcim_region USING btree (lft);
--
-- Name: dcim_region_name_ba5a7082_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_region_name_ba5a7082_like ON dcim_region USING btree (name varchar_pattern_ops);
--
-- Name: dcim_region_parent_id_2486f5d4; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_region_parent_id_2486f5d4 ON dcim_region USING btree (parent_id);
--
-- Name: dcim_region_rght_20f888e3; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_region_rght_20f888e3 ON dcim_region USING btree (rght);
--
-- Name: dcim_region_slug_ff078a66_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_region_slug_ff078a66_like ON dcim_region USING btree (slug varchar_pattern_ops);
--
-- Name: dcim_region_tree_id_a09ea9a7; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_region_tree_id_a09ea9a7 ON dcim_region USING btree (tree_id);
--
-- Name: dcim_site_name_8fe66c76_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_site_name_8fe66c76_like ON dcim_site USING btree (name varchar_pattern_ops);
--
-- Name: dcim_site_region_id_45210932; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_site_region_id_45210932 ON dcim_site USING btree (region_id);
--
-- Name: dcim_site_slug_4412c762_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_site_slug_4412c762_like ON dcim_site USING btree (slug varchar_pattern_ops);
--
-- Name: dcim_site_tenant_id_15e7df63; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX dcim_site_tenant_id_15e7df63 ON dcim_site USING btree (tenant_id);
--
-- Name: django_admin_log_content_type_id_c4bce8eb; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX django_admin_log_content_type_id_c4bce8eb ON django_admin_log USING btree (content_type_id);
--
-- Name: django_admin_log_user_id_c564eba6; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX django_admin_log_user_id_c564eba6 ON django_admin_log USING btree (user_id);
--
-- Name: django_session_expire_date_a5c62663; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX django_session_expire_date_a5c62663 ON django_session USING btree (expire_date);
--
-- Name: django_session_session_key_c0390e0f_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX django_session_session_key_c0390e0f_like ON django_session USING btree (session_key varchar_pattern_ops);
--
-- Name: extras_customfield_name_2fe72707_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_customfield_name_2fe72707_like ON extras_customfield USING btree (name varchar_pattern_ops);
--
-- Name: extras_customfield_obj_type_contenttype_id_6890b714; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_customfield_obj_type_contenttype_id_6890b714 ON extras_customfield_obj_type USING btree (contenttype_id);
--
-- Name: extras_customfield_obj_type_customfield_id_82480f86; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_customfield_obj_type_customfield_id_82480f86 ON extras_customfield_obj_type USING btree (customfield_id);
--
-- Name: extras_customfieldchoice_field_id_35006739; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_customfieldchoice_field_id_35006739 ON extras_customfieldchoice USING btree (field_id);
--
-- Name: extras_customfieldvalue_field_id_1a461f0d; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_customfieldvalue_field_id_1a461f0d ON extras_customfieldvalue USING btree (field_id);
--
-- Name: extras_customfieldvalue_obj_type_id_b750b07b; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_customfieldvalue_obj_type_id_b750b07b ON extras_customfieldvalue USING btree (obj_type_id);
--
-- Name: extras_exporttemplate_content_type_id_59737e21; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_exporttemplate_content_type_id_59737e21 ON extras_exporttemplate USING btree (content_type_id);
--
-- Name: extras_imageattachment_content_type_id_90e0643d; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_imageattachment_content_type_id_90e0643d ON extras_imageattachment USING btree (content_type_id);
--
-- Name: extras_reportresult_report_3575dd21_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_reportresult_report_3575dd21_like ON extras_reportresult USING btree (report varchar_pattern_ops);
--
-- Name: extras_reportresult_user_id_0df55b95; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_reportresult_user_id_0df55b95 ON extras_reportresult USING btree (user_id);
--
-- Name: extras_topologymap_name_f377ebf1_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_topologymap_name_f377ebf1_like ON extras_topologymap USING btree (name varchar_pattern_ops);
--
-- Name: extras_topologymap_site_id_b56b3ceb; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_topologymap_site_id_b56b3ceb ON extras_topologymap USING btree (site_id);
--
-- Name: extras_topologymap_slug_9ba3d31e_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_topologymap_slug_9ba3d31e_like ON extras_topologymap USING btree (slug varchar_pattern_ops);
--
-- Name: extras_useraction_content_type_id_99f782d7; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_useraction_content_type_id_99f782d7 ON extras_useraction USING btree (content_type_id);
--
-- Name: extras_useraction_user_id_8aacec56; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX extras_useraction_user_id_8aacec56 ON extras_useraction USING btree (user_id);
--
-- Name: ipam_aggregate_rir_id_ef7a27bd; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_aggregate_rir_id_ef7a27bd ON ipam_aggregate USING btree (rir_id);
--
-- Name: ipam_ipaddress_interface_id_91e71d9d; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_ipaddress_interface_id_91e71d9d ON ipam_ipaddress USING btree (interface_id);
--
-- Name: ipam_ipaddress_tenant_id_ac55acfd; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_ipaddress_tenant_id_ac55acfd ON ipam_ipaddress USING btree (tenant_id);
--
-- Name: ipam_ipaddress_vrf_id_51fcc59b; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_ipaddress_vrf_id_51fcc59b ON ipam_ipaddress USING btree (vrf_id);
--
-- Name: ipam_prefix_role_id_0a98d415; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_prefix_role_id_0a98d415 ON ipam_prefix USING btree (role_id);
--
-- Name: ipam_prefix_site_id_0b20df05; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_prefix_site_id_0b20df05 ON ipam_prefix USING btree (site_id);
--
-- Name: ipam_prefix_tenant_id_7ba1fcc4; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_prefix_tenant_id_7ba1fcc4 ON ipam_prefix USING btree (tenant_id);
--
-- Name: ipam_prefix_vlan_id_1db91bff; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_prefix_vlan_id_1db91bff ON ipam_prefix USING btree (vlan_id);
--
-- Name: ipam_prefix_vrf_id_34f78ed0; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_prefix_vrf_id_34f78ed0 ON ipam_prefix USING btree (vrf_id);
--
-- Name: ipam_rir_name_64a71982_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_rir_name_64a71982_like ON ipam_rir USING btree (name varchar_pattern_ops);
--
-- Name: ipam_rir_slug_ff1a369a_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_rir_slug_ff1a369a_like ON ipam_rir USING btree (slug varchar_pattern_ops);
--
-- Name: ipam_role_name_13784849_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_role_name_13784849_like ON ipam_role USING btree (name varchar_pattern_ops);
--
-- Name: ipam_role_slug_309ca14c_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_role_slug_309ca14c_like ON ipam_role USING btree (slug varchar_pattern_ops);
--
-- Name: ipam_service_device_id_b4d2bb9c; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_service_device_id_b4d2bb9c ON ipam_service USING btree (device_id);
--
-- Name: ipam_service_ipaddresses_ipaddress_id_b4138c6d; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_service_ipaddresses_ipaddress_id_b4138c6d ON ipam_service_ipaddresses USING btree (ipaddress_id);
--
-- Name: ipam_service_ipaddresses_service_id_ae26b9ab; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_service_ipaddresses_service_id_ae26b9ab ON ipam_service_ipaddresses USING btree (service_id);
--
-- Name: ipam_service_virtual_machine_id_e8b53562; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_service_virtual_machine_id_e8b53562 ON ipam_service USING btree (virtual_machine_id);
--
-- Name: ipam_vlan_group_id_88cbfa62; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_vlan_group_id_88cbfa62 ON ipam_vlan USING btree (group_id);
--
-- Name: ipam_vlan_role_id_f5015962; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_vlan_role_id_f5015962 ON ipam_vlan USING btree (role_id);
--
-- Name: ipam_vlan_site_id_a59334e3; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_vlan_site_id_a59334e3 ON ipam_vlan USING btree (site_id);
--
-- Name: ipam_vlan_tenant_id_71a8290d; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_vlan_tenant_id_71a8290d ON ipam_vlan USING btree (tenant_id);
--
-- Name: ipam_vlangroup_site_id_264f36f6; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_vlangroup_site_id_264f36f6 ON ipam_vlangroup USING btree (site_id);
--
-- Name: ipam_vlangroup_slug_40abcf6b; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_vlangroup_slug_40abcf6b ON ipam_vlangroup USING btree (slug);
--
-- Name: ipam_vlangroup_slug_40abcf6b_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_vlangroup_slug_40abcf6b_like ON ipam_vlangroup USING btree (slug varchar_pattern_ops);
--
-- Name: ipam_vrf_rd_0ac1bde1_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_vrf_rd_0ac1bde1_like ON ipam_vrf USING btree (rd varchar_pattern_ops);
--
-- Name: ipam_vrf_tenant_id_498b0051; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX ipam_vrf_tenant_id_498b0051 ON ipam_vrf USING btree (tenant_id);
--
-- Name: secrets_secret_device_id_c7c13124; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX secrets_secret_device_id_c7c13124 ON secrets_secret USING btree (device_id);
--
-- Name: secrets_secret_role_id_39d9347f; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX secrets_secret_role_id_39d9347f ON secrets_secret USING btree (role_id);
--
-- Name: secrets_secretrole_groups_group_id_a687dd10; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX secrets_secretrole_groups_group_id_a687dd10 ON secrets_secretrole_groups USING btree (group_id);
--
-- Name: secrets_secretrole_groups_secretrole_id_3cf0338b; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX secrets_secretrole_groups_secretrole_id_3cf0338b ON secrets_secretrole_groups USING btree (secretrole_id);
--
-- Name: secrets_secretrole_name_7b6ee7a4_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX secrets_secretrole_name_7b6ee7a4_like ON secrets_secretrole USING btree (name varchar_pattern_ops);
--
-- Name: secrets_secretrole_slug_a06c885e_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX secrets_secretrole_slug_a06c885e_like ON secrets_secretrole USING btree (slug varchar_pattern_ops);
--
-- Name: secrets_secretrole_users_secretrole_id_d2eac298; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX secrets_secretrole_users_secretrole_id_d2eac298 ON secrets_secretrole_users USING btree (secretrole_id);
--
-- Name: secrets_secretrole_users_user_id_25be95ad; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX secrets_secretrole_users_user_id_25be95ad ON secrets_secretrole_users USING btree (user_id);
--
-- Name: tenancy_tenant_group_id_7daef6f4; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX tenancy_tenant_group_id_7daef6f4 ON tenancy_tenant USING btree (group_id);
--
-- Name: tenancy_tenant_name_f6e5b2f5_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX tenancy_tenant_name_f6e5b2f5_like ON tenancy_tenant USING btree (name varchar_pattern_ops);
--
-- Name: tenancy_tenant_slug_0716575e_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX tenancy_tenant_slug_0716575e_like ON tenancy_tenant USING btree (slug varchar_pattern_ops);
--
-- Name: tenancy_tenantgroup_name_53363199_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX tenancy_tenantgroup_name_53363199_like ON tenancy_tenantgroup USING btree (name varchar_pattern_ops);
--
-- Name: tenancy_tenantgroup_slug_e2af1cb6_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX tenancy_tenantgroup_slug_e2af1cb6_like ON tenancy_tenantgroup USING btree (slug varchar_pattern_ops);
--
-- Name: users_token_key_820deccd_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX users_token_key_820deccd_like ON users_token USING btree (key varchar_pattern_ops);
--
-- Name: users_token_user_id_af964690; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX users_token_user_id_af964690 ON users_token USING btree (user_id);
--
-- Name: virtualization_cluster_group_id_de379828; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_cluster_group_id_de379828 ON virtualization_cluster USING btree (group_id);
--
-- Name: virtualization_cluster_name_1b59a61b_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_cluster_name_1b59a61b_like ON virtualization_cluster USING btree (name varchar_pattern_ops);
--
-- Name: virtualization_cluster_site_id_4d5af282; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_cluster_site_id_4d5af282 ON virtualization_cluster USING btree (site_id);
--
-- Name: virtualization_cluster_type_id_4efafb0a; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_cluster_type_id_4efafb0a ON virtualization_cluster USING btree (type_id);
--
-- Name: virtualization_clustergroup_name_4fcd26b4_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_clustergroup_name_4fcd26b4_like ON virtualization_clustergroup USING btree (name varchar_pattern_ops);
--
-- Name: virtualization_clustergroup_slug_57ca1d23_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_clustergroup_slug_57ca1d23_like ON virtualization_clustergroup USING btree (slug varchar_pattern_ops);
--
-- Name: virtualization_clustertype_name_ea854d3d_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_clustertype_name_ea854d3d_like ON virtualization_clustertype USING btree (name varchar_pattern_ops);
--
-- Name: virtualization_clustertype_slug_8ee4d0e0_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_clustertype_slug_8ee4d0e0_like ON virtualization_clustertype USING btree (slug varchar_pattern_ops);
--
-- Name: virtualization_virtualmachine_cluster_id_6c9f9047; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_virtualmachine_cluster_id_6c9f9047 ON virtualization_virtualmachine USING btree (cluster_id);
--
-- Name: virtualization_virtualmachine_name_266f6cdc_like; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_virtualmachine_name_266f6cdc_like ON virtualization_virtualmachine USING btree (name varchar_pattern_ops);
--
-- Name: virtualization_virtualmachine_platform_id_a6c5ccb2; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_virtualmachine_platform_id_a6c5ccb2 ON virtualization_virtualmachine USING btree (platform_id);
--
-- Name: virtualization_virtualmachine_role_id_0cc898f9; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_virtualmachine_role_id_0cc898f9 ON virtualization_virtualmachine USING btree (role_id);
--
-- Name: virtualization_virtualmachine_tenant_id_d00d1d77; Type: INDEX; Schema: public; Owner: netbox
--
CREATE INDEX virtualization_virtualmachine_tenant_id_d00d1d77 ON virtualization_virtualmachine USING btree (tenant_id);
--
-- Name: auth_group_permissio_permission_id_84c5c92e_fk_auth_perm; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_group_permissions
ADD CONSTRAINT auth_group_permissio_permission_id_84c5c92e_fk_auth_perm FOREIGN KEY (permission_id) REFERENCES auth_permission(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_group_permissions_group_id_b120cbf9_fk_auth_group_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_group_permissions
ADD CONSTRAINT auth_group_permissions_group_id_b120cbf9_fk_auth_group_id FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_permission_content_type_id_2f476e4b_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_permission
ADD CONSTRAINT auth_permission_content_type_id_2f476e4b_fk_django_co FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_groups_group_id_97559544_fk_auth_group_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user_groups
ADD CONSTRAINT auth_user_groups_group_id_97559544_fk_auth_group_id FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_groups_user_id_6a12ed8b_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user_groups
ADD CONSTRAINT auth_user_groups_user_id_6a12ed8b_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user_user_permissions
ADD CONSTRAINT auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm FOREIGN KEY (permission_id) REFERENCES auth_permission(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY auth_user_user_permissions
ADD CONSTRAINT auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: circuits_circuit_provider_id_d9195418_fk_circuits_provider_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuit
ADD CONSTRAINT circuits_circuit_provider_id_d9195418_fk_circuits_provider_id FOREIGN KEY (provider_id) REFERENCES circuits_provider(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: circuits_circuit_tenant_id_812508a5_fk_tenancy_tenant_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuit
ADD CONSTRAINT circuits_circuit_tenant_id_812508a5_fk_tenancy_tenant_id FOREIGN KEY (tenant_id) REFERENCES tenancy_tenant(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: circuits_circuit_type_id_1b9f485a_fk_circuits_circuittype_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuit
ADD CONSTRAINT circuits_circuit_type_id_1b9f485a_fk_circuits_circuittype_id FOREIGN KEY (type_id) REFERENCES circuits_circuittype(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: circuits_circuitterm_circuit_id_257e87e7_fk_circuits_; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuittermination
ADD CONSTRAINT circuits_circuitterm_circuit_id_257e87e7_fk_circuits_ FOREIGN KEY (circuit_id) REFERENCES circuits_circuit(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: circuits_circuitterm_interface_id_a147755f_fk_dcim_inte; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuittermination
ADD CONSTRAINT circuits_circuitterm_interface_id_a147755f_fk_dcim_inte FOREIGN KEY (interface_id) REFERENCES dcim_interface(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: circuits_circuittermination_site_id_e6fe5652_fk_dcim_site_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY circuits_circuittermination
ADD CONSTRAINT circuits_circuittermination_site_id_e6fe5652_fk_dcim_site_id FOREIGN KEY (site_id) REFERENCES dcim_site(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_consoleport_cs_port_id_41f056d5_fk_dcim_cons; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleport
ADD CONSTRAINT dcim_consoleport_cs_port_id_41f056d5_fk_dcim_cons FOREIGN KEY (cs_port_id) REFERENCES dcim_consoleserverport(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_consoleport_device_id_f2d90d3c_fk_dcim_device_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleport
ADD CONSTRAINT dcim_consoleport_device_id_f2d90d3c_fk_dcim_device_id FOREIGN KEY (device_id) REFERENCES dcim_device(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_consoleporttemp_device_type_id_075d4015_fk_dcim_devi; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleporttemplate
ADD CONSTRAINT dcim_consoleporttemp_device_type_id_075d4015_fk_dcim_devi FOREIGN KEY (device_type_id) REFERENCES dcim_devicetype(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_consoleserverpo_device_type_id_579bdc86_fk_dcim_devi; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleserverporttemplate
ADD CONSTRAINT dcim_consoleserverpo_device_type_id_579bdc86_fk_dcim_devi FOREIGN KEY (device_type_id) REFERENCES dcim_devicetype(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_consoleserverport_device_id_d9866581_fk_dcim_device_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_consoleserverport
ADD CONSTRAINT dcim_consoleserverport_device_id_d9866581_fk_dcim_device_id FOREIGN KEY (device_id) REFERENCES dcim_device(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_device_cluster_id_cf852f78_fk_virtualization_cluster_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_cluster_id_cf852f78_fk_virtualization_cluster_id FOREIGN KEY (cluster_id) REFERENCES virtualization_cluster(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_device_device_role_id_682e8188_fk_dcim_devicerole_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_device_role_id_682e8188_fk_dcim_devicerole_id FOREIGN KEY (device_role_id) REFERENCES dcim_devicerole(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_device_device_type_id_d61b4086_fk_dcim_devicetype_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_device_type_id_d61b4086_fk_dcim_devicetype_id FOREIGN KEY (device_type_id) REFERENCES dcim_devicetype(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_device_platform_id_468138f1_fk_dcim_platform_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_platform_id_468138f1_fk_dcim_platform_id FOREIGN KEY (platform_id) REFERENCES dcim_platform(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_device_primary_ip4_id_2ccd943a_fk_ipam_ipaddress_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_primary_ip4_id_2ccd943a_fk_ipam_ipaddress_id FOREIGN KEY (primary_ip4_id) REFERENCES ipam_ipaddress(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_device_primary_ip6_id_d180fe91_fk_ipam_ipaddress_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_primary_ip6_id_d180fe91_fk_ipam_ipaddress_id FOREIGN KEY (primary_ip6_id) REFERENCES ipam_ipaddress(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_device_rack_id_23bde71f_fk_dcim_rack_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_rack_id_23bde71f_fk_dcim_rack_id FOREIGN KEY (rack_id) REFERENCES dcim_rack(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_device_site_id_ff897cf6_fk_dcim_site_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_site_id_ff897cf6_fk_dcim_site_id FOREIGN KEY (site_id) REFERENCES dcim_site(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_device_tenant_id_dcea7969_fk_tenancy_tenant_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_device
ADD CONSTRAINT dcim_device_tenant_id_dcea7969_fk_tenancy_tenant_id FOREIGN KEY (tenant_id) REFERENCES tenancy_tenant(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_devicebay_device_id_0c8a1218_fk_dcim_device_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicebay
ADD CONSTRAINT dcim_devicebay_device_id_0c8a1218_fk_dcim_device_id FOREIGN KEY (device_id) REFERENCES dcim_device(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_devicebay_installed_device_id_04618112_fk_dcim_device_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicebay
ADD CONSTRAINT dcim_devicebay_installed_device_id_04618112_fk_dcim_device_id FOREIGN KEY (installed_device_id) REFERENCES dcim_device(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_devicebaytempla_device_type_id_f4b24a29_fk_dcim_devi; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicebaytemplate
ADD CONSTRAINT dcim_devicebaytempla_device_type_id_f4b24a29_fk_dcim_devi FOREIGN KEY (device_type_id) REFERENCES dcim_devicetype(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_devicetype_manufacturer_id_a3e8029e_fk_dcim_manu; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_devicetype
ADD CONSTRAINT dcim_devicetype_manufacturer_id_a3e8029e_fk_dcim_manu FOREIGN KEY (manufacturer_id) REFERENCES dcim_manufacturer(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_interface_device_id_359c6115_fk_dcim_device_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interface
ADD CONSTRAINT dcim_interface_device_id_359c6115_fk_dcim_device_id FOREIGN KEY (device_id) REFERENCES dcim_device(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_interface_lag_id_ea1a1d12_fk_dcim_interface_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interface
ADD CONSTRAINT dcim_interface_lag_id_ea1a1d12_fk_dcim_interface_id FOREIGN KEY (lag_id) REFERENCES dcim_interface(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_interface_virtual_machine_id_2afd2d50_fk_virtualiz; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interface
ADD CONSTRAINT dcim_interface_virtual_machine_id_2afd2d50_fk_virtualiz FOREIGN KEY (virtual_machine_id) REFERENCES virtualization_virtualmachine(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_interfaceconnec_interface_a_id_503f46c2_fk_dcim_inte; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interfaceconnection
ADD CONSTRAINT dcim_interfaceconnec_interface_a_id_503f46c2_fk_dcim_inte FOREIGN KEY (interface_a_id) REFERENCES dcim_interface(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_interfaceconnec_interface_b_id_85faa104_fk_dcim_inte; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interfaceconnection
ADD CONSTRAINT dcim_interfaceconnec_interface_b_id_85faa104_fk_dcim_inte FOREIGN KEY (interface_b_id) REFERENCES dcim_interface(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_interfacetempla_device_type_id_4bfcbfab_fk_dcim_devi; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_interfacetemplate
ADD CONSTRAINT dcim_interfacetempla_device_type_id_4bfcbfab_fk_dcim_devi FOREIGN KEY (device_type_id) REFERENCES dcim_devicetype(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_inventoryitem_device_id_033d83f8_fk_dcim_device_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_inventoryitem
ADD CONSTRAINT dcim_inventoryitem_device_id_033d83f8_fk_dcim_device_id FOREIGN KEY (device_id) REFERENCES dcim_device(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_inventoryitem_manufacturer_id_dcd1b78a_fk_dcim_manu; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_inventoryitem
ADD CONSTRAINT dcim_inventoryitem_manufacturer_id_dcd1b78a_fk_dcim_manu FOREIGN KEY (manufacturer_id) REFERENCES dcim_manufacturer(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_inventoryitem_parent_id_7ebcd457_fk_dcim_inventoryitem_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_inventoryitem
ADD CONSTRAINT dcim_inventoryitem_parent_id_7ebcd457_fk_dcim_inventoryitem_id FOREIGN KEY (parent_id) REFERENCES dcim_inventoryitem(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_poweroutlet_device_id_286351d7_fk_dcim_device_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_poweroutlet
ADD CONSTRAINT dcim_poweroutlet_device_id_286351d7_fk_dcim_device_id FOREIGN KEY (device_id) REFERENCES dcim_device(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_poweroutlettemp_device_type_id_26b2316c_fk_dcim_devi; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_poweroutlettemplate
ADD CONSTRAINT dcim_poweroutlettemp_device_type_id_26b2316c_fk_dcim_devi FOREIGN KEY (device_type_id) REFERENCES dcim_devicetype(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_powerport_device_id_ef7185ae_fk_dcim_device_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_powerport
ADD CONSTRAINT dcim_powerport_device_id_ef7185ae_fk_dcim_device_id FOREIGN KEY (device_id) REFERENCES dcim_device(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_powerport_power_outlet_id_741276ef_fk_dcim_poweroutlet_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_powerport
ADD CONSTRAINT dcim_powerport_power_outlet_id_741276ef_fk_dcim_poweroutlet_id FOREIGN KEY (power_outlet_id) REFERENCES dcim_poweroutlet(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_powerporttempla_device_type_id_1ddfbfcc_fk_dcim_devi; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_powerporttemplate
ADD CONSTRAINT dcim_powerporttempla_device_type_id_1ddfbfcc_fk_dcim_devi FOREIGN KEY (device_type_id) REFERENCES dcim_devicetype(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_rack_group_id_44e90ea9_fk_dcim_rackgroup_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rack
ADD CONSTRAINT dcim_rack_group_id_44e90ea9_fk_dcim_rackgroup_id FOREIGN KEY (group_id) REFERENCES dcim_rackgroup(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_rack_role_id_62d6919e_fk_dcim_rackrole_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rack
ADD CONSTRAINT dcim_rack_role_id_62d6919e_fk_dcim_rackrole_id FOREIGN KEY (role_id) REFERENCES dcim_rackrole(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_rack_site_id_403c7b3a_fk_dcim_site_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rack
ADD CONSTRAINT dcim_rack_site_id_403c7b3a_fk_dcim_site_id FOREIGN KEY (site_id) REFERENCES dcim_site(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_rack_tenant_id_7cdf3725_fk_tenancy_tenant_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rack
ADD CONSTRAINT dcim_rack_tenant_id_7cdf3725_fk_tenancy_tenant_id FOREIGN KEY (tenant_id) REFERENCES tenancy_tenant(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_rackgroup_site_id_13520e89_fk_dcim_site_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackgroup
ADD CONSTRAINT dcim_rackgroup_site_id_13520e89_fk_dcim_site_id FOREIGN KEY (site_id) REFERENCES dcim_site(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_rackreservation_rack_id_1ebbaa9b_fk_dcim_rack_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackreservation
ADD CONSTRAINT dcim_rackreservation_rack_id_1ebbaa9b_fk_dcim_rack_id FOREIGN KEY (rack_id) REFERENCES dcim_rack(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_rackreservation_user_id_0785a527_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_rackreservation
ADD CONSTRAINT dcim_rackreservation_user_id_0785a527_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_region_parent_id_2486f5d4_fk_dcim_region_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_region
ADD CONSTRAINT dcim_region_parent_id_2486f5d4_fk_dcim_region_id FOREIGN KEY (parent_id) REFERENCES dcim_region(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_site_region_id_45210932_fk_dcim_region_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_site
ADD CONSTRAINT dcim_site_region_id_45210932_fk_dcim_region_id FOREIGN KEY (region_id) REFERENCES dcim_region(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: dcim_site_tenant_id_15e7df63_fk_tenancy_tenant_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY dcim_site
ADD CONSTRAINT dcim_site_tenant_id_15e7df63_fk_tenancy_tenant_id FOREIGN KEY (tenant_id) REFERENCES tenancy_tenant(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: django_admin_log_content_type_id_c4bce8eb_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY django_admin_log
ADD CONSTRAINT django_admin_log_content_type_id_c4bce8eb_fk_django_co FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: django_admin_log_user_id_c564eba6_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY django_admin_log
ADD CONSTRAINT django_admin_log_user_id_c564eba6_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: extras_customfield_o_contenttype_id_6890b714_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfield_obj_type
ADD CONSTRAINT extras_customfield_o_contenttype_id_6890b714_fk_django_co FOREIGN KEY (contenttype_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: extras_customfield_o_customfield_id_82480f86_fk_extras_cu; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfield_obj_type
ADD CONSTRAINT extras_customfield_o_customfield_id_82480f86_fk_extras_cu FOREIGN KEY (customfield_id) REFERENCES extras_customfield(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: extras_customfieldch_field_id_35006739_fk_extras_cu; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfieldchoice
ADD CONSTRAINT extras_customfieldch_field_id_35006739_fk_extras_cu FOREIGN KEY (field_id) REFERENCES extras_customfield(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: extras_customfieldva_field_id_1a461f0d_fk_extras_cu; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfieldvalue
ADD CONSTRAINT extras_customfieldva_field_id_1a461f0d_fk_extras_cu FOREIGN KEY (field_id) REFERENCES extras_customfield(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: extras_customfieldva_obj_type_id_b750b07b_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_customfieldvalue
ADD CONSTRAINT extras_customfieldva_obj_type_id_b750b07b_fk_django_co FOREIGN KEY (obj_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: extras_exporttemplat_content_type_id_59737e21_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_exporttemplate
ADD CONSTRAINT extras_exporttemplat_content_type_id_59737e21_fk_django_co FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: extras_imageattachme_content_type_id_90e0643d_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_imageattachment
ADD CONSTRAINT extras_imageattachme_content_type_id_90e0643d_fk_django_co FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: extras_reportresult_user_id_0df55b95_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_reportresult
ADD CONSTRAINT extras_reportresult_user_id_0df55b95_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: extras_topologymap_site_id_b56b3ceb_fk_dcim_site_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_topologymap
ADD CONSTRAINT extras_topologymap_site_id_b56b3ceb_fk_dcim_site_id FOREIGN KEY (site_id) REFERENCES dcim_site(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: extras_useraction_content_type_id_99f782d7_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_useraction
ADD CONSTRAINT extras_useraction_content_type_id_99f782d7_fk_django_co FOREIGN KEY (content_type_id) REFERENCES django_content_type(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: extras_useraction_user_id_8aacec56_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY extras_useraction
ADD CONSTRAINT extras_useraction_user_id_8aacec56_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_aggregate_rir_id_ef7a27bd_fk_ipam_rir_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_aggregate
ADD CONSTRAINT ipam_aggregate_rir_id_ef7a27bd_fk_ipam_rir_id FOREIGN KEY (rir_id) REFERENCES ipam_rir(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_ipaddress_interface_id_91e71d9d_fk_dcim_interface_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_ipaddress
ADD CONSTRAINT ipam_ipaddress_interface_id_91e71d9d_fk_dcim_interface_id FOREIGN KEY (interface_id) REFERENCES dcim_interface(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_ipaddress_nat_inside_id_a45fb7c5_fk_ipam_ipaddress_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_ipaddress
ADD CONSTRAINT ipam_ipaddress_nat_inside_id_a45fb7c5_fk_ipam_ipaddress_id FOREIGN KEY (nat_inside_id) REFERENCES ipam_ipaddress(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_ipaddress_tenant_id_ac55acfd_fk_tenancy_tenant_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_ipaddress
ADD CONSTRAINT ipam_ipaddress_tenant_id_ac55acfd_fk_tenancy_tenant_id FOREIGN KEY (tenant_id) REFERENCES tenancy_tenant(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_ipaddress_vrf_id_51fcc59b_fk_ipam_vrf_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_ipaddress
ADD CONSTRAINT ipam_ipaddress_vrf_id_51fcc59b_fk_ipam_vrf_id FOREIGN KEY (vrf_id) REFERENCES ipam_vrf(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_prefix_role_id_0a98d415_fk_ipam_role_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_prefix
ADD CONSTRAINT ipam_prefix_role_id_0a98d415_fk_ipam_role_id FOREIGN KEY (role_id) REFERENCES ipam_role(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_prefix_site_id_0b20df05_fk_dcim_site_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_prefix
ADD CONSTRAINT ipam_prefix_site_id_0b20df05_fk_dcim_site_id FOREIGN KEY (site_id) REFERENCES dcim_site(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_prefix_tenant_id_7ba1fcc4_fk_tenancy_tenant_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_prefix
ADD CONSTRAINT ipam_prefix_tenant_id_7ba1fcc4_fk_tenancy_tenant_id FOREIGN KEY (tenant_id) REFERENCES tenancy_tenant(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_prefix_vlan_id_1db91bff_fk_ipam_vlan_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_prefix
ADD CONSTRAINT ipam_prefix_vlan_id_1db91bff_fk_ipam_vlan_id FOREIGN KEY (vlan_id) REFERENCES ipam_vlan(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_prefix_vrf_id_34f78ed0_fk_ipam_vrf_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_prefix
ADD CONSTRAINT ipam_prefix_vrf_id_34f78ed0_fk_ipam_vrf_id FOREIGN KEY (vrf_id) REFERENCES ipam_vrf(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_service_device_id_b4d2bb9c_fk_dcim_device_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_service
ADD CONSTRAINT ipam_service_device_id_b4d2bb9c_fk_dcim_device_id FOREIGN KEY (device_id) REFERENCES dcim_device(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_service_ipaddre_ipaddress_id_b4138c6d_fk_ipam_ipad; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_service_ipaddresses
ADD CONSTRAINT ipam_service_ipaddre_ipaddress_id_b4138c6d_fk_ipam_ipad FOREIGN KEY (ipaddress_id) REFERENCES ipam_ipaddress(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_service_ipaddresses_service_id_ae26b9ab_fk_ipam_service_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_service_ipaddresses
ADD CONSTRAINT ipam_service_ipaddresses_service_id_ae26b9ab_fk_ipam_service_id FOREIGN KEY (service_id) REFERENCES ipam_service(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_service_virtual_machine_id_e8b53562_fk_virtualiz; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_service
ADD CONSTRAINT ipam_service_virtual_machine_id_e8b53562_fk_virtualiz FOREIGN KEY (virtual_machine_id) REFERENCES virtualization_virtualmachine(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_vlan_group_id_88cbfa62_fk_ipam_vlangroup_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlan
ADD CONSTRAINT ipam_vlan_group_id_88cbfa62_fk_ipam_vlangroup_id FOREIGN KEY (group_id) REFERENCES ipam_vlangroup(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_vlan_role_id_f5015962_fk_ipam_role_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlan
ADD CONSTRAINT ipam_vlan_role_id_f5015962_fk_ipam_role_id FOREIGN KEY (role_id) REFERENCES ipam_role(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_vlan_site_id_a59334e3_fk_dcim_site_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlan
ADD CONSTRAINT ipam_vlan_site_id_a59334e3_fk_dcim_site_id FOREIGN KEY (site_id) REFERENCES dcim_site(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_vlan_tenant_id_71a8290d_fk_tenancy_tenant_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlan
ADD CONSTRAINT ipam_vlan_tenant_id_71a8290d_fk_tenancy_tenant_id FOREIGN KEY (tenant_id) REFERENCES tenancy_tenant(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_vlangroup_site_id_264f36f6_fk_dcim_site_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vlangroup
ADD CONSTRAINT ipam_vlangroup_site_id_264f36f6_fk_dcim_site_id FOREIGN KEY (site_id) REFERENCES dcim_site(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: ipam_vrf_tenant_id_498b0051_fk_tenancy_tenant_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY ipam_vrf
ADD CONSTRAINT ipam_vrf_tenant_id_498b0051_fk_tenancy_tenant_id FOREIGN KEY (tenant_id) REFERENCES tenancy_tenant(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: secrets_secret_device_id_c7c13124_fk_dcim_device_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secret
ADD CONSTRAINT secrets_secret_device_id_c7c13124_fk_dcim_device_id FOREIGN KEY (device_id) REFERENCES dcim_device(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: secrets_secret_role_id_39d9347f_fk_secrets_secretrole_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secret
ADD CONSTRAINT secrets_secret_role_id_39d9347f_fk_secrets_secretrole_id FOREIGN KEY (role_id) REFERENCES secrets_secretrole(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: secrets_secretrole_g_secretrole_id_3cf0338b_fk_secrets_s; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole_groups
ADD CONSTRAINT secrets_secretrole_g_secretrole_id_3cf0338b_fk_secrets_s FOREIGN KEY (secretrole_id) REFERENCES secrets_secretrole(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: secrets_secretrole_groups_group_id_a687dd10_fk_auth_group_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole_groups
ADD CONSTRAINT secrets_secretrole_groups_group_id_a687dd10_fk_auth_group_id FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: secrets_secretrole_u_secretrole_id_d2eac298_fk_secrets_s; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole_users
ADD CONSTRAINT secrets_secretrole_u_secretrole_id_d2eac298_fk_secrets_s FOREIGN KEY (secretrole_id) REFERENCES secrets_secretrole(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: secrets_secretrole_users_user_id_25be95ad_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_secretrole_users
ADD CONSTRAINT secrets_secretrole_users_user_id_25be95ad_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: secrets_sessionkey_userkey_id_3ca6176b_fk_secrets_userkey_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_sessionkey
ADD CONSTRAINT secrets_sessionkey_userkey_id_3ca6176b_fk_secrets_userkey_id FOREIGN KEY (userkey_id) REFERENCES secrets_userkey(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: secrets_userkey_user_id_13ada46b_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY secrets_userkey
ADD CONSTRAINT secrets_userkey_user_id_13ada46b_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: tenancy_tenant_group_id_7daef6f4_fk_tenancy_tenantgroup_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY tenancy_tenant
ADD CONSTRAINT tenancy_tenant_group_id_7daef6f4_fk_tenancy_tenantgroup_id FOREIGN KEY (group_id) REFERENCES tenancy_tenantgroup(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: users_token_user_id_af964690_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY users_token
ADD CONSTRAINT users_token_user_id_af964690_fk_auth_user_id FOREIGN KEY (user_id) REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: virtualization_clust_group_id_de379828_fk_virtualiz; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_cluster
ADD CONSTRAINT virtualization_clust_group_id_de379828_fk_virtualiz FOREIGN KEY (group_id) REFERENCES virtualization_clustergroup(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: virtualization_clust_type_id_4efafb0a_fk_virtualiz; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_cluster
ADD CONSTRAINT virtualization_clust_type_id_4efafb0a_fk_virtualiz FOREIGN KEY (type_id) REFERENCES virtualization_clustertype(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: virtualization_cluster_site_id_4d5af282_fk_dcim_site_id; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_cluster
ADD CONSTRAINT virtualization_cluster_site_id_4d5af282_fk_dcim_site_id FOREIGN KEY (site_id) REFERENCES dcim_site(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: virtualization_virtu_cluster_id_6c9f9047_fk_virtualiz; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_virtualmachine
ADD CONSTRAINT virtualization_virtu_cluster_id_6c9f9047_fk_virtualiz FOREIGN KEY (cluster_id) REFERENCES virtualization_cluster(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: virtualization_virtu_platform_id_a6c5ccb2_fk_dcim_plat; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_virtualmachine
ADD CONSTRAINT virtualization_virtu_platform_id_a6c5ccb2_fk_dcim_plat FOREIGN KEY (platform_id) REFERENCES dcim_platform(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: virtualization_virtu_primary_ip4_id_942e42ae_fk_ipam_ipad; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_virtualmachine
ADD CONSTRAINT virtualization_virtu_primary_ip4_id_942e42ae_fk_ipam_ipad FOREIGN KEY (primary_ip4_id) REFERENCES ipam_ipaddress(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: virtualization_virtu_primary_ip6_id_b7904e73_fk_ipam_ipad; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_virtualmachine
ADD CONSTRAINT virtualization_virtu_primary_ip6_id_b7904e73_fk_ipam_ipad FOREIGN KEY (primary_ip6_id) REFERENCES ipam_ipaddress(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: virtualization_virtu_role_id_0cc898f9_fk_dcim_devi; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_virtualmachine
ADD CONSTRAINT virtualization_virtu_role_id_0cc898f9_fk_dcim_devi FOREIGN KEY (role_id) REFERENCES dcim_devicerole(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: virtualization_virtu_tenant_id_d00d1d77_fk_tenancy_t; Type: FK CONSTRAINT; Schema: public; Owner: netbox
--
ALTER TABLE ONLY virtualization_virtualmachine
ADD CONSTRAINT virtualization_virtu_tenant_id_d00d1d77_fk_tenancy_t FOREIGN KEY (tenant_id) REFERENCES tenancy_tenant(id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--
|
set lines 155
set verify off
set pagesize 999
col username format a13
col outline_category for a16
col prog format a22
col sql_text format a55 wrap
col sid format 999
col child_number format 99999 heading CHILD
col ocategory format a10
col outline_name format a12
col avg_etime format 9,999,999.99
col etime format 9,999,999.99
select sql_id, child_number, executions execs,
(elapsed_time/1000000)/decode(nvl(executions,0),0,1,executions) avg_etime, outline_category,
o.name outline_name, plan_hash_value,
s.sql_text
-- from v$sql s, dbs_outlines o
from dba_outlines o left outer join v$sql s
on o.signature = outline_signature(s.sql_fulltext)
where upper(s.sql_text) like upper(nvl('&sql_text',s.sql_text))
-- and s.sql_text not like '%from v$sql where s.sql_text like nvl(%'
and sql_id like nvl('&sql_id',sql_id)
and outline_category is not null
/
|
CREATE TABLE admin(
id int(11) NOT NULL auto_increment,
username varchar(255) NOT NULL,
password varchar(255) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY id (id)
); |
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
--
-- Name: gizmo_type_groups_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('gizmo_type_groups_id_seq', 8, true);
--
-- Data for Name: gizmo_type_groups; Type: TABLE DATA; Schema: public; Owner: -
--
SET SESSION AUTHORIZATION DEFAULT;
ALTER TABLE gizmo_type_groups DISABLE TRIGGER ALL;
COPY gizmo_type_groups (id, name, created_at, updated_at) FROM stdin;
1 All Systems 2011-11-19 16:02:07.714152 2011-11-19 16:02:07.714152
2 All Laptops 2011-11-19 16:04:30.915174 2011-11-19 16:04:30.915174
3 All Macs 2011-11-19 16:05:08.02319 2011-11-19 16:05:08.02319
4 Parts 2011-11-19 16:06:13.488722 2011-11-19 16:06:13.488722
5 Peripherals 2011-11-19 16:07:07.212018 2011-11-19 16:07:07.212018
6 Advanced Testing Family 2012-03-14 15:51:04.558499 2012-03-14 15:51:04.558499
7 Non-Mac Laptop Family 2012-03-14 15:57:35.488094 2012-03-14 15:57:35.488094
8 Non-Mac Desktop Family 2012-03-14 15:59:12.618385 2012-03-14 15:59:12.618385
\.
ALTER TABLE gizmo_type_groups ENABLE TRIGGER ALL;
--
-- PostgreSQL database dump complete
--
|
-- MySQL Script generated by MySQL Workbench
-- Fri Jun 12 20:55:21 2020
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema project_1
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema project_1
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `project_1` DEFAULT CHARACTER SET utf8 ;
USE `project_1` ;
-- -----------------------------------------------------
-- Table `project_1`.`category`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `project_1`.`category` (
`idcategory` INT NOT NULL,
`name` VARCHAR(45) NOT NULL,
`description` VARCHAR(45) NULL,
PRIMARY KEY (`idcategory`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `project_1`.`products`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `project_1`.`products` (
`idproduct` INT NOT NULL,
`name` VARCHAR(45) NOT NULL,
`price` FLOAT NOT NULL,
`description` VARCHAR(45) NULL,
`instock` TINYINT NOT NULL,
`category_idcategory` INT NOT NULL,
PRIMARY KEY (`idproduct`, `category_idcategory`),
INDEX `fk_products_category1_idx` (`category_idcategory` ASC) VISIBLE,
CONSTRAINT `fk_products_category1`
FOREIGN KEY (`category_idcategory`)
REFERENCES `project_1`.`category` (`idcategory`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `project_1`.`steps`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `project_1`.`steps` (
`idstep` INT NOT NULL,
`topspeed` INT NULL,
`occupied` TINYINT NULL,
`assigned` TINYINT NULL,
PRIMARY KEY (`idstep`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `project_1`.`orders`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `project_1`.`orders` (
`idorder` INT NOT NULL,
`adress` VARCHAR(45) NOT NULL,
`ordertime` DATETIME NOT NULL,
`deliverystarttime` DATETIME NULL,
`deliveryendtime` DATETIME NULL,
`aantal_shocken` INT NULL,
`idstep` INT NOT NULL,
PRIMARY KEY (`idorder`, `idstep`),
INDEX `fk_orders_steps1_idx` (`idstep` ASC) VISIBLE,
CONSTRAINT `fk_orders_steps1`
FOREIGN KEY (`idstep`)
REFERENCES `project_1`.`steps` (`idstep`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `project_1`.`waypoints`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `project_1`.`waypoints` (
`idwaypoint` INT NOT NULL,
`longitude` VARCHAR(9) NOT NULL,
`latitude` VARCHAR(9) NOT NULL,
`avgspeed` FLOAT NOT NULL,
PRIMARY KEY (`idwaypoint`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `project_1`.`order_route`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `project_1`.`order_route` (
`order_idorder` INT NOT NULL,
`waypoints_idwaypoint` INT NOT NULL,
PRIMARY KEY (`order_idorder`, `waypoints_idwaypoint`),
INDEX `fk_order_route_order1_idx` (`order_idorder` ASC) VISIBLE,
CONSTRAINT `fk_order_route_waypoints1`
FOREIGN KEY (`waypoints_idwaypoint`)
REFERENCES `project_1`.`waypoints` (`idwaypoint`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_order_route_order1`
FOREIGN KEY (`order_idorder`)
REFERENCES `project_1`.`orders` (`idorder`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `project_1`.`order_items`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `project_1`.`order_items` (
`orders_idorder` INT NOT NULL,
`products_idproduct` INT NOT NULL,
`products_category_idcategory` INT NOT NULL,
`amount` INT NOT NULL,
PRIMARY KEY (`orders_idorder`, `products_idproduct`, `products_category_idcategory`),
INDEX `fk_order_items_products1_idx` (`products_idproduct` ASC, `products_category_idcategory` ASC) VISIBLE,
CONSTRAINT `fk_order_items_orders1`
FOREIGN KEY (`orders_idorder`)
REFERENCES `project_1`.`orders` (`idorder`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_order_items_products1`
FOREIGN KEY (`products_idproduct` , `products_category_idcategory`)
REFERENCES `project_1`.`products` (`idproduct` , `category_idcategory`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `project_1`.`settings`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `project_1`.`settings` (
`intervalGPS` INT NOT NULL,
`latitudeformat` VARCHAR(9) NOT NULL,
`longitudeformat` VARCHAR(9) NOT NULL,
`intervalMPU` INT NOT NULL,
`thresholdMPU` FLOAT NOT NULL)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
/*Problema: 2614 - Locações de Setembro:*/
select customers.name, rentals.rentals_date from customers inner join
rentals on rentals.id_customers = customers.id where
DATE_PART('MONTH', rentals.rentals_date) = '09';
/*Problema 2616 - Nenhuma Locação:*/
Select customers.id,customers.name
from customers where customers.id
not in (select locations.id_customers from locations)
;
/*Problema 2741 - Notas dos Alunos*/
SELECT concat('Approved: ',students.name),students.grade from students where students.grade >= 7
order by students.grade desc;
/*Problema 2738 - Concurso*/
SELECT candidate.name,
trunc(( (score.math *2 + score.specific*3 +
score.project_plan *5)/10),2) as "avg"
FROM score INNER join
candidate on
score.candidate_id = candidate.id
order by 2 desc
;
/* Problema 2623 - Categorias com Vários Produtos*/
SELECT products.name, categories.name FROM products
INNER JOIN
categories on products.id_categories = categories.id
where products.amount > 100 and categories.id in (1,2,3,6,9)
order by categories.id
;
/* Problema 2622 - Pessoas Jurídicas */
SELECT customers.name FROM legal_person
INNER join
customers on legal_person.id_customers = customers.id;
/* Problema 2737 - Advogados */
SELECT lawyers.name,lawyers.customers_number from lawyers where lawyers.customers_number =
(Select max(lawyers.customers_number) FROM lawyers)
union all
SELECT lawyers.name,lawyers.customers_number from lawyers where lawyers.customers_number =
(Select min(lawyers.customers_number) FROM lawyers)
union all
SELECT 'Average', round(avg(lawyers.customers_number),0) FROM lawyers
;
/* Problema 2618 - Produtos Importados */
SELECT products.name, providers.name,categories.name FROM products INNER JOIN
providers on products.id_providers = providers.id INNER JOIN
categories on products.id_categories = categories.id
where providers.name ='Sansul SA' and categories.name = 'Imported';
/* Problema 2619 - Super Luxo */
SELECT products.name, providers.name,products.price FROM products INNER JOIN
providers on products.id_providers = providers.id INNER JOIN
categories on products.id_categories = categories.id
where products.price >1000 and categories.name like 'Super%';
/* Problema 2624 - Quantidades de Cidades por Clientes */
SELECT count(DISTINCT customers.city) from customers;
/*Problema 2621 - Quantidades Entre 10 e 20 */
select products.name from products INNER join
providers on products.id_providers = providers.id
where providers.name like 'P%' and
products.amount > 10 and products.amount <20
;
/*Problema 2617 - Fornecedor Ajax SA */
select products.name,providers.name from products,providers where products.id_providers = providers.id
and providers.name = 'Ajax SA';
/*Problema 2609 - Produtos por Categorias*/
SELECT categories.name, sum(products.amount) from products
INNER JOIN categories on products.id_categories = categories.id
group by categories.name
;
/* Problema 2612 - Os Atores Silva */
SELECT DISTINCT movies.id,movies.name from movies, genres, actors, movies_actors
where movies_actors.id_movies = movies.id and movies_actors.id_actors = actors.id and
genres.description = 'Action' and actors.name like '%Silva'
order by movies.name;
;
/*Problema 2613 - Filmes em Promoção */
SELECT movies.id,movies.name from movies,prices where
movies.id_prices = prices.id and prices.value < 2.00;
/*Problema 2606 - Categorias */
SELECT products.id,products.name FROM products,categories where products.id_categories = categories.id
and categories.name like 'super%'
/*Problema 2611 - Filmes de Ação */
SELECT movies.id, movies.name FROM movies
INNER JOIN genres on movies.id_genres = genres.id
where genres.description = 'Action';
/*Problema 2610 - Valor Médio dos Produtos */
SELECT round(avg(price),2) from products;
/*Problema 2605 - Representantes Executivos */
SELECT products.name, providers.name FROM products
INNER JOIN providers on products.id_providers = providers.id WHERE products.id_categories = 6;
/* Problema 2615 - Expandindo o Negocio */
SELECT distinct city from customers;
/* Problema 2608 - Maior e Menor Preço */
SELECT max(price),min(price) from products;
/* Problema 2607 - Cidades em Ordem Alfabética */
SELECT city from providers order by city;
/* Problema 2604 - Menores que 10 ou Maiores que 100 */
SELECT "id","name" FROM products WHERE "price" < 10 or "price" >100;
/* Problema 2603 Endereço dos Clientes */
SELECT "name","street" from customers where "city" ='Porto Alegre';
/* Problema 2602 - Select Básico */
SELECT "name" from customers where "state" ='RS';
|
-- Change all values in format {size}M to {size}
UPDATE googleplaystore
SET size = substr(size, 1, length(size) - 1)
WHERE size LIKE '%M' |
CREATE DATABASE gozatu_1;
-- \c gozatu_1
CREATE TABLE restaurants(
restaurant_id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(30) NOT NULL,
city VARCHAR(30) NOT NULL,
cuisine VARCHAR(30),
description VARCHAR(200),
price INT,
visit_date DATE,
rating INT NOT NULL,
favorite BOOLEAN NOT NULL
); |
--
-- CRM_ORDER_DIR (Directory)
--
CREATE OR REPLACE DIRECTORY
CRM_ORDER_DIR AS
'/data02/crm_dump_dir/his_orderinfo/process_dir';
|
create table "APP".UTILIZADOR
(
ID_UTILIZADOR INTEGER not null primary key generated always as identity (start with 1, increment by 1),
NOME VARCHAR(50) not null,
EMAIL VARCHAR(50) not null unique,
PASSWORD VARCHAR(50) not null
);
create table "APP".MOBILIARIOCLINICO
(
ID_PRODUTO INTEGER not null primary key generated always as identity (start with 1, increment by 1),
NOME VARCHAR(50) not null,
DESCRICAO VARCHAR(100),
QUANTIDADE_TOTAL INTEGER default 0 not null,
QUANTIDADE_DISPONIVEL INTEGER default 0 not null
);
create table "APP".RESERVA
(
ID_RESERVA INTEGER not null primary key generated always as identity (start with 1, increment by 1),
DATA_RESERVA TIMESTAMP not null,
QUANTIDADE_RESERVADA INTEGER default 1 not null,
ID_UTILIZADOR INTEGER not null,
ID_PRODUTO INTEGER not null
);
create table "APP".REQUISICAO
(
ID_REQUISICAO INTEGER not null primary key generated always as identity (start with 1, increment by 1),
DATA_REQUISICAO TIMESTAMP not null,
QUANTIDADE_REQUISITADA INTEGER default 1 not null,
ID_UTILIZADOR INTEGER not null,
ID_PRODUTO INTEGER not null
);
ALTER TABLE Reserva ADD FOREIGN KEY (id_utilizador) REFERENCES Utilizador;
ALTER TABLE Reserva ADD FOREIGN KEY (id_produto) REFERENCES MobiliarioClinico;
ALTER TABLE Requisicao ADD FOREIGN KEY (id_utilizador) REFERENCES Utilizador;
ALTER TABLE Requisicao ADD FOREIGN KEY (id_produto) REFERENCES MobiliarioClinico;
|
DROP TABLE IF EXISTS characters CASCADE;
CREATE TABLE characters (
id SERIAL PRIMARY KEY,
account_id INTEGER NOT NULL,
world_id SMALLINT NOT NULL DEFAULT 0,
name TEXT UNIQUE NOT NULL,
gender SMALLINT NOT NULL DEFAULT 0,
skin SMALLINT NOT NULL DEFAULT 0,
face INTEGER NOT NULL DEFAULT 0,
hair INTEGER NOT NULL DEFAULT 0,
pet_serials BIGINT ARRAY[3] NOT NULL DEFAULT '{0, 0, 0}',
level SMALLINT NOT NULL DEFAULT 0,
job SMALLINT NOT NULL DEFAULT 0,
str SMALLINT NOT NULL DEFAULT 0,
dex SMALLINT NOT NULL DEFAULT 0,
int SMALLINT NOT NULL DEFAULT 0,
luk SMALLINT NOT NULL DEFAULT 0,
hp SMALLINT NOT NULL DEFAULT 0,
max_hp SMALLINT NOT NULL DEFAULT 0,
mp SMALLINT NOT NULL DEFAULT 0,
max_mp SMALLINT NOT NULL DEFAULT 0,
ap SMALLINT NOT NULL DEFAULT 0,
sp SMALLINT NOT NULL DEFAULT 0,
exp INTEGER NOT NULL DEFAULT 0,
fame SMALLINT NOT NULL DEFAULT 0,
map INTEGER NOT NULL DEFAULT 0,
portal SMALLINT NOT NULL DEFAULT 0
);
|
-- ----------------------------
-- Table structure for co_company
-- ----------------------------
# DROP TABLE IF EXISTS `co_company`;
CREATE TABLE `co_company`
(
`id` bigint NOT NULL COMMENT 'ID',
`name` varchar(255) NOT NULL COMMENT '公司名称',
`manager_id` bigint NOT NULL COMMENT '企业登录账号ID',
`version` varchar(255) DEFAULT NULL COMMENT '当前版本',
`renewal_date` datetime DEFAULT NULL COMMENT '续期时间',
`expiration_date` datetime DEFAULT NULL COMMENT '到期时间',
`company_area` varchar(255) DEFAULT NULL COMMENT '公司地区',
`company_address` text COMMENT '公司地址',
`business_license_id` varchar(255) DEFAULT NULL COMMENT '营业执照-图片ID',
`legal_representative` varchar(255) DEFAULT NULL COMMENT '法人代表',
`company_phone` varchar(255) DEFAULT NULL COMMENT '公司电话',
`mailbox` varchar(255) DEFAULT NULL COMMENT '邮箱',
`company_size` varchar(255) DEFAULT NULL COMMENT '公司规模',
`industry` varchar(255) DEFAULT NULL COMMENT '所属行业',
`remarks` text COMMENT '备注',
`audit_state` varchar(255) DEFAULT NULL COMMENT '审核状态',
`state` int DEFAULT '1' COMMENT '状态',
`balance` decimal(16, 2) NOT NULL DEFAULT 0.00 COMMENT '当前余额',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
-- ----------------------------
-- Records of co_company
-- ----------------------------
INSERT INTO `co_company`
VALUES (1, 'M78星云', 1122, '12', null, null, null, null, null, '张三', null, null, null, null, null, '0', '1', '0',
'2018-11-07 13:30:05', null);
INSERT INTO `co_company`
VALUES (1060043412612452352, '人马', 1133, '12', null, null, null, null, null, null, null, null, null, null, null, '0',
'1', '0', '2018-11-07 13:36:58', null);
INSERT INTO `co_company`
VALUES (1061532681482932224, '金牛', 1144, '12', null, null, null, null, null, null, null, null, null, null, null, '0',
'1', '0', '2018-11-11 16:14:48', null);
INSERT INTO `co_company`
VALUES (1065494996154650624, '地球', 1166, '12', null, null, null, null, null, null, null, null, null, null, null, '0',
'1', 0, null, null);
INSERT INTO `co_company`(id, name, manager_id)
VALUES (1065494996154650625, '火星', 1166);
-- ----------------------------
-- Table structure for co_department
-- ----------------------------
# DROP TABLE IF EXISTS `co_department`;
CREATE TABLE `co_department`
(
`id` bigint NOT NULL,
`company_id` bigint NOT NULL COMMENT '企业ID',
`pid` bigint DEFAULT NULL COMMENT '父级部门ID',
`name` varchar(255) NOT NULL COMMENT '部门名称',
`code` varchar(255) NOT NULL COMMENT '部门编码',
`manager_id` bigint DEFAULT NULL COMMENT '负责人ID',
`manager` varchar(40) DEFAULT NULL COMMENT '部门负责人',
`introduce` text COMMENT '介绍',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
-- ----------------------------
-- Records of co_department
-- ----------------------------
INSERT INTO `co_department`
VALUES ('1063676045212913664', '1', '0', '研发部', 'DEV-TECHNOLOG', null, '技术部总监', '包含开发部,测试部', '2018-11-17 14:11:45',
null);
INSERT INTO `co_department`
VALUES ('1063678149528784896', '1', '1063676045212913664', '测试部', 'DEPT-TEST', null, '测试部门领导', '所有测试人员统一划分到测试部',
'2018-11-17 14:20:07', null);
INSERT INTO `co_department`
VALUES ('1066238836272664576', '1', null, '财务部', 'DEPT-FIN', null, '李四', '包含出纳和会计', '2018-11-24 15:55:22', null);
INSERT INTO `co_department`
VALUES ('1066239766607040512', '1', null, '行政中心', 'DEPT-XZ', null, '张三', '包含人力资源和行政部门', '2018-11-24 15:59:04', null);
INSERT INTO `co_department`
VALUES ('1066239913642561536', '1', '1066239766607040512', '人力资源部', 'DEPT-HR', null, '李四', '人力资源部',
'2018-11-24 15:59:39', null);
INSERT INTO `co_department`
VALUES ('1066240303092076544', '1', '1066239766607040512', '行政部', 'DEPT-XZ', null, '王五', '行政部', '2018-11-24 16:01:12',
null);
INSERT INTO `co_department`
VALUES ('1066240656856453120', '1', '1063676045212913664', '开发部', 'DEPT-DEV', null, '研发', '全部java开发人员',
'2018-11-24 16:02:37', null);
-- ----------------------------
-- Table structure for bs_user
-- ----------------------------
# DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user`
(
`id` bigint NOT NULL COMMENT 'ID',
`mobile` varchar(40) NOT NULL COMMENT '手机号码',
`username` varchar(255) NOT NULL COMMENT '用户名称',
`password` varchar(255) DEFAULT NULL COMMENT '密码',
`enable_state` int(2) DEFAULT '1' COMMENT '启用状态 0是禁用,1是启用',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`department_id` bigint DEFAULT NULL COMMENT '部门ID',
`time_of_entry` datetime DEFAULT NULL COMMENT '入职时间',
`form_of_employment` int(1) DEFAULT NULL COMMENT '聘用形式',
`work_number` varchar(20) DEFAULT NULL COMMENT '工号',
`form_of_management` varchar(8) DEFAULT NULL COMMENT '管理形式',
`working_city` varchar(16) DEFAULT NULL COMMENT '工作城市',
`correction_time` datetime DEFAULT NULL COMMENT '转正时间',
`in_service_status` int(1) DEFAULT NULL COMMENT '在职状态 1.在职 2.离职',
`company_id` bigint DEFAULT NULL COMMENT '企业ID',
`company_name` varchar(40) DEFAULT NULL,
`department_name` varchar(40) DEFAULT NULL,
`level` varchar(40) DEFAULT NULL COMMENT '用户级别:saasAdmin,coAdmin,user',
`staff_photo` text comment '照片地址',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_user_phone` (`mobile`) USING BTREE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
-- ----------------------------
-- Records of sys_user
-- ----------------------------
INSERT INTO `sys_user`
VALUES ('1063705482939731968', '13800000001', 'cgx', '88012a09484c94fcec9e65b2377c44b9', null, '2018-11-17 16:08:44',
null, '2018-11-01 08:00:00', '1', '', null, null, '2018-11-01 00:00:00', null, null, null, null, 'saasAdmin',
null, null);
INSERT INTO `sys_user`
VALUES ('1063705989926227968', '13800000002', 'aj123', 'c8b7722b1139bb9b346409e503302e82', '1', '2018-11-17 16:10:45',
'1066241293639880704', '2018-11-02 08:00:00', '1', '9002', null, null, '2018-11-30 00:00:00', null, '1', '光之国',
'test1', 'coAdmin', 'http://pkbivgfrm.bkt.clouddn.com/1063705989926227968?t=1545788007343', null);
INSERT INTO `sys_user`
VALUES ('1066370498633486336', '13800000003', 'zbz', '14af10ffa3798486632a79cbbf469376', '1', null,
'1063678149528784896', '2018-11-04 08:00:00', '1', '111', null, null, '2018-11-20 00:00:00', null, '1', '光之国',
'测试部', 'user', 'http://pkbivgfrm.bkt.clouddn.com/1066370498633486336?t=1545812322518', null);
INSERT INTO `sys_user`
VALUES ('1071632760222810112', '13800000004', 'll', '456134d471010ecba14c6f89cac349ff', '1', null,
'1063678149528784896', '2018-12-02 08:00:00', '1', '1111', null, null, '2018-12-31 00:00:00', null, '1', '光之国',
'测试部', 'user', null, null);
INSERT INTO `sys_user`
VALUES ('1074238801330704384', '13400000001', 'a01', '80069fc2872ce3cf269053f4a84b2f0d', '1', '2018-12-16 17:44:22',
'1066240656856453120', '2018-01-01 00:00:00', '1', '1001', null, null, null, '1', '1', '光之国', '开发部', null, null,
null);
INSERT INTO `sys_user`
VALUES ('1074238801402007552', '13400000002', 'a02', 'a4f6437f96466ff2ad41dc8c46317e7f', '1', '2018-12-16 17:44:23',
'1066240656856453120', '2018-01-01 00:00:00', '1', '1002', null, null, null, '1', '1', '光之国', '开发部', null, null,
null);
INSERT INTO `sys_user`
VALUES ('1075383133106425856', '13500000001', 'test001', 'aa824c0d32d9725482e58a7503a20521', '1', null,
'1066240656856453120', '2018-01-01 00:00:00', '1', '2001', null, null, null, '1', '1', '光之国', '开发部', 'user',
null, null);
INSERT INTO `sys_user`
VALUES ('1075383135371350016', '13500000002', 'test002', 'becc21ed8df7975fc845c6c70f46c2dd', '1', null,
'1066240656856453120', '2018-01-01 00:00:00', '1', '2002', null, null, null, '1', '1', '光之国', '开发部', 'user',
null, null);
INSERT INTO `sys_user`
VALUES ('1075383135459430400', '13500000003', 'test003', '7321b9c9cfaa938abc7408147fc29441', '1', null,
'1066240656856453120', '2018-01-01 00:00:00', '1', '2003', null, null, null, '1', '1', '光之国', '开发部', 'user',
null, null);
-- ----------------------------
-- Table structure for pe_role
-- ----------------------------
# DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role`
(
`id` bigint NOT NULL COMMENT '主键ID',
`name` varchar(40) DEFAULT NULL COMMENT '权限名称',
`description` varchar(255) DEFAULT NULL COMMENT '说明',
`company_id` bigint DEFAULT NULL COMMENT '企业id',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `UK_k3beff7qglfn58qsf2yvbg41i` (`name`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT INTO `sys_role`
VALUES ('1062944989845262336', '人事经理', '负责整合人事部门', '1', null, null);
INSERT INTO `sys_role`
VALUES ('1064098829009293312', '系统管理员', '管理整合平台,可以操作企业所有功能', '1', null, null);
INSERT INTO `sys_role`
VALUES ('1064098935443951616', '人事专员', '只能操作员工菜单', '1', null, null);
INSERT INTO `sys_role`
VALUES ('1064099035536822272', '薪资专员', '绩效管理', '1', null, null);
-- ----------------------------
-- Table structure for sys_permission
-- ----------------------------
# DROP TABLE IF EXISTS `sys_permission`;
CREATE TABLE `sys_permission`
(
`id` bigint NOT NULL COMMENT '主键',
`description` text COMMENT '权限描述',
`name` varchar(255) DEFAULT NULL COMMENT '权限名称',
`type` tinyint(4) DEFAULT NULL COMMENT '权限类型 1为菜单 2为功能 3为API',
`pid` bigint DEFAULT 0 COMMENT '父节点',
`code` varchar(20) DEFAULT NULL,
`en_visible` int(1) DEFAULT NULL COMMENT '企业可见性 0:不可见,1:可见',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
INSERT INTO `sys_permission`
VALUES ('1', '3', 'SAAS企业管理', '1', '0', 'saas-clients', '0', null, null);
INSERT INTO `sys_permission`
VALUES ('1063313020819738624', '查看部门的按钮', '查看部门', '2', '1', 'point-dept', '0', null, null);
INSERT INTO `sys_permission`
VALUES ('1063315016368918528', '用户管理菜单', '员工管理', '1', '0', 'employees', '1', null, null);
INSERT INTO `sys_permission`
VALUES ('1063315194329042944', '用户删除按钮', '用户删除按钮', '2', '1063315016368918528', 'point-user-delete', '1', null, null);
INSERT INTO `sys_permission`
VALUES ('1063322760811515904', '删除api', '删除用户api', '3', '1063315194329042944', 'API-USER-DELETE', '1', null, null);
INSERT INTO `sys_permission`
VALUES ('1063327833876729856', '组织架构菜单', '组织架构', '1', '0', 'departments', '1', null, null);
INSERT INTO `sys_permission`
VALUES ('1063328114689576960', '公司设置菜单', '公司设置', '1', '0', 'settings', '1', null, null);
INSERT INTO `sys_permission`
VALUES ('1063328310592933888', '用户添加按钮', '用户添加按钮', '2', '1063315016368918528', 'POINT-USER-ADD', '1', null, null);
INSERT INTO `sys_permission`
VALUES ('1063328532492587008', '用户修改按钮', '用户修改按钮', '2', '1063315016368918528', 'POINT-USER-UPDATE', '1', null, null);
INSERT INTO `sys_permission`
VALUES ('1064104257952813056', null, '权限管理', '1', '0', 'permissions', '1', null, null);
INSERT INTO `sys_permission`
VALUES ('1064553683007705088', 'test', 'test', '1', '0', 'test', '1', null, null);
INSERT INTO `sys_permission`
VALUES ('1067396481381625856', '啊啊啊', '啊啊啊', '1', '0', '啊啊啊', '1', null, null);
# DROP TABLE IF EXISTS `sys_permission_api`;
CREATE TABLE `sys_permission_api`
(
`id` bigint NOT NULL COMMENT '主键ID',
`api_level` varchar(2) DEFAULT NULL COMMENT '权限等级,1为通用接口权限,2为需校验接口权限',
`api_method` varchar(255) DEFAULT NULL COMMENT '请求类型',
`api_url` varchar(255) DEFAULT NULL COMMENT '链接',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
INSERT INTO `sys_permission_api`
VALUES ('1063322760811515904', '1', 'delete', '/sys/user/delete');
# DROP TABLE IF EXISTS `sys_permission_menu`;
CREATE TABLE `sys_permission_menu`
(
`id` bigint NOT NULL COMMENT '主键ID',
`menu_icon` varchar(20) DEFAULT NULL COMMENT '权限代码',
`menu_order` varchar(40) DEFAULT NULL COMMENT '序号',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
INSERT INTO `sys_permission_menu`
VALUES ('1', 'abc5', '14');
INSERT INTO `sys_permission_menu`
VALUES ('1063315016368918528', 'menu-user', '1');
INSERT INTO `sys_permission_menu`
VALUES ('1063327833876729856', '2', '2');
INSERT INTO `sys_permission_menu`
VALUES ('1063328114689576960', '3', '3');
INSERT INTO `sys_permission_menu`
VALUES ('1064104257952813056', null, null);
INSERT INTO `sys_permission_menu`
VALUES ('1064553683007705088', '1', '1');
INSERT INTO `sys_permission_menu`
VALUES ('1067396481381625856', '1', '1');
INSERT INTO `sys_permission_menu`
VALUES ('2', 'def', '2');
# DROP TABLE IF EXISTS `sys_permission_point`;
CREATE TABLE `sys_permission_point`
(
`id` bigint NOT NULL COMMENT '主键ID',
`point_class` varchar(20) DEFAULT NULL COMMENT '按钮类型',
`point_icon` varchar(20) DEFAULT NULL COMMENT '按钮icon',
`point_status` int(11) DEFAULT NULL COMMENT '状态',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
INSERT INTO `sys_permission_point`
VALUES ('1063313020819738624', 'dept', 'dept', '1');
INSERT INTO `sys_permission_point`
VALUES ('1063315194329042944', 'point-user-delete', 'point-user-delete', '1');
INSERT INTO `sys_permission_point`
VALUES ('1063328310592933888', 'POINT-USER-ADD', 'POINT-USER-ADD', '1');
INSERT INTO `sys_permission_point`
VALUES ('1063328532492587008', 'POINT-USER-UPDATE', 'POINT-USER-UPDATE', '1');
-- ----------------------------
-- Table structure for sys_user_role
-- ----------------------------
-- DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE `sys_user_role`
(
`user_id` bigint NOT NULL COMMENT '用户ID',
`role_id` bigint NOT NULL COMMENT '角色ID',
PRIMARY KEY (`user_id`, `role_id`),
KEY `FK74qx7rkbtq2wqms78gljv87a1` (`role_id`),
KEY `FKee9dk0vg99shvsytflym6egx1` (`user_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
INSERT INTO `sys_user_role`
VALUES (1066370498633486336,1062944989845262336);
-- ----------------------------
-- Table structure for sys_role_permission
-- ----------------------------
-- DROP TABLE IF EXISTS `sys_role_permission`;
CREATE TABLE `sys_role_permission`
(
`role_id` bigint NOT NULL COMMENT '角色ID',
`permission_id` bigint NOT NULL COMMENT '权限ID',
PRIMARY KEY (`role_id`, `permission_id`),
KEY `FK74qx7rkbtq2wqms78gljv87a0` (`permission_id`),
KEY `FKee9dk0vg99shvsytflym6egxd` (`role_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
INSERT INTO `sys_role_permission`
VALUES ('1062944989845262336', '1063315016368918528');
INSERT INTO `sys_role_permission`
VALUES ('1062944989845262336', '1063328310592933888');
INSERT INTO `sys_role_permission`
VALUES ('1062944989845262336', '1063328532492587008'); |
DROP PROCEDURE CPI.GIPIS002_POPULATE_TABLES;
CREATE OR REPLACE PROCEDURE CPI.gipis002_populate_tables (
p_par_id IN gipi_wopen_policy.par_id%TYPE,
p_line_cd IN gipi_wopen_policy.line_cd%TYPE,
p_op_subline_cd IN gipi_wopen_policy.op_subline_cd%TYPE,
p_op_iss_cd IN gipi_wopen_policy.op_iss_cd%TYPE,
p_op_issue_yy IN gipi_wopen_policy.op_issue_yy%TYPE,
p_op_pol_seqno IN gipi_wopen_policy.op_pol_seqno%TYPE,
p_op_renew_no IN gipi_wopen_policy.op_renew_no%TYPE,
p_policy_id IN gipi_polbasic.policy_id%TYPE
)
IS
/* USED IN OPEN POLICY FOR GIPIS002 - BRY 09/21/2010*/
v_policy_id gipi_polbasic.policy_id%TYPE;
v_line_cd gipi_itmperil.line_cd%TYPE;
v_item_no gipi_item.item_no%TYPE;
v_peril_cd gipi_itmperil.peril_cd%TYPE;
v_tsi_amt gipi_itmperil.tsi_amt%TYPE;
v_prem_amt gipi_itmperil.prem_amt%TYPE;
v_ann_tsi_amt gipi_itmperil.ann_tsi_amt%TYPE;
v_ann_prem_amt gipi_itmperil.ann_prem_amt%TYPE;
v_prem_rt gipi_itmperil.prem_rt%TYPE;
v_rec_flag gipi_itmperil.rec_flag%TYPE;
v_curr_cd gipi_item.currency_cd%TYPE;
v_curr_rt gipi_item.currency_rt%TYPE;
v_itm_grp gipi_item.item_grp%TYPE;
v_endt_id gipi_polbasic.policy_id%TYPE;
v_subline_cd giex_expiry.subline_cd%TYPE;
v_currency_rt gipi_witem.currency_rt%TYPE;
v_comp_rem gipi_witmperl.comp_rem%TYPE;
v_item_title gipi_witem.item_title%TYPE;
CURSOR policy_tab
IS
SELECT policy_id, NVL (endt_seq_no, 0) endt_seq_no, pol_flag
FROM gipi_polbasic b
WHERE b.line_cd = p_line_cd
AND b.subline_cd = p_op_subline_cd
AND b.iss_cd = p_op_iss_cd
AND b.issue_yy = p_op_issue_yy
AND b.pol_seq_no = p_op_pol_seqno
AND b.renew_no = p_op_renew_no
AND (endt_seq_no = 0)
ORDER BY eff_date, endt_seq_no;
CURSOR endt_tab
IS
SELECT policy_id, NVL (endt_seq_no, 0) endt_seq_no, pol_flag
FROM gipi_polbasic b
WHERE b.line_cd = p_line_cd
AND b.subline_cd = p_op_subline_cd
AND b.iss_cd = p_op_iss_cd
AND b.issue_yy = p_op_issue_yy
AND b.pol_seq_no = p_op_pol_seqno
AND b.renew_no = p_op_renew_no
AND ( endt_seq_no = 0
OR ( endt_seq_no > 0
AND TRUNC (endt_expiry_date) >= TRUNC (expiry_date)
)
)
ORDER BY eff_date, endt_seq_no;
BEGIN
DELETE FROM gipi_witmperl
WHERE par_id = p_par_id;
DELETE FROM gipi_witem
WHERE par_id = p_par_id;
FOR b IN (SELECT currency_cd, currency_rt, item_grp
FROM gipi_item
WHERE policy_id = p_policy_id)
LOOP
v_curr_cd := b.currency_cd;
v_curr_rt := b.currency_rt;
v_itm_grp := b.item_grp;
END LOOP;
IF v_curr_cd IS NULL
THEN
--if endt, and no record is retrieved in gipi_item, get from orig policy
FOR b IN (SELECT currency_cd, currency_rt, item_grp
FROM gipi_item
WHERE policy_id =
(SELECT policy_id
FROM gipi_polbasic
WHERE line_cd = p_line_cd
AND subline_cd = p_op_subline_cd
AND iss_cd = p_op_iss_cd
AND issue_yy = p_op_issue_yy
AND pol_seq_no = p_op_pol_seqno
AND renew_no = p_op_renew_no
AND endt_seq_no = 0))
LOOP
v_curr_cd := b.currency_cd;
v_curr_rt := b.currency_rt;
v_itm_grp := b.item_grp;
END LOOP;
END IF;
INSERT INTO gipi_witem
(par_id, item_no, item_title, currency_cd, currency_rt,
item_grp
)
VALUES (p_par_id, 1, 'ITEM', v_curr_cd, v_curr_rt,
v_itm_grp
);
FOR polbasic IN policy_tab
LOOP
v_policy_id := polbasic.policy_id; -- added by aaron 10/31/2007
FOR DATA IN
(SELECT a.peril_cd, a.prem_amt, a.tsi_amt, a.tarf_cd, a.prem_rt,
a.comp_rem, a.line_cd, a.item_no, b.item_title,
b.pack_subline_cd, b.currency_rt, a.ann_tsi_amt,
a.ann_prem_amt
--added by aaron 10/31/2007 @fpac to correct value of ann_tsi_amt
FROM gipi_itmperil a, gipi_item b
WHERE a.policy_id = b.policy_id
AND a.item_no = b.item_no
AND a.policy_id = polbasic.policy_id)
LOOP
v_currency_rt := DATA.currency_rt;
v_peril_cd := DATA.peril_cd;
v_line_cd := DATA.line_cd;
v_prem_amt := DATA.prem_amt;
v_tsi_amt := DATA.tsi_amt;
v_item_title := DATA.item_title;
v_prem_rt := DATA.prem_rt;
v_comp_rem := DATA.comp_rem;
v_ann_tsi_amt := DATA.ann_tsi_amt;
-- added by aaron 10/31/2007 @fpac
v_ann_prem_amt := DATA.ann_prem_amt;
-- added by aaron 10/31/2007 @fpac
FOR row_no2 IN endt_tab
LOOP
v_endt_id := row_no2.policy_id;
FOR data2 IN
(SELECT a.prem_amt, a.tsi_amt, a.prem_rt, a.comp_rem,
a.ri_comm_rate, a.ri_comm_amt, b.item_title,
a.ann_tsi_amt,
--added by aaron 10/31/2007 @fpac to correct value of ann_tsi_amt
a.ann_prem_amt --added by aaron 10/31/2007 @fpac
FROM gipi_itmperil a, gipi_item b
WHERE a.policy_id = b.policy_id
AND a.item_no = b.item_no
AND peril_cd = v_peril_cd
AND a.item_no = DATA.item_no
AND a.policy_id = v_endt_id)
LOOP
IF v_policy_id <> v_endt_id
THEN
v_item_title := NVL (data2.item_title, v_item_title);
v_prem_amt := NVL (v_prem_amt, 0) + NVL (data2.prem_amt, 0);
v_tsi_amt := NVL (v_tsi_amt, 0) + NVL (data2.tsi_amt, 0);
v_ann_tsi_amt := NVL (data2.ann_tsi_amt, 0);
--added by aaron 10/31/2007 @fpac to correct value of ann_tsi_amt
v_ann_prem_amt := NVL (data2.ann_prem_amt, 0);
--added by aaron 10/31/2007 @fpac
IF NVL (data2.prem_rt, 0) > 0
THEN
v_prem_rt := data2.prem_rt;
END IF;
v_comp_rem := NVL (data2.comp_rem, v_comp_rem);
END IF;
END LOOP;
END LOOP;
IF NVL (v_tsi_amt, 0) > 0
THEN
--message('1');message('1');
INSERT INTO gipi_witmperl
(par_id, line_cd, item_no, peril_cd, tsi_amt,
prem_amt, prem_rt, ann_tsi_amt,
ann_prem_amt, rec_flag
)
VALUES (p_par_id, v_line_cd, 1, v_peril_cd, v_tsi_amt,
v_prem_amt, v_prem_rt, v_ann_tsi_amt,
v_ann_prem_amt, v_rec_flag
);
v_peril_cd := NULL;
v_line_cd := NULL;
v_prem_amt := NULL;
v_tsi_amt := NULL;
v_prem_rt := NULL;
v_currency_rt := NULL;
v_comp_rem := NULL;
END IF;
END LOOP;
END LOOP;
END gipis002_populate_tables;
/
|
select
uc.UserId
,IsFraud
,IsFraudDateChanged
,u.username
,case
when exists
(
select 1 from Debtors d
inner join Credits c on c.Id = d.CreditId
where c.UserId = uc.UserId
and d.Status != 3
)
then 1
else 0
end as isDebtor
from dbo.UserCards uc
inner join dbo.syn_CmsUsers u on u.userid = uc.IsFraudChangedByUserId
where uc.IsFraudDateChanged >= '20170731'
|
use [Lab_3]
insert into tbl_Book(Title, Author, Publisher, BookNumber) values ('Head First C#', 'Andrew Stellman', 'O''Reilly Media', 5);
insert into tbl_Book(Title, Author, Publisher, BookNumber) values ('Fahrenheit 451', 'Ray Bradbury', 'Simon & Schuster', 3);
insert into tbl_Book(Title, Author, Publisher, BookNumber) values ('The Cat in the Hat', 'Dr. Seuss', 'Random House', 2); |
use MyCompany_Database
Delete from YearComplexBudget
Delete from QuarterComplexBudget
Delete from MonthComplexBudget
Delete from BudgetProject
Delete from ComplexlBudget
Delete from BudgetCategory
Delete from TargetBudget
Delete from BudgetItem |
DROP TABLE IF EXISTS test1.`USER`;
CREATE TABLE test1.`USER`(
ID CHAR(36) PRIMARY KEY COMMENT '主键',
USERNAME VARCHAR(50) NOT NULL COMMENT '用户名',
PASSWORD VARCHAR(100) NOT NULL COMMENT '密码',
GENDER TINYINT(1) NOT NULL DEFAULT 0 COMMENT '性别:0保密 1女 2男',
AGE INT COMMENT '年龄'
);
DROP TABLE IF EXISTS test2.`USER`;
CREATE TABLE test2.`USER`(
ID CHAR(36) PRIMARY KEY COMMENT '主键',
USERNAME VARCHAR(50) NOT NULL COMMENT '用户名',
PASSWORD VARCHAR(100) NOT NULL COMMENT '密码',
GENDER TINYINT(1) NOT NULL DEFAULT 0 COMMENT '性别:0保密 1女 2男',
AGE INT COMMENT '年龄'
);
DROP TABLE IF EXISTS test3.`USER`;
CREATE TABLE test3.`USER`(
ID CHAR(36) PRIMARY KEY COMMENT '主键',
USERNAME VARCHAR(50) NOT NULL COMMENT '用户名',
PASSWORD VARCHAR(100) NOT NULL COMMENT '密码',
GENDER TINYINT(1) NOT NULL DEFAULT 0 COMMENT '性别:0保密 1女 2男',
AGE INT COMMENT '年龄'
); |
-- FUNKCJA który resetuje haslo
CREATE OR REPLACE FUNCTION reset_password(v_generated_code IN INTEGER, v_login IN VARCHAR2, v_new_password IN VARCHAR2)
RETURN BOOLEAN
IS
result BOOLEAN;
count_result INTEGER;
BEGIN
SELECT COUNT (*)
INTO count_result
FROM accounts a INNER JOIN mail_rst_pass
ON a.id_account = mrp.id_account
WHERE a.login = v_login AND generated_code = v_generated_code;
IF count_result = 1 THEN
UPDATE accounts SET password = v_new_password WHERE login = v_login;
UPDATE mail_rst_pass SET succesfull = 1, generated_code = NULL
WHERE generated_code = v_generated_code AND id_account = (SELECT id_account FROM accounts WHERE login = v_login);
result := TRUE;
ELSE
result := FALSE;
END IF;
END; |
select
c.id
,c.Timezone
,rt.Timezone as RealTimezone -- update c set c.Timezone = rt.Timezone
from client.Client c
inner join client.Address a1 on a1.ClientId = c.Id
and a1.AddressType = 1
left join client.Address a2 on a2.ClientId = c.Id
and a2.AddressType = 2
and c.RegAddressIsFact = 0
inner join client.RegionTimezone rt on rt.RegionCode = isnull(cast(a2.RegionId as int),cast(a1.RegionId as int))
where c.Timezone != rt.Timezone
|
DROP PROCEDURE IF EXISTS update_node_rating;
DELIMITER ;;
CREATE DEFINER=web@localhost PROCEDURE update_node_rating(IN $nid INT, IN $uid INT, IN $rating INT, IN $time INT)
COMMENT 'update user as a given user'
BEGIN
REPLACE INTO yp_ratings (nid,uid,rating,time) VALUES ( $nid, $uid, $rating, $time);
END ;;
DELIMITER ;
|
CREATE TABLE `person` (
`PersonID` INT(4) NOT NULL AUTO_INCREMENT,
`FirstName` VARCHAR(50) NOT NULL,
`LastName` VARCHAR(50) NOT NULL,
`EmailAddress` VARCHAR(60) NOT NULL,
PRIMARY KEY (`PersonID`)
);
CREATE TABLE `subscription` (
`SubscriptionID` INT(4) NOT NULL AUTO_INCREMENT,
`PersonID` INT(4) NOT NULL,
#`EmailAddress` VARCHAR(50) NOT NULL,
`Topic` VARCHAR(12) NOT NULL,
`ARN` VARCHAR(250) NOT NULL,
PRIMARY KEY (`SubscriptionID`),
CONSTRAINT `FK_Person_Person_ID` FOREIGN KEY (`PersonID`) REFERENCES `person` (`PersonID`)
);
CREATE TABLE `subscription` (
`SubscriptionID` INT(4) NOT NULL AUTO_INCREMENT,
`PersonID` INT(4) NOT NULL,
`IsComputerSub` BOOL NOT NULL,
`IsConsoleSub` BOOL NOT NULL,
`IsHeaterSub` BOOL NOT NULL,
`IsLawnSub` BOOL NOT NULL,
`IsToolSub` BOOL NOT NULL,
`IsTelevisionSub` BOOL NOT NULL,
PRIMARY KEY (`SubscriptionID`),
CONSTRAINT `FK_Person_Person_ID` FOREIGN KEY (`PersonID`) REFERENCES `person` (`PersonID`)
);
INSERT INTO person (FirstName, LastName, EmailAddress)
VALUES ('Andrew', 'White', 'white_andrewj@yahoo.com');
SELECT @@identity -- returns the key of the most recently changed record for the current connection
INSERT INTO subscription (PersonID, Topic, ARN)
VALUES (20, "Heater", "pending confirmation");
DROP TABLE person;
SELECT PersonID, FirstName, LastName, EmailAddress
FROM person
WHERE EmailAddress = "*"
SELECT person.EmailAddress, subscription.Topic, subscription.ARN
FROM subscription
INNER JOIN person ON subscription.PersonID = person.PersonID;
#WHERE clause comes after join statement
SELECT p.PersonID, p.FirstName, p.LastName, p.EmailAddress, s.Topic, s.ARN
FROM person p
LEFT OUTER JOIN subscription s ON s.PersonID = p.PersonID
#WHERE s.Topic = "Computer"
SELECT Topic, ARN
FROM subscription
WHERE PersonID = 44;
UPDATE subscription
SET ARN=""
WHERE PersonID=3 AND Topic="Heater"
DELETE FROM subscription
WHERE PersonID=3 AND Topic="Heater"
|
create database hibernate;
use hibernate;
create table Employee(
id int(11) unsigned primary key not null auto_increment,
nome varchar(20) default null,
role varchar(20) default null,
insert_time datetime default null
)ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; |
/* TODO implementation migrations */
CREATE TABLE `builds` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`charname` varchar(255) DEFAULT NULL,
`class` varchar(255) DEFAULT NULL,
`mastery1` varchar(255) DEFAULT NULL,
`mastery2` varchar(255) DEFAULT NULL,
`damagetype` varchar(255) DEFAULT NULL,
`activeskills` varchar(255) DEFAULT NULL,
`passiveskills` varchar(255) DEFAULT NULL,
`playstyle` varchar(255) DEFAULT NULL,
`version` varchar(255) DEFAULT NULL,
`gearreq` varchar(255) DEFAULT NULL,
`cruci` varchar(255) DEFAULT NULL,
`srlevel` varchar(255) DEFAULT NULL,
`guide` varchar(4096) DEFAULT NULL,
`author` varchar(255) DEFAULT NULL,
`primaryskill` varchar(255) DEFAULT NULL,
`link` varchar(255) DEFAULT NULL,
`purpose` varchar(255) DEFAULT NULL,
`blurb` varchar(1024) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1;
|
USE hutoma;
UPDATE `hutoma`.`entity` SET `hidden`=1 WHERE `name`='sys.person'; |
/* Drop Tables */
DROP TABLE PROGRESS CASCADE CONSTRAINTS;
DROP TABLE COURSE_VIDEO CASCADE CONSTRAINTS;
DROP TABLE ENROLMENT CASCADE CONSTRAINTS;
DROP TABLE POSTSCRIPTION CASCADE CONSTRAINTS;
DROP TABLE QNA CASCADE CONSTRAINTS;
DROP TABLE COURSE CASCADE CONSTRAINTS;
DROP TABLE DEPT CASCADE CONSTRAINTS;
DROP TABLE LECTURER CASCADE CONSTRAINTS;
DROP TABLE NOTICE CASCADE CONSTRAINTS;
DROP TABLE POINT CASCADE CONSTRAINTS;
DROP TABLE TECH CASCADE CONSTRAINTS;
DROP TABLE STUDENT CASCADE CONSTRAINTS;
/* Create Tables */
CREATE TABLE COURSE
(
COURSE_NO number(6) NOT NULL,
COURSE_NAME varchar2(100),
COURSE_SUMMARY varchar2(500),
COURSE_DETAIL varchar2(2000),
COURSE_POINT number(3,0),
LECTURER_NO number(3,0),
DEPT_NO number(2,0),
PRIMARY KEY (COURSE_NO)
);
CREATE TABLE COURSE_VIDEO
(
COURSE_VIDEO_NO number(4,0) NOT NULL,
COURSE_VIDEO_LINK varchar2(100) UNIQUE,
COURSE_VIDEO_TITLE varchar2(100),
COURSE_VIDEO_DESCRIPTION varchar2(500),
COURSE_VIDEO_ATTACHED varchar2(500),
COURSE_VIDEO_PERMIT char(1) DEFAULT 'N',
COURSE_VIDEO_ORDER number(2,0),
COURSE_NO number(6),
PRIMARY KEY (COURSE_VIDEO_NO)
);
CREATE TABLE DEPT
(
DEPT_NO number(2,0) NOT NULL,
DEPT_NAME varchar2(0) UNIQUE,
PRIMARY KEY (DEPT_NO)
);
CREATE TABLE ENROLMENT
(
ENROLMENT_NO number(4,0) NOT NULL,
ENROLMENT_START_DATE date DEFAULT SYSDATE,
STUDENT_NO number(3),
COURSE_NO number(6),
PRIMARY KEY (ENROLMENT_NO)
);
CREATE TABLE LECTURER
(
LECTURER_NO number(3,0) NOT NULL,
LECTURER_NAME varchar2(100),
LECTURER_EMAIL varchar2(256) UNIQUE,
LECTURER_PWD char(64),
LECTURER_PHONE varchar2(20),
LECTURER_CAREER varchar2(200),
LECTURER_PICTURE varchar2(500),
LECTURER_PERMIT char(1) DEFAULT 'N',
USER_TYPE char(1) DEFAULT 'T',
PRIMARY KEY (LECTURER_NO)
);
CREATE TABLE NOTICE
(
NOTICE_NO number(4,0) NOT NULL,
NOTICE_TITLE varchar2(100),
NOTICE_CONTENT varchar2(2000),
NOTICE_REGDATE date DEFAULT SYSDATE,
NOTICE_EXPIREDATE date,
NOTICE_ACTIVE char(1) DEFAULT 'Y',
PRIMARY KEY (NOTICE_NO)
);
CREATE TABLE POINT
(
POINT_PAYMENT number(5,0),
POINT_HISTORY varchar2(150),
POINT_DATE date DEFAULT SYSDATE,
STUDENT_NO number(3)
);
CREATE TABLE POSTSCRIPTION
(
POSTSCRIPTION_NO number(4,0) NOT NULL,
POSTSCRIPTION_TITLE varchar2(100),
POSTSCRIPTION_CONTENT varchar2(2000),
POSTSCRIPTION_REGDATE date,
POSTSCRIPTION_GRADE number(1),
POSTSCRIPTION_ACTIVE char(1) DEFAULT 'Y',
STUDENT_NO number(3),
COURSE_NO number(6),
PRIMARY KEY (POSTSCRIPTION_NO)
);
CREATE TABLE PROGRESS
(
PROGRESS_COMPLETE char(1) DEFAULT 'N',
STUDENT_NO number(3),
COURSE_VIDEO_NO number(4,0)
);
CREATE TABLE QNA
(
QNA_NO number(4,0) NOT NULL,
QNA_TITLE varchar2(100),
QNA_QUES_CONTENT varchar2(2000),
QNA_QUES_DATE date DEFAULT SYSDATE,
QNA_ANS_CONTENT varchar2(500),
QNA_ANS_REGDATE date DEFAULT SYSDATE,
QNA_ACTIVE char(1) DEFAULT 'Y',
COURSE_NO number(6),
STUDENT_NO number(3),
PRIMARY KEY (QNA_NO)
);
CREATE TABLE STUDENT
(
STUDENT_NO number(3) NOT NULL,
STUDENT_NAME varchar2(100),
STUDENT_EMAIL varchar2(256) UNIQUE,
STUDENT_PWD char(64),
STUDENT_PHONE varchar2(20),
STUDENT_POINT number(6),
USER_TYPE char(1) DEFAULT 'S',
PRIMARY KEY (STUDENT_NO)
);
CREATE TABLE TECH
(
TECH_NO number(4,0) NOT NULL,
TECH_TITLE varchar2(100),
TECH_QUES_CONTENT varchar2(2000),
TECH_QUES_REGDATE date DEFAULT SYSDATE,
TECH_ANS_CONTENT varchar2(500),
TECH_ANS_REGDATE date DEFAULT SYSDATE,
TECH_ACTIVE char(1) DEFAULT 'Y',
STUDENT_NO number(3),
PRIMARY KEY (TECH_NO)
);
/* Create Foreign Keys */
ALTER TABLE COURSE_VIDEO
ADD FOREIGN KEY (COURSE_NO)
REFERENCES COURSE (COURSE_NO)
;
ALTER TABLE ENROLMENT
ADD FOREIGN KEY (COURSE_NO)
REFERENCES COURSE (COURSE_NO)
;
ALTER TABLE POSTSCRIPTION
ADD FOREIGN KEY (COURSE_NO)
REFERENCES COURSE (COURSE_NO)
;
ALTER TABLE QNA
ADD FOREIGN KEY (COURSE_NO)
REFERENCES COURSE (COURSE_NO)
;
ALTER TABLE PROGRESS
ADD FOREIGN KEY (COURSE_VIDEO_NO)
REFERENCES COURSE_VIDEO (COURSE_VIDEO_NO)
;
ALTER TABLE COURSE
ADD FOREIGN KEY (DEPT_NO)
REFERENCES DEPT (DEPT_NO)
;
ALTER TABLE COURSE
ADD FOREIGN KEY (LECTURER_NO)
REFERENCES LECTURER (LECTURER_NO)
;
ALTER TABLE ENROLMENT
ADD FOREIGN KEY (STUDENT_NO)
REFERENCES STUDENT (STUDENT_NO)
;
ALTER TABLE POINT
ADD FOREIGN KEY (STUDENT_NO)
REFERENCES STUDENT (STUDENT_NO)
;
ALTER TABLE POSTSCRIPTION
ADD FOREIGN KEY (STUDENT_NO)
REFERENCES STUDENT (STUDENT_NO)
;
ALTER TABLE PROGRESS
ADD FOREIGN KEY (STUDENT_NO)
REFERENCES STUDENT (STUDENT_NO)
;
ALTER TABLE QNA
ADD FOREIGN KEY (STUDENT_NO)
REFERENCES STUDENT (STUDENT_NO)
;
ALTER TABLE TECH
ADD FOREIGN KEY (STUDENT_NO)
REFERENCES STUDENT (STUDENT_NO)
;
|
--Tabelas principais
create table funcionario(
id_funcionario serial not null,
nome varchar(100),
cpf varchar(11),
data_nascimento date,
usuario varchar(100),
senha varchar(100),
permissão varchar(1),
primary key(id_funcionario)
);
create table operacao(
id_operacao serial not null,
descricao varchar(100),
tipo varchar(1),
primary key(id_operacao)
);
create table estoque(
id_mercadoria serial not null,
descricao varchar(100),
estoque integer,
estoque_minimo integer,
primary key(id_mercadoria)
);
create table setor(
id_setor serial not null,
descricao varchar(100),
primary key(id_setor)
);
create table movimentacao(
id_movimento serial not null,
data_movimentacao date,
observacao varchar(500),
id_setor integer,
id_operacao integer,
id_funcionario integer,
id_usuario integer,
primary key(id_movimento),
foreign key(id_setor) references setor(id_setor),
foreign key(id_operacao) references operacao(id_operacao),
foreign key(id_funcionario) references funcionario(id_funcionario),
foreign key(id_usuario) references funcionario(id_funcionario)
);
create table movimento_item(
id_movimento integer not null,
id_mercadoria integer not null,
quantidade integer,
primary key(id_movimento,id_mercadoria)
)
|
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 11, 2017 at 01:57 PM
-- Server version: 5.7.14
-- PHP Version: 5.6.25
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: `university`
--
-- --------------------------------------------------------
--
-- Table structure for table `courses`
--
CREATE TABLE `courses` (
`courses_id` int(5) NOT NULL,
`courses_course_name` varchar(50) NOT NULL,
`courses_course_section` varchar(50) NOT NULL,
`courses_course_houres` varchar(50) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `courses`
--
INSERT INTO `courses` (`courses_id`, `courses_course_name`, `courses_course_section`, `courses_course_houres`) VALUES
(3, '', '', ''),
(2, 'aaq', 'aa', '1'),
(4, '22', '22', '22');
-- --------------------------------------------------------
--
-- Table structure for table `coursesofstudent`
--
CREATE TABLE `coursesofstudent` (
`Student_courses_student_id` int(11) NOT NULL,
`Student_courses_course_id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `coursesofstudent`
--
INSERT INTO `coursesofstudent` (`Student_courses_student_id`, `Student_courses_course_id`) VALUES
(1, 2),
(1, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(7, 2),
(1, 2),
(1, 2);
-- --------------------------------------------------------
--
-- Table structure for table `students`
--
CREATE TABLE `students` (
`Student_id` int(5) NOT NULL,
`Student_First_Name` varchar(50) NOT NULL,
`Student_Last_Name` varchar(50) NOT NULL,
`Student_Email` varchar(100) NOT NULL,
`Student_City` varchar(30) NOT NULL,
`Student_Contry` varchar(30) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `students`
--
INSERT INTO `students` (`Student_id`, `Student_First_Name`, `Student_Last_Name`, `Student_Email`, `Student_City`, `Student_Contry`) VALUES
(1, 'aa', 'aa', 'aa', 'aa', 'aa'),
(2, 'aaaaa', 'aaa', 'aa', 'aa', 'aa'),
(3, 'ayman', 'ayyad', 'a@a.com', 'Palestine', 'gaza'),
(4, 'ayman', 'ayyad', 'a@a.com', 'Palestine', 'gaza'),
(5, 'ayman', 'ayyad', 'a@a.com', 'Palestine', 'gaza'),
(6, 'ayman', 'ayyad', 'a@a.com', 'Palestine', 'gaza'),
(7, 'ayman', 'ayyad', 'a@a.com', 'Palestine', 'gaza'),
(8, 'as', 'as', 'sa', 'as', 'as');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `courses`
--
ALTER TABLE `courses`
ADD PRIMARY KEY (`courses_id`);
--
-- Indexes for table `coursesofstudent`
--
ALTER TABLE `coursesofstudent`
ADD KEY `Student_courses_student_id` (`Student_courses_student_id`),
ADD KEY `Student_courses_course_id` (`Student_courses_course_id`);
--
-- Indexes for table `students`
--
ALTER TABLE `students`
ADD PRIMARY KEY (`Student_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `courses`
--
ALTER TABLE `courses`
MODIFY `courses_id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
MODIFY `Student_id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
/*!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 */;
|
--
-- import genealiases from a TAIR10 gene_aliases file
--
DELETE FROM genealiases;
COPY genealiases (locusname,symbol,fullname) FROM '/home/sam/genomes/TAIR10/gene_aliases_20140331.txt' WITH CSV HEADER DELIMITER AS ' ';
|
DATABASE CREATE `contact_test`
USE `contact_test`
CREATE TABLE `contact_info_saved` (
`id` int(6) NOT NULL,
`contact_name` text NOT NULL,
`contact_email` text NOT NULL,
`contact_phone` text,
`contact_message` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
ALTER TABLE `contact_info_saved`
ADD PRIMARY KEY (`id`);
ALTER TABLE `contact_info_saved`
MODIFY `id` int(6) NOT NULL AUTO_INCREMENT;
COMMIT; |
ALTER TABLE vedtak ADD COLUMN saksbehandler_ident VARCHAR DEFAULT NULL;
ALTER TABLE vedtak ADD COLUMN beslutter_ident VARCHAR DEFAULT NULL; |
-- **************************************************************
-- Respuestas a Sakila - Consultas (Queries)
-- **************************************************************
-- Base de Datos Usada
USE sakila;
-- **************************************************************
-- **************************************************************
-- 1. ¿Qué consulta ejecutarías para obtener todos los clientes dentro de city_id = 312?
-- Su consulta debe devolver el nombre, apellido, correo electrónico y dirección del cliente.
SELECT b.city_id, a.first_name, a.last_name, a.email, c.address
FROM customer a, city b, address c
WHERE b.city_id = 312 and b.city_id = c.city_id and a.address_id = c.address_id;
-- **************************************************************
-- **************************************************************
-- 2. ¿Qué consulta harías para obtener todas las películas de comedia?
-- Su consulta debe devolver el título de la película, la descripción, el año de estreno, la calificación,
-- las características especiales y el género (categoría).
SELECT a.film_id, a.title, a.description, a.release_year, a.rating, a.special_features, c.name as "Género"
FROM film a, film_category b, category c
WHERE c.name = "Comedy" and b.category_id = c.category_id and a.film_id = b.film_id;
-- **************************************************************
-- **************************************************************
-- 3. ¿Qué consulta harías para obtener todas las películas unidas por actor_id = 5?
-- Su consulta debe devolver la identificación del actor, el nombre del actor, el título de la película,
-- la descripción y el año de lanzamiento.
SELECT b.actor_id, concat(b.first_name, " ", b.last_name) as NombreActor, c.film_id, a.title, a.description, a.release_year
FROM film a, actor b, film_actor c
WHERE b.actor_id = 5 and b.actor_id = c.actor_id and a.film_id = c.film_id;
-- **************************************************************
-- **************************************************************
-- 4. ¿Qué consulta ejecutaría para obtener todos los clientes en store_id = 1 y dentro de estas ciudades (1, 42, 312 y 459)?
-- Su consulta debe devolver el nombre, apellido, correo electrónico y dirección del cliente.
SELECT a.store_id, b.city_id, a.first_name, a.last_name, a.email, d.address
FROM customer a, city b, store c, address d
WHERE a.store_id = 1 and a.store_id = c.store_id and b.city_id in (1, 42, 312, 459)
and a.address_id = d.address_id and b.city_id = d.city_id;
-- **************************************************************
-- **************************************************************
-- 5. ¿Qué consulta realizarías para obtener todas las películas con una "calificación = G" y
-- "característica especial = detrás de escena", unidas por actor_id = 15?
-- Su consulta debe devolver el título de la película, la descripción, el año de lanzamiento,
-- la calificación y la función especial. Sugerencia: puede usar la función LIKE para obtener la parte 'detrás de escena'.
SELECT a.title, a.description, a.release_year, a.rating, a.special_features
FROM film a, actor b, film_actor c
WHERE a.rating = "G" and a.special_features like "%Behind the Scenes%" and b.actor_id = 15
and b.actor_id = c.actor_id and a.film_id = c.film_id;
-- **************************************************************
-- **************************************************************
-- 6. ¿Qué consulta harías para obtener todos los actores que se unieron en el film_id = 369?
-- Su consulta debe devolver film_id, title, actor_id y actor_name.
SELECT a.film_id, a.title, b.actor_id, concat(b.first_name, " ", b.last_name) as NombreActor
FROM film a, actor b, film_actor c
WHERE a.film_id = 369 and b.actor_id = c.actor_id and a.film_id = c.film_id;
-- **************************************************************
-- **************************************************************
-- 7. ¿Qué consulta harías para obtener todas las películas dramáticas con una tarifa de alquiler de 2.99?
-- Su consulta debe devolver el título de la película, la descripción, el año de estreno, la calificación,
-- las características especiales y el género (categoría).
SELECT a.film_id, a.title, a.description, a.release_year, a.rating, a.special_features, c.name as "Género", a.rental_rate
FROM film a, film_category b, category c
WHERE a.rental_rate = 2.99 and c.name = "Drama" and b.category_id = c.category_id and a.film_id = b.film_id;
-- **************************************************************
-- **************************************************************
-- 8. ¿Qué consulta harías para obtener todas las películas de acción a las que se une SANDRA KILMER?
-- Su consulta debe devolver el título de la película, la descripción, el año de estreno, la calificación,
-- las características especiales, el género (categoría) y el nombre y apellido del actor.
SELECT b.actor_id, concat(b.first_name, " ", b.last_name) as NombreActor, c.film_id, a.title,
a.description, a.release_year, a.rating, a.special_features, e.name as "Género"
FROM film a, actor b, film_actor c, film_category d, category e
WHERE b.first_name = "SANDRA" and b.last_name = "KILMER" and b.actor_id = c.actor_id and a.film_id = c.film_id and
e.name = "Action" and d.category_id = e.category_id and a.film_id = d.film_id;
-- **************************************************************
|
/*Books need 6*/
INSERT INTO books (id, title, year) VALUES
(1, "Hurdy Putter", 1993),
(2, "Hurdy Putter", 1993),
(3, "Hurdy Putter", 1993),
(4, "Hurdy Putter", 1993),
(5, "Hurdy Putter", 1993),
(6, "Hurdy Putter", 1993);
/*joins needs 16*/
INSERT INTO character_books (id, book_id, character_id) VALUES
(1, 2, 2),
(2, 2, 2),
(3, 2, 2),
(4, 2, 2),
(5, 2, 2),
(6, 2, 2),
(7, 2, 2),
(8, 2, 2),
(9, 2, 2),
(10, 2, 2),
(11, 2, 2),
(12, 2, 2),
(13, 2, 2),
(14, 2, 2),
(15, 2, 2),
(16, 2, 2);
/*characters needs 8*/
INSERT INTO characters (id, name, motto, species) VALUES
(2, "Joe", "Bazinga", "Human"),
(3, "Joe", "Bazinga", "Human"),
(4, "Joe", "Bazinga", "Human"),
(5, "Joe", "Bazinga", "Human"),
(6, "Joe", "Bazinga", "Human"),
(7, "Joe", "Bazinga", "Human"),
(8, "Joe", "Bazinga", "Human"),
(9, "Joe", "Bazinga", "Human");
/*authors, 2*/
INSERT INTO authors (id, name) VALUES
(1, "Jippie"),
(2, "Jones");
/*subgenres, 2*/
INSERT INTO subgenres (name) VALUES
("scary"),
("not scary");
/*series, 2*/
INSERT INTO series (title, author_id, subgenre_id) VALUES
("HURDY", 1, 2),
("HURDY", 1, 2);
|
INSERT INTO cars (brand, year, color) VALUES
('Audi', 1992, 'Red'),
('Fiat', 2001, 'Red'),
('Mercedes', 1991, 'Brown'),
('Fiat', 1962, 'Black'),
('Renault', 1997, 'Brown'),
('Renault', 1967, 'Maroon'),
('Renault', 1986, 'Yellow'),
('BMW', 1970, 'Maroon'),
('Fiat', 1990, 'Silver'),
('Renault', 1972, 'Black');
INSERT INTO owners (lastName) VALUES
('Pesho'),('Misho'),('Kosyo');
INSERT INTO carOwners (carId, ownerId) VALUES
(1,1), (1,2),(1,3),
(2,1),(2,2);
INSERT INTO tyres (manufacturer) VALUES
('Mishelin'),('Goodyer');
INSERT INTO carTyres (carId, tyreId) VALUES
(1,1),
(2,1),(2,2),
(3,1),
(4,2),
(5,2);
INSERT INTO users (enabled, password, role, username) VALUES
(true, '$2a$10$YYf3ANYshH/43xAzxDoRC.4FLNF//uV1ne.h.xPIU6DGJ/C/GGi1.', 'ADMIN', 'ivoqwe'); |
DELETE FROM carts
WHERE product_id = $1 AND user_id = $2; |
--@Autor: Flores Fuentes Kevin y Torres Verastegui Jose Antonio
--@Fecha creación: 18/06/2020
--@Descripción: Compound trigger para asignación de placas
set serveroutput on
create or replace trigger tr_revisa_placa
for insert or update of placa_id on vehiculo
compound trigger
before each row is
v_placa_inactiva number;
begin
-- Revisando si la placa ya está marcada como inactiva
select inactiva into v_placa_inactiva
from placa
where placa_id = :new.placa_id;
if v_placa_inactiva = 1 then
raise_application_error(-20050, 'La placa es inactiva');
end if;
end before each row;
after each row is
begin
update placa
set fecha_asignacion = sysdate
where placa_id = :new.placa_id;
end after each row;
end tr_revisa_placa;
/ |
CREATE TABLE "user"
(
"id" SERIAL PRIMARY KEY,
"username" VARCHAR (80) UNIQUE NOT NULL,
"password" VARCHAR (1000) NOT NULL
);
CREATE TABLE "groups"
(
"id" SERIAL PRIMARY KEY,
"group_name" VARCHAR NOT NULL,
"passcode" VARCHAR NOT NULL,
"family_passcode" VARCHAR
);
CREATE TABLE "family"
(
"id" SERIAL PRIMARY KEY,
"first_name1" VARCHAR (50) NOT NULL,
"last_name1" VARCHAR (50) NOT NULL,
"first_name2" VARCHAR,
"last_name2" VARCHAR,
"email" VARCHAR (100) NOT NULL,
"street_address" VARCHAR,
"city" VARCHAR,
"state" VARCHAR,
"zip_code" VARCHAR,
"phone_number" VARCHAR NOT NULL,
"image" VARCHAR,
"user_id" INT REFERENCES "user",
"family_passcode" VARCHAR,
"group_id" INT REFERENCES "groups"
);
CREATE TABLE "kid"
(
"id" SERIAL PRIMARY KEY,
"first_name" VARCHAR (50) NOT NULL,
"last_name" VARCHAR (50) NOT NULL,
"birthdate" DATE NOT NULL,
"allergies" VARCHAR,
"medication" VARCHAR,
"image" VARCHAR,
"family_id" INT REFERENCES "family",
"notes" VARCHAR (500)
);
CREATE TABLE "event"
(
"id" SERIAL PRIMARY KEY,
"event_date" varchar(200),
"event_time_start" TIME NOT NULL,
"event_time_end" TIME NOT NULL,
"total_hours" INTEGER,
"event_confirmed" BOOLEAN DEFAULT False,
"requester_id" INT REFERENCES "family",
"claimer_id" INT REFERENCES "family",
"group_id" INT REFERENCES "groups",
"notes" varchar(300),
"offer_needed" Boolean,
"event_claimed" Boolean DEFAULT FALSE,
"claimer_notes" varchar(300)
);
CREATE TABLE "feed"
(
"id" SERIAL PRIMARY KEY,
"event_id" INT REFERENCES "event"
);
|
SELECT
n.id,
n.isInitial,
n.nodeTypeId as id,
n.decisionTreeId as id,
dt.version,
dt.description,
dt.isCurrent
FROM
Node n
INNER JOIN DecisionTree dt ON
dt.id = n.decisionTreeId
WHERE
n.id = @id |
SELECT count(order_id) AS order_count,
sum(tax_amount) AS tax_total,
avg(tax_amount) AS tax_average
FROM orders; |
select count(*) as validation_errors
from `mlab-recreate`.`dbt_pipeline_deposit`.`my_second_dbt_model`
where id is null
|
SET VERIFY OFF
ACCEPT pTablespace PROMPT "Type TABLESPACE_NAME: "
SELECT DBMS_METADATA.GET_DDL('TABLESPACE','&pTablespace')
FROM DUAL
/
SET VERIFY ON |
DROP TABLE IF EXISTS user;
DROP TABLE IF EXISTS post;
CREATE TABLE user (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT UNIQUE NOT NULL,
password TEXT NOT NULL
);
CREATE TABLE post (
id INTEGER PRIMARY KEY AUTOINCREMENT,
author_id INTEGER NOT NULL,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
title TEXT NOT NULL,
body TEXT NOT NULL,
FOREIGN KEY (author_id) REFERENCES user (id)
); |
-- create schema Assignment;
-- use Assignment;
/*The Stock price data provided is from 1-Jan-2015 to 31-July-2018 for six stocks:
Eicher Motors, Hero, Bajaj Auto, TVS Motors, Infosys and TCS.
A new schema called 'Assignment' is created.
The CSV files are imported in MySQL, naming the tables as the name of the stocks.
*/
-- ***************Part 1******************************************************
/* Create a new table named 'bajaj1'
containing the date, close price, 20 Day MA and 50 Day MA from table bajaj auto (This has to be done for all 6 stocks)
*/
-- STR_TO_DATE() function is used for conversion of Date from type text to standard date format
# bajaj1
create view t1 as( -- view to convert date to standard format from text type
Select STR_TO_DATE(Date,'%d-%M-%Y') as Date,
`Close Price` from `bajaj auto`
order by Date ASC);
create view t2 as( -- view to introduce new column `introw` to store current row no
Select Date,`Close Price`,
ROW_NUMBER() OVER () AS intRow,
if(ROW_NUMBER() OVER ()>19, -- to set previous 19 rows moving average as null
AVG(`Close Price`) OVER (ROWS 19 PRECEDING),NULL)MA20, -- window function to calculate 20 and 50 day moving averages
if(ROW_NUMBER() OVER ()>49, -- to set previous 49 rows moving average as null
AVG(`Close Price`) OVER (ROWS 49 PRECEDING),NULL)MA50
from t1
order by Date ASC);
create table bajaj1 as( -- Create table 'bajaj1' containing the date, close price, 20 Day MA and 50 Day MA.
Select Date,`Close Price`,
MA20 as `20 Day MA`,MA50 as `50 Day MA`
from t2);
# select * from bajaj1;
# eicher1
drop view t1; -- remove previously created view t1
drop view t2; -- remove previously created view t2
create view t1 as( -- view to convert date to standard format from text type
Select STR_TO_DATE(Date,'%d-%M-%Y') as Date,
`Close Price` from `eicher motors`
order by Date ASC);
create view t2 as( -- view to introduce new column `introw` to store current row no
Select Date,`Close Price`,
ROW_NUMBER() OVER () AS intRow,
if(ROW_NUMBER() OVER ()>19, -- to set previous 19 rows moving average as null
AVG(`Close Price`) OVER (ROWS 19 PRECEDING),NULL)MA20, -- window function to calculate 20 and 50 day moving averages
if(ROW_NUMBER() OVER ()>49, -- to set previous 49 rows moving average as null
AVG(`Close Price`) OVER (ROWS 49 PRECEDING),NULL)MA50
from t1
order by Date ASC);
create table eicher1 as( -- Create table 'eicher1' containing the date, close price, 20 Day MA and 50 Day MA.
Select Date,`Close Price`,
MA20 as `20 Day MA`,MA50 as `50 Day MA`
from t2);
#select * from eicher1;
# hero1
drop view t1; -- remove previously created view t1
drop view t2; -- remove previously created view t2
create view t1 as( -- view to convert date to standard format from text type
Select STR_TO_DATE(Date,'%d-%M-%Y') as Date,
`Close Price` from `hero motocorp`
order by Date ASC);
create view t2 as( -- view to introduce new column `introw` to store current row no
Select Date,`Close Price`,
ROW_NUMBER() OVER () AS intRow,
if(ROW_NUMBER() OVER ()>19, -- to set previous 19 rows moving average as null
AVG(`Close Price`) OVER (ROWS 3 PRECEDING),NULL)MA20, -- window function to calculate 20 and 50 day moving averages
if(ROW_NUMBER() OVER ()>49, -- to set previous 49 rows moving average as null
AVG(`Close Price`) OVER (ROWS 5 PRECEDING),NULL)MA50
from t1
order by Date ASC);
create table hero1 as( -- Create table 'hero1' containing the date, close price, 20 Day MA and 50 Day MA.
Select Date,`Close Price`,
MA20 as `20 Day MA`,MA50 as `50 Day MA`
from t2);
#select * from hero1;
# infosys1
drop view t1; -- remove previously created view t1
drop view t2; -- remove previously created view t2
create view t1 as( -- view to convert date to standard format from text type
Select STR_TO_DATE(Date,'%d-%M-%Y') as Date,
`Close Price` from `infosys`
order by Date ASC);
create view t2 as( -- view to introduce new column `introw` to store current row no
Select Date,`Close Price`,
ROW_NUMBER() OVER () AS intRow,
if(ROW_NUMBER() OVER ()>19, -- to set previous 19 rows moving average as null
AVG(`Close Price`) OVER (ROWS 19 PRECEDING),NULL)MA20, -- window function to calculate 20 and 50 day moving averages
if(ROW_NUMBER() OVER ()>49, -- to set previous 49 rows moving average as null
AVG(`Close Price`) OVER (ROWS 49 PRECEDING),NULL)MA50
from t1
order by Date ASC);
create table infosys1 as( -- Create table 'infosys1' containing the date, close price, 20 Day MA and 50 Day MA.
Select Date,`Close Price`,
MA20 as `20 Day MA`,MA50 as `50 Day MA`
from t2);
#select * from infosys1;
# tcs1
drop view t1; -- remove previously created view t1
drop view t2; -- remove previously created view t2
create view t1 as( -- view to convert date to standard format from text type
Select STR_TO_DATE(Date,'%d-%M-%Y') as Date,
`Close Price` from `tcs`
order by Date ASC);
create view t2 as( -- view to introduce new column `introw` to store current row no
Select Date,`Close Price`,
ROW_NUMBER() OVER () AS intRow,
if(ROW_NUMBER() OVER ()>19, -- to set previous 19 rows moving average as null
AVG(`Close Price`) OVER (ROWS 19 PRECEDING),NULL)MA20, -- window function to calculate 20 and 50 day moving averages
if(ROW_NUMBER() OVER ()>49, -- to set previous 49 rows moving average as null
AVG(`Close Price`) OVER (ROWS 49 PRECEDING),NULL)MA50
from t1
order by Date ASC);
create table tcs1 as( -- Create table 'tcs1' containing the date, close price, 20 Day MA and 50 Day MA.
Select Date,`Close Price`,
MA20 as `20 Day MA`,MA50 as `50 Day MA`
from t2);
#select * from tcs1;
# tvs1
drop view t1; -- remove previously created view t1
drop view t2; -- remove previously created view t2
create view t1 as( -- view to convert date to standard format from text type
Select STR_TO_DATE(Date,'%d-%M-%Y') as Date,
`Close Price` from `tvs motors`
order by Date ASC);
create view t2 as( -- view to introduce new column `introw` to store current row no
Select Date,`Close Price`,
ROW_NUMBER() OVER () AS intRow,
if(ROW_NUMBER() OVER ()>19, -- to set previous 19 rows moving average as null
AVG(`Close Price`) OVER (ROWS 3 PRECEDING),NULL)MA20, -- window function to calculate 20 and 50 day moving averages
if(ROW_NUMBER() OVER ()>49, -- to set previous 49 rows moving average as null
AVG(`Close Price`) OVER (ROWS 5 PRECEDING),NULL)MA50
from t1
order by Date ASC);
create table tvs1 as( -- Create table 'tvs1' containing the date, close price, 20 Day MA and 50 Day MA.
Select Date,`Close Price`,
MA20 as `20 Day MA`,MA50 as `50 Day MA`
from t2);
#select * from tvs1;
drop view t1; -- remove previously created view t1
drop view t2; -- remove previously created view t2
-- ***************Part 2******************************************************
/* Create a master table containing the date and close price of all the six stocks.
(Column header for the price is the name of the stock)
*/
create table mastertable as(
SELECT b.Date,b.`Close Price` as Bajaj,
e.`Close Price`as Eicher,
h.`Close Price` as Hero,
i.`Close Price` as Infosys,
tcs1.`Close Price` as TCS,
t.`Close Price` as TVS
FROM `bajaj1` as b LEFT JOIN `eicher1` as e ON b.Date= e.Date -- LEFT JOIN joins two tables and fetches rows
LEFT JOIN `hero1` as h ON e.date = h.date -- based on a condition, which is matching in both the tables and the
LEFT JOIN `infosys1` as i ON h.date = i.date -- unmatched rows will also be available from the table
LEFT JOIN `tcs1` ON i.date = tcs1.date -- written before the JOIN clause.
LEFT JOIN `tvs1` as t ON tcs1.date = t.date);
#select * from mastertable;
-- ***************Part 3******************************************************
/* Use the tables created in Part(1) to generate buy and sell signal.
Store this in another table named 'bajaj2'. Perform this operation for all stocks.
*/
/*When the shorter-term moving average crosses above the longer-term moving average,
it is a signal to BUY, as it indicates that the trend is shifting up.
On the opposite when the shorter term moving average crosses below the longer term moving average,
it is a signal to SELL, as it indicates the trend is shifting down.
***************
A signal is generated only when the moving averages cross each other.
Merely being above or below is not sufficient to generate a signal.
For example, if in continuos dates 20 day moving average is greater than 50 day moving average
then signal is 'hold' but
if on previous date 20 day moving average is greater than 50 day moving average
and the next day it becomes lower than 50 day becoming average then signal is generated to sell the stock
Similarly, if on previous date 20 day moving average is less than 50 day moving average
and the next day it becomes greater than 50 day becoming average then signal is generated to buy the stock
In all other cases, it is advised to hold.
*/
/* The LAG() function is used in tables bajaj2,eicher2,hero2,infosys2,tcs2 and tvs2
to get value from row that precedes the current row
and check the crossing over of moving averages
*/
# bajaj2
create table bajaj2 as(
SELECT Date,`Close Price`,
if(`20 Day MA`>`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING)< lag(`50 Day MA`) -- checks the previous values of moving averages (BUY SIGNAL)
OVER (ROWS 1 PRECEDING)),"Buy", -- for crossing over of `20 Day Ma` and `50 Day Ma`
if(`20 Day MA`<`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING) > lag(`50 Day MA`) -- checks the previous values of moving averages (SELL SIGNAL)
OVER (ROWS 1 PRECEDING)),"Sell","Hold"))`Signal` -- for crossing over of `20 Day Ma` and `50 Day Ma`
from bajaj1);
#select * from bajaj2;
# eicher2
create table eicher2 as(
SELECT Date,`Close Price`,
if(`20 Day MA`>`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING)< lag(`50 Day MA`)
OVER (ROWS 1 PRECEDING)),"Buy",
if(`20 Day MA`<`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING) > lag(`50 Day MA`)
OVER (ROWS 1 PRECEDING)),"Sell","Hold"))`Signal`
from eicher1);
#select * from eicher2;
# hero2
create table hero2 as(
SELECT Date,`Close Price`,
if(`20 Day MA`>`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING)< lag(`50 Day MA`)
OVER (ROWS 1 PRECEDING)),"Buy",
if(`20 Day MA`<`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING) > lag(`50 Day MA`)
OVER (ROWS 1 PRECEDING)),"Sell","Hold"))`Signal`
from hero1);
#select * from hero2;
# infosys2
create table infosys2 as(
SELECT Date,`Close Price`,
if(`20 Day MA`>`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING)< lag(`50 Day MA`)
OVER (ROWS 1 PRECEDING)),"Buy",
if(`20 Day MA`<`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING) > lag(`50 Day MA`)
OVER (ROWS 1 PRECEDING)),"Sell","Hold"))`Signal`
from infosys1);
#select * from infosys2;
# tcs2
create table tcs2 as(
SELECT Date,`Close Price`,
if(`20 Day MA`>`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING)< lag(`50 Day MA`)
OVER (ROWS 1 PRECEDING)),"Buy",
if(`20 Day MA`<`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING) > lag(`50 Day MA`)
OVER (ROWS 1 PRECEDING)),"Sell","Hold"))`Signal`
from tcs1);
#select * from tcs2;
# tvs2
create table tvs2 as(SELECT Date,`Close Price`,
if(`20 Day MA`>`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING)< lag(`50 Day MA`)
OVER (ROWS 1 PRECEDING)),"Buy",
if(`20 Day MA`<`50 Day MA` and
(lag(`20 Day MA`) OVER (ROWS 1 PRECEDING) > lag(`50 Day MA`)
OVER (ROWS 1 PRECEDING)),"Sell","Hold"))`Signal`
from tvs1);
#select * from tvs2;
-- ***************Part 4******************************************************
/* Create a User defined function, that takes the date as input and
returns the signal for that particular day (Buy/Sell/Hold) for the Bajaj stock
*/
DELIMITER |
CREATE FUNCTION return_signal(input_date DATE) -- date as parameter in User defined function
RETURNS VARCHAR(4)
DETERMINISTIC
BEGIN
DECLARE signal_value VARCHAR(4);
select `Signal` from bajaj2
where `Date`=input_date into signal_value;
RETURN signal_value;
END|
select return_signal(Date) as `Signal` from bajaj2 -- function returning signal for particular day
where `Date`='2015-06-02'; -- particular date can be specified in where clause
|
CREATE TABLE NAVIGATION_MENU(
ID INT NOT NULL,
PARENT_ID VARCHAR(255),
NAME VARCHAR (255) NOT NULL,
LOCAL_NAME VARCHAR(255) NOT NULL,
LINK VARCHAR(512) NOT NULL,
PRIMARY KEY (ID)
);
INSERT INTO NAVIGATION_MENU VALUES ("0001","","Main","Главная", "http://www.google.ru");
INSERT INTO NAVIGATION_MENU VALUES ("0002","","Catalog","Каталог", "http://www.yandex.ru");
INSERT INTO NAVIGATION_MENU VALUES ("0003","","Contacts","Контакты", "http://www.vk.com");
INSERT INTO NAVIGATION_MENU VALUES ("0004","Catalog","Phones","Телефоны", "http://www.google.ru");
INSERT INTO NAVIGATION_MENU VALUES ("0005","Phones","Mobile","Мобильники", "http://www.google.ru");
INSERT INTO NAVIGATION_MENU VALUES ("0006","Phones","Home","Домашние", "#");
|
-- 1. What query would you run to get all the customers inside city_id = 312? Your query
-- should return customer first name, last name, email, and address.
select customer.first_name, customer.last_name, customer.email, address.address
from customer
join address
on customer.address_id = address.address_id
join city
on address.city_id = city.city_id
join country
on city.country_id = country.country_id
where city.city_id = 312;
-- 2. What query would you run to get all comedy films? Your query should return film title,
-- description, release year, rating, special features, and genre (category).
select film.title, film.description, film.release_year, film.rating, film.special_features, category.name
from film
join film_category
on film.film_id = film_category.film_id
join category
on film_category.category_id = category.category_id
where category.name = "Comedy";
-- 3. What query would you run to get all the films joined by actor_id=5? Your query should
-- return the actor id, actor name, film title, description, and release year.
select actor.actor_id, concat(actor.first_name,' ', actor.last_name) fullname, film.title, film.description, film.release_year
from actor
join film_actor
on actor.actor_id = film_actor.actor_id
join film
on film_actor.film_id = film.film_id
where actor.actor_id = 5;
-- 4. What query would you run to get all the customers in store_id = 1 and inside these cities
-- (1, 42, 312 and 459)? Your query should return customer first name, last name, email, and address.
select customer.first_name, customer.last_name, customer.email,address.address
from customer
join address
on customer.address_id = address.address_id
where customer.store_id = 1
and address.city_id in (1,42,312,459);
-- 5. What query would you run to get all the films with a "rating = G" and "special feature = behind the scenes",
-- joined by actor_id = 15? Your query should return the film title, description, release year, rating, and special
-- feature. Hint: You may use LIKE function in getting the 'behind the scenes' part.
select film.title, film.description, film.release_year, film.rating, film.special_features
from film
join film_actor
on film.film_id = film_actor.film_id
join actor
on film_actor.actor_id = actor.actor_id
where film.rating = "G"
and film.special_features like "%Behind%"
and actor.actor_id = 15;
-- 6. What query would you run to get all the actors that joined in the film_id = 369? Your query should
-- return the film_id, title, actor_id, and actor_name.
select film.film_id, film.title, actor.actor_id, actor.first_name, actor.last_name
from film
join film_actor
on film.film_id = film_actor.film_id
join actor
on film_actor.actor_id = actor.actor_id
where film.film_id = 369;
-- 7. What query would you run to get all drama films with a rental rate of 2.99? Your query should return
-- film title, description, release year, rating, special features, and genre (category).
select film.title, film.description, film.release_year, film.rating, film.special_features, category.name
from film
join film_category
on film.film_id = film_category.film_id
join category
on film_category.category_id = category.category_id
where category.name = 'drama'
and film.rental_rate = 2.99;
-- 8. What query would you run to get all the action films which are joined by SANDRA KILMER? Your query
-- should return film title, description, release year, rating, special features, genre (category), and
-- actor's first name and last name.
select film.title, film.description, film.release_year, film.rating, film.special_features, category.name,
concat(actor.first_name, ' ', actor.last_name ) actor_name
from film
join film_category
on film.film_id = film_category.film_id
join category
on film_category.category_id = category.category_id
join film_actor
on film.film_id = film_actor.film_id
join actor
on film_actor.actor_id = actor.actor_id
where concat(actor.first_name, ' ', actor.last_name ) = "SANDRA KILMER";
-- Note: You may download this PDF file displaying the expected results from the questions above - Expected Result (Sakila) |
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 24, 2021 at 08:21 AM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 8.0.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `dbms`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`id_admin` varchar(20) NOT NULL,
`password` varchar(45) NOT NULL,
`name` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`id_admin`, `password`, `name`) VALUES
('ad-006', 'adi123', 'aditya'),
('ad-017', 'bhu123', 'bhuvan');
-- --------------------------------------------------------
--
-- Table structure for table `court`
--
CREATE TABLE `court` (
`id_court` varchar(20) NOT NULL,
`password` varchar(45) NOT NULL,
`id_prisoner` varchar(20) NOT NULL,
`name` varchar(45) DEFAULT NULL,
`last_hearing_date` varchar(20) DEFAULT NULL,
`next_hearing_date` varchar(20) DEFAULT NULL,
`sentence` varchar(100) DEFAULT NULL,
`status` varchar(20) DEFAULT 'Pending',
`id_victim` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `court`
--
INSERT INTO `court` (`id_court`, `password`, `id_prisoner`, `name`, `last_hearing_date`, `next_hearing_date`, `sentence`, `status`, `id_victim`) VALUES
('1', '123', 'pr-7865', 'abhi', '2000-05-10', '2004-05-24', 'asmdsdf', 'comple', '123'),
('1', '123', 'pr-7866', 'abhi', '2000-02-10', '2000-04-10', NULL, 'Pending', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `crime`
--
CREATE TABLE `crime` (
`id_crime` varchar(20) NOT NULL,
`crime_type` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `crime`
--
INSERT INTO `crime` (`id_crime`, `crime_type`) VALUES
('cr-1028', 'personal crime'),
('cr-1029', 'property crime'),
('cr-1030', 'satutory crime'),
('cr-1031', 'financial crime'),
('cr-1032', 'inchoate crime'),
('cr-1033', 'traffic offence');
-- --------------------------------------------------------
--
-- Table structure for table `fir`
--
CREATE TABLE `fir` (
`id_FIR` int(11) NOT NULL,
`FIR_desc` varchar(100) DEFAULT NULL,
`FIR_date` date DEFAULT NULL,
`id_police` varchar(45) DEFAULT NULL,
`id_crime` varchar(45) DEFAULT NULL,
`id_victim` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `fir`
--
INSERT INTO `fir` (`id_FIR`, `FIR_desc`, `FIR_date`, `id_police`, `id_crime`, `id_victim`) VALUES
(123, '123', '2000-02-12', 'po-5824', 'cr-1028', '123'),
(1234, 'qertert', '2000-05-04', 'po-5827', 'cr-1033', '11234');
-- --------------------------------------------------------
--
-- Table structure for table `login`
--
CREATE TABLE `login` (
`id_login` varchar(20) DEFAULT NULL,
`time` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `login`
--
INSERT INTO `login` (`id_login`, `time`) VALUES
('1', '2021-01-22 11:47:03'),
('1', '2021-01-22 11:48:26'),
('1', '2021-01-22 11:49:42'),
('1', '2021-01-22 11:50:33'),
('1', '2021-01-22 11:55:26'),
('1', '2021-01-22 11:56:58'),
('1', '2021-01-22 11:58:59'),
('1', '2021-01-22 12:00:07'),
('1', '2021-01-22 12:04:24'),
('1', '2021-01-22 12:05:31'),
('po-5827', '2021-01-22 12:24:06'),
('po-5827', '2021-01-22 12:27:28'),
('po-5827', '2021-01-22 12:29:20'),
('po-5827', '2021-01-22 12:31:11'),
('po-5827', '2021-01-22 12:31:32'),
('po-5827', '2021-01-22 12:32:54'),
('po-5827', '2021-01-22 12:34:16'),
('123', '2021-01-22 13:46:27'),
('123', '2021-01-22 17:55:10'),
('po-5827', '2021-01-22 17:55:46'),
('po-5827', '2021-01-22 18:25:47'),
('123', '2021-01-22 18:27:29'),
('1', '2021-01-22 18:28:01');
-- --------------------------------------------------------
--
-- Table structure for table `police`
--
CREATE TABLE `police` (
`id_police` varchar(20) NOT NULL,
`password` varchar(45) NOT NULL,
`name` varchar(45) DEFAULT NULL,
`address` varchar(45) DEFAULT NULL,
`gender` varchar(20) DEFAULT NULL,
`mob_no` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `police`
--
INSERT INTO `police` (`id_police`, `password`, `name`, `address`, `gender`, `mob_no`) VALUES
('1234', 'asdfa', '4567', 'sdfasd', '123412', 'sadfasf'),
('po-5824', 'police5824', 'hooper', 'NY', 'M', '7930148526'),
('po-5825', 'police5825', 'jim', 'NY', 'M', '7256813490'),
('po-5826', 'police5826', 'jill', 'nevada', 'F', '8632541079'),
('po-5827', 'police5827', 'hotch', 'nevada', 'M', '8652310479'),
('po-5828', 'police5828', 'gedion', 'nevada', 'M', '8654103297'),
('po-5829', 'police5829', 'jenifer', 'minisoda', 'F', '7563218049'),
('po-5830', 'police5830', 'kenny', 'minisoda', 'F', '7569840123'),
('po-5831', 'police5831', 'peter', 'ohio', 'M', '8963254107'),
('po-5832', 'police5832', 'gracia', 'ohio', 'F', '8974521036'),
('po-5833', 'police5833', 'rick', 'DC', 'M', '1405236987'),
('po-5834', 'police5834', 'spencer', 'NY', 'M', '7935864012'),
('po-5835', 'police5835', 'sansa', 'NY', 'F', '7298563410');
-- --------------------------------------------------------
--
-- Table structure for table `prisoner`
--
CREATE TABLE `prisoner` (
`id_prisoner` varchar(20) NOT NULL,
`name` varchar(45) DEFAULT NULL,
`gender` varchar(20) DEFAULT NULL,
`mob_no` varchar(20) DEFAULT NULL,
`id_crime` varchar(45) DEFAULT NULL,
`id_police` varchar(45) DEFAULT NULL,
`id_fir` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `prisoner`
--
INSERT INTO `prisoner` (`id_prisoner`, `name`, `gender`, `mob_no`, `id_crime`, `id_police`, `id_fir`) VALUES
('pr-7865', 'peralta', 'M', '123654', 'cr-1029', 'po-5827', 123),
('pr-7866', 'jake', 'M', '789365214', 'cr-1031', 'po-5827', NULL),
('pr-7867', 'amy', 'F', '789385214', 'cr-1033', 'po-5827', NULL),
('pr-7868', 'jhonny', 'M', '789741254', 'cr-1028', 'po-5828', NULL),
('pr-7869', 'ben', 'M', '785987254', 'cr-1030', 'po-5828', NULL),
('pr-7870', 'kenny', 'F', '785258634', 'cr-1033', 'po-5828', NULL),
('pr-7871', 'penny', 'F', '785741234', 'cr-1031', 'po-5829', NULL),
('pr-7872', 'bernie', 'F', '785747412', 'cr-1028', 'po-5829', NULL),
('pr-7873', 'bert', 'M', '785747531', 'cr-1032', 'po-5829', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `victim`
--
CREATE TABLE `victim` (
`id_victim` varchar(45) NOT NULL,
`password` varchar(45) NOT NULL,
`name` varchar(45) DEFAULT NULL,
`address` varchar(45) DEFAULT NULL,
`gender` varchar(45) DEFAULT NULL,
`mob_no` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `victim`
--
INSERT INTO `victim` (`id_victim`, `password`, `name`, `address`, `gender`, `mob_no`) VALUES
('11234', '256', 'adfgsdfg', 'dfgaEQ', 'dhjdghj', '4758'),
('123', '123', '123', '123', '123', '123'),
('1234', '1234', 'dfgfdj', 'sfgcx', 'bfgh', '1234'),
('1234', '2345', 'fdkj', 'kglgiu', 'luio', '3456');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`id_admin`,`password`);
--
-- Indexes for table `court`
--
ALTER TABLE `court`
ADD PRIMARY KEY (`id_court`,`password`,`id_prisoner`) USING BTREE,
ADD KEY `id_prisoner` (`id_prisoner`),
ADD KEY `id_victim` (`id_victim`);
--
-- Indexes for table `crime`
--
ALTER TABLE `crime`
ADD PRIMARY KEY (`id_crime`);
--
-- Indexes for table `fir`
--
ALTER TABLE `fir`
ADD PRIMARY KEY (`id_FIR`),
ADD KEY `id_police` (`id_police`),
ADD KEY `id_user` (`id_victim`),
ADD KEY `id_crime` (`id_crime`);
--
-- Indexes for table `police`
--
ALTER TABLE `police`
ADD PRIMARY KEY (`id_police`,`password`);
--
-- Indexes for table `prisoner`
--
ALTER TABLE `prisoner`
ADD PRIMARY KEY (`id_prisoner`) USING BTREE,
ADD KEY `id_crime` (`id_crime`),
ADD KEY `id_police` (`id_police`),
ADD KEY `id_fir` (`id_fir`);
--
-- Indexes for table `victim`
--
ALTER TABLE `victim`
ADD PRIMARY KEY (`id_victim`,`password`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `court`
--
ALTER TABLE `court`
ADD CONSTRAINT `court_ibfk_1` FOREIGN KEY (`id_prisoner`) REFERENCES `prisoner` (`id_prisoner`) ON DELETE CASCADE,
ADD CONSTRAINT `court_ibfk_2` FOREIGN KEY (`id_victim`) REFERENCES `victim` (`id_victim`);
--
-- Constraints for table `fir`
--
ALTER TABLE `fir`
ADD CONSTRAINT `fir_ibfk_1` FOREIGN KEY (`id_police`) REFERENCES `police` (`id_police`) ON DELETE CASCADE,
ADD CONSTRAINT `fir_ibfk_2` FOREIGN KEY (`id_crime`) REFERENCES `crime` (`id_crime`) ON DELETE CASCADE,
ADD CONSTRAINT `fir_ibfk_3` FOREIGN KEY (`id_victim`) REFERENCES `victim` (`id_victim`) ON DELETE CASCADE;
--
-- Constraints for table `prisoner`
--
ALTER TABLE `prisoner`
ADD CONSTRAINT `prisoner_ibfk_3` FOREIGN KEY (`id_crime`) REFERENCES `crime` (`id_crime`) ON DELETE CASCADE,
ADD CONSTRAINT `prisoner_ibfk_4` FOREIGN KEY (`id_police`) REFERENCES `police` (`id_police`) ON DELETE CASCADE,
ADD CONSTRAINT `prisoner_ibfk_5` FOREIGN KEY (`id_fir`) REFERENCES `fir` (`id_FIR`) 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 */;
|
delete from HtmlLabelIndex where id=18083
/
delete from HtmlLabelInfo where indexid=18083
/
INSERT INTO HtmlLabelIndex values(18083,'´Î')
/
INSERT INTO HtmlLabelInfo VALUES(18083,'´Î',7)
/
INSERT INTO HtmlLabelInfo VALUES(18083,'ONCE',8)
/
INSERT INTO HtmlLabelInfo VALUES(18083,'´Î',9)
/
|
create procedure [sp_MSins_ProductionProductModelProductDescriptionCulture]
@c1 int,
@c2 int,
@c3 nchar(6),
@c4 datetime
as
begin
insert into [Production].[ProductModelProductDescriptionCulture] (
[ProductModelID],
[ProductDescriptionID],
[CultureID],
[ModifiedDate]
) values (
@c1,
@c2,
@c3,
@c4 )
end
|
-- Remove the conflict between FEATURE_LAKE == FEATURE_ICE and FEATURE_RIVER == FEATURE_JUNGLE
UPDATE FakeFeatures SET ID=ID+200;
ALTER TABLE Buildings
ADD AddsFreshWater INTEGER DEFAULT 0;
ALTER TABLE Buildings
ADD PurchaseOnly INTEGER DEFAULT 0;
ALTER TABLE Building_ThemingBonuses
ADD ConsecutiveEras INTEGER DEFAULT 0;
ALTER TABLE Improvements
ADD AddsFreshWater INTEGER DEFAULT 0;
INSERT INTO CustomModDbUpdates(Name, Value) VALUES('API_EXTENSIONS', 1);
|
\qecho Description of the statements used in the following queries:
\d Users
\d PartOf
\d Wall
\d Follows
\d Post
\qecho
/*
1)select users who are male and are part of at least 1 conversation
*/
\qecho
\qecho Output of first statement
\qecho
SELECT Users.email from Users where Users.gender ='m' intersect
SELECT email from PartOf LIMIT 50;
/*
2)find the email of the oldest person living in Bafoussam city(aggregation and subquery)
*/
\qecho
\qecho Output of second statement
\qecho
SELECT Users.email from Users
where Users.birthday = (SELECT min(birthday) from Users
where Users.city = 'Bafoussam') and Users.city='Bafoussam' LIMIT 50;
/*
3)select users who have more than 2 walls and live in a city that has more than 2 users
*/
\qecho
\qecho Output of third statement
\qecho
SELECT Users.email from Users where Users.email
in (SELECT Wall.email from Wall group by email having count(email) >2)
and Users.city in (SELECT city from Users group by city having count(email)>2) LIMIT 50;
/*
4)number of different people in each city grouped(grouping)
*/
\qecho
\qecho Output of fourth statement
\qecho
SELECT city,count(email) from Users group by city LIMIT 50;
/*
5) select user who both followed and post on the wall of another user.
*/
\qecho
\qecho Output of fifth statement
\qecho
SELECT followed_by, follower from Follows intersect
SELECT Post.email, Wall.email
from Post, wall where Post.wall_id = Wall.wall_id LIMIT 50;
|
drop table if exists user;
create table user (
user_id integer primary key autoincrement,
username text not null,
email text not null,
pw_hash text not null
);
drop table if exists message;
create table message (
message_id integer primary key autoincrement,
author_id integer not null,
text text not null,
pub_date integer
);
drop table if exists _group;
create table _group (
group_id integer primary key autoincrement,
shared_key text not null,
owner_id integer,
name text
);
drop table if exists _member;
create table _member (
member_id integer,
group_id integer
); |
-- Check full name with spaces in it
CREATE TABLE checkFName(
fullName TEXT(64) NOT NULL,
CONSTRAINT checkFNameSpace CHECK(fullName REGEXP '^[a-zA-Z ]*$' )
);
INSERT INTO `testDB`.`checkFName`
(`fullName`)
VALUES
('Vasant Govind M L'); |
SELECT Z.Name, Z.Population, Z.CountryCode
FROM world.city Z
WHERE Z.CountryCode IN (SELECT V.Code
FROM world.city X, world.country V
WHERE V.Code=X.CountryCode
GROUP BY V.Code
HAVING COUNT(*) < 3) and Z.Population = (SELECT MAX(N.Population)
FROM world.country B, world.city N
WHERE B.Code=N.CountryCode and Z.CountryCode=B.Code
GROUP BY B.Code)
ORDER BY Z.Population DESC; |
--mysql -b -N -u root -pmypass mysql < /scripts/create_users.sql
FLUSH PRIVILEGES;
ALTER USER 'analytics'@'localhost' IDENTIFIED BY 'mypass';
ALTER USER 'analytics'@'%' IDENTIFIED BY 'mypass';
CREATE USER 'analytics'@'localhost' IDENTIFIED BY 'mypass';
GRANT ALL PRIVILEGES ON *.* TO 'analytics'@'localhost';
CREATE USER 'analytics'@'%' IDENTIFIED BY 'mypass';
GRANT ALL PRIVILEGES ON *.* TO 'analytics'@'%';
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'mypass';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost';
CREATE USER 'admin'@'%' IDENTIFIED BY 'mypass';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%';
|
SELECT *
FROM
(SELECT value->>'layout' AS layout,
value->>'name' AS name,
value->'names' AS names,
value->>'manaCost' AS mana_cost,
value->>'cmc' AS cmc,
value->'colors' AS colors,
value->>'type' AS type,
value->'supertypes' AS supertypes,
value->'types' AS types,
value->'subtypes' AS subtypes,
value->>'text' AS text,
value->>'power' AS power,
value->>'toughness' AS toughness,
value->>'imageName' AS image_name,
value->>'colorIdentity' AS color_identity
FROM json_each((SELECT * FROM mtg.json_import)::json)) AS a |
#Updated on March 23th, 2017
#Author: Haoran Ma
#Description: Input some values for test + Test Case
USE HRbase;
# Insert Values in 'User' table
# Permission number: 0->Admin, 1->Employee, 2->User
INSERT INTO Users
(EMail, Password, Permission)
VALUES
('haoranma@gmail.com','12345','1'),
('bowentian@gmail.com','12345','0'),
('songdacheng@gmail.com','12345','1'),
('tongzhang@gmail.com','12345','1'),
('apple@gmail.com','12345','2'),
('jack@gmail.com','12345','2'),
('tom@gmail.com','12345','2'),
('kay@gmail.com','12345','2');
# Insert Value in 'Talent' table
INSERT INTO Talent
(PersonID, LastName, FirstName, Age, LivingArea, CellPhone, DirectPhone, Major, HighestDegree, GraduteSchool,
Citizen, SubmissionDate, Source, LinkedIn, ResumeLocation, KeyWord)
VALUES
(5, 'A', 'Apple', 25, 'California', '626-478-5299','','Electrical Engineering', 'PhD', 'Standford', 'Yes',
'2016-6-1', 'Internal','','','Electrical, Engineering, System Engineering'),
(6, 'B', 'Jack', 27, 'California', '','','Computer Science', 'PhD', 'Standford', 'Yes',
'2016-6-1', 'Internal','','','Computer Science, Java, Python'),
(7, 'C', 'Tom', 24, 'California', '','','Chemistry', 'PhD', 'Standford', 'Yes',
'2016-6-1', 'Internal','','','Chemistry, Requirement Analysis'),
(8, 'D', 'Kay', 25, 'California', '','','Electrical Engineering', 'PhD', 'Standford', 'Yes',
'2016-6-1', 'Internal','','','Electrical Engineering, Machine Learning');
# Insert Value in 'Employee' table
INSERT INTO Employee
(PersonID, LastName, FirstName, Department, WorkPhone, Position)
VALUES
(1, 'Ma', 'Haoran', 'Engineering&Project Management','949-255-4190','Director'),
(2, 'Zhang', 'Tong','Engineering&Project Management','949-255-2262','Director'),
(3, 'Tian', 'Bowen','Engineering&Project Management','949-255-4197','Director'),
(4, 'Cheng', 'Songda','Engineering&Project Management','949-255-4159','Director');
# Insert Value in 'Comments' table
INSERT INTO Comments
(PersonID, EmployeeID, Comments)
VALUES
(5, 1, 'Good'),
(6, 2, 'Not Good'),
(7, 3, 'Not Good Enough'),
(8, 4, 'Good Enough');
# Insert Value in 'Company' table
INSERT INTO Company (CompanyID, CompanyName, CompanyInf)
VALUES
(1, 'COMAC America Corporation', 'OMG'),
(2, 'Apple', 'GG'),
(3, 'FAA', 'Secret'),
(4, 'Google', 'MM');
# Insert Value in 'Employment_History' table
INSERT INTO Employment_History (EmploymentID, PersonID, CompanyID, WorkingField, Position, StartDate, EndDate, JobExp)
VALUES
(1,5,1,'EE','Director','2016-5-19','2017-5-19','No'),
(2,6,2,'CS','Director','2016-5-19','2017-5-19','No'),
(3,7,3,'CE','Director','2016-5-19','2017-5-19','No'),
(4,8,4,'EE','Director','2016-5-19','2017-5-19','No');
#Test Case:
#1. Verify Haoran Login and password
Select EMail, Password, Permission from Users where EMail = 'haoranma@gmail.com';
#2. Query Tom's personal information
Select LastName, FirstName, Age, Major, HighestDegree, GraduteSchool
from Talent where FirstName = 'Tom';
#2. Query Tom's Employment History (Include Working Field, Position, Start Day and End Day)
Select Talent.LastName, Talent.FirstName, Employment_History.WorkingField, Employment_History.Position,
Employment_History.StartDate, Employment_History.EndDate
from Talent inner join Employment_History on Talent.PersonID = Employment_History.PersonID where Talent.FirstName = 'Tom';
#3. Query Tom's Detail (Include Person ID, Working Field, Position, Start Day, End Day, Company Name and Comapny information)
Select Talent.LastName, Talent.FirstName, Employment_History.WorkingField, Employment_History.Position,
Employment_History.StartDate, Employment_History.EndDate, Company.CompanyName, Company.CompanyInf
from Employment_History
inner join Talent on Talent.PersonID = Employment_History.PersonID
inner join Company on Company.CompanyID = Employment_History.CompanyID
where Talent.FirstName = 'Tom';
#4 Query Tom's Comments
Select Talent.FirstName, Talent.LastName, Comments.Comments, Comments.EmployeeID from Comments
inner join Talent on Talent.PersonID = Comments.PersonID
inner join Employee on Employee.EmployeeID = Comments.EmployeeID
where Talent.FirstName = 'Tom';
# SD require to test:
Select * from Employment_History inner join Talent on Employment_History.PersonID = Talent.PersonID
inner join Company on Employment_History.CompanyID = Company.CompanyID
where FirstName = 'Tom' ; |
DROP DATABASE jpadb;
CREATE DATABASE jpadb; |
INSERT INTO addresses(location, destination)
VALUE ("2503 Fleming Drive, South Carolina", "1210 Bolt Drive, South Carolina");
|
-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jun 11, 2020 at 10:27 AM
-- Server version: 10.4.10-MariaDB
-- PHP Version: 7.3.12
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: `thetickapp`
--
-- --------------------------------------------------------
--
-- Table structure for table `adminusers`
--
DROP TABLE IF EXISTS `adminusers`;
CREATE TABLE IF NOT EXISTS `adminusers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(100) NOT NULL,
`lastname` varchar(100) NOT NULL,
`initial` varchar(2) NOT NULL,
`email` varchar(300) NOT NULL,
`password` varchar(100) NOT NULL,
`accounttype` tinyint(4) NOT NULL COMMENT '1:admin,2:marketmanager',
`status` tinyint(4) NOT NULL COMMENT '1:active,2:inactive',
`markets` text DEFAULT NULL,
`otp` int(11) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `adminusers`
--
INSERT INTO `adminusers` (`id`, `firstname`, `lastname`, `initial`, `email`, `password`, `accounttype`, `status`, `markets`, `otp`, `created_at`, `updated_at`) VALUES
(1, 'The', 'PickApp', 'MD', 'admin@example.com', 'e6e061838856bf47e1de730719fb2609', 1, 1, NULL, NULL, '2020-05-27 13:49:17', '2020-05-27 19:19:17'),
(2, 'tester', 'test', 'TT', 'test@example.com', '148b7a4c120fab9e839387afa9015fcf', 1, 1, NULL, NULL, '2020-05-18 13:19:17', '2020-05-18 18:49:17'),
(3, 'marketi', 'manager', 'MM', 'market@example.com', '89f6e91c84ae95d613f60fa86b2aff48', 2, 1, '3,2,1', NULL, '2020-06-10 09:39:41', '2020-06-10 15:09:41'),
(4, 'Newmarket', 'Manager', 'NM', 'new@example.com', '148b7a4c120fab9e839387afa9015fcf', 2, 1, '2,4', NULL, '2020-05-26 12:03:06', '2020-05-26 17:33:06'),
(5, 'test', 'market', 'TM', 'testmarket@example.com', '148b7a4c120fab9e839387afa9015fcf', 2, 1, '3,2', NULL, '2020-05-18 13:19:27', '2020-05-18 18:49:27'),
(6, 'New', 'Market', 'NM', 'newmarket@example.com', 'c31e54d895f4cab990c0f9f36b2ad82e', 2, 1, '5,3,1', NULL, '2020-05-27 17:20:09', '2020-05-27 22:50:09');
-- --------------------------------------------------------
--
-- Table structure for table `businesstypes`
--
DROP TABLE IF EXISTS `businesstypes`;
CREATE TABLE IF NOT EXISTS `businesstypes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(250) NOT NULL,
`status` tinyint(4) NOT NULL COMMENT '1:active,2:inactive',
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `businesstypes`
--
INSERT INTO `businesstypes` (`id`, `title`, `status`, `created_at`, `updated_at`) VALUES
(1, 'Prepared Foods', 1, '2020-04-20 15:44:13', '0000-00-00 00:00:00'),
(2, 'Foods', 1, '2020-04-20 15:51:24', '2020-04-20 21:21:24'),
(3, 'Wines', 1, '2020-04-20 15:44:57', '0000-00-00 00:00:00'),
(4, 'Others', 1, '2020-04-20 15:45:04', '0000-00-00 00:00:00'),
(5, 'Test Business', 1, '2020-05-10 18:12:46', '2020-05-10 23:42:46'),
(6, 'Edit Sample Category', 1, '2020-05-10 18:19:27', '2020-05-10 23:49:27');
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
DROP TABLE IF EXISTS `categories`;
CREATE TABLE IF NOT EXISTS `categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(250) NOT NULL,
`icon` varchar(250) DEFAULT NULL,
`status` tinyint(4) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` (`id`, `title`, `icon`, `status`, `created_at`, `updated_at`) VALUES
(1, 'Bagel', 'bagel', 1, '2020-04-21 12:29:13', '0000-00-00 00:00:00'),
(2, 'Drinks', 'Drinks', 1, '2020-04-21 12:29:18', '0000-00-00 00:00:00'),
(3, 'Art', 'Art', 1, '2020-04-21 12:29:23', '0000-00-00 00:00:00'),
(4, 'Wrap', 'Wrap', 1, '2020-04-21 12:29:28', '0000-00-00 00:00:00'),
(5, 'Sweets', 'Sweets', 1, '2020-04-21 12:29:33', '0000-00-00 00:00:00'),
(6, 'Others', 'Others', 1, '2020-04-21 12:29:37', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `coupons`
--
DROP TABLE IF EXISTS `coupons`;
CREATE TABLE IF NOT EXISTS `coupons` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`vendor_id` int(11) NOT NULL,
`code` varchar(15) NOT NULL,
`description` text DEFAULT NULL,
`discount_type` tinyint(4) NOT NULL COMMENT '1:fixed,2:pecentage',
`amount` double NOT NULL,
`status` tinyint(4) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `coupons`
--
INSERT INTO `coupons` (`id`, `vendor_id`, `code`, `description`, `discount_type`, `amount`, `status`, `created_at`, `updated_at`) VALUES
(1, 4, 'abcd', 'this is a simple text code', 1, 10, 1, '2020-04-26 11:43:32', '2020-04-26 17:13:32'),
(2, 4, 'tony', 'here is the new code', 2, 5, 1, '2020-04-26 10:57:03', '2020-04-26 16:27:03');
-- --------------------------------------------------------
--
-- Table structure for table `inventories`
--
DROP TABLE IF EXISTS `inventories`;
CREATE TABLE IF NOT EXISTS `inventories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`product_id` int(11) NOT NULL,
`unit` varchar(100) NOT NULL,
`price` double NOT NULL,
`availableqty` double NOT NULL,
`status` tinyint(4) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `inventories`
--
INSERT INTO `inventories` (`id`, `product_id`, `unit`, `price`, `availableqty`, `status`, `created_at`, `updated_at`) VALUES
(4, 3, '6 KG/BAG', 25, 3, 1, '2020-05-16 12:31:18', '2020-05-16 18:01:18'),
(2, 3, 'BAG', 10, 19, 1, '2020-04-24 12:06:42', '2020-04-24 17:36:42'),
(3, 3, 'BTL', 10, 13, 1, '2020-05-10 11:37:28', '2020-05-10 17:07:28'),
(5, 3, '4 BTL/BAG', 25, 1, 1, '2020-05-10 06:41:51', '2020-05-10 12:11:51'),
(6, 3, '15 BTL/BAG', 13, 0, 1, '2020-04-24 12:06:42', '2020-04-24 17:36:42'),
(7, 5, '10 .5BU/BAG', 13, 1, 1, '2020-05-17 18:33:09', '2020-05-18 00:03:09'),
(8, 6, '.5BU', 5, 9, 1, '2020-05-27 17:48:56', '2020-05-27 23:18:56'),
(9, 6, '.5BU', 15, 123, 1, '2020-05-27 17:48:56', '2020-05-27 23:18:56'),
(10, 7, 'KG', 10, 45, 1, '2020-05-27 17:48:56', '2020-05-27 23:18:56');
-- --------------------------------------------------------
--
-- Table structure for table `marketimings`
--
DROP TABLE IF EXISTS `marketimings`;
CREATE TABLE IF NOT EXISTS `marketimings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`market_id` int(11) NOT NULL,
`day` tinyint(4) NOT NULL,
`openingtime` time DEFAULT NULL,
`closingtime` time DEFAULT NULL,
`slotinterval` int(11) DEFAULT NULL,
`slotlimit` int(11) DEFAULT NULL,
`status` tinyint(4) NOT NULL DEFAULT 1,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `marketimings`
--
INSERT INTO `marketimings` (`id`, `market_id`, `day`, `openingtime`, `closingtime`, `slotinterval`, `slotlimit`, `status`, `created_at`, `updated_at`) VALUES
(1, 3, 1, '09:00:00', '18:00:00', 15, 15, 1, '0000-00-00 00:00:00', '2020-06-11 15:47:52'),
(2, 3, 2, '09:00:00', '18:00:00', 15, 20, 1, '0000-00-00 00:00:00', '2020-06-11 15:47:52'),
(3, 3, 3, '09:00:00', '18:00:00', 30, 10, 1, '0000-00-00 00:00:00', '2020-06-11 15:47:52'),
(4, 3, 4, '09:00:00', '18:00:00', 15, 20, 0, '0000-00-00 00:00:00', '2020-06-11 15:47:52'),
(5, 3, 5, '09:00:00', '18:00:00', 45, 5, 0, '0000-00-00 00:00:00', '2020-06-11 15:47:52'),
(6, 3, 6, '09:00:00', '18:00:00', 15, 5, 0, '0000-00-00 00:00:00', '2020-06-11 15:47:52'),
(7, 3, 7, '09:00:00', '18:00:00', 15, 7, 0, '0000-00-00 00:00:00', '2020-06-11 15:47:52');
-- --------------------------------------------------------
--
-- Table structure for table `marketpopups`
--
DROP TABLE IF EXISTS `marketpopups`;
CREATE TABLE IF NOT EXISTS `marketpopups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`vendor_id` int(11) NOT NULL,
`market_id` int(11) NOT NULL,
`message` text DEFAULT NULL,
`status` tinyint(4) NOT NULL DEFAULT 1,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `marketpopups`
--
INSERT INTO `marketpopups` (`id`, `vendor_id`, `market_id`, `message`, `status`, `created_at`, `updated_at`) VALUES
(1, 4, 5, '<p><b style=\"background-color: rgb(255, 255, 0);\">Hello this is a nice way to display into the poopo </b></p>', 1, '2020-06-09 12:04:20', '2020-06-09 17:34:20'),
(2, 4, 4, '<p>sddasd</p>', 1, '2020-06-09 12:04:31', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `markets`
--
DROP TABLE IF EXISTS `markets`;
CREATE TABLE IF NOT EXISTS `markets` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(250) NOT NULL,
`status` tinyint(4) NOT NULL,
`location` text DEFAULT NULL,
`lat` varchar(50) DEFAULT NULL,
`lng` varchar(50) DEFAULT NULL,
`image` varchar(250) DEFAULT NULL,
`description` text DEFAULT NULL,
`fee` double NOT NULL DEFAULT 5,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `markets`
--
INSERT INTO `markets` (`id`, `title`, `status`, `location`, `lat`, `lng`, `image`, `description`, `fee`, `created_at`, `updated_at`) VALUES
(1, 'Market 1', 1, 'Surat Railway Station, Ved Rd, Railway Station Area, Varachha, Surat, Gujarat, India', '21.204946', '72.8407345', '5ec1b76b14f7d.jpg', 'Nice Market Place', 5, '2020-05-17 04:50:59', '2020-05-17 10:20:59'),
(2, 'Market 2', 1, NULL, NULL, NULL, NULL, NULL, 5, '2020-04-21 12:30:14', '0000-00-00 00:00:00'),
(3, 'Market 3', 1, NULL, NULL, NULL, '5eb83d2814398.jpg', NULL, 5, '2020-05-10 17:43:52', '2020-05-10 23:13:52'),
(4, 'Sample Market', 1, 'adajan', NULL, NULL, '5eb83eecb2f58.jpg', 'hello this is just a test description', 4, '2020-05-10 00:20:36', '2020-05-10 05:50:36'),
(5, 'Sarojini Naydu Vegetable Market', 1, 'Vidhyakunj Hindi Vidyalaya, Pankaj Nagar, Surat, Gujarat, India', '21.20946619999999', '72.78102', '5ec1b9a720b89.png', 'All types of vegetables available', 5, '2020-05-17 04:54:39', '2020-05-17 10:24:39'),
(6, 'New Market', 1, 'New York Railway Supply, Thornton Drive, Westlake, TX, USA', '32.967111', '-97.23012399999999', '5ece9fa102580.png', 'Test Location for Market', 5, '2020-05-26 23:43:05', '2020-05-27 05:13:05');
-- --------------------------------------------------------
--
-- Table structure for table `messages`
--
DROP TABLE IF EXISTS `messages`;
CREATE TABLE IF NOT EXISTS `messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`subject` text NOT NULL,
`content` text NOT NULL,
`adminuser_id` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `messages`
--
INSERT INTO `messages` (`id`, `subject`, `content`, `adminuser_id`, `created_at`) VALUES
(1, 'Nice Poster', '<p>Hello,</p><p><br></p><p>All member from thi akasksakd</p><p>Thanks</p>', 1, '2020-05-10 03:07:32'),
(2, 'Nice Poster', '<p>Hello,</p><p><br></p><p><b>Keyur Patel</b> here</p><p><br></p><p>Thx</p>', 1, '2020-05-10 03:07:58'),
(3, 'Greetings From Me', '<p>Hello,</p><p>All This is your Market manager Speaking!<br></p>', 3, '2020-05-17 03:45:27'),
(4, 'Sample Test Message to all Consumer', '<p>Hello,</p><p>All consumer,</p><p><br></p><p>This is just a sample message from admin!....<br></p>', 1, '2020-05-26 23:44:09'),
(5, 'A message from Market Manager', '<p>Hello,</p><p><br></p><p>This is your market manager. </p><p>Thanks.<br></p>', 6, '2020-05-26 23:52:03');
-- --------------------------------------------------------
--
-- Table structure for table `orderdetails`
--
DROP TABLE IF EXISTS `orderdetails`;
CREATE TABLE IF NOT EXISTS `orderdetails` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` int(11) NOT NULL,
`vendor_id` int(11) NOT NULL,
`itemname` varchar(250) NOT NULL,
`comment` text DEFAULT NULL,
`unit` varchar(100) NOT NULL,
`qty` double NOT NULL,
`price` double NOT NULL,
`tax` double NOT NULL DEFAULT 0,
`total` double NOT NULL,
`sitefee` double NOT NULL DEFAULT 0,
`vendoramount` double NOT NULL DEFAULT 0,
`status` varchar(125) NOT NULL DEFAULT 'pending',
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `orderdetails`
--
INSERT INTO `orderdetails` (`id`, `order_id`, `vendor_id`, `itemname`, `comment`, `unit`, `qty`, `price`, `tax`, `total`, `sitefee`, `vendoramount`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, 4, 'Mayur', 'Nice Product', '10 .5BU/BAG', 3, 13, 1.17, 40.17, 2.01, 38.16, 'approved', '2020-05-17 18:59:10', '2020-05-18 00:29:10'),
(2, 2, 11, 'Banana', '', 'KG', 5, 10, 0, 50, 2.5, 47.5, 'approved', '2020-05-27 17:49:46', '2020-05-27 23:19:46'),
(3, 2, 4, 'Sample Test', '', '.5BU', 2, 15, 0, 30, 1.5, 28.5, 'approved', '2020-05-27 17:50:15', '2020-05-27 23:20:15'),
(4, 2, 4, 'Sample Test', '', '.5BU', 1, 5, 0, 5, 0.25, 4.75, 'approved', '2020-05-27 17:50:35', '2020-05-27 23:20:35');
-- --------------------------------------------------------
--
-- Table structure for table `orders`
--
DROP TABLE IF EXISTS `orders`;
CREATE TABLE IF NOT EXISTS `orders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`market_id` int(11) NOT NULL,
`total_items` double NOT NULL,
`status` varchar(10) NOT NULL,
`totalamount` double NOT NULL,
`couponcode` varchar(15) DEFAULT NULL,
`discount` double NOT NULL DEFAULT 0,
`fee` double NOT NULL DEFAULT 0,
`grandtotal` double NOT NULL DEFAULT 0,
`customer_id` varchar(250) DEFAULT NULL,
`payment_method` varchar(250) DEFAULT NULL,
`last4` int(4) DEFAULT NULL,
`paymentstatus` varchar(15) NOT NULL DEFAULT 'unpaid',
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `orders`
--
INSERT INTO `orders` (`id`, `user_id`, `market_id`, `total_items`, `status`, `totalamount`, `couponcode`, `discount`, `fee`, `grandtotal`, `customer_id`, `payment_method`, `last4`, `paymentstatus`, `created_at`, `updated_at`) VALUES
(1, 5, 3, 3, 'approved', 40.17, '', 0, 1.21, 41.38, 'cus_HISC8kDAvLrRl2', 'card_1GjrINBz8hwDGXwaW3OlfjLo', 1111, 'paid', '2020-05-17 19:00:21', '2020-05-18 00:30:21'),
(2, 12, 5, 8, 'approved', 85, '', 0, 2.55, 87.55, 'cus_HMBk3t9jKcCAAz', 'card_1GnTN2Bz8hwDGXwauJzweoMk', 1111, 'paid', '2020-05-27 17:50:38', '2020-05-27 23:20:38');
-- --------------------------------------------------------
--
-- Table structure for table `productimages`
--
DROP TABLE IF EXISTS `productimages`;
CREATE TABLE IF NOT EXISTS `productimages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`product_id` int(11) NOT NULL,
`image` text NOT NULL,
`sortorder` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `productimages`
--
INSERT INTO `productimages` (`id`, `product_id`, `image`, `sortorder`) VALUES
(1, 5, '5ea6c46c145e2.jpg', 1),
(2, 5, '5ea6c46c1515c.jpg', 0),
(6, 6, '5ece67915d073.png', 0),
(7, 6, '5ece6791e1fc5.jpg', 1);
-- --------------------------------------------------------
--
-- Table structure for table `products`
--
DROP TABLE IF EXISTS `products`;
CREATE TABLE IF NOT EXISTS `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` text NOT NULL,
`vendor_id` int(11) NOT NULL,
`category_id` int(11) NOT NULL,
`description` text NOT NULL,
`image` varchar(200) DEFAULT NULL,
`markets` text DEFAULT NULL,
`status` tinyint(4) NOT NULL,
`is_taxable` tinyint(4) NOT NULL DEFAULT 0,
`tax` double NOT NULL DEFAULT 0,
`is_comment` tinyint(4) NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `products`
--
INSERT INTO `products` (`id`, `title`, `vendor_id`, `category_id`, `description`, `image`, `markets`, `status`, `is_taxable`, `tax`, `is_comment`, `created_at`, `updated_at`) VALUES
(1, 'Keyur Patel', 4, 3, 'Hello This is Just A Description ', NULL, NULL, 1, 0, 0, 0, '2020-04-20 19:33:55', '2020-04-21 01:03:55'),
(2, 'test', 4, 1, 'fdfdfdf', NULL, NULL, 1, 0, 0, 0, '2020-04-20 19:34:06', '2020-04-21 01:04:06'),
(3, 'sadasdasadfafadsa', 4, 3, 'adadasdasdsdasdas', NULL, NULL, 1, 0, 0, 0, '2020-04-21 13:17:46', '2020-04-21 01:17:46'),
(4, 'New Product', 4, 3, 'Hello This is a new Product', '5ea6c3b75163c.jpg', '2,3,1', 1, 1, 2, 0, '2020-05-18 12:22:56', '2020-05-18 12:22:56'),
(5, 'Mayur', 4, 3, 'aheheh', '5ece65ae2342f.jpg', '2,3,1', 1, 1, 3, 1, '2020-05-27 13:05:50', '2020-05-27 01:05:50'),
(6, 'Sample Test', 4, 3, 'Nice Description', '5ece555db55b9.jpg', '1,4,5', 1, 1, 0, 0, '2020-05-27 17:47:14', '2020-05-27 05:47:14'),
(7, 'Banana', 11, 6, 'Banana', '', '5', 1, 0, 0, 0, '2020-05-26 23:59:26', '2020-05-27 05:29:26');
-- --------------------------------------------------------
--
-- Table structure for table `profiles`
--
DROP TABLE IF EXISTS `profiles`;
CREATE TABLE IF NOT EXISTS `profiles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`businesstype_id` int(11) NOT NULL,
`businessname` varchar(250) NOT NULL,
`address1` varchar(250) NOT NULL,
`address2` varchar(250) NOT NULL,
`zipcode` varchar(10) DEFAULT NULL,
`phonenumber` varchar(12) NOT NULL,
`image` varchar(200) DEFAULT NULL,
`defaultmarket` int(11) DEFAULT 0,
`defaultvendor` int(11) DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `user_id` (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `profiles`
--
INSERT INTO `profiles` (`id`, `user_id`, `businesstype_id`, `businessname`, `address1`, `address2`, `zipcode`, `phonenumber`, `image`, `defaultmarket`, `defaultvendor`, `created_at`, `updated_at`) VALUES
(1, 4, 1, 'KP STORE', 'Shilalekh', 'Pal', '10001', '9638464855', '5eccfaa52bdd4.png', 0, 0, '2020-05-26 11:23:08', '2020-05-26 11:23:08'),
(2, 5, 0, '', 'Shilalekh', 'Pal Surat', '10016', '7874631566', '5ec1359f8e92e.jpg', 5, 0, '2020-06-09 12:06:39', '2020-06-09 17:36:39'),
(3, 7, 6, 'Vendor New', 'abcd', 'xyz', '10016', '9898598555', '', 0, 0, '2020-05-17 06:11:22', '2020-05-17 11:41:22'),
(4, 10, 0, '', '201 Shilalekh', 'pal', '10001', '9898598555', '5ece6ec5dc747.png', 3, 0, '2020-05-27 13:47:40', '2020-05-27 19:17:40'),
(5, 11, 6, 'New Vendor', 'Sample Address', 'Sample Address2', '10001', '9898598555', '5ecea289bc644.png', 0, 0, '2020-05-26 23:55:29', '2020-05-27 05:25:29'),
(6, 12, 0, '', 'Sample Address', 'Sample Address2', '10001', '9898598555', '5ecea5f04256f.png', 5, 0, '2020-05-27 17:42:30', '2020-05-27 23:12:30');
-- --------------------------------------------------------
--
-- Table structure for table `settings`
--
DROP TABLE IF EXISTS `settings`;
CREATE TABLE IF NOT EXISTS `settings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`meta_key` varchar(250) NOT NULL,
`meta_value` text NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`update_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `meta_key` (`meta_key`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `settings`
--
INSERT INTO `settings` (`id`, `meta_key`, `meta_value`, `created_at`, `update_at`) VALUES
(1, 'CONSUMER_COMMISSION', '3', '2020-05-10 21:24:59', '2020-05-11 02:54:59');
-- --------------------------------------------------------
--
-- Table structure for table `stripeaccounts`
--
DROP TABLE IF EXISTS `stripeaccounts`;
CREATE TABLE IF NOT EXISTS `stripeaccounts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`access_token` varchar(250) NOT NULL,
`livemode` varchar(20) DEFAULT NULL,
`refresh_token` varchar(200) NOT NULL,
`token_type` varchar(250) NOT NULL,
`stripe_publishable_key` varchar(200) NOT NULL,
`stripe_user_id` varchar(200) NOT NULL,
`scope` varchar(150) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `user_id` (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `stripeaccounts`
--
INSERT INTO `stripeaccounts` (`id`, `user_id`, `access_token`, `livemode`, `refresh_token`, `token_type`, `stripe_publishable_key`, `stripe_user_id`, `scope`, `created_at`, `updated_at`) VALUES
(1, 4, 'sk_test_R3qBHzEargoEYozcREqXrsOe00eZVR373X', '0', 'rt_HISBgOjzFrkvMuJbTZHlSJcqv4BWb8M0w8SIoF0sQYhcz9ov', 'bearer', 'pk_test_uZZe6DTTidQ7u5u72w1Anmcp00zwHEwD3r', 'acct_1GjrF9DnMJT4bw0i', 'express', '2020-05-26 11:29:00', '2020-05-26 16:59:00'),
(2, 11, 'sk_test_WwIWu0pXIRU8BEXHK1zevbWN00wDh73iTV', '0', 'rt_HMBOLSWWtjYitF2CdjIvfiTNPQvVwCHWmSzJ9PAO9XaOH688', 'bearer', 'pk_test_sGvytGjMIfBqXRSNlhXlSCnU00t6exD364', 'acct_1GnT11IMYnnICosq', 'express', '2020-05-27 17:27:15', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `stripecharges`
--
DROP TABLE IF EXISTS `stripecharges`;
CREATE TABLE IF NOT EXISTS `stripecharges` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`charge_id` varchar(150) NOT NULL,
`amount` double NOT NULL,
`refund_id` varchar(150) DEFAULT NULL,
`amount_refunded` double DEFAULT NULL,
`created` varchar(100) NOT NULL,
`currency` varchar(10) NOT NULL,
`livemode` varchar(5) DEFAULT NULL,
`payment_method` varchar(150) NOT NULL,
`receipt_url` text DEFAULT NULL,
`status` varchar(150) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `stripecharges`
--
INSERT INTO `stripecharges` (`id`, `order_id`, `user_id`, `charge_id`, `amount`, `refund_id`, `amount_refunded`, `created`, `currency`, `livemode`, `payment_method`, `receipt_url`, `status`, `created_at`, `updated_at`) VALUES
(3, 1, 5, 'ch_1GjrhcBz8hwDGXwa80UkWpvK', 41.38, NULL, 0, '1589741952', 'usd', '0', 'card_1GjrINBz8hwDGXwaW3OlfjLo', 'https://pay.stripe.com/receipts/acct_1GfYy3Bz8hwDGXwa/ch_1GjrhcBz8hwDGXwa80UkWpvK/rcpt_HIScIY7rB4bxU2SFSOdJuwA1cZD8so9', 'succeeded', '2020-05-17 18:59:13', '0000-00-00 00:00:00'),
(4, 2, 12, 'ch_1GnTOiBz8hwDGXwa5VSWRDql', 87.55, NULL, 0, '1590601836', 'usd', '0', 'card_1GnTN2Bz8hwDGXwauJzweoMk', 'https://pay.stripe.com/receipts/acct_1GfYy3Bz8hwDGXwa/ch_1GnTOiBz8hwDGXwa5VSWRDql/rcpt_HMBmNuGm6KiwxjbnmwZc8RsCHAUhToj', 'succeeded', '2020-05-27 17:50:38', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `stripecustomers`
--
DROP TABLE IF EXISTS `stripecustomers`;
CREATE TABLE IF NOT EXISTS `stripecustomers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`customer_id` varchar(250) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `user_id` (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `stripecustomers`
--
INSERT INTO `stripecustomers` (`id`, `user_id`, `customer_id`, `created_at`, `updated_at`) VALUES
(1, 5, 'cus_HISC8kDAvLrRl2', '2020-05-17 18:33:09', '0000-00-00 00:00:00'),
(2, 12, 'cus_HMBk3t9jKcCAAz', '2020-05-27 17:48:55', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `stripetransfers`
--
DROP TABLE IF EXISTS `stripetransfers`;
CREATE TABLE IF NOT EXISTS `stripetransfers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` int(11) NOT NULL,
`charge_id` int(11) NOT NULL,
`vendor_id` int(11) NOT NULL,
`transfer_id` varchar(150) NOT NULL,
`reverse_transfer_id` varchar(150) DEFAULT NULL,
`amount` double NOT NULL,
`amount_reversed` double DEFAULT NULL,
`created` varchar(10) NOT NULL,
`currency` varchar(10) NOT NULL,
`destination` varchar(150) NOT NULL,
`destination_payment` varchar(150) NOT NULL,
`livemode` varchar(10) DEFAULT NULL,
`transfer_group` varchar(150) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `units`
--
DROP TABLE IF EXISTS `units`;
CREATE TABLE IF NOT EXISTS `units` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(250) NOT NULL,
`code` varchar(15) NOT NULL,
`iscontainer` tinyint(4) NOT NULL DEFAULT 0,
`status` tinyint(4) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `units`
--
INSERT INTO `units` (`id`, `title`, `code`, `iscontainer`, `status`, `created_at`, `updated_at`) VALUES
(1, '0.5 BU', '.5BU', 0, 1, '2020-04-21 12:33:28', '0000-00-00 00:00:00'),
(2, '0.5 DOZEN', '.5DZ', 0, 1, '2020-04-21 12:36:43', '2020-04-21 18:06:43'),
(3, 'BAG', 'BAG', 1, 1, '2020-04-21 12:37:21', '2020-04-21 18:07:21'),
(4, 'BOTTLE', 'BTL', 0, 1, '2020-04-21 12:36:37', '2020-04-21 18:06:37'),
(5, 'BOX', 'BOX', 1, 1, '2020-04-21 12:37:26', '2020-04-21 18:07:26'),
(6, 'Kilogram', 'KG', 0, 1, '2020-04-21 12:35:56', '0000-00-00 00:00:00'),
(7, 'Test Unit Test', 'TUT', 0, 1, '2020-05-10 20:13:16', '2020-05-11 01:43:16');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(100) NOT NULL,
`lastname` varchar(100) NOT NULL,
`initial` varchar(2) NOT NULL,
`email` varchar(300) NOT NULL,
`password` varchar(100) NOT NULL,
`accounttype` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1:superadmin,2:admin',
`status` tinyint(4) NOT NULL COMMENT '1:active,2:inactive',
`otp` int(11) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `firstname`, `lastname`, `initial`, `email`, `password`, `accounttype`, `status`, `otp`, `created_at`, `updated_at`) VALUES
(4, 'keyur', 'patel', 'KP', 'vendor@example.com', '251b1847fae3f1f3ae6bb775614ad7d7', 1, 1, NULL, '2020-05-23 11:50:29', '2020-05-23 17:20:29'),
(5, 'kinal', 'patel', 'KP', 'customer@example.com', 'a421e6b1f4ef36ee345db8db566d6b02', 2, 1, NULL, '2020-06-09 12:06:30', '2020-06-09 17:36:30'),
(7, 'vendor', 'new', 'VN', 'vendor2@example.com', '148b7a4c120fab9e839387afa9015fcf', 1, 1, NULL, '2020-05-18 13:19:07', '2020-05-18 18:49:07'),
(9, 'keyur', 'patel', 'KP', 'kp@example.com', 'c40a7d7a48c3af8bd7fb951b33489de2', 1, 1, NULL, '2020-05-21 19:38:18', '2020-05-22 01:08:18'),
(10, 'consumer', 'consumer', 'CC', 'consumer@example.com', '745a7b90b791da3e9409b9d83de6f836', 2, 1, NULL, '2020-05-26 19:59:59', '2020-05-27 01:29:59'),
(11, 'new', 'vendor', 'NV', 'newvendor@example.com', 'fcfadd86d788cb4bc7dd896739e1b9c0', 1, 1, NULL, '2020-05-26 23:54:49', '2020-05-27 05:24:49'),
(12, 'new', 'consumer', 'NC', 'newconsumer@example.com', 'd0f9c6217d648f8832567d16c3368ea4', 2, 1, NULL, '2020-05-27 00:09:12', '2020-05-27 05:39:12');
-- --------------------------------------------------------
--
-- Table structure for table `vendormarkets`
--
DROP TABLE IF EXISTS `vendormarkets`;
CREATE TABLE IF NOT EXISTS `vendormarkets` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`vendor_id` int(11) NOT NULL,
`market_id` int(11) NOT NULL,
`status` tinyint(4) NOT NULL,
`isapprove` tinyint(4) NOT NULL DEFAULT 0,
`sortorder` int(11) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `vendormarkets`
--
INSERT INTO `vendormarkets` (`id`, `vendor_id`, `market_id`, `status`, `isapprove`, `sortorder`, `created_at`, `updated_at`) VALUES
(11, 4, 2, 1, 1, 1, '2020-05-17 23:59:12', '2020-05-18 05:29:12'),
(13, 4, 3, 1, 1, NULL, '2020-05-17 20:50:40', '2020-05-18 02:20:40'),
(12, 4, 1, 0, 1, 1, '2020-05-27 17:21:38', '2020-05-27 22:51:38'),
(14, 7, 2, 1, 1, 0, '2020-05-17 23:59:12', '2020-05-18 05:29:12'),
(15, 7, 1, 1, 1, 0, '2020-05-27 17:21:38', '2020-05-27 22:51:38'),
(17, 4, 4, 0, 0, NULL, '2020-05-26 12:04:05', '2020-05-26 17:34:05'),
(18, 11, 5, 1, 1, NULL, '2020-05-27 17:46:00', '2020-05-27 23:16:00'),
(19, 4, 5, 1, 1, NULL, '2020-05-27 17:46:01', '2020-05-27 23:16:01');
-- --------------------------------------------------------
--
-- Table structure for table `zipcodes`
--
DROP TABLE IF EXISTS `zipcodes`;
CREATE TABLE IF NOT EXISTS `zipcodes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`zipcode` varchar(8) NOT NULL,
`lat` varchar(30) NOT NULL,
`lng` varchar(30) NOT NULL,
`city` varchar(150) DEFAULT NULL,
`state` varchar(100) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `zipcodes`
--
INSERT INTO `zipcodes` (`id`, `zipcode`, `lat`, `lng`, `city`, `state`, `created_at`, `updated_at`) VALUES
(1, '10001', '40.75065', '-73.996924', 'New York', 'NY', '2020-05-17 13:25:30', '0000-00-00 00:00:00'),
(2, '12345', '42.800004', '-73.920153', 'Schenectady', 'NY', '2020-05-17 13:25:43', '0000-00-00 00:00:00'),
(3, '10016', '40.745207', '-73.978018', 'New York', 'NY', '2020-05-17 13:35:52', '0000-00-00 00:00: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 */;
|
CREATE SCHEMA `internetshop` DEFAULT CHARACTER SET utf8 ;
CREATE TABLE `internetshop`.`items` (
`item_id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(225) NOT NULL,
`price` DECIMAL(4,2) NOT NULL,
PRIMARY KEY (`item_id`));
CREATE TABLE `users` (
`user_id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NULL,
`surname` VARCHAR(45) NULL,
`login` VARCHAR(45) NOT NULL,
`password` VARCHAR(45) NOT NULL,
`token` VARCHAR(45) NULL,
PRIMARY KEY (`user_id`));
CREATE TABLE `orders` (
`order_id` INT NOT NULL AUTO_INCREMENT,
`user_id` INT NOT NULL,
`date` DATE NULL,
PRIMARY KEY (`order_id`),
INDEX `orders.user_id_idx` (`user_id` ASC) VISIBLE,
CONSTRAINT `orders.user_id`
FOREIGN KEY (`user_id`)
REFERENCES `users` (`user_id`)
ON DELETE CASCADE
ON UPDATE CASCADE);
CREATE TABLE `orders_items` (
`orders_items_id` INT NOT NULL AUTO_INCREMENT,
`order_id` INT NOT NULL,
`item_id` INT NOT NULL,
PRIMARY KEY (`orders_items_id`),
INDEX `orders_items.orders.fk_idx` (`order_id` ASC) VISIBLE,
INDEX `orders_items.items_fk_idx` (`item_id` ASC) VISIBLE,
CONSTRAINT `orders_items.orders_fk`
FOREIGN KEY (`order_id`)
REFERENCES `orders` (`order_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `orders_items.items_fk`
FOREIGN KEY (`item_id`)
REFERENCES `items` (`item_id`)
ON DELETE CASCADE
ON UPDATE CASCADE);
CREATE TABLE `buckets` (
`bucket_id` INT NOT NULL AUTO_INCREMENT,
`user_id` INT NOT NULL,
PRIMARY KEY (`bucket_id`),
INDEX `buckets.user_id_fk_idx` (`user_id` ASC) VISIBLE,
CONSTRAINT `buckets.user_id_fk`
FOREIGN KEY (`user_id`)
REFERENCES `users` (`user_id`)
ON DELETE CASCADE
ON UPDATE CASCADE);
CREATE TABLE `roles` (
`role_id` INT NOT NULL AUTO_INCREMENT,
`role_name` VARCHAR(45) NOT NULL,
PRIMARY KEY (`role_id`));
CREATE TABLE `users_roles` (
`user_role_id` INT NOT NULL AUTO_INCREMENT,
`user_id` INT NOT NULL,
`role_id` INT NOT NULL,
PRIMARY KEY (`user_role_id`),
INDEX `users_roles.user_id_fk_idx` (`user_id` ASC) VISIBLE,
INDEX `users_roles.role_id_fk_idx` (`role_id` ASC) VISIBLE,
CONSTRAINT `users_roles.user_id_fk`
FOREIGN KEY (`user_id`)
REFERENCES `users` (`user_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `users_roles.role_id_fk`
FOREIGN KEY (`role_id`)
REFERENCES `roles` (`role_id`)
ON DELETE CASCADE
ON UPDATE CASCADE);
CREATE TABLE `buckets_items` (
`bucket_item_id` INT NOT NULL AUTO_INCREMENT,
`bucket_id` INT NOT NULL,
`item_id` INT NOT NULL,
PRIMARY KEY (`bucket_item_id`),
INDEX `buckets_items.bucket_id_fk_idx` (`bucket_id` ASC) VISIBLE,
INDEX `buckets_items.itemt_id_fk_idx` (`item_id` ASC) VISIBLE,
CONSTRAINT `buckets_items.bucket_id_fk`
FOREIGN KEY (`bucket_id`)
REFERENCES `buckets` (`bucket_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `buckets_items.itemt_id_fk`
FOREIGN KEY (`item_id`)
REFERENCES `items` (`item_id`)
ON DELETE CASCADE
ON UPDATE CASCADE);
INSERT INTO `roles` (`role_name`) VALUES ('ADMIN');
INSERT INTO `roles` (`role_name`) VALUES ('USER');
|
drop table ITEMS
create table ITEMS (
ID INT PRIMARY KEY,
TEXT VARCHAR(50) NOT NULL,
TYPE VARCHAR(50),
COLOR VARCHAR(50),
CREATE_DATE DATE NOT NULL
); |
drop database if exists i_notes;
create database i_notes;
use i_notes;
create table note_type(
id int primary key auto_increment,
`name` varchar(100),
`description` varchar(200)
);
create table note(
id int primary key auto_increment,
title varchar(100),
content varchar(500),
type_id int
);
alter table note add foreign key (type_id) references note_type(id) on delete cascade;
DELIMITER $$
CREATE PROCEDURE get_note()
BEGIN
SELECT n.id, n.title, n.content, nt.name
FROM note n join note_type nt on n.type_id = nt.id;
END$$
DELIMITER ;
DELIMITER $$
CREATE PROCEDURE insert_note(
IN note_title varchar(100),
IN note_content varchar(500),
IN note_type_id int
)
BEGIN
INSERT INTO note(title, content, type_id ) VALUES(note_title, note_content, note_type_id);
END$$
DELIMITER ;
DELIMITER $$
CREATE PROCEDURE update_note(
In note_id int,
IN note_title varchar(100),
IN note_content varchar(500),
IN note_type_id int
)
BEGIN
update note
set note.title = note_title, note.content = note_content, note.type_id = note_type_id
where note.id= note_id;
END$$
DELIMITER ;
DELIMITER $$
CREATE PROCEDURE delete_note_by_id(IN note_id INT)
BEGIN
delete from note where note.id = note_id;
END$$
DELIMITER ;
DELIMITER $$
CREATE PROCEDURE get_note_by_id(IN note_id INT)
BEGIN
SELECT note.title, note.content, note.type_id
FROM note
where note.id = note_id;
END$$
DELIMITER ;
insert into note_type(name,description) values ('cá nhân','việc cá nhân');
insert into note_type(name,description) values ('công ty','việc công ty');
insert into note_type(name,description) values ('gia đình','việc gia đình'); |
SELECT * FROM USERS
ORDER BY INSERT_DATETIME %s;
|
CREATE TABLE [ROUTES] (
[ID] INTEGER PRIMARY KEY AUTOINCREMENT,
[ORIGIN] TEXT NOT NULL,
[DESTINATION] TEXT NOT NULL,
[TRAVEL_TIME] INTEGER NOT NULL CHECK(TRAVEL_TIME>0),
UNIQUE(ORIGIN,DESTINATION)
);
|
delete from tbl_field_perms
where field_id = %1 and group_id = %2
|
CREATE TABLE [ADM].[C_EMPLEADO_IDIOMA] (
[ID_EMPLEADO_IDIOMA] INT IDENTITY (1, 1) NOT NULL,
[ID_EMPLEADO] INT NULL,
[ID_CANDIDATO] INT NULL,
[ID_IDIOMA] INT NOT NULL,
[PR_LECTURA] DECIMAL (5, 2) NULL,
[PR_ESCRITURA] DECIMAL (5, 2) NULL,
[PR_CONVERSACIONAL] DECIMAL (5, 2) NULL,
[CL_INSTITUCION] INT NULL,
[NO_PUNTAJE] DECIMAL (10, 3) NULL,
[FE_CREACION] DATETIME NOT NULL,
[FE_MODIFICACION] DATETIME NULL,
[CL_USUARIO_APP_CREA] NVARCHAR (50) NOT NULL,
[CL_USUARIO_APP_MODIFICA] NVARCHAR (50) NULL,
[NB_PROGRAMA_CREA] NVARCHAR (50) NOT NULL,
[NB_PROGRAMA_MODIFICA] NVARCHAR (50) NULL,
CONSTRAINT [PK_C_EMPLEADO_IDIOMA] PRIMARY KEY CLUSTERED ([ID_EMPLEADO_IDIOMA] ASC),
CONSTRAINT [FK_C_EMPLEADO_IDIOMA_C_CANDIDATO] FOREIGN KEY ([ID_CANDIDATO]) REFERENCES [ADM].[C_CANDIDATO] ([ID_CANDIDATO])
);
|
CREATE TABLE customer (
id int GENERATED BY DEFAULT AS IDENTITY,
firstName varchar(50) not null,
secondName varchar(50) not null,
address1 varchar(100) not null,
address2 varchar(100) null,
address3 varchar(100) null,
creditLimit NUMERIC(9,2),
PRIMARY KEY (id)
);
INSERT INTO customer (FIRSTNAME, secondname, address1, address2, address3, creditlimit) VALUES ('Johnny', 'Mack', '99 The Street', 'Ballytown', 'Limerick', 20000.0);
INSERT INTO customer (FIRSTNAME, secondname, address1, address2, address3, creditlimit) VALUES ('Jill', 'O''Mahony', '33 The Lane', 'Kilthere', 'Meath', 53217.44);
INSERT INTO customer (FIRSTNAME, secondname, address1, address2, address3, creditlimit) VALUES ('Bobby', 'O''Mahony', '33 The Lane', 'Kilthere', 'Cork', 53217.44);
INSERT INTO customer (FIRSTNAME, secondname, address1, address2, address3, creditlimit) VALUES ('Fred', 'Lowrey', '33 The Lane', 'Kilthere', 'Meath', 53217.44);
INSERT INTO customer (FIRSTNAME, secondname, address1, address2, address3, creditlimit) VALUES ('Mary', 'Savage', '33 The Lane', 'Kilthere', 'Cork', 53217.44);
|
INSERT INTO packt_serverless_analytics.nyc_taxi_partitioned_parquet
SELECT
vendorid,
tpep_pickup_datetime,
tpep_dropoff_datetime,
passenger_count,
trip_distance,
ratecodeid,
store_and_fwd_flag,
pulocationid,
dolocationid,
payment_type,
fare_amount,
extra,
mta_tax,
tip_amount,
tolls_amount,
improvement_surcharge,
total_amount,
congestion_surcharge,
--Below are partition columns and are always
--specified at the end of the SELECT statement
substr(tpep_pickup_datetime, 1, 4) AS year,
substr(tpep_pickup_datetime, 6, 2) AS month
FROM packt_serverless_analytics.nyc_taxi
WHERE tpep_pickup_datetime = '2020-07'; |
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKEC5C9E843FE2728C]') AND parent_object_id = OBJECT_ID('Blog_Articles'))
alter table Blog_Articles drop constraint FKEC5C9E843FE2728C
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKEC5C9E844D59DE92]') AND parent_object_id = OBJECT_ID('Blog_Articles'))
alter table Blog_Articles drop constraint FKEC5C9E844D59DE92
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKB4586BE4AB53CDD4]') AND parent_object_id = OBJECT_ID('ArticleTags_Article'))
alter table ArticleTags_Article drop constraint FKB4586BE4AB53CDD4
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKB4586BE4A8B479FA]') AND parent_object_id = OBJECT_ID('ArticleTags_Article'))
alter table ArticleTags_Article drop constraint FKB4586BE4A8B479FA
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK1F52BA553FE2728C]') AND parent_object_id = OBJECT_ID('Blog_ArticleMessages'))
alter table Blog_ArticleMessages drop constraint FK1F52BA553FE2728C
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK1F52BA55ED969811]') AND parent_object_id = OBJECT_ID('Blog_ArticleMessages'))
alter table Blog_ArticleMessages drop constraint FK1F52BA55ED969811
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK1F52BA55A8B479FA]') AND parent_object_id = OBJECT_ID('Blog_ArticleMessages'))
alter table Blog_ArticleMessages drop constraint FK1F52BA55A8B479FA
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK1F52BA5587C719FC]') AND parent_object_id = OBJECT_ID('Blog_ArticleMessages'))
alter table Blog_ArticleMessages drop constraint FK1F52BA5587C719FC
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKF498195E3FE2728C]') AND parent_object_id = OBJECT_ID('Blog_ArticleTags'))
alter table Blog_ArticleTags drop constraint FKF498195E3FE2728C
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKB223B6FC3FE2728C]') AND parent_object_id = OBJECT_ID('Blog_ArticleTypes'))
alter table Blog_ArticleTypes drop constraint FKB223B6FC3FE2728C
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK8BA0441091325CC]') AND parent_object_id = OBJECT_ID('Blog_Links'))
alter table Blog_Links drop constraint FK8BA0441091325CC
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK8BA044103FE2728C]') AND parent_object_id = OBJECT_ID('Blog_Links'))
alter table Blog_Links drop constraint FK8BA044103FE2728C
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK52ABEF303FE2728C]') AND parent_object_id = OBJECT_ID('Blog_LinkTypes'))
alter table Blog_LinkTypes drop constraint FK52ABEF303FE2728C
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKF404B7DF3FE2728C]') AND parent_object_id = OBJECT_ID('Blog_Projects'))
alter table Blog_Projects drop constraint FKF404B7DF3FE2728C
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKF404B7DF991984CA]') AND parent_object_id = OBJECT_ID('Blog_Projects'))
alter table Blog_Projects drop constraint FKF404B7DF991984CA
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FK3A2505673FE2728C]') AND parent_object_id = OBJECT_ID('Blog_ProjectTypes'))
alter table Blog_ProjectTypes drop constraint FK3A2505673FE2728C
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKB8CD86FB3E86CF7E]') AND parent_object_id = OBJECT_ID('Blog_UserTourLogs'))
alter table Blog_UserTourLogs drop constraint FKB8CD86FB3E86CF7E
if exists (select 1 from sys.objects where object_id = OBJECT_ID(N'[FKB8CD86FB3FE2728C]') AND parent_object_id = OBJECT_ID('Blog_UserTourLogs'))
alter table Blog_UserTourLogs drop constraint FKB8CD86FB3FE2728C
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_Users') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_Users
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_Ads') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_Ads
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_Articles') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_Articles
if exists (select * from dbo.sysobjects where id = object_id(N'ArticleTags_Article') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table ArticleTags_Article
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_ArticleMessages') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_ArticleMessages
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_ArticleTags') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_ArticleTags
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_ArticleTypes') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_ArticleTypes
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_Links') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_Links
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_LinkTypes') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_LinkTypes
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_Projects') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_Projects
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_ProjectTypes') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_ProjectTypes
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_UserTourLogs') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_UserTourLogs
if exists (select * from dbo.sysobjects where id = object_id(N'Blog_hibernate_unique_key') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Blog_hibernate_unique_key
create table Blog_Users (
Id INT not null,
UserName NVARCHAR(100) null,
UserNo NVARCHAR(100) null,
ImgHead NVARCHAR(200) null,
UserRole INT null,
SmallImgHead NVARCHAR(200) null,
StandardImgHead NVARCHAR(200) null,
Domain NVARCHAR(15) null,
Email NVARCHAR(30) null,
Card NVARCHAR(20) null,
UserSex INT null,
UserState INT null,
Phone NVARCHAR(15) null,
Paw NVARCHAR(255) null,
RealName NVARCHAR(25) null,
EnRealName NVARCHAR(25) null,
EmailValidate BIT null,
QQ NVARCHAR(30) null,
WeiBoUrl NVARCHAR(255) null,
BlogName NVARCHAR(50) null,
BlogDesc NVARCHAR(255) null,
CreateDate DATETIME null,
LastDateTime DATETIME null,
LoginDate DATETIME null,
LastLoginDate DATETIME null,
LoginIp NVARCHAR(15) null,
LastLoginIp NVARCHAR(15) null,
DesPassword NVARCHAR(255) null,
primary key (Id)
)
create table Blog_Ads (
AdId INT not null,
AdName NVARCHAR(50) null,
AdDesc NVARCHAR(100) null,
AdImg NVARCHAR(200) null,
StandardAdImg NVARCHAR(200) null,
SmallAdImg NVARCHAR(200) null,
AdType INT null,
IsShow BIT null,
Sort INT null,
CreateDate DATETIME null,
LastDateTime DATETIME null,
primary key (AdId)
)
create table Blog_Articles (
ArticleId INT not null,
Title NVARCHAR(200) null,
Content NVARCHAR(MAX) null,
ContentDesc NVARCHAR(800) null,
UrlQuoteUrl NVARCHAR(200) null,
IsShow BIT null,
ReadCount INT null,
CreateDate DATETIME null,
LastDateTime DATETIME null,
UserId INT null,
ArticleTypeId INT null,
primary key (ArticleId)
)
create table ArticleTags_Article (
ArticleId INT not null,
ArticleTagId INT not null
)
create table Blog_ArticleMessages (
ArticleMessageId INT not null,
Content NVARCHAR(MAX) null,
CreateDate DATETIME null,
IsShow BIT null,
NickName NVARCHAR(100) null,
Email NVARCHAR(50) null,
WebSiteUrl NVARCHAR(200) null,
LastDateTime DATETIME null,
UserId INT null,
BaseArticleMessageId INT null,
ArticleId INT null,
primary key (ArticleMessageId)
)
create table Blog_ArticleTags (
ArticleTagId INT not null,
TagName NVARCHAR(50) null,
IsShow BIT null,
CreateDate DATETIME null,
LastDateTime DATETIME null,
UserId INT null,
primary key (ArticleTagId)
)
create table Blog_ArticleTypes (
ArticleTypeId INT not null,
TypeName NVARCHAR(30) null,
IsShow BIT null,
CreateDate DATETIME null,
LastDateTime DATETIME null,
UserId INT null,
primary key (ArticleTypeId)
)
create table Blog_Links (
LinkId INT not null,
LinkTxt NVARCHAR(200) null,
LinkUrl NVARCHAR(200) null,
Img NVARCHAR(200) null,
Description NVARCHAR(500) null,
IsShow BIT null,
Sort INT null,
CreateDate DATETIME null,
LastDateTime DATETIME null,
LinkTypeId INT null,
UserId INT null,
primary key (LinkId)
)
create table Blog_LinkTypes (
LinkTypeId INT not null,
TypeName NVARCHAR(30) null,
IsShow BIT null,
Sort INT null,
CreateDate DATETIME null,
LastDateTime DATETIME null,
UserId INT null,
primary key (LinkTypeId)
)
create table Blog_Projects (
ProjectId INT not null,
ProjectName NVARCHAR(200) null,
ProjectImg NVARCHAR(200) null,
SmallProjectImg NVARCHAR(200) null,
StandardProjectImg NVARCHAR(200) null,
WebSite NVARCHAR(200) null,
Content NVARCHAR(MAX) null,
Introduction NVARCHAR(MAX) null,
IsShow BIT null,
Sort INT null,
CreateDate DATETIME null,
LastDateTime DATETIME null,
UserId INT null,
ProjectTypeId INT null,
primary key (ProjectId)
)
create table Blog_ProjectTypes (
ProjectTypeId INT not null,
TypeName NVARCHAR(30) null,
IsShow BIT null,
CreateDate DATETIME null,
LastDateTime DATETIME null,
UserId INT null,
primary key (ProjectTypeId)
)
create table Blog_UserTourLogs (
UserTourLogId INT not null,
CreateDate DATETIME null,
LastDateTime DATETIME null,
TourUserId INT null,
UserId INT null,
primary key (UserTourLogId)
)
alter table Blog_Articles
add constraint FKEC5C9E843FE2728C
foreign key (UserId)
references Blog_Users
alter table Blog_Articles
add constraint FKEC5C9E844D59DE92
foreign key (ArticleTypeId)
references Blog_ArticleTypes
alter table ArticleTags_Article
add constraint FKB4586BE4AB53CDD4
foreign key (ArticleTagId)
references Blog_ArticleTags
alter table ArticleTags_Article
add constraint FKB4586BE4A8B479FA
foreign key (ArticleId)
references Blog_Articles
alter table Blog_ArticleMessages
add constraint FK1F52BA553FE2728C
foreign key (UserId)
references Blog_Users
alter table Blog_ArticleMessages
add constraint FK1F52BA55ED969811
foreign key (BaseArticleMessageId)
references Blog_ArticleMessages
alter table Blog_ArticleMessages
add constraint FK1F52BA55A8B479FA
foreign key (ArticleId)
references Blog_Articles
alter table Blog_ArticleMessages
add constraint FK1F52BA5587C719FC
foreign key (ArticleMessageId)
references Blog_ArticleMessages
alter table Blog_ArticleTags
add constraint FKF498195E3FE2728C
foreign key (UserId)
references Blog_Users
alter table Blog_ArticleTypes
add constraint FKB223B6FC3FE2728C
foreign key (UserId)
references Blog_Users
alter table Blog_Links
add constraint FK8BA0441091325CC
foreign key (LinkTypeId)
references Blog_LinkTypes
alter table Blog_Links
add constraint FK8BA044103FE2728C
foreign key (UserId)
references Blog_Users
alter table Blog_LinkTypes
add constraint FK52ABEF303FE2728C
foreign key (UserId)
references Blog_Users
alter table Blog_Projects
add constraint FKF404B7DF3FE2728C
foreign key (UserId)
references Blog_Users
alter table Blog_Projects
add constraint FKF404B7DF991984CA
foreign key (ProjectTypeId)
references Blog_ProjectTypes
alter table Blog_ProjectTypes
add constraint FK3A2505673FE2728C
foreign key (UserId)
references Blog_Users
alter table Blog_UserTourLogs
add constraint FKB8CD86FB3E86CF7E
foreign key (TourUserId)
references Blog_Users
alter table Blog_UserTourLogs
add constraint FKB8CD86FB3FE2728C
foreign key (UserId)
references Blog_Users
create table Blog_hibernate_unique_key (
next_hi INT
)
insert into Blog_hibernate_unique_key values ( 1 )
|
DROP PROCEDURE CPI.COPY_POL_WREMINDER_2;
CREATE OR REPLACE PROCEDURE CPI.copy_pol_wreminder_2(
p_old_pol_id gipi_reminder.policy_id%TYPE,
p_new_par_id gipi_reminder.par_id%TYPE,
p_user gipi_reminder.user_id%TYPE
)
IS
v_row NUMBER;
item_exist VARCHAR2 (1) := 'N';
note_id NUMBER := 0;
BEGIN
/*
** Created by : Robert Virrey
** Date Created : 10-13-2011
** Reference By : (GIEXS004 - TAG EXPIRED POLICIES FOR RENEWAL)
** Description : copy_pol_wreminder program unit
*/
FOR wc IN (SELECT note_type, note_subject, note_text, renew_flag
FROM gipi_reminder
WHERE policy_id = p_old_pol_id
AND renew_flag = 'Y'
AND note_type = 'N')
LOOP
note_id := note_id + 1;
item_exist := 'N';
FOR chk IN (SELECT note_type, note_subject, note_text, renew_flag
FROM gipi_reminder
WHERE par_id = p_new_par_id)
LOOP
item_exist := 'Y';
END LOOP;
IF item_exist = 'N'
THEN
FOR wc2 IN (SELECT note_type, note_subject, note_text, renew_flag
FROM gipi_reminder
WHERE policy_id = p_old_pol_id
AND renew_flag = 'Y'
AND note_type = 'N')
LOOP
wc.note_type := wc2.note_type;
wc.note_subject := wc2.note_subject;
wc.note_text := wc2.note_text;
wc.renew_flag := wc2.renew_flag;
END LOOP;
INSERT INTO gipi_reminder
(par_id, note_id, note_type,
note_subject, note_text, renew_flag, date_created,
user_id, last_update
)
VALUES (p_new_par_id, note_id, wc.note_type,
wc.note_subject, wc.note_text, wc.renew_flag, SYSDATE,
p_user, SYSDATE
);
--CLEAR_MESSAGE;
--MESSAGE('Copying policy notes ...',NO_ACKNOWLEDGE);
--SYNCHRONIZE;
END IF;
END LOOP;
END;
/
|
create database students;
use students;
create table student(
id int primary key auto_increment,
`name` varchar(10),
age int,
course char(4),
price int
);
insert into student(`name`,age,course,price)
values('hoang',21,'CNTT',400000),
('viet',19,'dtvt',320000),
('thanh',18,'ktdn',400000),
('nhan',19,'CK',450000),
('huong',20,'TCNH',500000),
('huong',20,'TCNH',200000);
-- hiển thị tất cả các dòng tên hương
select * from student where name = 'huong' ;
-- hiển thị tổng số tiền của hương
select sum(price) from student where name = 'huong';
-- hiển thị danh sách của tất cả các học viên không trùng lặp
select * , count('name') c from student GROUP BY name HAVING c >=1;
-- Viết câu lệnh lấy ra tên danh sách của tất cả học viên, không trùng lặp
select distinct name from student; |
create database olist;
use olist;
######## customer table
create table customers
(customer_id VARCHAR(200),
customer_zip_code_prefix bigint,
customer_city VARCHAR(100),
customer_state VARCHAR(50),
constraint cust_pk primary key(customer_id)
);
select * from customers;
####### orders table
create table orders
(order_id VARCHAR(200),
customer_id VARCHAR(200),
order_status VARCHAR(100),
order_purchase_timestamp VARCHAR(100),
order_delivered_customer_date VARCHAR(100),
constraint order_pk primary key(order_id),
constraint cust_o_fk foreign key(customer_id) references customers(customer_id)
);
select order_delivered_customer_date,cust_delivery_date from orders;
alter table orders drop column cust_delivery_date;
alter table orders add column cust_purchase_date datetime;
alter table orders add column cust_delivery_date datetime;
SET SQL_SAFE_UPDATES = 0;
update orders
set cust_purchase_date = str_to_date(order_purchase_timestamp,'%m/%d/%Y %H:%i');
update orders
set cust_delivery_date = str_to_date(order_delivered_customer_date,'%m/%d/%Y %H:%i');
drop table orders;
select count(customer_id) from customers;
######## product translation table
create table product_trans
(product_category_name VARCHAR(200),
product_category_name_english VARCHAR(200),
constraint prod_name_pk primary key(product_category_name)
);
######### products table
create table products
(product_id VARCHAR(200),
product_category_name VARCHAR(200),
product_weight_g INT,
product_length_cm INT,
product_height_cm INT,
product_width_cm INT,
constraint product_pk primary key(product_id),
constraint prod_name_fk foreign key(product_category_name) references product_trans(product_category_name)
);
######## Seller table
create table sellers
(
seller_id VARCHAR(200),
seller_zip_code_prefix bigint,
seller_city VARCHAR(100),
seller_state VARCHAR(50),
constraint seller_pk primary key(seller_id)
);
######## Order Items table
create table order_items
(
order_id VARCHAR(200),
product_id VARCHAR(200),
seller_id VARCHAR(200),
shipping_limit_date VARCHAR(200),
price float,
freight_value float,
constraint order_oi_fk foreign key(order_id) references orders(order_id),
constraint product_oi_fk foreign key(product_id) references products(product_id),
constraint seller_oi_fk foreign key(seller_id) references sellers(seller_id)
);
select shipping_limit_date,shipping_date from order_items;
alter table order_items drop column shipping_date;
alter table order_items add column shipping_date datetime;
update order_items
set shipping_date = str_to_date(shipping_limit_date,'%m/%d/%Y %H:%i');
# Payment table
create table order_payment
(order_id VARCHAR(200),
payment_sequential INT,
payment_type VARCHAR(100),
payment_installments INT,
payment_value float,
constraint order_op_fk foreign key(order_id) references orders(order_id)
);
# reviews table
create table order_review
(
review_id VARCHAR(200),
order_id VARCHAR(200),
review_score INT,
review_creation_date VARCHAR(200),
review_answer_timestamp VARCHAR(200),
constraint review_pk primary key(review_id),
constraint order_or_fk foreign key(order_id) references orders(order_id)
);
alter table order_review add column creation_date datetime;
update order_review
set creation_date = str_to_date(review_creation_date,'%m/%d/%Y %H:%i');
alter table order_review add column answer_timestamp datetime;
update order_review
set answer_timestamp = str_to_date(review_answer_timestamp,'%m/%d/%Y %H:%i');
|
SELECT * FROM KNOWLEDGE_USERS
WHERE
USER_ID = ?
;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.