conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Remove missing Hive drop test table\n" }, { "from": "human", "value": "DROP TABLE IF EXISTS presto_test_sequence;\n\nDROP TABLE IF EXISTS presto_test;\n\nDROP TABLE IF EXISTS presto_test_partition_format;\n\nDROP TABLE IF EXISTS presto_test_unpartitioned;\n\nCREATE ...
sql
chosen
[ { "from": "system", "value": "Add patch for new link between genomic_align_tree and genomic_align_group\n" }, { "from": "human", "value": "\n# Updating the schema version\n\nUPDATE meta SET meta_value = 50 where meta_key = \"schema_version\";\n\n\n# DN/DS" }, { "from": "gpt", "value"...
sql
chosen
[ { "from": "system", "value": "Update sql to store timestamp without a timezone.\n" }, { "from": "human", "value": "create table Block (\n\tid serial,\n\n\tcreatedate timestamp not null,\n\tmodified_date timestamp not null,\n\n\tdisplayorder integer not null default 0,\n\tattachment integer null ...
sql
chosen
[ { "from": "system", "value": "Fix test.\nThe previous version was used to produce the desired output, this is\nwhat we want to test.\n" }, { "from": "human", "value": "start transaction;\n\ncreate table table3388 (k int,b int);\ninsert into table3388 values (1,2);\ninsert into table3388 values (...
sql
chosen
[ { "from": "system", "value": "Remove unmatched migration down column\n" }, { "from": "human", "value": "ALTER TABLE app_info\nDROP COLUMN IF EXISTS certificate;\n\nALTER TABLE module_config\nDROP COLUMN IF EXISTS certificate CASCADE,\nDROP COLUMN IF EXISTS private_key CASCADE;\n\nDROP TABLE IF E...
sql
chosen
[ { "from": "system", "value": "Add some note (just to get scripts executed again).\n" }, { "from": "human", "value": "IF EXISTS (\n select * from INFORMATION_SCHEMA.COLUMNS\n where TABLE_SCHEMA='dw' and TABLE_NAME='f_virta_otp_kvliikkuvuus'\n and COLUMN_NAME='d_opiskeluoikeudentyyppi_id'\n) BE...
sql
chosen
[ { "from": "system", "value": "Fix create user security code sproc\n" }, { "from": "human", "value": "CREATE PROCEDURE CreateUserSecurityCode\r\n\t@Code varchar(50),\r\n\t@UserId varchar(50),\r\n\t@CodeType int,\r\n\t@ExpiryTime datetime,\r\n\t@ReturnUrl varchar(max),\r\n\t@PendingValue nvarchar(...
sql
chosen
[ { "from": "system", "value": "Call Register_Bank() instead of doing hard-coded INSERT INTO Banks\n" }, { "from": "human", "value": "INSERT INTO Banks (BankID, Protocol, Host, Port, Path) VALUES ('TESTBANK001', 'https', 'www.testbank1.com', 443, '/api');\nINSERT INTO Banks (BankID, Protocol, Host...
sql
chosen
[ { "from": "system", "value": "Revert \"Fix DDL on timestamp\"\n" }, { "from": "human", "value": "-- add timestap column\n-- https://dev.mysql.com/doc/refman/5.5/en/timestamp-initialization.html\n-- at most one TIMESTAMP column per table could be automatically initialized or updated to the curren...
sql
chosen
[ { "from": "system", "value": "Fix permissions for user itest.\n" }, { "from": "human", "value": "CREATE USER itest;\nCREATE DATABASE itest OWNER itest;\n\n\\c itest;\nCREATE SEQUENCE users_id_sequence\n/* Create test tables */\nCREATE TABLE users (\n id int DEFAULT nextval('users_id_sequen...
sql
chosen
[ { "from": "system", "value": "Increase size of deployment properties varchar for mysql\n\nFixes #2019\n" }, { "from": "human", "value": "CREATE TABLE STREAM_DEPLOYMENTS (\n\tSTREAM_NAME VARCHAR(255) NOT NULL PRIMARY KEY,\n\tDEPLOYMENT_PROPS VARCHAR(1000)\n) ENGINE=InnoDB;\n" }, { "from"...
sql
chosen
[ { "from": "system", "value": "Use student state ID and school local ID for assessment export\n" }, { "from": "human", "value": "use x2data\nSELECT\n 'state_id',\n 'school_id',\n 'assessment_id',\n 'assessment_date',\n 'assessment_scale_score',\n 'assessment_perf_level',\n 'assessment_name...
sql
chosen
[ { "from": "system", "value": "Update initial list of users\n" }, { "from": "human", "value": "insert into user(id, name, login, password) values (1,'Roy','roy','spring');\ninsert into user(id, name, login, password) values (2,'SomeOne','so','spring');" }, { "from": "gpt", "value": "i...
sql
chosen
[ { "from": "system", "value": "Revert \"Be explicit about creating players_id_seq\"\n\nThis reverts commit 00417af166adcdfd8c6947f8d67773b60c7b3641.\n" }, { "from": "human", "value": "create sequence players_id_seq as integer;\ncreate table players(\n id integer not null default nextval('playe...
sql
chosen
[ { "from": "system", "value": "Add 'IF NOT EXISTS' to tables for Tabby\n\nThis fixes the \"error\" after first startup\n\n" }, { "from": "human", "value": "CREATE TABLE sessions\n(\n id INTEGER PRIMARY KEY,\n parent_id INTEGER DEFAULT 0,\n crdate INTEGER DEFAULT 0,\n tstamp INTEGER DE...
sql
chosen
[ { "from": "system", "value": "Update comment for new column\n" }, { "from": "human", "value": "/* Copyright 2019 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You...
sql
chosen
[ { "from": "system", "value": "Add locale, project unique constraint\n" }, { "from": "human", "value": "CREATE TABLE projects (\n id serial PRIMARY KEY,\n keys text[]\n);\n\nCREATE TABLE documents (\n id serial PRIMARY KEY,\n locale varchar(128) NOT NULL CHECK (locale <> ''),\n pai...
sql
chosen
[ { "from": "system", "value": "Make some indices unique as appropriate.\n" }, { "from": "human", "value": "BEGIN;\n\n\nCREATE TYPE LINKTYPE AS ENUM ('gopher', 'html');\n\n\nCREATE TABLE \"url\" (\n\t\"id\" BIGSERIAL,\n\t\"url\" TEXT NOT NULL,\n\tPRIMARY KEY (\"id\")\n);\n\nCREATE INDEX \"url__url...
sql
chosen
[ { "from": "system", "value": "Fix concurrency issue with pgsql stored function\n" }, { "from": "human", "value": "CREATE OR REPLACE FUNCTION {{routine_name}}(now {{table_name}}.eta%TYPE)\nRETURNS SETOF {{table_name}} AS $$\nDECLARE\n found_id {{table_name}}.id%TYPE;\nBEGIN\n SELECT id INTO...
sql
chosen
[ { "from": "system", "value": "Update initial sql query for the base table\n" }, { "from": "human", "value": "CREATE TABLE `cj_base_table` (\n`id` int(11) unsigned NOT NULL,\n `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n `modifiedAt` timestamp NULL DEFAULT NULL,\n `live` enum('1...
sql
chosen
[ { "from": "system", "value": "Add language in the table.\n" }, { "from": "human", "value": "-- README:\n-- Do not remove the field with a `-- DEFAULT` suffix.\n-- That's the default tables/fields needed by Ocsigen-start\n\nCREATE DATABASE ocsipersist;\n\nCREATE EXTENSION citext; --DEFAULT\n-- Yo...
sql
chosen
[ { "from": "system", "value": "Fix TO db migration comment breaking goose\n" }, { "from": "human", "value": "/*\n\tCopyright 2016 Comcast Cable Communications Management, LLC\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance w...
sql
chosen
[ { "from": "system", "value": "Refactor for Data table changes" }, { "from": "human", "value": "DELIMITER $$\nCREATE DEFINER=`admin`@`localhost` PROCEDURE `GetLeaderboardForStat`(IN `stat_name` VARCHAR(20))\n READS SQL DATA\nBEGIN\n\nDROP TABLE IF EXISTS LeaderboardForStat;\n\nCREATE TEMPORARY...
sql
chosen
[ { "from": "system", "value": "Add private boolean to media-set to force content-signing\n\n\nsvn commit r79266\n" }, { "from": "human", "value": "create table MediaSet (\n\tid serial,\n\n\tinstance integer default null references Instance(id) on delete cascade,\n\tshortname va...
sql
chosen
[ { "from": "system", "value": "Add update timestamp to retrieved columns\n" }, { "from": "human", "value": "DROP PROCEDURE IF EXISTS selectOrganization;\r\n\r\nDELIMITER $$\r\nCREATE PROCEDURE selectOrganization(p_orgid INT UNSIGNED)\r\nBEGIN\r\n\tSELECT org.orgid, org.org_name, usr.person_name, ...
sql
chosen
[ { "from": "system", "value": "Use more efficient indices in sample configuration" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS `queue_default` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `queue` varchar(64) NOT NULL,\n `data` text NOT NULL,\n `status` smallint(1) NOT NULL,\n `...
sql
chosen
[ { "from": "system", "value": "Use \\COPY instead of COPY\n\nCan be used without being a superuser" }, { "from": "human", "value": "\nDROP TABLE IF EXISTS hpo_phenotype;\nCREATE TABLE hpo_phenotype\n(\n hpo_id character varying(30) COLLATE pg_catalog.\"C\",\n hpo_label text COLLATE pg_catal...
sql
chosen
[ { "from": "system", "value": "Add a minimal request rspec.\n\nMinimal rspec requests any single node. Also cleaned out some old\ncruft.\n" }, { "from": "human", "value": "INSERT INTO schema_version(key, extra) values ('003', 'schema version');\n\n-- Fake tmitchel data\n-- INSERT INTO identity\n-...
sql
chosen
[ { "from": "system", "value": "Define the ENGINE to use InnoDB for the table and force UTF-8\n" }, { "from": "human", "value": "/* File generated automatically by dynamo */\n/* Entity types */\nCREATE TABLE entity_type (\n /* the entity type identifier */\n `id` INTEGER AUTO_INCREMENT,\n /* t...
sql
chosen
[ { "from": "system", "value": "Drop the local_stable_id column in the variation_annotation table\n" }, { "from": "human", "value": "# add a study_id column in the tables structural_variation and variation_annotation\n\nALTER TABLE structural_variation ADD COLUMN study_id int(10);\nALTER TABLE str...
sql
chosen
[ { "from": "system", "value": "Set up default value to alarm type\n" }, { "from": "human", "value": "ALTER TABLE `AlarmVO` ADD COLUMN `type` varchar(32) NOT NULL;\n\nCREATE TABLE IF NOT EXISTS `V2VConversionCacheVO` (\n `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT,\n `conversionHost...
sql
chosen
[ { "from": "system", "value": "Fix mysql log api script" }, { "from": "human", "value": "create table plm_log_api\n(\n id bigint not null primary key,\n date datetime not null,\n method varchar(255) not null,\n status_code SMALLINT not null,\n body_reque...
sql
chosen
[ { "from": "system", "value": "[arp_zonenplan_pub] Select auf Schema arp_npl geändert\n" }, { "from": "human", "value": "SELECT\n ogc_fid AS t_id,\n ST_Multi(wkb_geometry) AS geometrie,\n zcode,\n zcode_text,\n gem_bfs,\n exact,\n bearbeiter,\n verifiziert,\n datum \nFR...
sql
chosen
[ { "from": "system", "value": "Remove postgres 9.6 specific settings\n\nWe have 9.4 on Travis at the moment\n" }, { "from": "human", "value": "SET statement_timeout = 0;\nSET lock_timeout = 0;\nSET idle_in_transaction_session_timeout = 0;\nSET client_encoding = 'UTF8';\nSET standard_conforming_st...
sql
chosen
[ { "from": "system", "value": "Fix syntax error in DDL\n" }, { "from": "human", "value": "metadata :name => \"rkhunter\",\n :description => \"Utility to assist in the update/management of rkhunter\",\n :author => \"Drew A. Blessing <drew.blessing@mac.com>\",\n...
sql
chosen
[ { "from": "system", "value": "Update default char limit for project description\n" }, { "from": "human", "value": "CREATE TABLE projects (\n\tid INT NOT NULL PRIMARY KEY AUTO_INCREMENT,\n\tname VARCHAR(64) NOT NULL,\n\tactive BOOLEAN,\n\tmodified_time BIGINT NOT NULL,\n\tcreate_time BIGINT NOT ...
sql
chosen
[ { "from": "system", "value": "Remove previous road level index\n" }, { "from": "human", "value": "DO $$\nBEGIN\n\n--------------------------------------------------------------------------------\n-- planet_osm_line\n--------------------------------------------------------------------------------...
sql
chosen
[ { "from": "system", "value": "Add assembly id for expression atlas lookup dump\n" }, { "from": "human", "value": "COPY(\n SELECT urs_taxid,\n xref.taxid as taxid,\n gene || '|' || external_id || '|' || gene_synonym || '|' || optional_id as external_id,\n description,\n seq_version,...
sql
chosen
[ { "from": "system", "value": "Mark build key as not null\n" }, { "from": "human", "value": "CREATE TABLE builds (\n id SERIAL,\n created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),\n\n key VARCHAR(100),\n name VARCHAR(100),\n status VARCHAR(20),\n started TIMESTAMP WITH TIME ZONE,\n ...
sql
chosen
[ { "from": "system", "value": "Add whitespace to SQL schema\n" }, { "from": "human", "value": "CREATE DATABASE IF NOT EXISTS `laika-db`;\n\nCREATE TABLE IF NOT EXISTS `feature`(\n `id` INT NOT NULL AUTO_INCREMENT,\n `name` VARCHAR(255) NOT NULL,\n `created_at` DATE NOT NULL,\n PRIMARY KEY (id...
sql
chosen
[ { "from": "system", "value": "Fix a typo in PostgreSQL files\n" }, { "from": "human", "value": "CREATE TABLE propertystorage\n id SERIAL NOT NULL,\n path VARCHAR(1024) NOT NULL,\n name VARCHAR(100) NOT NULL,\n value TEXT\n);\n\nALTER TABLE ONLY propertystorage\n ADD CONSTRAINT pro...
sql
chosen
[ { "from": "system", "value": "Fix patch number in meta\n" }, { "from": "human", "value": "# Add index on the source_id column in variation_feature and phenotype_feature\nALTER TABLE variation_feature ADD key source_idx (source_id);\nALTER TABLE phenotype_feature ADD key source_idx (source_id);\n...
sql
chosen
[ { "from": "system", "value": "Add a configuration Option for hide non full supply tab.\n" }, { "from": "human", "value": "delete from configuration_settings where key = 'RNR_HIDE_SKIPPED_PRODUCTS';\n\nINSERT INTO configuration_settings (key, name, groupname, description, value, valueType,display...
sql
chosen
[ { "from": "system", "value": "Add UNIQUE constraint on username\n" }, { "from": "human", "value": "# --- !Ups\n\nCREATE TABLE user (\n id INT(11) NOT NULL AUTO_INCREMENT,\n username VARCHAR(255) NOT NULL,\n password VARCHAR(255) NOT NULL,\n admin BOOLEAN NOT NULL,\n PRIMARY KEY (id)\n);\n\n...
sql
chosen
[ { "from": "system", "value": "Fix for live_agents with not enough closer_campaign space.\n\n" }, { "from": "human", "value": "# 07/07/2009\n\nALTER TABLE osdial_xfer_log ADD uniqueid VARCHAR(20) NOT NULL default '';\nCREATE INDEX uniqueid ON osdial_xfer_log (uniqueid);\n\nALTER TABLE osdial_agen...
sql
chosen
[ { "from": "system", "value": "Make guild_id in channel table not unique\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS minecord (\n id TINYINT(1) PRIMARY KEY CHECK (id = 0),\n version TINYINT(2) NOT NULL\n);\nINSERT INTO minecord (id, version)\n VALUES(0, 1);\nCREATE...
sql
chosen
[ { "from": "system", "value": "Change back to varchar because otherwise cannot compare\n" }, { "from": "human", "value": "\n--\n-- Database: `idgeneration`\n--\nCREATE SCHEMA `idgeneration` ;\n-- --------------------------------------------------------\n\n--\n-- Table structure for table `id_gene...
sql
chosen
[ { "from": "system", "value": "Add new table to upgrade SQL file\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS `uploadfile` (\n `id` int(11) NOT NULL auto_increment,\n `filename` varchar(255) NOT NULL,\n `filesize` int(11) NOT NULL DEFAULT '0',\n `sha1sum` varchar(40) NOT NULL...
sql
chosen
[ { "from": "system", "value": "Clean up the polygon holes" }, { "from": "human", "value": "--DROP FUNCTION o2p_aggregate_polygon_relation(bigint);\nCREATE OR REPLACE FUNCTION o2p_aggregate_polygon_relation(\n bigint\n) returns geometry[] AS $o2p_aggregate_polygon_relation$\nDECLARE\n v_rel_id A...
sql
chosen
[ { "from": "system", "value": "Add references oldstyle for easy understandings\n" }, { "from": "human", "value": "-- Script: Tabelas\n-- Learn: http://www.postgresql.org/docs/current/static/sql-createtable.html\n\nCREATE TABLE usuarios (\n username VARCHAR(30) PRIMARY KEY,\n password VARCHA...
sql
chosen
[ { "from": "system", "value": "Fix syntax error in DDL\n" }, { "from": "human", "value": "metadata :name => \"rkhunter\",\n :description => \"Utility to assist in the update/management of rkhunter\",\n :author => \"Drew A. Blessing <drew.blessing@mac.com>\",\n...
sql
chosen
[ { "from": "system", "value": "Add index on log_query(name) column\n" }, { "from": "human", "value": "-- Copyright (C) 2017 Alaa Masoud\n-- See the LICENSE file in the project root for more information.\n\nCREATE TABLE IF NOT EXISTS log(\n\tid TEXT NOT NULL PRIMARY KEY,\n\tmessage TEXT NOT NULL,\...
sql
chosen
[ { "from": "system", "value": "Document suggestions for the user now proper handle the surname word buondaries when searching.\n" }, { "from": "human", "value": "CREATE OR REPLACE VIEW documentsuggestion AS\n SELECT DISTINCT\n d.\"id\" AS \"document\",\n \"user\".\"id\" AS \"researchE...
sql
chosen
[ { "from": "system", "value": "Adjust needsReview for furigana in update\n\nso that we won’t need to regenerate all the furiganas\njust for that.\n" }, { "from": "human", "value": "alter table transcriptions ADD needsReview tinyint(1) NOT NULL DEFAULT '1' after user_id;\nupdate transcriptions set...
sql
chosen
[ { "from": "system", "value": "Fix SQL error in migration script" }, { "from": "human", "value": "BEGIN;\n\n-- add userneed state\nALTER TABLE userneed ADD COLUMN state VARCHAR(255) DEFAULT \"ACTIVE\";\n\nCOMMIT;\n" }, { "from": "gpt", "value": "BEGIN;\n\n-- add userneed state\nALTER ...
sql
chosen
[ { "from": "system", "value": "Add cascade for dropping snomedct schema." }, { "from": "human", "value": "/* Create the database */\n-- This is to create a schema inside a database instead of creating a blank database.\n-- Postgres does not allow to drop a database within the same connection. Als...
sql
chosen
[ { "from": "system", "value": "Change text mining sql to join on urs_taxid rather than urs\n" }, { "from": "human", "value": "COPY (\n SELECT\n json_build_object(\n 'id', todo.id,\n 'urs_taxid', todo.urs_taxid,\n 'publication_count', counts.publication_count\n )\n FROM se...
sql
chosen
[ { "from": "system", "value": "Correct the script creating tables for plays\n\nThe date were defined as `varchar`, but dates should not be managed as it.\nThis commit changes the script to accept timestamp instead.\n\nThis script was updated instead of creating another file\nbecause there is no other person ...
sql
chosen
[ { "from": "system", "value": "Revert \"[TOOLS-572] removing wrong sql line\"\n\nThis reverts commit be008944b162e4884d0d0adbc2c5ff120ddcdcd3.\n" }, { "from": "human", "value": "CREATE TABLE FOLLOWUP_DAILY_SYNTHESIS (\n id NUMBER NOT NULL,\n followup_date DATE ...
sql
chosen
[ { "from": "system", "value": "Add query of user errors to see error results on CI Server.\n" }, { "from": "human", "value": "whenever sqlerror exit failure rollback\nwhenever oserror exit failure rollback\n\n@@types/ut_object.tps\n@@types/ut_objects_list.tps\n@@types/ut_composite_object.tps\n@@t...
sql
chosen
[ { "from": "system", "value": "Fix typo on export_scan function\n\nSigned-off-by: Michael Casadevall <6fe105eefab41990d7ec714c6c25ade3095cdb48@them.com>\n" }, { "from": "human", "value": "-- Returns a scan result in such a way that I can get the JSON object back out of the database\n\nCREATE OR R...
sql
chosen
[ { "from": "system", "value": "mdb: Add NOT NULL constraint to file.file_name\n" }, { "from": "human", "value": "\nCREATE TABLE file\n ( file_id INTEGER PRIMARY KEY AUTOINCREMENT\n , file_sha1 BINARY(20)\n , file_name TEXT UNIQUE\n , file_size INTEGER NOT NULL\n ,...
sql
chosen
[ { "from": "system", "value": "Revert \"Made the ownership of tables really clear. Should help avoid the problem that DD had the other day.\"\n\nThis reverts commit e1144cf9ba61e87df9ee4c4bd0889e7a4422ee2c.\n\nThat commit introduced a hard-coded username in multiple places in a source\ncode file instead of j...
sql
chosen
[ { "from": "system", "value": "Add comment (really,doing this mostly to kick off a new build).\n\ngit-svn-id: 6bd94cac40bd5c1df74b384d972046d926de6ffa@12068 a8845c50-7012-0410-95d3-8e1449b9b1e4\n" }, { "from": "human", "value": "DROP TABLE IF EXISTS LOAN_MONITORING;\r\n\r\n/*\r\nThe table LOAN_MO...
sql
chosen
[ { "from": "system", "value": "Add comments on how to create a db and a db user\n" }, { "from": "human", "value": "-- Type of spelling\n-- a classic reference table\nCREATE TABLE spelling (\n id TINYINT PRIMARY KEY,\n name VARCHAR(256) NOT NULL\n);\n\nCREATE TABLE words (\n word VARCHAR(256) N...
sql
chosen
[ { "from": "system", "value": "Add idle/cc_grp_ldrs sitevar, for when we should start cc'ing leaders on idle msgs.\n" }, { "from": "human", "value": "-- MySQL dump 8.22\n--\n-- Host: localhost Database: tbdb\n---------------------------------------------------------\n-- Server version\t3.23.54...
sql
chosen
[ { "from": "system", "value": "Create roll and grant priveleges\n" }, { "from": "human", "value": "CREATE DATABASE FAM_SARP;\n\\c fam_sarp\n\nCREATE TABLE participants (\n subject smallserial NOT NULL,\n email character varying(40) UNIQUE NOT NULL,\n sessions_completed smallint NOT NULL,\n rn...
sql
chosen
[ { "from": "system", "value": "Fix case in test case.\n" }, { "from": "human", "value": "SELECT CASE WHEN F(NULL) THEN 'null' WHEN NAME IS NOT NULL THEN name ELSE 'default' END FROM customers\n" }, { "from": "gpt", "value": "SELECT CASE WHEN F(NULL) THEN 'null' WHEN name IS NOT NULL T...
sql
chosen
[ { "from": "system", "value": "Fix escaping in data script\n" }, { "from": "human", "value": "INSERT INTO media\n(\n title,\n uri,\n rating,\n viewed_at,\n created_at\n)\nVALUES\n(\"God's Not Dead 2\", 'http://www.imdb.com/title/tt4824308/', 1000, '2016-08-24', now())" }, { "from": "...
sql
chosen
[ { "from": "system", "value": "Add default config to kro table\n" }, { "from": "human", "value": "do $$\ndeclare\n\tselected_role safetymaps.role%rowtype;\nbegin\n\tselect * \n\tinto selected_role\n\tfrom safetymaps.role \n\twhere role = 'kro';\n\t\n\tif not found then\n\t\tinsert into safetymaps...
sql
chosen
[ { "from": "system", "value": "Add UUID to infrastructures view" }, { "from": "human", "value": "CREATE VIEW {# geotrek.maintenance #}.v_infrastructures AS (\n\tSELECT e.geom, e.id, t.*\n\tFROM infrastructure_infrastructure AS t, infrastructure_infrastructuretype AS b, core_topology AS e\n\tWHERE...
sql
chosen
[ { "from": "system", "value": "Allow batchjobstate type to exist in any schema, not just public\n" }, { "from": "human", "value": "CREATE OR REPLACE FUNCTION cron.Is_Valid_Function(_Function regprocedure)\nRETURNS boolean\nLANGUAGE sql\nSTABLE\nSET search_path TO public, pg_temp\nAS $FUNC$\nSELEC...
sql
chosen
[ { "from": "system", "value": "Fix to identity_images migration sql\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS identity_images(\r\n type VARCHAR,\r\n image_payload BLOB NOT NULL,\r\n width int,\r\n height int\r\n filesize int,\r\n resize_target int,\r\n) WITHO...
sql
chosen
[ { "from": "system", "value": "Swap columns in color sql\n" }, { "from": "human", "value": "INSERT INTO color (wikidata_id, color) VALUES\n ('blue', 'Q1088'),\n ('brown', 'Q47071'),\n ('cyan', 'Q180778'),\n ('green', 'Q3133'),\n ('magenta', 'Q3276756'),\n ('orange', 'Q39338'),\n ('purple', 'Q3257...
sql
chosen
[ { "from": "system", "value": "Clean up provider test script migrations.\n" }, { "from": "human", "value": "create table Users\n ( Id int not null primary key\n , Name string(128)\n , Email string(128)\n , Password binary(64)\n , Salt binary(64)\n )\n\ncreate T...
sql
chosen
[ { "from": "system", "value": "DROP TABLE IF EXISTS before CREATE it\n" }, { "from": "human", "value": "CREATE TABLE `pvpstats_faction` (\n `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,\n `faction` BIT NOT NULL,\n `level` TINYINT UNSIGNED NOT NULL,\n `date` DATETIME NOT NULL,\n PRIMARY KEY (...
sql
chosen
[ { "from": "system", "value": "Reset duns on down evolution\n\nEvolution invalidation. Duns values are lost, this just keeps\nexistence.\n" }, { "from": "human", "value": "# --- !Ups\n\nALTER TABLE \"party\" DROP \"duns\";\nALTER TABLE audit.\"party\" DROP \"duns\";\n\n# --- !Downs\n\nALTER TABL...
sql
chosen
[ { "from": "system", "value": "Fix ZF-11050: Zend_Queue can duplicate messages when using Postgres\n" }, { "from": "human", "value": "/*\r\nSample grant for PostgreSQL\r\n\r\nCREATE ROLE queue LOGIN\r\n PASSWORD '[CHANGE ME]'\r\n NOSUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE;\r\n\r\n*/\r\n\r\n-...
sql
chosen
[ { "from": "system", "value": "Store the information about who initiated the ban\n" }, { "from": "human", "value": "ALTER TABLE partners ADD COLUMN banned_at TIMESTAMP WITH TIME ZONE;\nALTER TABLE partners ADD COLUMN ban_reason VARCHAR(4098);\n" }, { "from": "gpt", "value": "ALTER TAB...
sql
chosen
[ { "from": "system", "value": "Tweak tps per client report\n" }, { "from": "human", "value": "SELECT\n set,script,scale,\n pg_size_pretty(avg(dbsize)::int8) AS db_size,\n-- pg_size_pretty(avg(dbsize)::int8 / scale) AS size_per_scale,\n clients,rate_limit,\n round(avg(tps)) as tps,\n round(a...
sql
chosen
[ { "from": "system", "value": "Add \"IF EXISTS\" in drop column SQL\n" }, { "from": "human", "value": "-- CIRCUS CS DB Migration 12\n\nALTER TABLE series_list DROP COLUMN is_deleted;\nALTER TABLE study_list DROP COLUMN is_deleted;\nALTER TABLE patient_list DROP COLUMN is_deleted;\n" }, { ...
sql
chosen
[ { "from": "system", "value": "Improve projects and pages migration file.\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS projects (\n id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),\n created_at timestamptz DEFAULT current_timestamp,\n modified_at timestamptz DEFAULT current_tim...
sql
chosen
[ { "from": "system", "value": "Include click count for each shortened url\n" }, { "from": "human", "value": "drop table if exists entries;\ncreate table entries (\n slug text primary key,\n url text not null,\n timestamp datetime default CURRENT_TIMESTAMP\n);" }, { "from": "gpt", "...
sql
chosen
[ { "from": "system", "value": "Add field for \"extra\" to DB.\n" }, { "from": "human", "value": "DROP TABLE IF EXISTS results_redux CASCADE;\nCREATE TABLE results_redux (\n\tid SERIAL NOT NULL UNIQUE,\t\t\t\t\t\t\t\t\t-- index of the result\n\ttask TEXT NOT NULL,\t\t\t\t\t\t\t\t\t\t\t-- which tas...
sql
chosen
[ { "from": "system", "value": "Convert karyotype data to JSON\n\nIt is a json field so should be loaded as such.\n" }, { "from": "human", "value": "INSERT INTO ensembl_karyotypes (\n assembly_id,\n karyotype\n) (\nselect\n assembly_id,\n karyotype\nfrom load_karyotypes\n) ON CONFLICT ...
sql
chosen
[ { "from": "system", "value": "Remove database names and add tag tables\n" }, { "from": "human", "value": "DROP TABLE dbs_registry.vocab_metadata;\nDROP TABLE dbs_registry.harvest_parameter;\n\n\nCREATE TABLE `dbs_registry`.`registry_object_identifier_relationships` (\n `id` INT UNSIGNED NOT NU...
sql
chosen
[ { "from": "system", "value": "Define dummy relations for geospatial schema\n" }, { "from": "human", "value": "SET search_path = relation, pg_catalog;\n\n\nINSERT INTO \"type\" (name) VALUES ('self');\n" }, { "from": "gpt", "value": "SET search_path = relation, pg_catalog;\n\n\nINSERT...
sql
chosen
[ { "from": "system", "value": "Change aggregation columns to nullable" }, { "from": "human", "value": "-- Remove not null constraint on age tranche (data is incomplete)\nALTER TABLE agg_child_health ALTER COLUMN age_tranche DROP NOT NULL;\n" }, { "from": "gpt", "value": "-- Remove not...
sql
chosen
[ { "from": "system", "value": "Remove unique - some duplicated exists.\n" }, { "from": "human", "value": "-- Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute\n-- Copyright [2016-2020] EMBL-European Bioinformatics Institute\n-- \n-- Licensed unde...
sql
chosen
[ { "from": "system", "value": "Update demo data according to new DB\n" }, { "from": "human", "value": "INSERT INTO `ssbo_ticketing`.`tickets`\n(`code`, `firstname`, `lastname`, `street`, `housenumber`, `postalcode`, `town`, `date`)\nVALUES\n('1911332118324935400', 'Max', 'Mustermann', 'Musterstra...
sql
chosen
[ { "from": "system", "value": "Comment out WHERE clause that limits tasks to currently logged in user.\n" }, { "from": "human", "value": "SELECT\n\tt.TaskDescription\n\t, t.StartDate\n\t, t.DueDate\n\t, tt.TypeDescription\n\t, t.PercentComplete\n\t, t.PriorityCode\n\t, t.TaskID\n\t, t.TaskSeqNum\...
sql
chosen
[ { "from": "system", "value": "Set default values for DDL queue_log in PostgreSQL\n" }, { "from": "human", "value": "CREATE TABLE \"queue_log\" (\n \"id\" SERIAL,\n \"time\" TIMESTAMP WITHOUT TIME ZONE DEFAULT now() NOT NULL,\n \"callid\" character varying(50) NOT NULL,\n \"queuename\...
sql
chosen
[ { "from": "system", "value": "Revert \"remove not null on created on\"\n\nThis reverts commit 49bee17fecc7b12f78b3f3591ca4b01369dae672.\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS `FILES` (\n `ID` bigint(20) NOT NULL,\n `ETAG` char(36) NOT NULL,\n `PREVIEW_ID` bigint(20) DEF...
sql
chosen
[ { "from": "system", "value": "Add id column in emails and foreign key constraint to pacakges.\n" }, { "from": "human", "value": "BEGIN;\n\n CREATE TABLE package_managers\n ( id bigserial PRIMARY KEY\n , name text NOT NULL UNIQUE\n );\n\n CREATE TABLE ...
sql
chosen
[ { "from": "system", "value": "Allow for department's provided NFIRS to override NFPA NFIRS\n" }, { "from": "human", "value": "CREATE MATERIALIZED VIEW IF NOT EXISTS public.joint_fireincident AS\n SELECT * FROM public.fireincident UNION ALL\n SELECT * FROM department_nfirs.fireincident;\n" ...
sql
chosen
[ { "from": "system", "value": "Add reset to password expiration\n\nFixes edge-case where global admin account is immediately locked if\npassword expiration is enabled, account locking is set, and the global\nadmin last changed the password earlier than the expiration window.\n" }, { "from": "human", ...
sql
chosen
[ { "from": "system", "value": "Fix duplicate key issue on migration 151\n" }, { "from": "human", "value": "INSERT INTO `django_content_type` (`name`, `app_label`, `model`) VALUES ('redirect','inproduct','redirect');\n\nSELECT (@id:=`id`) FROM `django_content_type` WHERE `name` = 'redirect';\n\nIN...
sql
chosen
[ { "from": "system", "value": "Remove useless join which gobbled memory\n" }, { "from": "human", "value": "begin;\ndrop table if exists line_joints;\ncreate table line_joints (\n synth_id varchar(64),\n objects varchar(64) array,\n terminal_id int[],\n area geometry(poly...
sql
chosen
[ { "from": "system", "value": "Change deployment_props to varchar(1000) to facilitate testing\n" }, { "from": "human", "value": "CREATE TABLE STREAM_DEFINITIONS (\n\tDEFINITION_NAME VARCHAR(255) NOT NULL PRIMARY KEY,\n\tDEFINITION TEXT DEFAULT NULL\n) ENGINE=InnoDB;\n\nCREATE TABLE STREAM_DEPLOY...
sql
chosen
[ { "from": "system", "value": "Revert \"OLMIS-2492: fixed inserting warehouse in migration\"\n\nThis reverts commit df04d013faea38f384612e27c8ea4b8853325ae5.\n" }, { "from": "human", "value": "INSERT INTO facility_types (id, code, name, active, displayOrder)\n VALUES ('e2faaa9e-4b2d-4212-bb60-...
sql
chosen