conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Clean up timeside drop sql script\n" }, { "from": "gpt", "value": "BEGIN;\n\nDROP TABLE IF EXISTS `timeside_results`;\nDROP TABLE IF EXISTS `timeside_selections_items`;\nDROP TABLE IF EXISTS `timeside_items`;\nDROP TABLE IF EXISTS `timeside_tasks`;\nDROP TABLE IF EXI...
sql
chosen
[ { "from": "human", "value": "Add kebabs to lunch choices\n" }, { "from": "gpt", "value": "SELECT run_migration(6, $$\n\tINSERT INTO choice (id, name, added_in, removed_in)\n\tVALUES (17, 'Kebabs', 33, NULL);\n$$);\n\n-- SELECT rollback_migration(6, $$\n-- \tDELETE FROM \"choice\" WHERE id = 17;\...
sql
chosen
[ { "from": "human", "value": "[NEW] Upgrade Patch to show Modules menu item when tiki_p_admin_modules permission is activated\n\ngit-svn-id: a7fabbc6a7c54ea5c67cbd16bd322330fd10cc35@24421 b456876b-0849-0410-b77d-98878d47e9d5\n" }, { "from": "gpt", "value": "SET @pcant=0;\nSELECT (@pcant:=count(*)...
sql
chosen
[ { "from": "human", "value": "Delete old versions that are no longer migratable but for which we have a latest\ngood version\n" }, { "from": "gpt", "value": "update versions\n set deleted_at=now(),deleted_by_guid = (select guid from users where deleted_at is null and email='admin@apidoc.me')\n ...
sql
chosen
[ { "from": "human", "value": "Add missing collection scientist changes\n" }, { "from": "gpt", "value": "set search_path=darwin2;\nalter table collections add column staff_ref integer;\nalter table collections add constraint fk_collections_staff foreign key (staff_ref) references users(id) on dele...
sql
chosen
[ { "from": "human", "value": "[OWL-974] Add a schema for DB migration of Grafana\n" }, { "from": "gpt", "value": "CREATE DATABASE grafana_database;\nUSE grafana_database;\n\nCREATE TABLE `session` (\n `key` CHAR(16) NOT NULL,\n `data` BLOB,\n `expiry` INT(11) UNSIGNED NOT N...
sql
chosen
[ { "from": "human", "value": "Add read only permissions to ipsative survey.\n\nThis commit adds a migration to allow read to\nusers that are not logged in.\n\nIssue #HAV-99\n\nSigned-off-by: Christopher Mundus <711c73f64afdce07b7e38039a96d2224209e9a6c@kindlyops.com>\n" }, { "from": "gpt", "value"...
sql
chosen
[ { "from": "human", "value": "Add PostgreSQL function example with feature split bigtable by month\n" }, { "from": "gpt", "value": "DROP FUNCTION if exists split_bigtable(\"s\" timestamp);\nCREATE OR REPLACE FUNCTION split_bigtable(\"s\" timestamp)\n RETURNS void AS\n$$\nDECLARE\n \"e\" times...
sql
chosen
[ { "from": "human", "value": "Add a n option for Beginning balance column\n" }, { "from": "gpt", "value": "UPDATE master_rnr_columns\nset calculationOption = '[{\"name\":\"Default (Users not allowed to override beginning balance) \", \"id\":\"DEFAULT\"},{\"name\":\"Allow users to override beginni...
sql
chosen
[ { "from": "human", "value": "Add table definition to store (failed) token attempts\n" }, { "from": "gpt", "value": "\r\nCREATE TABLE if not exists gems__token_attempts (\r\n gta_id_attempt bigint unsigned not null auto_increment,\r\n gta_id_token varchar(9) CHARACTER SET 'utf8' COL...
sql
chosen
[ { "from": "human", "value": "Add db patch for invships.\n" }, { "from": "gpt", "value": "DROP VIEW invusedtypes;\n\nCREATE OR REPLACE VIEW invships AS \n SELECT invtypes.typeid, invtypes.typename, invtypes.groupid, invgroups.groupname, invtypes.marketgroupid, invmarketgroups.marketgroupname\n ...
sql
chosen
[ { "from": "human", "value": "Test proper setting of the global optimizer variable.\n" }, { "from": "gpt", "value": "-- show behavior of optimizer plans\n\nselect optimizer;\nset optimizer='off';\nselect optimizer;\nset optimizer='on';\nselect optimizer;\nset optimizer='off';\nset optimizer='defa...
sql
chosen
[ { "from": "human", "value": "Add is_deleted field to exchange_routes\n" }, { "from": "gpt", "value": "BEGIN;\n ALTER TABLE exchange_routes ADD COLUMN is_deleted bool NOT NULL DEFAULT FALSE;\n\n DROP CAST (current_exchange_routes AS exchange_routes);\n DROP VIEW current_exchange_routes;\...
sql
chosen
[ { "from": "human", "value": "Delete old service versions on past api.json format\n" }, { "from": "gpt", "value": "update users\n set email = 'admin@apidoc.me'\n where email = 'admin@apidoc.com'\n and deleted_at is null;\n\nupdate services\n set deleted_at = now(),\n deleted_by_guid =...
sql
chosen
[ { "from": "human", "value": "Add the first migration, to create the tasks table in H2 database\n" }, { "from": "gpt", "value": "CREATE TABLE tasks (\n id INT (11) PRIMARY KEY AUTO_INCREMENT,\n title VARCHAR(200) NOT NULL,\n description TEXT DEFAULT '',\n status TINYINT NOT NULL DEFAULT 0,\n ...
sql
chosen
[ { "from": "human", "value": "Add tables for federated device messages\n\nAdds tables for storing the messages that need to be sent to a\nremote device and for deduplicating messages received.\n" }, { "from": "gpt", "value": "/* Copyright 2016 OpenMarket Ltd\n *\n * Licensed under the Apache Lice...
sql
chosen
[ { "from": "human", "value": "Add billing related DB changes.\n" }, { "from": "gpt", "value": "--\n-- Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.\n--\n-- WSO2 Inc. licenses this file to you under the Apache License,\n-- Version 2.0 (the \"License\"); you may no...
sql
chosen
[ { "from": "human", "value": "Add init script for postgres database\n" }, { "from": "gpt", "value": "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";\n\nCREATE TABLE traces(\ntrace_uuid uuid PRIMARY KEY,\ntransaction_uuid uuid,\norigin_uuid uuid,\ntrace_name text,\nstart_time timestamp(6),\nend_time...
sql
chosen
[ { "from": "human", "value": "Add test cases for creating index\n" }, { "from": "gpt", "value": "-- Create a nonclustered index on a table or view \nCREATE INDEX i1 ON t1 (col1); \n\n--Create a clustered index on a table and use a 3-part name for the table \nCREATE CLUSTERED INDEX i1 ON d1.s1....
sql
chosen
[ { "from": "human", "value": "Increase size of kuvaus in varda_koodistot\n" }, { "from": "gpt", "value": "USE [ANTERO]\nGO\n\nALTER TABLE [sa].[sa_varda_koodistot] DROP CONSTRAINT [DF__sa_varda_koodistot__username]\nGO\n\nALTER TABLE [sa].[sa_varda_koodistot] DROP CONSTRAINT [DF__sa_varda_koodist...
sql
chosen
[ { "from": "human", "value": "KCIAC-285: Implement IACUC notification for Hold\n" }, { "from": "gpt", "value": "INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMESTAMP, VER_NBR, OBJ...
sql
chosen
[ { "from": "human", "value": "Create Unique Composite Key Mod Script\n\nAdding a safe, repeatable mod script to add the retention rule composite key. This should already be in the main DDL, but this mod script will be available just in case there are old versions of the schema that need to be updated.\n" }...
sql
chosen
[ { "from": "system", "value": "Address owner changed to role_connect\n" }, { "from": "human", "value": "--drop and recreate the address table to allow new columns for organisation_name and locality\n\nset schema 'caseframe';\n\nDELETE FROM questionnaire;\nDELETE FROM \"case\";\nDELETE FROM addres...
sql
chosen
[ { "from": "human", "value": "Add script to migrate duplicated study groups\n" }, { "from": "gpt", "value": "CREATE OR REPLACE FUNCTION migrate_study_group(target_study_group int, duplicated_study_group int)\n RETURNS VOID\n LANGUAGE plpgsql\nAS\n$$\nDECLARE\n\nBEGIN\n IF target_study_gr...
sql
chosen
[ { "from": "human", "value": "Add Queries vulnerable to SQL injection\n" }, { "from": "gpt", "value": "/*\nAuthor: Bert Wagner\nSource link: https://blog.bertwagner.com/warning-are-your-queries-vulnerable-to-sql-injection-db914fb39668\n*/\n\nSET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;\n\nSE...
sql
chosen
[ { "from": "human", "value": "Create function to locate points" }, { "from": "gpt", "value": "-- Locate user defined point on network\n-- Author: Christopher Fricke\n-- License: MIT\n\n-- DROP FUNCTION routing.get_waypoint(geometry);\nCREATE OR REPLACE FUNCTION routing.get_waypoint(test_geom geom...
sql
chosen
[ { "from": "human", "value": "Add the fields for the eye candy and sale featires to the prims table.\nNo user functionality yet.\nRun prebuild. Contains a Migration. May contain nuts.\n\n\n" }, { "from": "gpt", "value": "BEGIN;\n\nALTER TABLE prims ADD COLUMN PayPrice integer not null default 0;\...
sql
chosen
[ { "from": "human", "value": "Add function to refresh all materialized views.\n" }, { "from": "gpt", "value": "CREATE OR REPLACE FUNCTION refresh_nist_materialized_views()\nRETURNS void LANGUAGE plpgsql\nAS $$\nBEGIN\n REFRESH MATERIALIZED VIEW nist.dept_incidents;\n REFRESH MATERIALIZED VI...
sql
chosen
[ { "from": "human", "value": "Prepare for switch to Django-generated db schema.\n" }, { "from": "gpt", "value": "\n-- o/` Leave the past behind, just walk away o/`\n\nDROP TABLE IF EXISTS auth_user_groups;\nDROP TABLE IF EXISTS auth_user_user_permissions;\nDROP TABLE IF EXISTS django_admin_log;\n...
sql
chosen
[ { "from": "human", "value": "KCIAC-326: Implement IACUC notification for Review Type Determination\n" }, { "from": "gpt", "value": "INSERT INTO IACUC_PROTOCOL_ACTION_TYPE ( PROTOCOL_ACTION_TYPE_CODE, DESCRIPTION, TRIGGER_SUBMISSION, TRIGGER_CORRESPONDENCE, UPDATE_TIMESTAMP, UPDATE_USER, OBJ_ID )...
sql
chosen
[ { "from": "human", "value": "Add Identifying In-Memory Objects script\n" }, { "from": "gpt", "value": "/*\nAuthor: Frank Gill\nOriginal link: https://skreebydba.com/2016/07/18/identifying-in-memory-objects-when-querying-the-transaction-log/\n*/\n\n\nSELECT \nf.[Current LSN],\nf.Operation,\nf.Con...
sql
chosen
[ { "from": "human", "value": "Create indexes for tables with a FK to job.id\n\n\nFormer-commit-id: bf71b6d71167281d966e2089da7f89256363168c [formerly f099059b6d2936379e5619b9e3c79eb9b1a2151f]\nFormer-commit-id: f4cb979e1e22a820bb707fdbade14262daad4814" }, { "from": "gpt", "value": "CREATE INDEX l...
sql
chosen
[ { "from": "human", "value": "Update / migration SQL script to convert local patient ids in the default document repository to unique patient ids\n" }, { "from": "gpt", "value": "-- CONNECT 3.2\r\n--\r\n-- Default Document Repository - Migrate Patient Ids\r\n-- Created on: 2011-06-09\r\n-- Author...
sql
chosen
[ { "from": "human", "value": "Add db patch for deprovision warning email\n\ngit-svn-id: e77a8db410fc7e53f700994083f7980387c3a882@1117 528793b8-127e-4309-9901-b74759c7208d\n" }, { "from": "gpt", "value": "UPDATE `emails` SET `email_text` = 'Dear {user},<br /><br />This mail is to inform you that y...
sql
chosen
[ { "from": "human", "value": "[DB] Fix column position between fresh install and upgrade - please use the AFTER parameter\n\ngit-svn-id: 9bac41f8ebc9458fc3e28d41abfab39641e8bd1c@29584 b456876b-0849-0410-b77d-98878d47e9d5\n" }, { "from": "gpt", "value": "ALTER TABLE `tiki_tracker_fields` MODIFY `v...
sql
chosen
[ { "from": "human", "value": "Add migration (new compute_timestamp column)\n" }, { "from": "gpt", "value": "-- Target versions: pre v2.18\n-- SHOULD be executed when upgrading to SlipStream v2.18\n\nalter table \"usage_summaries\" add column \"compute_timestamp\" varchar(30);\n" } ]
sql
chosen
[ { "from": "human", "value": "INFUND-9352: Set default academic grant percentage on competition templates\n" }, { "from": "gpt", "value": "-- Update the value of the academic grant percentage for both the template competitions\nSET @sector_template_name = \"Template for the Sector competition typ...
sql
chosen
[ { "from": "human", "value": "Fix NPC 7856 (Southsea Freebooter)\n" }, { "from": "gpt", "value": "INSERT INTO version_db_world (`sql_rev`) VALUES ('1530734106945512205');\n\nUPDATE `creature_template` SET `unit_flags` = 0 WHERE `entry` = 7856;\nUPDATE `smart_scripts` SET `event_type` = 9, `event_...
sql
chosen
[ { "from": "human", "value": "Make sure everyone is automatically on the free plan\n" }, { "from": "gpt", "value": "-- +goose Up\nALTER TABLE accounts ALTER COLUMN plan SET NOT NULL;\nALTER TABLE accounts ALTER COLUMN plan SET DEFAULT 'free';\n\n-- +goose Down\nALTER TABLE accounts ALTER COLUMN p...
sql
chosen
[ { "from": "human", "value": "Create media server partner permissions\n" }, { "from": "gpt", "value": "\nINSERT INTO permission (type, name, friendly_name, description, partner_id, status, created_at, updated_at, custom_data) VALUES \n(1, 'MEDIA_SERVER_BASE', 'Media server system permission', 'Me...
sql
chosen
[ { "from": "human", "value": "Update the schema version and the synteny_region/dnafrag_region schema tables transferring the existing data\n" }, { "from": "gpt", "value": "\n# Updating the schema version\n\nDELETE FROM meta WHERE meta_key=\"schema_version\";\nINSERT INTO meta (meta_key,meta_value...
sql
chosen
[ { "from": "human", "value": "Create honor for 7,16,17,30 destroyer squadrons" }, { "from": "gpt", "value": "insert into fleet_group values\n (3, \"第七駆逐隊\"),\n (4, \"第十六駆逐隊\"),\n (5, \"第十七逐隊\"),\n (6, \"第三十駆逐隊\");\n\ninsert into fleet_group_member values\n (3, 15),\n (3, 16),\n ...
sql
chosen
[ { "from": "human", "value": "Add sql script to alter table and add index\n" }, { "from": "gpt", "value": "--\n-- JBoss, Home of Professional Open Source.\n-- Copyright 2014-2020 Red Hat, Inc., and individual contributors\n-- as indicated by the @author tags.\n--\n-- Licensed under the Apache Lic...
sql
chosen
[ { "from": "human", "value": "Drop obsolete tables from the database, if they exist\n" }, { "from": "gpt", "value": "DROP TABLE IF EXISTS\n addon_payment_account,\n addons_excluded_regions,\n addons_trending,\n api_access,\n app_collection_membership,\n app_collections,\n app...
sql
chosen
[ { "from": "human", "value": "Fix Death Knight quest 12711 \"Abandoned Mail\": Send letter \"News From The North\" after completing the quest.\n" }, { "from": "gpt", "value": "INSERT INTO version_db_world (`sql_rev`) VALUES ('1526717821898752673');\n\nUPDATE `quest_template_addon` SET `RewardMail...
sql
chosen
[ { "from": "human", "value": "core: Add upgrade script for disk alias\n\nAdding an upgrade script for nitialization of disk alias name.\nEach disk will be generated with disk alias which will be combined with\nthe vm name it is associated with and its internal drive mappping.\n\nThis change is part of the up...
sql
chosen
[ { "from": "human", "value": "KCIAC-311: Create notification for action \"Removed from Agenda\"\n" }, { "from": "gpt", "value": "INSERT INTO NOTIFICATION_TYPE (NOTIFICATION_TYPE_ID, MODULE_CODE, ACTION_CODE, DESCRIPTION, SUBJECT, MESSAGE, PROMPT_USER, SEND_NOTIFICATION, UPDATE_USER, UPDATE_TIMEST...
sql
chosen
[ { "from": "human", "value": "KCIAC-317: Implement notification for IACUC Review Not Required\n" }, { "from": "gpt", "value": "INSERT INTO IACUC_PROTOCOL_ACTION_TYPE ( PROTOCOL_ACTION_TYPE_CODE, DESCRIPTION, TRIGGER_SUBMISSION, TRIGGER_CORRESPONDENCE, UPDATE_TIMESTAMP, UPDATE_USER, OBJ_ID )\r\n ...
sql
chosen
[ { "from": "human", "value": "Remove not updated from Ensembl and unused array designs; Removed bad quality micrRNA array designs\n" }, { "from": "gpt", "value": "delete from A2_arraydesign \nwhere accession in ('A-MEXP-121','A-MEXP-27','A-MEXP-28','A-MEXP-294','A-MEXP-585','A-MEXP-935','A-MIRB-0...
sql
chosen
[ { "from": "human", "value": "Add SQL to move items to archive table\n" }, { "from": "gpt", "value": "-- Archive anything older than 1 month that is read.\n--\n-- This is to keep the table used for active interaction smaller and quicker.\n\n--INSERT INTO rss_item_archive\n--(id, title, descriptio...
sql
chosen
[ { "from": "human", "value": "Add rollback sql for migration v 7 - second edition\n" }, { "from": "gpt", "value": "-- ALTER TABLE bemyndigelse.bemyndigelse ADD COLUMN rettighed_id BIGINT;\n-- ALTER TABLE bemyndigelse.bemyndigelse ADD COLUMN arbejdsfunktion_id BIGINT;\n-- ALTER TABLE bemyndigelse...
sql
chosen
[ { "from": "system", "value": "Update to pre-deployment script for PAYE\n\nMake sure there are checks around the pre-deployment script for\nremoving the constraint and also the column from the PAYE table\n" }, { "from": "human", "value": "/*\n Pre-Deployment Script Template\t\t\t\t\t\t\t\n------...
sql
chosen
[ { "from": "system", "value": "Add index on waterway lines\n" }, { "from": "human", "value": "DO $$\nBEGIN\n\n--------------------------------------------------------------------------------\n-- planet_osm_line\n--------------------------------------------------------------------------------\n\nA...
sql
chosen
[ { "from": "system", "value": "KCIAC-17: Implement Custom Data for IACUC\n" }, { "from": "human", "value": "CREATE SEQUENCE SEQ_IACUC_PROTOCOL_CUSTOM_DATA_ID INCREMENT BY 1 START WITH 1 NOCACHE\r\n/\r\n" }, { "from": "gpt", "value": "CREATE SEQUENCE SEQ_IACUC_PROT_CUST_DATA_ID INCREME...
sql
chosen
[ { "from": "system", "value": "Correct a SQL error when happen after 2nd boot by 'vagrant up' command\n" }, { "from": "human", "value": "CREATE USER 'root'@'%' IDENTIFIED BY 'root';\nGRANT ALL PRIVILEGES ON * . * TO 'root'@'%' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 M...
sql
chosen
[ { "from": "system", "value": "Fix DROP INDEX ix_usr_oguser_name, which was missing ON usr_oguser(name)\n" }, { "from": "human", "value": "SET XACT_ABORT ON;\nBEGIN TRANSACTION;\n -- update the version\n UPDATE usr_schema_version SET version_value='46' WHERE version_key='schema_patch';\n\n DRO...
sql
chosen
[ { "from": "system", "value": "Add missing SET SQL_NOTES line\n" }, { "from": "human", "value": "-- Stop NOTE level warnings about objects (not)? existing\nSET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0;\n\n-- Some handy views for admins viewing the doc store, NOT used by the app\n\ncreate or replac...
sql
chosen
[ { "from": "system", "value": "Fix automod upgrade query to explicitly change nulls\n\nI have no idea why the original query does not work in production.\n" }, { "from": "human", "value": "-- Revises: V1\n-- Creation Date: 2022-05-06 14:33:59.784020 UTC\n-- Reason: automod changes\n\nALTER TABLE ...
sql
chosen
[ { "from": "system", "value": "Use MyISAM for FULLTEXT support on older MySQL versions\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS `salesforce_cache` (\n\t`id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t`sfid` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,\n\t`type` varchar...
sql
chosen
[ { "from": "system", "value": "Fix changelog UPDATE to satisfy mysql safe mode\n" }, { "from": "human", "value": "ALTER table court\nADD COLUMN citation_expires_after_days SMALLINT;\n\n\nUPDATE court\nSET citation_expires_after_days=-1\nWHERE court_id IS NOT NULL;\n\nUPDATE court\nset citation_ex...
sql
chosen
[ { "from": "system", "value": "Update SQL file to create schema from ERD." }, { "from": "human", "value": "-- Test Script for Database Migration\r\nCREATE TABLE ACCOUNT (\r\n USER_ID INT PRIMARY KEY,\r\n USER_NAME VARCHAR(100) NOT NULL\r\n);\r\n\r\nCREATE TABLE PROJECT (\r\n PROJECT_ID INT PRI...
sql
chosen
[ { "from": "system", "value": "Revert update to default clause\n" }, { "from": "human", "value": "IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'charity' AND COLUMN_NAME='name' AND COLUMN_DEFAULT IS NULL)\nBEGIN\n\tUPDATE charity\n\t SET Name = ''\n\t WHERE Name IS NULL...
sql
chosen
[ { "from": "system", "value": "Change data blob to email text.\n\nDidn't need anythign else that might have been in the blob. This\nis simpler and now emails are visible in cqlsh, which helps.\n" }, { "from": "human", "value": "CREATE KEYSPACE ccfp WITH REPLICATION = { 'class' : 'SimpleStrategy',...
sql
chosen
[ { "from": "system", "value": "Remove extra ; to fix test\n" }, { "from": "human", "value": "/******************************************************************************** \nfile-centric-snapshot-mdrs-no-version-skew.sql\n Assertion:\n \"Target modules in the MDRS must have the same ...
sql
chosen
[ { "from": "system", "value": "Add function murmur_hash_v3.sql in database update script.\n" }, { "from": "human", "value": "ALTER table `sentences` ADD COLUMN `hash` BINARY(16) NOT NULL;\n\nUPDATE sentences SET hash=LOWER(CONV(murmur_hash_v3(CONCAT(lang, text), 0), 10, 32));\n\n# Must update use...
sql
chosen
[ { "from": "system", "value": "Create a table to store unique device ID\n" }, { "from": "human", "value": "create database if not exists device_mgmt;\ncreate database if not exists test;\n\nuse device_mgmt;\nCREATE TABLE if not exists users (id int(10) PRIMARY KEY AUTO_INCREMENT, username VARCHAR...
sql
chosen
[ { "from": "system", "value": "inventory: Use IN instead of in for SQL cmds\n\nChange-Id: I08563cc0a882156ce2f9f1b54beaa44c0937c0f1\nSigned-off-by: Douglas Schilling Landgraf <cb5f9630225b7afa1e13760d30868c8ce876fc60@redhat.com>\n" }, { "from": "human", "value": "-- vds_groups table has been rena...
sql
chosen
[ { "from": "system", "value": "Fix DDL syntax in pg_upgrade test\n" }, { "from": "human", "value": "-- WARNING\n-- This file is executed against the postgres database, as that is known to\n-- exist at the time of running upgrades. If objects are to be manipulated\n-- in other databases, make sure...
sql
chosen
[ { "from": "system", "value": "Extend the string examples with weakly-typed queries.\n" }, { "from": "human", "value": "SELECT JsonQuery('{ \"foo\": \"bar baz\" }', 'foo');\nSELECT JsonQueryString('{ \"foo\": \"bar baz\" }', 'foo');\n\nSELECT JsonQuery('{ \"foo\": true }', 'foo')::boolean;\nSELEC...
sql
chosen
[ { "from": "system", "value": "Stop trying to add extra_donation\n" }, { "from": "human", "value": "-- Deploy rams-core:add-watch-list to pg\n\nBEGIN;\n\nCREATE TABLE watch_list (\n id uuid NOT NULL,\n first_names character varying DEFAULT ''::character varying NOT NULL,\n la...
sql
chosen
[ { "from": "system", "value": "Change users_vocabulary vocabulary_id data type.\n" }, { "from": "human", "value": "# Move current id to hash column\nALTER TABLE `vocabulary` ADD hash BINARY(16) NOT NULL;\nUPDATE `vocabulary` SET hash = id;\n\n# Change id to auto-increment int\nALTER TABLE `vocabu...
sql
chosen
[ { "from": "system", "value": "Hide badges with no value in \"Upcoming Badges\"\n" }, { "from": "human", "value": "DELIMITER $$\n\nDROP PROCEDURE IF EXISTS `GetUpcomingBadges` $$\n\nCREATE DEFINER=`admin`@`localhost` PROCEDURE `GetUpcomingBadges`(IN `agent_name` VARCHAR(15))\n READS SQL DATA\n...
sql
chosen
[ { "from": "system", "value": "Remove Process.PgBackendPID as this column is not set anymore. We instead log it per execution to Log.\n" }, { "from": "human", "value": "CREATE TABLE cron.Processes (\nProcessID serial NOT NULL,\nJobID integer NOT NULL...
sql
chosen
[ { "from": "system", "value": "Change earned badges to use TEXT uid, in line with specification\n" }, { "from": "human", "value": "-- Drop tables in reverse order of creation, otherwise\n-- we may run into foreign key constraints\nDROP TABLE IF EXISTS earned_badges;\nDROP TABLE IF EXISTS earners;...
sql
chosen
[ { "from": "system", "value": "Purge plperl from database, as it is no longer required.\n" }, { "from": "human", "value": "\\set ON_ERROR_STOP 1\n\n-- drop unused tables\nDROP TABLE IF EXISTS alexa_topsites CASCADE;\nDROP TABLE IF EXISTS top_crashes_by_signature CASCADE;\nDROP TABLE IF EXISTS top...
sql
chosen
[ { "from": "system", "value": "Rename table name, fizzbuzz -> fizzbuzz_tweets.\n" }, { "from": "human", "value": "DROP DATABASE IF EXISTS fizzbuzz_twitterbot;\nCREATE DATABASE fizzbuzz_twitterbot CHARACTER SET utf8;\nUSE fizzbuzz_twitterbot;\n\nDROP TABLE IF EXISTS fizzbuzz;\nCREATE TABLE fizzbuz...
sql
chosen
[ { "from": "system", "value": "Update the column definition so we can track time down to the\nmillisecond. This will be an important tie breaker for users who are\nusing the NFC tags to track their time.\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS `user` (\n `id` int(11) NOT NU...
sql
chosen
[ { "from": "system", "value": "Add a flag to table of document events to track application of events\n" }, { "from": "human", "value": "CREATE TABLE wf_docevents (\nid INT PRIMARY KEY,\ndoc_id INT NOT NULL,\ndocstate_id INT NOT NULL,\nuser_id INT NOT NULL,\ndocaction_id INT NOT NULL,\ndata TEXT,\...
sql
chosen
[ { "from": "system", "value": "Return users with the desired skills\n" }, { "from": "human", "value": "WITH RECURSIVE trust_graph(confirmer_id, skill_claimant_id, depth, path, confirmations_in_graph) AS (\n SELECT\n conf1.confirmer_id,\n conf1.skill_claimant_id,\n 1 ...
sql
chosen
[ { "from": "system", "value": "Replace use of wal_location_to_int function with native operator\n" }, { "from": "human", "value": "CREATE VIEW metric.replication_lag AS\nSELECT\n pg_stat_replication.client_addr,\n public.wal_location_to_int(pg_current_xlog_location()) - public.wal_location_...
sql
chosen
[ { "from": "system", "value": "Allow efficient finding of entries by item hash\n\nThe record entries resource needs to find entries by item hash (based on\nan item found by primary key on a gin index). Without this index, this\ndefaults to a sequential scan:\n\n explain select entry_number, timestamp, sh...
sql
chosen
[ { "from": "system", "value": "Add schema to store build logs\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,...
sql
chosen
[ { "from": "system", "value": "Remove 'workaround' as it was pgq_coop own bug\n" }, { "from": "human", "value": "\ncreate extension pgq;\n\n\\set ECHO none\n\\i structure/install.sql\n\\set ECHO all\n\ncreate extension pgq_coop from 'unpackaged';\ndrop extension pgq_coop;\n\n-- workaround for pos...
sql
chosen
[ { "from": "system", "value": "Add comment about verifying default tablespace\n" }, { "from": "human", "value": "set define '^'\nset verify off\n\nACCEPT default_tbs CHAR PROMPT 'Please enter the tablespace you would like to make the default [USERS]: '\n\ndeclare\n l_new_tablespace varchar2(50...
sql
chosen
[ { "from": "system", "value": "Set isolation level to 'Repeatable Read'. Seems to prevent index errors (WrongExpectedVersion) that default isolation level can generate. Doesn't result in deadlocks that 'Serializable' raises.\n" }, { "from": "human", "value": "/*SET TRANSACTION ISOLATION LEVEL SER...
sql
chosen
[ { "from": "system", "value": "Truncate manager activity log on upgrade\n" }, { "from": "human", "value": "UPDATE `settings` SET `cmumversion`='3.2.0', `dbversion`='3.2.0' WHERE `id`=1;\nALTER TABLE `groups` ADD `enabled` tinyint(1) NULL DEFAULT '1' AFTER `comment`;\nALTER TABLE `settings` DROP `...
sql
chosen
[ { "from": "system", "value": "Update remove all script to reflect new object names\n" }, { "from": "human", "value": "SELECT name, is_broker_enabled, service_broker_guid FROM sys.databases;\n\nALTER DATABASE msdb SET ENABLE_BROKER;\nALTER DATABASE CURRENT SET NEW_BROKER WITH ROLLBACK IMMEDIATE;...
sql
chosen
[ { "from": "system", "value": "Add more information to compile output\n" }, { "from": "human", "value": "set linesize 200\n\nset serveroutput on\nset verify off\n\nCOLUMN MY_USER FORMAT A20\nCOLUMN DB FORMAT A15\nCOLUMN NOW FORMAT A40\n\n--Show the details of the connection for confirmation\nsele...
sql
chosen
[ { "from": "system", "value": "[MOD] Remove the AFTER column clauses from the update\n\ngit-svn-id: a7fabbc6a7c54ea5c67cbd16bd322330fd10cc35@46708 b456876b-0849-0410-b77d-98878d47e9d5\n" }, { "from": "human", "value": "ALTER TABLE `tiki_mailin_accounts` add COLUMN `routing` char(1) NULL AFTER `at...
sql
chosen
[ { "from": "system", "value": "Make sure all tables are using InnoDB as the engine (for transaction support).\n" }, { "from": "human", "value": "\n\n--\n-- Store session data in here.\n-- Idea originally from: http://www.developertutorials.com/tutorials/php/saving-php-session-data-database-050711...
sql
chosen
[ { "from": "system", "value": "Add curr_ to table name\n" }, { "from": "human", "value": "\n/******************************************************************************** \n\tfile-centric-snapshot-language-unknown-acceptability.sql\n\n\tAssertion:\n\tUnknown acceptability for language referenc...
sql
chosen
[ { "from": "system", "value": "Improve projects and pages migration.\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_timestam...
sql
chosen
[ { "from": "system", "value": "Update schema to include count of entries making up average happiness.\n" }, { "from": "human", "value": "CREATE TABLE `users` (\n `ID` int(10) unsigned NOT NULL auto_increment,\n `username` varchar(255) default NULL,\n `password` varchar(255) default NULL,...
sql
chosen
[ { "from": "system", "value": "Correct trigger to cascade delete group membership when group is deleted\n" }, { "from": "human", "value": "/*Connect to database*/\n\\connect mobydq\n\n\n\n/*Create table user group*/\nCREATE TABLE base.user_group (\n id SERIAL PRIMARY KEY\n , name TEXT NOT NUL...
sql
chosen
[ { "from": "system", "value": "Change type of timestamp col of location history table from INT to REAL\n" }, { "from": "human", "value": "CREATE TABLE credentials(\n provider TEXT UNIQUE NOT NULL,\n api_key TEXT NOT NULL\n);\n\nCREATE TABLE users(\n user_id INT PRIMARY KEY NOT...
sql
chosen
[ { "from": "system", "value": "Fix the log activity comments migration.\n" }, { "from": "human", "value": "DROP TABLE IF EXISTS log_activity_comment;\n\nCREATE TABLE `log_activity_comment` (\n `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,\n `created` datetime NOT NULL,\n `modified` d...
sql
chosen
[ { "from": "system", "value": "Add sql query for adding user follows\n" }, { "from": "human", "value": "INSERT INTO\n followers_users_users\n (follower, target)\nVALUES\n (${currentUser}, ${target})\nON CONFLICT\n (follower, target)\nDO NOTHING\nRETURNING *;\n" }, { "from": "gpt", ...
sql
chosen
[ { "from": "system", "value": "Create mark and message tables in database\n" }, { "from": "human", "value": "CREATE DATABASE uncovery;\n\nUSE uncovery;\n" }, { "from": "gpt", "value": "CREATE DATABASE uncovery;\n\nUSE uncovery;\n\nCREATE TABLE mark (\n mark_id int(5) AUTO_INCREMENT,\...
sql
chosen
[ { "from": "system", "value": "Work around trigger import/export bug\n\nWhen the trigger is created without BEGIN/END around the FOR loop,\nmysqldump produces a syntaxically invalid \"CREATE TRIGGER\" directive,\nand mysql fails to import it with the following message :\n\nERROR 1064 (42000) at line 56: You ...
sql
chosen
[ { "from": "system", "value": "Add missing deleted field on images table.\n" }, { "from": "human", "value": "CREATE TABLE IF NOT EXISTS image_collections (\n id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),\n created_at timestamptz NOT NULL DEFAULT clock_timestamp(),\n modified_at timestamptz N...
sql
chosen