conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Drop deprecated columns from wfs-search db table\n" }, { "from": "gpt", "value": "\nALTER TABLE oskari_wfs_search_channels DROP COLUMN topic;\nALTER TABLE oskari_wfs_search_channels DROP COLUMN description;\nALTER TABLE oskari_wfs_search_channels DROP COLUMN is_addre...
sql
chosen
[ { "from": "human", "value": "Migrate db create rewards table\n" }, { "from": "gpt", "value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nCREATE TABLE `rewards` (\n `id` INT(11) NOT NULL AUTO_INCREMENT,\n `user_id` INT(11) NOT NULL,\n `reward` INT(11) NO...
sql
chosen
[ { "from": "human", "value": "Add Data Description file for agent\n" }, { "from": "gpt", "value": "metadata :name => 'File Staging Agent',\n :description => 'Agent to manage the staging of files to a node over a network connection',\n :author => 'Thomas Linkin',\n ...
sql
chosen
[ { "from": "system", "value": "Add some indexes on repository and host_category\n" }, { "from": "human", "value": "-- SQL Script to update the DB schema from MirrorManager1 to MirrorManager2\n\n-- Drop tables that we no longer use\nDROP TABLE \"group_permission\";\nDROP TABLE \"permission\";\nDRO...
sql
chosen
[ { "from": "human", "value": "Add script to create an index that will help us recover file downloads.\n\n\n" }, { "from": "gpt", "value": "CREATE INDEX CONCURRENTLY relative_file_paths_to_verify on downloads( relative_file_path ) where file_status = 'tbd' and relative_file_path <> 'tbd' and relat...
sql
chosen
[ { "from": "human", "value": "Add SQL script backup/restore status\n" }, { "from": "gpt", "value": "/*\nAuthor: Chris Yates\nOriginal link: http://www.sqlservercentral.com/blogs/the-sql-professor/2017/01/26/backuprestorewhats-my-status/\n*/\n\n--By checking only for the restore and backup command...
sql
chosen
[ { "from": "human", "value": "Convert date to timestamp in Postgres.\n" }, { "from": "gpt", "value": "\n-- +goose Up\nALTER TABLE users ALTER COLUMN created TYPE timestamp;\nALTER TABLE users ALTER COLUMN updated TYPE timestamp;\nALTER TABLE schools ALTER COLUMN created TYPE timestamp;\nALTER TAB...
sql
chosen
[ { "from": "human", "value": "Add a missing migration for transaction actors\n\nSummary: Add a missing migration which should have been included in D9982. Harbormaster and Herald PHIDs are used as actors in some transactions.\n\nTest Plan: Ran `./bin/storage upgrade`. Saw a transaction render correctly as \"...
sql
chosen
[ { "from": "human", "value": "Fix a country name. Taiwan\n" }, { "from": "gpt", "value": "-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nBEGIN;\nUPDATE `m_country` SET name_ja='台湾(台湾省/中華民国)' WHERE id = 158;\nCOMMIT;\n\n-- +goose Down\n-- SQL section 'Down' is exe...
sql
chosen
[ { "from": "human", "value": "Add post insert script back\n\nThis also adds a constraint that ensures we always have references to\nthe search urs table. Just want to sanity check the data before working\nwith it.\n" }, { "from": "gpt", "value": "CREATE INDEX ix_search_accessions__urs_taxid ON se...
sql
chosen
[ { "from": "human", "value": "Create the type `geomval` if not exist\n\nRelated to https://github.com/CartoDB/cartodb-platform/issues/6237\n" }, { "from": "gpt", "value": "-- PG12_DEPRECATED\n-- Create geomval if it doesn't exist (in postgis 3+ it only exists in postgis_raster)\nDO $$\nBEGIN\n ...
sql
chosen
[ { "from": "human", "value": "Add migration script to create district demographic estimates table\n" }, { "from": "gpt", "value": "CREATE TABLE district_demographic_estimates\n(\n id SERIAL PRIMARY KEY,\n year INT NOT NULL,\n districtId INT NOT NULL REFERENC...
sql
chosen
[ { "from": "human", "value": "Add RC3 update for centstorage DB\n\ngit-svn-id: 25a0ac75d3222d69293b2750b310215dcabd6451@6189 6bcd3966-0018-0410-8128-fd23d134de7e\n" }, { "from": "gpt", "value": "\r\nALTER TABLE `index_data` ADD `hidden` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `special` , ADD ...
sql
chosen
[ { "from": "human", "value": "Migrate db add user_id index to auth_tokens\n" }, { "from": "gpt", "value": "\n-- +goose Up\n-- SQL in section 'Up' is executed when this migration is applied\nALTER TABLE `auth_tokens`\nADD INDEX (`user_id`);\n\n-- +goose Down\n-- SQL section 'Down' is executed when...
sql
chosen
[ { "from": "human", "value": "Add test sample on pgtap\n" }, { "from": "gpt", "value": "BEGIN;\r\n-- Plan count should match the number of tests. If it does not then pg_prove will fail the test\r\nSELECT plan(1);\r\n\r\n-- Run the tests.\r\n-- Given\r\nTRUNCATE TABLE item;\r\nCALL new_item('foo',...
sql
chosen
[ { "from": "human", "value": "Add SQL constraint to ensure unicity of emails\n" }, { "from": "gpt", "value": "DO $$\n BEGIN\n BEGIN\n CREATE UNIQUE INDEX sys_user_unique_email ON sys_user(email) WHERE email != '';\n END;\n BEGIN\n CREATE UNIQUE INDEX cd_profiles_unique_email O...
sql
chosen
[ { "from": "human", "value": "Set the format of the crontab file and gave some examples to show how useful it will be\n" }, { "from": "gpt", "value": "# Islamic crontab\n\n# gm:\tGregorian Month (1 to 12)\n# gd:\tGregorian Day of Month (1 to 31)\n# hm:\tHijri Month (1 to 12)\n# hd:\tHijri day of ...
sql
chosen
[ { "from": "human", "value": "Change the smallest varchar() fields to use text type instead of an arbitrary limit. The remaining varchars should probably be changed to text as well, but these are the most obvious for now.\n" }, { "from": "gpt", "value": "# --- !Ups\n\nALTER TABLE ENTRY ALTER num ...
sql
chosen
[ { "from": "human", "value": "Include script to generate coverage. Should be in migrations or something,\nbut currently we can't do the simplification etc. in a migration. Also, it\ntakes like forever to run.\n" }, { "from": "gpt", "value": "/*\r\n Terrängkartan and Vägkartan has overlapping d...
sql
chosen
[ { "from": "human", "value": "Fix campaign_id length on osdial_user_log.\n\n" }, { "from": "gpt", "value": "# 2010/03/01\n\n\nALTER TABLE osdial_user_log MODIFY campaign_id VARCHAR(20) NOT NULL;##|##\n ## Field length or NULL correction.;\n\nUPDATE system_settings SET version='2.2.1.046',last_...
sql
chosen
[ { "from": "human", "value": "CSCVIPUNEN-427: Add SA table for VIRTA-JTP/Latausraportit/Duplikaatit\n" }, { "from": "gpt", "value": "IF NOT EXISTS (\n select * from INFORMATION_SCHEMA.TABLES\n where TABLE_SCHEMA='sa' and TABLE_NAME='sa_virta_jtp_latausraportit_duplikaatit'\n) BEGIN\n\nCREATE TA...
sql
chosen
[ { "from": "human", "value": "Add default users to DB schema\n" }, { "from": "gpt", "value": "INSERT INTO users values (-1, '$2a$10$WNHPWraFAOfbPA.goukqjujAfk1rr7Gc7.tm5y56NnbzPSHf1Bj.S', 'admin', 'admin', 'a@a.com', 1, '2017-01-10');\nINSERT INTO users values (-2, '$2a$10$WNHPWraFAOfbPA.goukqjuj...
sql
chosen
[ { "from": "human", "value": "Add SQL script to get the size of all databases\n\n" }, { "from": "gpt", "value": "SELECT table_schema AS \"Database Name\",\nROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS \"Size in (MB)\"\nFROM information_schema.TABLES\nGROUP BY table_schema;" } ]
sql
chosen
[ { "from": "human", "value": "Fix Midsummer Celebrants in Tirisfal Glades and add Festival Scorchling\n" }, { "from": "gpt", "value": "INSERT INTO version_db_world (`sql_rev`) VALUES ('1530312696838521331');\n\nUPDATE `creature` SET `modelid` = 16444, `orientation` = 1.2727 WHERE `guid` = 202761;...
sql
chosen
[ { "from": "human", "value": "Fix the flyway issue due to conflicting versions\n" }, { "from": "gpt", "value": "-- Copyright 2017 Hortonworks.\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 may...
sql
chosen
[ { "from": "human", "value": "Index creation script for TPC-H.\n\n\nFormer-commit-id: 4637bcedfb200062568228337563d718637c82dd" }, { "from": "gpt", "value": "alter table part add primary key (p_partkey);\nalter table supplier add primary key (s_suppkey);\nalter table partsupp add primary key (ps_...
sql
chosen
[ { "from": "human", "value": "Insert base de données banque" }, { "from": "gpt", "value": "INSERT INTO customer (id,civilite,lastname,firstname,birthday,email,telephone,address,city,country,zipcode) VALUES (1,'Mr','Lagaffe','Gaston','1956-10-02','toto@franquin.com','0163458950','40 rue des champ...
sql
chosen
[ { "from": "human", "value": "Add SQL to create parking data table\n\nTable adds fields to make modeling/processing easier.\n" }, { "from": "gpt", "value": "CREATE TABLE Parking2014 (\n\tParkingEventId INTEGER,\n\tDeviceId INTEGER,\n\tArrivalTime TEXT, -- from source\n\tArrivalTimeSeconds INTEGER...
sql
chosen
[ { "from": "human", "value": "[ENH] Add BigBlueButton join & left room actions into ActionLog\n\ngit-svn-id: a7fabbc6a7c54ea5c67cbd16bd322330fd10cc35@45783 b456876b-0849-0410-b77d-98878d47e9d5\n" }, { "from": "gpt", "value": "INSERT IGNORE INTO tiki_actionlog_conf(action, `objectType`, status) VA...
sql
chosen
[ { "from": "human", "value": "Add migration to add an exempt pairing board to every project\n\n- only applies to projects that don't have one already\n" }, { "from": "gpt", "value": "INSERT INTO pairing_board (project_id, name, is_exempt)\n(SELECT DISTINCT project_id, 'OUT OF OFFICE', TRUE FROM p...
sql
chosen
[ { "from": "human", "value": "Add sql script to dump the size of database tables.\n\n\n" }, { "from": "gpt", "value": "SELECT nspname || '.' || relname AS \"relation\",\n pg_size_pretty(pg_relation_size(C.oid)) AS \"non_index_size\", pg_size_pretty(pg_total_relation_size(C.oid)) AS \"index_s...
sql
chosen
[ { "from": "human", "value": "Create view to add average to maandverbruik" }, { "from": "gpt", "value": "DROP VIEW APP.MAANDVERBRUIK_EXTRA;\n\nCREATE VIEW APP.MAANDVERBRUIK_EXTRA (\n\t ID\n\t, JAAR\n\t, MAAND\n\t, ID_METERSOORT\n\t, VERBRUIK\n\t, AVERAGE\n\t, DELTA\n) AS (\n\tSELECT \n \t m.ID\...
sql
chosen
[ { "from": "human", "value": "Fix campaign_id length on osdial_agent_log.\n\n" }, { "from": "gpt", "value": "# 2010/03/01\n\nALTER TABLE osdial_agent_log MODIFY campaign_id VARCHAR(20);##|##\n ## Field length or NULL correction. This may take a while.;\n\nUPDATE system_settings SET version='2....
sql
chosen
[ { "from": "human", "value": "Change mapstats path on mapfull-template\n" }, { "from": "gpt", "value": "UPDATE portti_bundle SET startup='{\n \"bundlename\" : \"mapfull\"\n \"metadata\" : {\n \"Import-Bundle\" : {\n \"core-base\" : {\n \"bundlePath\" : \"/Os...
sql
chosen
[ { "from": "human", "value": "Save example query used to compute de-duplication rate\n" }, { "from": "gpt", "value": "\n-- Queries use to calculate deduplicaiton rate for two partners\ndeclare @distinct_patids_UFH int\ndeclare @distinct_uuids_UFH int\ndeclare @linked_patients_UFH_FLM int\ndeclare...
sql
chosen
[ { "from": "human", "value": "Create : 181 Employees Earning More Than Their Managers\n" }, { "from": "gpt", "value": "SELECT\n e1.name AS Employee\nFROM\n Employee AS e1\n INNER JOIN Employee AS e2\n ON e1.managerid = e2.id\nWHERE\n e1.salary > e2.salary\n;\n" } ]
sql
chosen
[ { "from": "human", "value": "Add valid values for created/modified waffle times.\n" }, { "from": "gpt", "value": "UPDATE `waffle_flag_amo` set `created` = NOW() where `created` = 0;\nUPDATE `waffle_flag_amo` set `modified` = NOW() where `created` = 0;\n\nUPDATE `waffle_sample_amo` set `created` ...
sql
chosen
[ { "from": "human", "value": "Handle unique constraint change during migration in 'issues/4197'\n\nAdd oracle_rac script\n" }, { "from": "gpt", "value": "UPDATE IDN_OAUTH2_ACCESS_TOKEN\nSET TOKEN_SCOPE_HASH=(dbms_random.string('L', 32))\nWHERE TOKEN_ID IN (\n\tSELECT DISTINCT a.TOKEN_ID\n\tFROM I...
sql
chosen
[ { "from": "human", "value": "Add some more cascades for pre 8.0 databases.\n" }, { "from": "gpt", "value": "\n-- Sort out accessing calendar entries.\n\nBEGIN;\nSELECT check_db_revision(1,2,2);\n\nALTER TABLE role_member DROP CONSTRAINT \"$1\";\nALTER TABLE role_member ADD CONSTRAINT \"$1\" (rol...
sql
chosen
[ { "from": "human", "value": "Add update script for timestamps in cloud schema\n\n- provide a script to apply timestamp schema changes to all ready\n deployed instances. Because we are changing a column to NOT NULL\n we need to define a default, the current time was chosen as this default.\n- Sets it so th...
sql
chosen
[ { "from": "human", "value": "Add drop table SQL for schema 0.7.0\n" }, { "from": "gpt", "value": "DROP TABLE \n `cache`,\n `class`,\n `component`,\n `connector`,\n `constraint`,\n `error`,\n `lib`,\n `log`,\n `permission`,\n `request`,\n `resource`,\n `response`,\n `role`,\n `savep...
sql
chosen
[ { "from": "human", "value": "Add Postgres sql for JDBC implementation of OAuth2AuthorizedClientService\n\nPostgres doesn't have a BLOB type, but it does have an equivalent BYTEA\ntype.\nThis approach and naming convention follows the convention established\nin Spring Session JDBC which has sql for each RDBM...
sql
chosen
[ { "from": "human", "value": "Update SQL statement to fix older TB1 citations that are still called \"in prep\" when they are likely to be published\n" }, { "from": "gpt", "value": "-- For old TreeBASE1 data (i.e. those with a value for tb_studyid) that have \n-- page numbers in their citation m...
sql
chosen
[ { "from": "human", "value": "Remove unnecessary bundles and add missing ones\n" }, { "from": "gpt", "value": "-- remove routingService as its not part of the current pti appsetup\nDELETE FROM portti_view_bundle_seq\nWHERE view_id = (select id from portti_view where name = 'Geoportal OL3')\nand b...
sql
chosen
[ { "from": "human", "value": "Create job that dump sensor data to blob storage and calculate the avg of sensor for each min. The avg data is dump to Power BI and Azure Table\n" }, { "from": "gpt", "value": "WITH avgdata AS (\nSELECT \n deviceId as deviceId,\n System.TimeStamp as timeslot,\n...
sql
chosen
[ { "from": "human", "value": "Add How old your backups script\n" }, { "from": "gpt", "value": "/*\nAuthor: Tim Ford\nOriginal link: http://sqlmag.com/database-backup-and-recovery/how-old-are-your-backups\n*/\nWITH full_backups AS (\nSELECT ROW_NUMBER() OVER(PARTITION BY BS.database_name,\n ...
sql
chosen
[ { "from": "human", "value": "Add init data for user" }, { "from": "gpt", "value": "INSERT INTO `role` (`authority`, `description`) VALUES ('ROLE_ADMIN', '管理员');\nINSERT INTO `role` (`authority`, `description`) VALUES ('ROLE_SALES', '销售人员');\nINSERT INTO `role` (`authority`, `description`) VALUES...
sql
chosen
[ { "from": "human", "value": "Add hash column to users_vocabulary.\n" }, { "from": "gpt", "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 `vocabulary` DROP PRIM...
sql
chosen
[ { "from": "human", "value": "Drop all empty (with no tables) MySQL databases\n" }, { "from": "gpt", "value": "use mysql;\n\n-- switch to a different delimiter\ndelimiter $$\n\ncreate procedure drop_empty_databases()\nbegin\n\n declare table_schema varchar(200); -- will hold schema obtained fr...
sql
chosen
[ { "from": "human", "value": "Add sql script to delete /Old Internal Statistics folder and children\n" }, { "from": "gpt", "value": "-- Delete the child folders of '/Old Internal Statistics'\n\n-- Additional sub-select needed to get round MySQL's inability to copy with having the table being\n-- ...
sql
chosen
[ { "from": "human", "value": "Patch for 42 -> 43\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) VALUES (\"schema_version\",43);\n\n# Add class column to the method_link table:\n\nALTER...
sql
chosen
[ { "from": "human", "value": "Check No of rows and kilobytes\n" }, { "from": "gpt", "value": "CREATE TABLE #RowCountsAndSizes (TableName NVARCHAR(128),rows CHAR(11), \n reserved VARCHAR(18),data VARCHAR(18),index_size VARCHAR(18),\n unused VARCHAR(18))\n\nEXEC sp_MSForEachTa...
sql
chosen
[ { "from": "human", "value": "Add migration removing 'jetpack' tag\n" }, { "from": "gpt", "value": "-- Uncomment this locally if you can't create files anymore.\n-- On dev/stage/prod, this isn't necessary as the column already has a default value.\n-- The column will be removed entirely in a futu...
sql
chosen
[ { "from": "human", "value": "Add view for both portrait and landscape media\n" }, { "from": "gpt", "value": "DROP VIEW IF EXISTS store_RotatedMedia;\nCREATE VIEW store_RotatedMedia AS\n\tSELECT id as media_ptr_id, name, cost_cents, price_cents, weight_oz, exterior_width, exterior_height, stock_a...
sql
chosen
[ { "from": "human", "value": "Rename dataprovider \"Liikennevirasto\" to \"Väylävirasto\"\nUpdate layer subtitles, too\n" }, { "from": "gpt", "value": "UPDATE oskari_dataprovider SET locale = '{\"fi\":{\"name\":\"Väylävirasto\"},\"sv\":{\"name\":\"Trafikledsverket\"},\"en\":{\"name\":\"Finnish Tr...
sql
chosen
[ { "from": "human", "value": "Add table for video download queue\n" }, { "from": "gpt", "value": "-- // \n-- Migration SQL that makes the change goes here.\nCREATE TABLE video_dl_queue (\n id SERIAL PRIMARY KEY,\n url TEXT NOT NULL,\n user_id INTEGER NOT NULL REFERENCES users (id),\n track_id...
sql
chosen
[ { "from": "human", "value": "Add select by category id SQL\n" }, { "from": "gpt", "value": "SELECT\n `blog_post`.`post_id`,\n `blog_post`.`title`,\n `blog_post`.`body`,\n `blog_post`.`category`,\n `blog_post`.`created`,\n `blog_post`.`created_by`\nFROM\n `blog_post`\nWHERE\n `blog_post`....
sql
chosen
[ { "from": "human", "value": "Add stored procedure initialization script.\n\nAdd two procedures for selecting highscores. These are\nvery much open for improvements.\n" }, { "from": "gpt", "value": "-- Select top 10 result in total\n\nDELIMITER //\nCREATE PROCEDURE GetGlobalTopTen ()\n BEGIN \n...
sql
chosen
[ { "from": "human", "value": "Copy file attachment edges to new storage\n\nSummary: Ref T13603. Copy all existing file attachment data into the new storage table.\n\nTest Plan: Ran migration, checked attachment table for general reasonableness.\n\nSubscribers: PHID-OPKG-gm6ozazyms6q6i22gyam\n\nManiphest Task...
sql
chosen
[ { "from": "human", "value": "Add basic sql script to fix and remove null values\n" }, { "from": "gpt", "value": "Select * from xcolab.members_Member where members_Member.createDate is NULL ;\n\nUPDATE xcolab.members_Member set status=0 where status is NULL;\nUPDATE xcolab.members_Member set aut...
sql
chosen
[ { "from": "human", "value": "Remove 1.2 Universe Generator admin tool link\n\nThe link to this tool needs to be removed since the tool itself\nno longer exists.\n" }, { "from": "gpt", "value": "-- Remove the 1.2 Universe Generator admin tool\nDELETE FROM permission WHERE permission_id = 2;\n\n--...
sql
chosen
[ { "from": "human", "value": "Create event_images table for storing info about images\n" }, { "from": "gpt", "value": "-- table to store the available images for an event\ncreate table event_images (\n id int auto_increment primary key,\n event_id int not null,\n type varchar(30) not nul...
sql
chosen
[ { "from": "human", "value": "Update new application names to views\n" }, { "from": "gpt", "value": "UPDATE public.portti_view SET application='geoportal' WHERE application='full-map'; \nUPDATE public.portti_view SET application='geoportal-3D' WHERE application='full-map-3D';\nUPDATE public.portt...
sql
chosen
[ { "from": "human", "value": "Add migration to fix signature keys inconsistency\n\n" }, { "from": "gpt", "value": "--\n-- Copyright (c) 2012-2018 Red Hat, Inc.\n-- This program and the accompanying materials are made\n-- available under the terms of the Eclipse Public License 2.0\n-- which is ava...
sql
chosen
[ { "from": "human", "value": "Add stock card entry key values table\n" }, { "from": "gpt", "value": "DO $$\nBEGIN\n DROP TABLE IF EXISTS stock_card_entry_key_values;\n\n CREATE TABLE stock_card_entry_key_values\n (\n stockcardentryid integer NOT NULL,\n keycolumn text NOT NULL,\n valu...
sql
chosen
[ { "from": "human", "value": "Add a migration to add scopes field to users table\n" }, { "from": "gpt", "value": "-- Add a scopes field to users table\n\nALTER TABLE public.users\nADD COLUMN scopes JSONB NOT NULL DEFAULT '{\n \"PROJECT\": [\"VIEW\", \"CREATE\", \"EDIT\", \"ANNOTATE\", \"EXPORT\"...
sql
chosen
[ { "from": "human", "value": "Add function to wrapper the pg_stat_activity view.\n\n" }, { "from": "gpt", "value": "CREATE OR REPLACE FUNCTION show_stat_activity()\n RETURNS SETOF pg_stat_activity AS\n$$\nDECLARE\nBEGIN\n RETURN QUERY select * from pg_stat_activity;\n RETURN;\nEND;\n$$\nL...
sql
chosen
[ { "from": "human", "value": "Remove previous table for the phantom peak scores\n" }, { "from": "gpt", "value": "-- Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute\n-- Copyright [2016-2018] EMBL-European Bioinformatics Institute\n-- Licensed un...
sql
chosen
[ { "from": "human", "value": "Add in progress direction generator (api)\n" }, { "from": "gpt", "value": "/*\nSELECT time.stop_id, GROUP_CONCAT(terminus.area) FROM stop_times AS time\nLEFT OUTER JOIN (\n\tSELECT trip_id, area FROM stop_times\n LEFT OUTER JOIN stops ON id = stop_id\n WHERE (t...
sql
chosen
[ { "from": "human", "value": "Add sql script to drop Timeside server tables\n" }, { "from": "gpt", "value": "BEGIN;\nDROP TABLE `timeside_experiences`;\nDROP TABLE `timeside_results`;\nDROP TABLE `timeside_experiences_presets`;\nDROP TABLE `timeside_items`;\nDROP TABLE `timeside_selections_items`...
sql
chosen
[ { "from": "human", "value": "Fix campaign_id and server_ip length on osdial_log.\n\n" }, { "from": "gpt", "value": "# 2010/03/01\n\n\nALTER TABLE osdial_log MODIFY campaign_id VARCHAR(20), MODIFY server_ip VARCHAR(15);##|##\n ## Field length or NULL correction for campaign_id and server_ip, t...
sql
chosen
[ { "from": "human", "value": "core: Add fk constraint on vm_interface_statistics\n\nOnce a network interface is being removed from the Data Base its\ncorresponding statistics data in _vm_interface_statistics should be\nremoved also.\n\nCurrently, when a Storge Domain is being detached from a Data Center, all...
sql
chosen
[ { "from": "human", "value": "Add protocol field in karaoke table\n\n" }, { "from": "gpt", "value": "ALTER TABLE karaoke ADD `protocol` varchar(64) NOT NULL default 'nfs';\r\nUPDATE karaoke SET protocol='nfs' where rtsp_url='';\r\nUPDATE karaoke SET protocol='custom' where rtsp_url!='';" } ]
sql
chosen
[ { "from": "human", "value": "Add db migrations for archive and federation\n" }, { "from": "gpt", "value": "ALTER TABLE job ADD COLUMN cluster_name character varying DEFAULT 'master'::character varying;\nALTER TABLE job ADD COLUMN archive jsonb[];\n\nCREATE TABLE cluster\n(\n name character ...
sql
chosen
[ { "from": "human", "value": "Add VVM and Adjstement reason tables\n" }, { "from": "gpt", "value": "DO $$\n BEGIN\n BEGIN\n CREATE TABLE vaccine_lots_on_hand_adjustments\n (\n id integer NOT NULL DEFAULT nextval('vaccine_lots_on_hand_adjustment_id_seq'::regclass),\n lo...
sql
chosen
[ { "from": "human", "value": "Fix web test to recognize proposal log lookup on create new IP\n" }, { "from": "gpt", "value": "insert into PROPOSAL_LOG (FISCAL_MONTH,FISCAL_YEAR,PROPOSAL_TYPE_CODE,LOG_STATUS,PI_ID,PROPOSAL_LOG_TYPE_CODE,PROPOSAL_NUMBER,TITLE,LEAD_UNIT,UPDATE_TIMESTAMP,UPDATE_USER)...
sql
chosen
[ { "from": "human", "value": "Change name of sql file to todo.sql.\n" }, { "from": "gpt", "value": "--\n-- PostgreSQL database dump\n--\n\nSET statement_timeout = 0;\nSET lock_timeout = 0;\nSET client_encoding = 'UTF8';\nSET standard_conforming_strings = on;\nSET check_function_bodies = false;\nS...
sql
chosen
[ { "from": "human", "value": "Add janitor for suppliers' files\n" }, { "from": "gpt", "value": "-- finds suppliers with duplicated files (one as customer and another one as supplier)\n\nselect supplier.name as nom, supplier.vat as DNI \n from res_partner as supplier\n inner join res_par...
sql
chosen
[ { "from": "human", "value": "Fix \"source\" column length for comments.\nIt now matches the length of the data potentially being inserted into it.\n" }, { "from": "gpt", "value": "# Update source field length on comment tables\n# to match the length of the API key \"application\" column\n\nALTER...
sql
chosen
[ { "from": "human", "value": "Add a table for metrics\n" }, { "from": "gpt", "value": "CREATE TABLE IF NOT EXISTS bridge_metrics (\n request_id CHAR(36) ENCODE RAW NOT NULL,\n request_start TIMESTAMP ENCODE DELTA32K NOT NULL,\n request_end TIMESTAMP ...
sql
chosen
[ { "from": "human", "value": "Add BBQ on the deck as a choice\n" }, { "from": "gpt", "value": "SELECT run_migration(5, $$\n\tINSERT INTO choice (id, name, added_in, removed_in)\n\tVALUES (16, 'BBQ on the deck', 26, NULL);\n$$);\n\n-- SELECT rollback_migration(5, $$\n-- \tDELETE FROM \"choice\" WH...
sql
chosen
[ { "from": "human", "value": "Add contact table,address fields to organization\n" }, { "from": "gpt", "value": "CREATE TABLE `contact` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `organization_id` int(11) NOT NULL,\n `first_name` varchar(255) NOT NULL,\n `last_name` varchar(255) DEFAULT NULL,...
sql
chosen
[ { "from": "human", "value": "Add gallery permissions and content type.\n" }, { "from": "gpt", "value": "-- Permission for deleting media\nINSERT INTO django_content_type (name, app_label, model) VALUES\n ('Gallery Video', 'gallery', 'video'),\n ('Gallery Image', 'gallery', 'image');\nINSER...
sql
chosen
[ { "from": "human", "value": "Patch to add new start_time and end_time columns to session table for more reliable session tracking.\n" }, { "from": "gpt", "value": "alter table session add column end_time DATETIME after db_release;\nalter table session add column start_time DATETIME after db_rele...
sql
chosen
[ { "from": "human", "value": "Index creation script for TPC-H.\n\n\nFormer-commit-id: 4637bcedfb200062568228337563d718637c82dd\nFormer-commit-id: 13f0d682cc2a7840467c083c74d58b73ea39017e" }, { "from": "gpt", "value": "alter table part add primary key (p_partkey);\nalter table supplier add primary...
sql
chosen
[ { "from": "human", "value": "Add DB updates for comments, Q&A and likes\n" }, { "from": "gpt", "value": "ALTER TABLE `comments` CHANGE `type` `type` ENUM( 'confused', 'dislike', 'support', 'question', 'answer' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL \n\nALTER TABLE `comments` ADD `...
sql
chosen
[ { "from": "human", "value": "Fix incorrect column type of notification_event.resource_id\n\nThe column type must not be bigint because the type of\nNotificationEvent.resourceId is String.\n" }, { "from": "gpt", "value": "# --- !Ups\n\nalter table notification_event add column tmp_resource_id var...
sql
chosen
[ { "from": "human", "value": "Add initial query to fetch sequences\n\nThis finds a limited subset of sequences for secondary structure\ngeneration. We start with only the rRNA's that have no QA issues. This should\nselect the easiest to build sequences.\n" }, { "from": "gpt", "value": "COPY (\nSE...
sql
chosen
[ { "from": "system", "value": "Remove database name from deployment script\n" }, { "from": "human", "value": "ALTER TABLE xcolab.xcolab_Proposal DROP currentVersion;\nALTER TABLE xcolab.xcolab_ProposalAttribute DROP versionWhenCreated;" }, { "from": "gpt", "value": "ALTER TABLE xcolab...
sql
chosen
[ { "from": "system", "value": "Use DELETE-INSERT instead of REPLACE for SQL updates" }, { "from": "human", "value": "INSERT INTO version_db_world (`sql_rev`) VALUES ('1527682153565076000');\nREPLACE INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`eve...
sql
chosen
[ { "from": "system", "value": "Add indexes and constraints to roads_nodes\n" }, { "from": "human", "value": "DROP TABLE IF EXISTS roads;\n\nCREATE TABLE roads AS\n SELECT\n DISTINCT ON (osm_id)\n osm_id as id,\n name,\n CASE WHEN oneway = 'yes' THEN true ELSE false END AS oneway,\n ...
sql
chosen
[ { "from": "system", "value": "Add aardwolf schema to search_path for Database.database\n" }, { "from": "human", "value": "CREATE SCHEMA IF NOT EXISTS aardwolf;\n\nCREATE EXTENSION IF NOT EXISTS \"pgcrypto\";\n" }, { "from": "gpt", "value": "CREATE SCHEMA IF NOT EXISTS aardwolf;\nALTE...
sql
chosen
[ { "from": "system", "value": "Add indexes for efficient lookup of sources and qualifiers.\n" }, { "from": "human", "value": "CREATE TABLE snak (\n id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n property VARCHAR(32),\n svalue TEXT,\n dvalue DECIMAL,\n lat DOUB...
sql
chosen
[ { "from": "system", "value": "Make first version of clone_schema unusable.\n\nWe don't want someone to migrate to this version, and attempt to use it.\n" }, { "from": "human", "value": "-- http://wiki.postgresql.org/wiki/Clone_schema\n\nCREATE OR REPLACE FUNCTION clone_schema(source_schema text,...
sql
chosen
[ { "from": "system", "value": "Use UNIQUE KEY instead of CONSTRAINT UNIQUE in db script\n" }, { "from": "human", "value": "CREATE TABLE `transactions` (\n `id` INT NOT NULL AUTO_INCREMENT,\n `date` DATE NOT NULL,\n `amount` DOUBLE NOT NULL, \n `description` VARCHAR(200) NOT NULL, \n `accou...
sql
chosen
[ { "from": "system", "value": "Fix spec database setup script\n" }, { "from": "human", "value": "CREATE EXTENSION IF NOT EXISTS hstore;\n\nDROP TABLE IF EXISTS hstore_records;\n\nCREATE TABLE hstore_records(\n id serial PRIMARY KEY,\n properties hstore\n);\n\n\n\nDROP TABLE IF EXISTS text_array...
sql
chosen
[ { "from": "system", "value": "Add unique index using guid\n\nBased on looking at the guids in a few feeds these are definitely not\nglobally unique.\n" }, { "from": "human", "value": "-- In this upgrade I add a GUID column to feed items.\n--\n-- This is a unique identifier that the feed may spec...
sql
chosen
[ { "from": "system", "value": "Revert \"Revert \"Fix DDL on timestamp\"\"\n" }, { "from": "human", "value": "-- add timestap column\n-- timestamp column is not null by default\nALTER TABLE project ADD create_time timestamp DEFAULT CURRENT_TIMESTAMP;\nALTER TABLE project ADD change_time timestamp ...
sql
chosen
[ { "from": "system", "value": "Rename typu - oprava SQL skriptu pro nasazeni typu\n" }, { "from": "human", "value": "@&&run_dir_begin\n\n\nprompt Creating type QUILT_REPORT_PROCESS_TYPE\n@@quilt_report_process.tps\n\nprompt Creating type QUILT_REPORT_TYPE\n@@quilt_report_type.tps\n\nprompt Creati...
sql
chosen
[ { "from": "system", "value": "Read SQL from temp Dir\n" }, { "from": "human", "value": "drop database if exists apim;\ncreate database apim;\nuse apim;\nsource ~/wso2am-2.1.0/dbscripts/apimgt/mysql5.7.sql\n\ndrop database if exists registry;\ncreate database registry;\nuse registry;\nsource ~/ws...
sql
chosen