Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add sql to create tables
-- Create syntax for TABLE 'article_tags' CREATE TABLE `article_tags` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `article_id` int(11) unsigned NOT NULL, `tag_id` int(11) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- Create syntax for TABLE 'articles' CREATE TABLE `article...
Add script to create baseline table
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -- Allows us to use gist in this database CREATE EXTENSION IF NOT EXISTS btree_gist; -- create baseline table CREA...
Add SQL constraint to ensure unicity of emails
DO $$ BEGIN BEGIN CREATE UNIQUE INDEX sys_user_unique_email ON sys_user(email) WHERE email != ''; END; BEGIN CREATE UNIQUE INDEX cd_profiles_unique_email ON cd_profiles(email) WHERE email != ''; END; END; $$
Add SA table for VIRTA-JTP/Latausraportit/Duplikaatit
IF NOT EXISTS ( select * from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='sa' and TABLE_NAME='sa_virta_jtp_latausraportit_duplikaatit' ) BEGIN CREATE TABLE sa.sa_virta_jtp_latausraportit_duplikaatit( id bigint IDENTITY(1,1) NOT NULL, duplikaattiID int null, organisaatiotunnus nvarchar(50) null, organisa...
Change mapstats path on mapfull-template
UPDATE portti_bundle SET startup='{ "bundlename" : "mapfull" "metadata" : { "Import-Bundle" : { "core-base" : { "bundlePath" : "/Oskari/packages/framework/bundle/" }, "core-map" : { "bundlePath" : "/Oskari/packages/framework/bundle/" ...
Handle unique constraint change during migration in 'issues/4197'
UPDATE IDN_OAUTH2_ACCESS_TOKEN SET TOKEN_SCOPE_HASH=(dbms_random.string('L', 32)) WHERE TOKEN_ID IN ( SELECT DISTINCT a.TOKEN_ID FROM IDN_OAUTH2_ACCESS_TOKEN a JOIN ( SELECT CONSUMER_KEY_ID, AUTHZ_USER, USER_DOMAIN, TENANT_ID, TOKEN_SCOPE_HASH, USER_TYPE, TOKEN_STATE, COUNT(*) FROM IDN_OAUTH2_ACCESS_TOKEN GROU...
Add How old your backups script
/* Author: Tim Ford Original link: http://sqlmag.com/database-backup-and-recovery/how-old-are-your-backups */ WITH full_backups AS ( SELECT ROW_NUMBER() OVER(PARTITION BY BS.database_name, BS.type ORDER BY BS.database_name ASC, ...
Add sql script to delete /Old Internal Statistics folder and children
-- Delete the child folders of '/Old Internal Statistics' -- Additional sub-select needed to get round MySQL's inability to copy with having the table being -- deleted from in an immediate sub-select DELETE FROM FOLDER WHERE fk_folder_id IN ( SELECT id FROM ( SELECT * FROM FOLDER WHERE ...
Add migration removing 'jetpack' tag
-- Uncomment this locally if you can't create files anymore. -- On dev/stage/prod, this isn't necessary as the column already has a default value. -- The column will be removed entirely in a future push. -- ALTER TABLE `files` MODIFY COLUMN `requires_chrome` tinyint(1) NOT NULL DEFAULT 0; DELETE `users_tags_addons` FR...
Create event_images table for storing info about images
-- table to store the available images for an event create table event_images ( id int auto_increment primary key, event_id int not null, type varchar(30) not null, url varchar(255) not null, width int, height int, index event_image_type (event_id, type) ); -- populate it also with our old-...
Use DELETE-INSERT instead of REPLACE for SQL updates
INSERT INTO version_db_world (`sql_rev`) VALUES ('1527682153565076000'); REPLACE INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_pa...
INSERT INTO version_db_world (`sql_rev`) VALUES ('1527682153565076000'); DELETE FROM `smart_scripts` WHERE `entryorguid` = 177385; INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4...
Make first version of clone_schema unusable.
-- http://wiki.postgresql.org/wiki/Clone_schema CREATE OR REPLACE FUNCTION clone_schema(source_schema text, dest_schema text) RETURNS void AS $$ DECLARE object text; buffer text; default_ text; column_ text; trigger_ text; view_ record; BEGIN EXECUTE 'CREATE SCHEMA ' || dest_schema ; -- TODO: Find a ...
-- http://wiki.postgresql.org/wiki/Clone_schema CREATE OR REPLACE FUNCTION clone_schema(source_schema text, dest_schema text) RETURNS void AS $$ DECLARE BEGIN RAISE EXCEPTION 'This function is no longer supported. Please upgrade.'; END; $$ LANGUAGE plpgsql VOLATILE;
Use DELETE-INSERT instead of REPLACE for SQL updates
INSERT INTO version_db_world (`sql_rev`) VALUES ('1527682153565076000'); REPLACE INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_pa...
INSERT INTO version_db_world (`sql_rev`) VALUES ('1527682153565076000'); DELETE FROM `smart_scripts` WHERE `entryorguid` = 177385; INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4...
Add owner_app to owner_id unique index
DROP TYPE IF EXISTS app; CREATE TYPE app AS ENUM ('telegram', 'vk'); CREATE TABLE IF NOT EXISTS rooms ( id SERIAL PRIMARY KEY, owner_id BIGINT NOT NULL, owner_app app NOT NULL, guest_id BIGINT, guest_app app, active BOOLEAN NOT NULL DEFAULT TRUE, created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW() CH...
DROP TYPE IF EXISTS app; CREATE TYPE app AS ENUM ('telegram', 'vk'); CREATE TABLE IF NOT EXISTS rooms ( id SERIAL PRIMARY KEY, owner_id BIGINT NOT NULL, owner_app app NOT NULL, guest_id BIGINT, guest_app app, active BOOLEAN NOT NULL DEFAULT TRUE, created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW() CH...
Add db index to improve speed of get_open_games
create table games ( id char(48) primary key, data jsonb );
create table games ( id char(48) primary key, data jsonb ); create index idx_get_open_games on games((data->>'active'), (data->>'ended_at'), (data->>'created_at'));
Add dropping of commodprices table to SQL migration scripts
DROP TABLE IF EXISTS `obj_load_min_level`; DROP TABLE IF EXISTS `shopgoldtmp`; DROP TABLE IF EXISTS `talenhistory`;
DROP TABLE IF EXISTS `obj_load_min_level`; DROP TABLE IF EXISTS `shopgoldtmp`; DROP TABLE IF EXISTS `talenhistory`; DROP TABLE IF EXISTS `commodprices`;
Fix SQL for database setup.
use memegendb; create table MemeInfo if not exists ( id bigint auto_increment primary key , filename varchar(256) unique, upvotes bigint, downvotes bigint, createdby varchar(256), createdon datetime ); create table MemeTags if not exists ( tagid bigint auto_increment primary key, memeid bigint,...
use memegendb; create table if not exists MemeInfo ( meme_id bigint auto_increment, filename varchar(256) unique, upvotes bigint, downvotes bigint, createdby varchar(256), createdon datetime, primary key (meme_id) ); create table if not exists MemeTags ( tag_id bigint auto_increment pri...
Drop function from public and create in pg_catalog
DROP FUNCTION master_update_shard_statistics(shard_id bigint); CREATE FUNCTION pg_catalog.master_update_shard_statistics(shard_id bigint) RETURNS bigint LANGUAGE C STRICT AS 'MODULE_PATHNAME', $$master_update_shard_statistics$$; COMMENT ON FUNCTION master_update_shard_statistics(bigint) IS 'updates sha...
DROP FUNCTION IF EXISTS public.master_update_shard_statistics(shard_id bigint); CREATE OR REPLACE FUNCTION pg_catalog.master_update_shard_statistics(shard_id bigint) RETURNS bigint LANGUAGE C STRICT AS 'MODULE_PATHNAME', $$master_update_shard_statistics$$; COMMENT ON FUNCTION master_update_shard_statistics...
Include educators with no LASID in educators export file
use x2data SELECT 'state_id', 'local_id', 'full_name', 'staff_type', 'homeroom', 'status', 'login_name', 'school_local_id' UNION ALL SELECT STF_ID_STATE, STF_ID_LOCAL, stf_name_view, STF_STAFF_TYPE, STF_HOMEROOM, STF_STATUS, USR_LOGIN_NAME, SKL_SCHOOL_ID FROM staff INNER JOIN school ON...
use x2data SELECT 'state_id', 'local_id', 'full_name', 'staff_type', 'homeroom', 'status', 'login_name', 'school_local_id' UNION ALL SELECT STF_ID_STATE, STF_ID_LOCAL, stf_name_view, STF_STAFF_TYPE, STF_HOMEROOM, STF_STATUS, USR_LOGIN_NAME, SKL_SCHOOL_ID FROM staff INNER JOIN school ON...
Change tag order to match infoQuestion.json order
-- Returns a JSON array describing the tags for question question_id. CREATE OR REPLACE FUNCTION tags_for_question (question_id bigint) RETURNS JSONB AS $$ SELECT JSONB_AGG(JSONB_BUILD_OBJECT( 'name',tag.name, 'id',tag.id, 'color',tag.color, 'number', tag.number ) ORDER BY ...
-- Returns a JSON array describing the tags for question question_id. CREATE OR REPLACE FUNCTION tags_for_question (question_id bigint) RETURNS JSONB AS $$ SELECT JSONB_AGG(JSONB_BUILD_OBJECT( 'name',tag.name, 'id',tag.id, 'color',tag.color ) ORDER BY qt.number, tag.id) FROM ta...
Remove unmatched migration down column
ALTER TABLE app_info DROP COLUMN IF EXISTS certificate; ALTER TABLE module_config DROP COLUMN IF EXISTS certificate CASCADE, DROP COLUMN IF EXISTS private_key CASCADE; DROP TABLE IF EXISTS app_certificates;
ALTER TABLE module_config DROP COLUMN IF EXISTS certificate CASCADE, DROP COLUMN IF EXISTS private_key CASCADE; DROP TABLE IF EXISTS app_certificates;
Add update timestamp to retrieved columns
DROP PROCEDURE IF EXISTS selectOrganization; DELIMITER $$ CREATE PROCEDURE selectOrganization(p_orgid INT UNSIGNED) BEGIN SELECT org.orgid, org.org_name, usr.person_name, usr.email, usr.email_is_verified, org.user_id, org.org_website, org.money_url, org.mission, org.abbreviated_name, org.customer_notice, org.c...
DROP PROCEDURE IF EXISTS selectOrganization; DELIMITER $$ CREATE PROCEDURE selectOrganization(p_orgid INT UNSIGNED) BEGIN SELECT org.orgid, org.org_name, usr.person_name, usr.email, usr.email_is_verified, org.user_id, org.update_timestamp, org.org_website, org.money_url, org.mission, org.abbreviated_name, org....
Remove postgres 9.6 specific settings
SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; SET row_security = off; -- -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - -- C...
SET statement_timeout = 0; SET lock_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; -- -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - -- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; -- --...
Fix for live_agents with not enough closer_campaign space.
# 07/07/2009 ALTER TABLE osdial_xfer_log ADD uniqueid VARCHAR(20) NOT NULL default ''; CREATE INDEX uniqueid ON osdial_xfer_log (uniqueid); ALTER TABLE osdial_agent_log ADD uniqueid VARCHAR(20) NOT NULL default ''; CREATE INDEX uniqueid ON osdial_agent_log (uniqueid); ALTER TABLE recording_log ADD uniqueid VARCHAR(2...
# 07/07/2009 ALTER TABLE osdial_xfer_log ADD uniqueid VARCHAR(20) NOT NULL default ''; CREATE INDEX uniqueid ON osdial_xfer_log (uniqueid); ALTER TABLE osdial_agent_log ADD uniqueid VARCHAR(20) NOT NULL default ''; CREATE INDEX uniqueid ON osdial_agent_log (uniqueid); ALTER TABLE recording_log ADD uniqueid VARCHAR(2...
Add new table to upgrade SQL file
CREATE TABLE IF NOT EXISTS `uploadfile` ( `id` int(11) NOT NULL auto_increment, `filename` varchar(255) NOT NULL, `filesize` int(11) NOT NULL DEFAULT '0', `sha1sum` varchar(40) NOT NULL, PRIMARY KEY(`id`), KEY `sha1sum` (`sha1sum`) ); CREATE TABLE IF NOT EXISTS `build2uploadfile` ( `fileid` bigint(11) NO...
CREATE TABLE IF NOT EXISTS `uploadfile` ( `id` int(11) NOT NULL auto_increment, `filename` varchar(255) NOT NULL, `filesize` int(11) NOT NULL DEFAULT '0', `sha1sum` varchar(40) NOT NULL, PRIMARY KEY(`id`), KEY `sha1sum` (`sha1sum`) ); CREATE TABLE IF NOT EXISTS `build2uploadfile` ( `fileid` bigint(11) NO...
Add references oldstyle for easy understandings
-- Script: Tabelas -- Learn: http://www.postgresql.org/docs/current/static/sql-createtable.html CREATE TABLE usuarios ( username VARCHAR(30) PRIMARY KEY, password VARCHAR(30) ); CREATE TABLE batalha_usuario ( username VARCHAR(30) PRIMARY KEY FOREIGN KEY, password VARCHAR(30) PRIMARY KEY FOREIGN KEY );...
-- Script: Tabelas -- Learn: http://www.postgresql.org/docs/current/static/sql-createtable.html CREATE TABLE USUARIOS ( username VARCHAR(30) PRIMARY KEY, password VARCHAR(30) ); CREATE TABLE BATALHA_USUARIO ( username VARCHAR(30), batalha_id INT, PRIMARY KEY (username, password), FOREIGN KEY b...
Add comment (really,doing this mostly to kick off a new build).
DROP TABLE IF EXISTS LOAN_MONITORING; /* The table LOAN_MONITORING will contain the default behavior of the group loan with individual monitoring on the MFI - Configuration This information can not be configured through the UI, so it does need to be configured in the script */ CREATE TABLE LOAN_MONITORING ( ...
DROP TABLE IF EXISTS LOAN_MONITORING; /* The table LOAN_MONITORING will contain the default behavior of the group loan with individual monitoring on the MFI - Configuration This information can not be configured through the UI, so it does need to be configured in the script */ CREATE TABLE LOAN_MONITORING ( ...
Add comments on how to create a db and a db user
-- Type of spelling -- a classic reference table CREATE TABLE spelling ( id TINYINT PRIMARY KEY, name VARCHAR(256) NOT NULL ); CREATE TABLE words ( word VARCHAR(256) NOT NULL, hyphenation VARCHAR(256) NOT NULL, spelling TINYINT NOT NULL, PRIMARY KEY(word, spelling), FOREIGN KEY(spelling) REFERENCES spell...
-- Create a db -- CREATE DATABASE hyphenation CHARACTER SET utf8 COLLATE utf8_bin; -- Create a user -- CREATE USER 'hyphenation'@'localhost' IDENTIFIED BY 'sekret'; -- GRANT ALL ON hyphenation.* TO 'hyphenation'@'localhost'; -- FLUSH PRIVILEGES; -- Type of spelling -- a classic reference table CREATE TABLE spelling (...
Create roll and grant priveleges
CREATE DATABASE FAM_SARP; \c fam_sarp CREATE TABLE participants ( subject smallserial NOT NULL, email character varying(40) UNIQUE NOT NULL, sessions_completed smallint NOT NULL, rng_seed integer NOT NULL, PRIMARY KEY(subject) ); CREATE TABLE stimuli ( id smallserial NOT NULL, target character varying(...
CREATE DATABASE FAM_SARP; \c fam_sarp CREATE TABLE participants ( subject smallserial NOT NULL, email character varying(40) UNIQUE NOT NULL, sessions_completed smallint NOT NULL, rng_seed integer NOT NULL, PRIMARY KEY(subject) ); CREATE TABLE stimuli ( id smallserial NOT NULL, target character varying(...
Remove useless join which gobbled memory
begin; drop table if exists line_joints; create table line_joints ( synth_id varchar(64), objects varchar(64) array, terminal_id int[], area geometry(polygon, 3857) ); insert into line_joints (synth_id, terminal_id, area, objects) select concat('j', nextval('synthetic_objects')), ...
begin; drop table if exists line_joints; create table line_joints ( synth_id varchar(64), objects varchar(64) array, terminal_id int[], area geometry(polygon, 3857) ); insert into line_joints (synth_id, terminal_id, area, objects) select concat('j', nextval('synthetic_objects')), ...
Fix 'dynamic theme' tag migration. The column blacklisted got renamed to denied.
INSERT INTO tags (tag_text, blacklisted, restricted) VALUES ('dynamic theme', 0, 1) ON DUPLICATE KEY UPDATE restricted = 1;
INSERT INTO tags (tag_text, denied, restricted) VALUES ('dynamic theme', 0, 1) ON DUPLICATE KEY UPDATE restricted = 1;
Fix column already exist issue
ALTER TABLE vaccine_distributions ADD COLUMN isNotificationSent Boolean default false;
DO $$ BEGIN BEGIN ALTER TABLE vaccine_distributions ADD COLUMN isNotificationSent Boolean default false; EXCEPTION WHEN duplicate_column THEN RAISE NOTICE 'column isNotificationSent already exists in vaccine_distributions.'; END; END; $$
Add 'used' attribute to DB
CREATE TABLE IF NOT EXISTS tickets ( code BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, firstname VARCHAR(50) NOT NULL, lastname VARCHAR(50) NOT NULL, street VARCHAR(50) NOT NULL, housenumber VARCHAR(5) NOT NULL, postalcode INT(5) UNSIGNED NOT NULL, town VARCHAR(50) NOT NULL, date TIMESTAMP NOT NULL, PRIMARY KE...
CREATE TABLE IF NOT EXISTS tickets ( code BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, firstname VARCHAR(50) NOT NULL, lastname VARCHAR(50) NOT NULL, street VARCHAR(50) NOT NULL, housenumber VARCHAR(5) NOT NULL, postalcode INT(5) UNSIGNED NOT NULL, town VARCHAR(50) NOT NULL, date TIMESTAMP NOT NULL, used BOOL...
Fix table def to autonumber id field.
CREATE USER itest; CREATE DATABASE itest OWNER itest; \c itest; /* Create test tables */ create table users ( id int not null, first_name varchar(80), last_name varchar(80), primary key (id) );
CREATE USER itest; CREATE DATABASE itest OWNER itest; \c itest; CREATE SEQUENCE users_id_sequence /* Create test tables */ CREATE TABLE users ( id int DEFAULT nextval('users_id_sequence') PRIMARY KEY, first_name varchar(80), last_name varchar(80) );
Add default ReplayGain pref to schema
-- Up ALTER TABLE "media" ADD COLUMN "rgTrackGain" REAL; ALTER TABLE "media" ADD COLUMN "rgTrackPeak" REAL; -- Down
-- Up ALTER TABLE "media" ADD COLUMN "rgTrackGain" REAL; ALTER TABLE "media" ADD COLUMN "rgTrackPeak" REAL; INSERT INTO prefs (key,data) VALUES ('isReplayGainEnabled','false'); -- Down
Remove redundant CREATE TRIGGER calls
CREATE ROLE administrator; CREATE USER administrator_user PASSWORD 'password' IN ROLE administrator; GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE users, contracts, calls TO administrator; CREATE OR REPLACE FUNCTION _check_time() RETURNS TRIGGER AS $$ BEGIN IF (current_user = 'administrator_user') ...
CREATE ROLE administrator; CREATE USER administrator_user PASSWORD 'password' IN ROLE administrator; GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE users, contracts, calls TO administrator; CREATE OR REPLACE FUNCTION _check_time() RETURNS TRIGGER AS $$ BEGIN IF (current_user = 'administrator_user') ...
Add dummy "paid_out" column to the payments SQL query.
select * from transactions join transaction_types on transaction_types.transaction_type_id=transactions.transaction_type_id where transaction_id in (select transaction_id from transactions join transaction_types on transaction_types.transaction_type_id=transactions.transaction_type_id where account_id=? and tra...
select t.*, tt.*, false as paid_out from transactions t join transaction_types tt on tt.transaction_type_id=t.transaction_type_id where t.transaction_id in (select transaction_id from transactions join transaction_types on transaction_types.transaction_type_id=transactions.transaction_type_id where account_id=?...
Update equipment status line item table schema
CREATE TABLE equipment_status_line_items( id SERIAL PRIMARY KEY, facilityId INT NOT NULL REFERENCES facilities(id), programId INT NOT NULL REFERENCES programs(id), periodId INT NOT NULL REFERENCES processing_periods(id), operationalStatusI...
DROP TABLE IF EXISTS equipment_status_line_items; CREATE TABLE equipment_status_line_items( id SERIAL PRIMARY KEY, rnrId INT NOT NULL REFERENCES requisitions(id), code VARCHAR(200) NOT NULL, equipmentName VARCHAR(200) NOT NULL, equi...
Add new layer to polygons
drop table if exists minsk_polygons; create table minsk_polygons as ( with segments as ( select (ST_Dump( ST_Transform( ST_VoronoiPolygons( ST_Collect( ST_SetSRID( ST_MakePoin...
drop table if exists minsk_polygons; create table minsk_polygons as ( with segments as ( select (ST_Dump( ST_Transform( ST_VoronoiPolygons( ST_Collect( ST_SetSRID( ST_MakePoin...
Add Collate for user nickname
CREATE EXTENSION IF NOT EXISTS CITEXT; CREATE TABLE IF NOT EXISTS users ( id SERIAL PRIMARY KEY, nickname CITEXT NOT NULL UNIQUE, fullname TEXT NOT NULL, email CITEXT NOT NULL UNIQUE, about TEXT ); CREATE INDEX IF NOT EXISTS idx_users_nickname ON users (nickname);
CREATE EXTENSION IF NOT EXISTS CITEXT; CREATE TABLE IF NOT EXISTS users ( id SERIAL PRIMARY KEY, nickname CITEXT NOT NULL UNIQUE COLLATE UCS_BASIC, fullname TEXT NOT NULL, email CITEXT NOT NULL UNIQUE, about TEXT ); CREATE INDEX IF NOT EXISTS idx_users_nickname ON users (nickname);
Make result enum match ReportLine level strings.
# Table structure for healthcheck output database # Healthcheck running sessions. CREATE TABLE session ( session_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, start_time DATETIME, end_time DATETIME, release INT, PRIMARY KEY (session_id), KEY release_idx(release) ); # Individual heal...
# Table structure for healthcheck output database # Healthcheck running sessions. CREATE TABLE session ( session_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, start_time DATETIME, end_time DATETIME, release INT, PRIMARY KEY (session_id), KEY release_idx(release) ); # Individual heal...
Fix syntax errors in database schema.
create table entities ( id serial primary key, jid text not null unique ); create table nodes ( id serial primary key, node text not null unique, persistent boolean not null default true, deliver_payload boolean not null default true send_last_published_item text not null default 'on_sub' ...
create table entities ( id serial primary key, jid text not null unique ); create table nodes ( id serial primary key, node text not null unique, persistent boolean not null default true, deliver_payload boolean not null default true, send_last_published_item text not null default 'on_sub' ...
Fix up the votes db query so that it gets the winner correctly
select c.id, c.name, count(v.id) as votes from "choice" c left outer join ( select v.* from vote v join "round" r on v.round_id = r.id where r.id = $1 ) as v on v.choice_id = c.id where (c.added_in is null or c.added_in <= $1) and (c.removed_in is null or c.removed_in >= $1) group by c.id order by c.id asc;
select c.id, c.name, r.winning_choice_id = c.id as winner, count(v.id) as votes from choice c join round r on r.id = $1 left outer join vote v on v.choice_id = c.id and v.round_id = $1 where (c.added_in is null or c.added_in <= $1) and (c.removed_in is null or c.removed_in >= $1) group by c.id, r.winning_choice_id orde...
Use temp tables for migration.
ALTER TABLE ${ohdsiSchema}.sec_permission ADD COLUMN for_role_id INTEGER; INSERT INTO ${ohdsiSchema}.sec_permission (id, value, for_role_id) SELECT nextval('${ohdsiSchema}.sec_permission_id_seq'), REPLACE('vocabulary:%s:concept:*:ancestorAndDescendant:get', '%s', REPLACE(REPLACE(value, 'source:', ''), ':access', '')...
CREATE TEMP TABLE temp_migration ( from_perm_id int, new_value character varying(255) ); INSERT INTO temp_migration (from_perm_id, new_value) SELECT sp.id as from_id, REPLACE('vocabulary:%s:concept:*:ancestorAndDescendant:get', '%s', REPLACE(REPLACE(value, 'source:', ''), ':access', '')) as new_value FROM ${ohds...
Fix bug with null equivalence that led us to lose the first span.
-- -- Copyright 2020 The Android Open Source Project -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- https://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applica...
-- -- Copyright 2020 The Android Open Source Project -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- https://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applica...
Add index on (channel, nick) for faster nick: searches.
DROP TABLE IF EXISTS `irclog`; CREATE TABLE `irclog` ( id INT auto_increment, channel VARCHAR(30), nick VARCHAR(40), opcode VARCHAR(20), timestamp INT, line TEXT, PRIMARY KEY(`id`) ) CHARSET=utf8 ENGINE=MyISAM; CREATE INDEX `irclog_channel_timestamp_index` ON `ir...
DROP TABLE IF EXISTS `irclog`; CREATE TABLE `irclog` ( id INT auto_increment, channel VARCHAR(30), nick VARCHAR(40), opcode VARCHAR(20), timestamp INT, line TEXT, PRIMARY KEY(`id`) ) CHARSET=utf8 ENGINE=MyISAM; CREATE INDEX `irclog_channel_timestamp_index` ON `ir...
Fix for hierarchy to get the top level.
CREATE OR REPLACE FUNCTION ti.gettaxonhierarchy(_taxonname character varying) RETURNS TABLE(taxonid integer, taxonname character varying, valid boolean, highertaxonid integer) LANGUAGE sql AS $function$ WITH RECURSIVE lowertaxa AS (SELECT txa.taxonid, txa.highertaxonid FROM ndb.ta...
CREATE OR REPLACE FUNCTION ti.gettaxonhierarchy(_taxonname character varying) RETURNS TABLE(taxonid integer, taxonname character varying, valid boolean, highertaxonid integer) LANGUAGE sql AS $function$ WITH RECURSIVE lowertaxa AS (SELECT txa.taxonid, txa.highertaxonid FROM ndb.ta...
Update documentation for new chat access scopes
CREATE TABLE `pb_bot` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(64) NOT NULL COMMENT 'i.e. snusbot', `twitch_access_token` VARCHAR(64) NULL DEFAULT NULL COMMENT 'Bot level access-token', `twitch_refresh_token` VARCHAR(64) NULL DEFAULT NULL COMMENT 'Bot level refresh-token', PRIMARY KEY (`id`)...
CREATE TABLE `pb_bot` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(64) NOT NULL COMMENT 'i.e. snusbot', `twitch_access_token` VARCHAR(64) NULL DEFAULT NULL COMMENT 'Bot level access-token', `twitch_refresh_token` VARCHAR(64) NULL DEFAULT NULL COMMENT 'Bot level refresh-token', PRIMARY KEY (`id`)...
Clean up temp precompute tables
vacuum (analyze, verbose);
DROP TABLE load_qa_status; DROP TABLE load_precomputed; DROP TABLE precompute_urs; DROP TABLE precompute_urs_taxid; DROP TABLE precompute_urs_accession; vacuum (analyze, verbose);
Fix substring -> substr in TPCH query set
SELECT cntrycode, count(*) AS numcust, sum(acctbal) AS totacctbal FROM ( SELECT substring(c.phone,1,2) AS cntrycode, c.acctbal FROM "${database}"."${schema}"."${prefix}customer" c WHERE substring(c.phone,1,2) IN ('13', '31', '23', '29', '30', '18', '17') AND c....
SELECT cntrycode, count(*) AS numcust, sum(acctbal) AS totacctbal FROM ( SELECT substr(c.phone,1,2) AS cntrycode, c.acctbal FROM "${database}"."${schema}"."${prefix}customer" c WHERE substr(c.phone,1,2) IN ('13', '31', '23', '29', '30', '18', '17') AND c.acctbal ...
Convert MyISAM table to InnoDB for consistency
-- Licensed to the Apache Software Foundation (ASF) under one -- or more contributor license agreements. See the NOTICE file -- distributed with this work for additional information -- regarding copyright ownership. The ASF licenses this file -- to you under the Apache License, Version 2.0 (the -- "License"); you may...
-- Licensed to the Apache Software Foundation (ASF) under one -- or more contributor license agreements. See the NOTICE file -- distributed with this work for additional information -- regarding copyright ownership. The ASF licenses this file -- to you under the Apache License, Version 2.0 (the -- "License"); you may...
Clear the fact tables before loading
/* truncate table synth_ma.synth_cousub_stats; truncate table synth_ma.synth_county_stats; truncate table synth_ma.synth_cousub_facts; truncate table synth_ma.synth_county_facts; */
/* truncate table synth_ma.synth_condition_facts; truncate table synth_ma.synth_disease_fact; truncate table synth_ma.synth_pop_facts; */
Add public printout method for testing
set define off create or replace public class Upi { public static String getUpi( long id ) { String str = Long.toHexString( id ).toUpperCase(); return "UPI0000000000".substring(0, 13 - str.length() ) + str; } } create or replace package upi is /* * Returns a new protein identifier. */ ...
set define off create or replace public class Upi { public static String getUpi( long id ) { String str = Long.toHexString( id ).toUpperCase(); return "UPI0000000000".substring(0, 13 - str.length() ) + str; } public static void main (String args[]) { long l = Long.parseLong(args[0]); System.out.println(ge...
Set linux version to Trusty
CREATE TABLE IF NOT EXISTS `HardCache` ( `Id` varchar(255) NOT NULL, `Bucket` varchar(255) NOT NULL, `Value` longtext NOT NULL, `EndDate` datetime NOT NULL, `Created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `Modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,...
CREATE TABLE IF NOT EXISTS `HardCache` ( `Id` varchar(255) NOT NULL, `Bucket` varchar(255) NOT NULL, `Value` longtext NOT NULL, `EndDate` datetime NOT NULL, `Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `Modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP...
Fix email overlap check so it looks at cohorts with transfer sender (but not approved)
CREATE PROCEDURE [dbo].[CheckForOverlappingEmailsForTable] @Emails [EmailCheckTable] READONLY, @CohortId BIGINT = NULL AS BEGIN SELECT E.RowId, A.Id, A.FirstName, A.LastName, A.DateOfBirth, A.CommitmentId AS CohortId, A.StartDate, A.EndDate, A.IsApproved, A.Email, dbo.CourseDatesOverlap(A.Sta...
CREATE PROCEDURE [dbo].[CheckForOverlappingEmailsForTable] @Emails [EmailCheckTable] READONLY, @CohortId BIGINT = NULL AS BEGIN SELECT E.RowId, A.Id, A.FirstName, A.LastName, A.DateOfBirth, A.CommitmentId AS CohortId, A.StartDate, A.EndDate, A.IsApproved, A.Email, dbo.CourseDatesOverlap(A.Sta...
Set download_url to longer length to match VO
-- -- Schema upgrade from 5.3.2 to 5.3.3; -- -- VirtIO-SCSI INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (1002, UUID(), 7, 'VirtIO-SCSI capable OS (64-bit)', utc_timestamp()); INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, gues...
-- -- Schema upgrade from 5.3.2 to 5.3.3; -- -- VirtIO-SCSI INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (1002, UUID(), 7, 'VirtIO-SCSI capable OS (64-bit)', utc_timestamp()); INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, gues...
Change primary key, add compressed column.
CREATE TABLE file ( ufn VARCHAR(64) NOT NULL, uhn VARCHAR(64) NOT NULL, hostname VARCHAR(255) NOT NULL, path TEXT NOT NULL, filename TEXT NOT NULL, crcsum VARCHAR(64) NOT NULL, block_size INTEGER NOT NULL ); ALTER TABLE file ADD CONSTRAINT file_pkey PRIMA...
CREATE TABLE file ( ufn VARCHAR(64) NOT NULL, uhn VARCHAR(64) NOT NULL, hostname VARCHAR(255) NOT NULL, path TEXT NOT NULL, filename TEXT NOT NULL, crcsum VARCHAR(64) NOT NULL, block_size INTEGER NOT NULL ); ALTER TABLE file ADD CONSTRAINT file_pkey PRIMA...
Standardize on varchar rather than text (they're virtually identical)
-- Table names are flush left, and column definitions are -- indented by at least one space or tab. Blank lines and -- lines beginning with a double hyphen are comments. tracks id serial primary key artist varchar not null default '' title varchar not null default '' filename varchar not null default '' artwork b...
-- Table names are flush left, and column definitions are -- indented by at least one space or tab. Blank lines and -- lines beginning with a double hyphen are comments. tracks id serial primary key artist varchar not null default '' title varchar not null default '' filename varchar not null default '' artwork b...
Make expected timeline test case use the same sql joins as actual
-- -- Copyright 2020 The Android Open Source Project -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- https://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applica...
-- -- Copyright 2020 The Android Open Source Project -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- https://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applica...
Fix migration file to include a non null default date
alter table invoice_tracking_ids add column is_active boolean default true after record_date; alter table invoice_tracking_ids add column updated_by varchar(50) NOT NULL after created_date; alter table invoice_tracking_ids add column updated_date datetime NOT NULL after updated_by; create index invoice_tracking_invoice...
alter table invoice_tracking_ids add column is_active boolean default true after record_date; alter table invoice_tracking_ids add column updated_by varchar(50) NOT NULL after created_date; alter table invoice_tracking_ids add column updated_date datetime NOT NULL DEFAULT '1970-01-01 00:00:00' after updated_by; create ...
Add migration comments about type altering
ALTER TABLE _auth_provider_password ALTER COLUMN auth_data TYPE text; ALTER TABLE _auth_provider_password RENAME COLUMN auth_data TO login_id; ALTER TABLE _auth_provider_password ADD login_id_key text;
/* This migration script only alter auth_data type from jsonb to text, and doesn't delete previous signup rows. */ ALTER TABLE _auth_provider_password ALTER COLUMN auth_data TYPE text; ALTER TABLE _auth_provider_password RENAME COLUMN auth_data TO login_id; ALTER TABLE _auth_provider_password ADD login_id_key text;
Add UUID to trekking views
CREATE OR REPLACE VIEW {# geotrek.trekking #}.v_treks AS ( SELECT e.geom, e.id, i.* FROM trekking_trek AS i, core_topology AS e WHERE i.topo_object_id = e.id AND e.deleted = FALSE ); CREATE OR REPLACE VIEW {# geotrek.trekking #}.v_pois AS ( SELECT e.geom, e.id, i.* FROM trekking_poi AS i, core_topology AS e WHE...
CREATE OR REPLACE VIEW {# geotrek.trekking #}.v_treks AS ( SELECT e.geom, e.id, e.uuid, i.* FROM trekking_trek AS i, core_topology AS e WHERE i.topo_object_id = e.id AND e.deleted = FALSE ); CREATE OR REPLACE VIEW {# geotrek.trekking #}.v_pois AS ( SELECT e.geom, e.id, e.uuid, i.* FROM trekking_poi AS i, core_to...
Make the default user a whatif user.
INSERT INTO users (email, enabled, firstname, lastname, PASSWORD) values('##user##@##hostname##', '1', 'Whatif', 'User', '$2a$10$IMlSuqhi3F..6V4zG/Y78.DCg2DmXT.B7JsvZVpwf5d4FiLiNQo4K');
-- create user INSERT INTO users (email, enabled, firstname, lastname, PASSWORD) values('##user##@##hostname##', '1', 'Whatif', 'User', '$2a$10$IMlSuqhi3F..6V4zG/Y78.DCg2DmXT.B7JsvZVpwf5d4FiLiNQo4K'); -- give the user access to whatif as a user INSERT INTO user_apps (user_app_id, app_id, user_id) values(1, 1, 1); INSER...
Add PI to user details
SELECT DISTINCT pc.value AS practice_code, d.value AS email_address FROM redcap6170_briccsext.redcap_data d INNER JOIN redcap6170_briccsext.redcap_data pc ON pc.project_id = d.project_id AND pc.field_name = 'practice_code' AND pc.record = d.record WHERE d.project_id IN (29, 53) AND d...
SELECT DISTINCT pc.value AS practice_code, d.value AS email_address FROM redcap6170_briccsext.redcap_data d INNER JOIN redcap6170_briccsext.redcap_data pc ON pc.project_id = d.project_id AND pc.field_name = 'practice_code' AND pc.record = d.record WHERE d.project_id IN (29, 53) AND d...
Add uuid-ossp extension to first migration.
-- A table that will store the whole transaction log of the database. CREATE TABLE IF NOT EXISTS txlog ( id uuid PRIMARY KEY DEFAULT uuid_generate_v4(), created_at timestamptz DEFAULT current_timestamp, payload text ) WITH (OIDS=FALSE);
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; -- A table that will store the whole transaction log of the database. CREATE TABLE IF NOT EXISTS txlog ( id uuid PRIMARY KEY DEFAULT uuid_generate_v4(), created_at timestamptz DEFAULT current_timestamp, payload text ) WITH (OIDS=FALSE);
Add missing not null props to user table fields.
CREATE TABLE IF NOT EXISTS users ( id uuid PRIMARY KEY DEFAULT uuid_generate_v4(), created_at timestamptz DEFAULT current_timestamp, modified_at timestamptz DEFAULT current_timestamp, photo text, username text, email text, password text ) WITH (OIDS=FALSE); CREATE UNIQUE INDEX users_username_idx ON use...
CREATE TABLE IF NOT EXISTS users ( id uuid PRIMARY KEY DEFAULT uuid_generate_v4(), created_at timestamptz DEFAULT current_timestamp, modified_at timestamptz DEFAULT current_timestamp, username text NOT NULL, email text NOT NULL, password text NOT NULL ) WITH (OIDS=FALSE); CREATE UNIQUE INDEX users_username...
Fix zoom from scale condition for NULL result
-- Maximum supported zoom level CREATE OR REPLACE FUNCTION _CDB_MaxSupportedZoom() RETURNS int LANGUAGE SQL IMMUTABLE AS $$ -- The maximum zoom level has to be limited for various reasons, -- e.g. zoom levels greater than 31 would require tile coordinates -- that would not fit in an INTEGER (which is signed, 32 b...
-- Maximum supported zoom level CREATE OR REPLACE FUNCTION _CDB_MaxSupportedZoom() RETURNS int LANGUAGE SQL IMMUTABLE AS $$ -- The maximum zoom level has to be limited for various reasons, -- e.g. zoom levels greater than 31 would require tile coordinates -- that would not fit in an INTEGER (which is signed, 32 b...
Increase counter after a succesful DB migration (11 in this case)
BEGIN; ALTER TABLE subscribers RENAME TO sub; create table subscribers ( id serial primary key, msisdn varchar, name varchar, authorized smallint not null default 0, balance decimal not null default 0.00, subscription_status ...
BEGIN; UPDATE meta SET value='11' WHERE key='db_revision'; ALTER TABLE subscribers RENAME TO sub; create table subscribers ( id serial primary key, msisdn varchar, name varchar, authorized smallint not null default 0, balance decimal...
Change dbv revision file to set default status
ALTER TABLE `contest` ADD `visibility` ENUM( 'Visible', 'Hidden' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'Hidden' AFTER `status`; UPDATE `contest` SET `startDate` = NOW(), `endDate` = NOW() + INTERVAL 3 YEAR WHERE `status` = 'RunningContest'; UPDATE `contest` SET `startDate` = NOW() + INTERV...
ALTER TABLE `contest` ADD `visibility` ENUM( 'Visible', 'Hidden' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'Hidden' AFTER `status`; UPDATE `contest` SET `startDate` = NOW(), `endDate` = NOW() + INTERVAL 3 YEAR WHERE `status` = 'RunningContest'; UPDATE `contest` SET `startDate` = NOW() + INTERV...
Drop the go annotation publications
COPY ( SELECT json_build_object( 'rna_id', anno.rna_id, 'go_annotations', array_agg( json_build_object( 'go_term_id', anno.ontology_term_id, 'qualifier', anno.qualifier, 'go_name', ont.name, 'assigned_by', anno.assigned_by, 'pubmed_ids', pubmed.ref_pubmed_id, 'dois', pubmed.d...
COPY ( SELECT json_build_object( 'rna_id', anno.rna_id, 'go_annotations', array_agg( json_build_object( 'go_term_id', anno.ontology_term_id, 'qualifier', anno.qualifier, 'go_name', ont.name, 'assigned_by', anno.assigned_by ) ) ) FROM go_term_annotations anno JOIN ontology_terms ont...
Support regional geoblocking (Ops), revise copyright header
/* Copyright 2015 Cisco, Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
/* Copyright 2015 Cisco Systems, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writ...
Add default image description for images that do not have a caption
CREATE OR REPLACE VIEW ObjectsImagesExport AS SELECT NULLIF(TRIM(o.ItemType), '') AS ItemType, NULLIF(TRIM(i.Accession_Full_ID), '') AS Accession_Full_ID, NULLIF(TRIM(o.ItemName), '') AS ItemName, NULLIF(TRIM(ObjectsImagesID),...
CREATE OR REPLACE VIEW ObjectsImagesExport AS SELECT NULLIF(TRIM(o.ItemType), '') AS ItemType, NULLIF(TRIM(i.Accession_Full_ID), '') AS Accession_Full_ID, NULLIF(TRIM(o.ItemName), '') AS ItemName, NULLIF(TRIM(ObjectsImagesID),...
Fix bug in migration to add hitl job status type
-- Add a table for human-in-the-loop jobs CREATE TYPE public.hitl_job_status AS ENUM ( 'NOTRUN', 'TORUN', 'RUNNING', 'RAN', 'FAILED' ); ALTER TYPE public.hitl_job_status OWNER TO rasterfoundry; CREATE TABLE public.hitl_jobs ( id UUID PRIMARY KEY, created_at TIMESTAMP WITHOUT TIME ZONE NOT...
-- Add a table for human-in-the-loop jobs CREATE TYPE public.hitl_job_status AS ENUM ( 'NOTRUN', 'TORUN', 'RUNNING', 'RAN', 'FAILED' ); CREATE TABLE public.hitl_jobs ( id UUID PRIMARY KEY, created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL, created_by CHARACTER VARYING(255) NOT NULL REFER...
Fix changelog issues with mysql and existing state
# Create new sms_alerts table CREATE TABLE sms_alerts ( id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, citation_number VARCHAR(25), court_date DATETIME, phone_number VARCHAR(25), date_of_birth DATE NULL )ENGINE=InnoDB; # Add auto_increment to violations ALTER TABLE viola...
# Create new sms_alerts table CREATE TABLE sms_alerts ( id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, citation_number VARCHAR(25), court_date DATETIME, phone_number VARCHAR(25), date_of_birth DATE NULL )ENGINE=InnoDB; # Add auto_increment to violations ALTER ...
Implement COI event type of "IACUC Protocol"
INSERT INTO COI_DISCLOSURE_EVENT_TYPE ( EVENT_TYPE_CODE,DESCRIPTION,UPDATE_TIMESTAMP,UPDATE_USER,VER_NBR,OBJ_ID,EXCLUDE_FROM_MASTER_DISCL,ACTIVE_FLAG,USE_SLCT_BOX_1,REQ_SLCT_BOX_1,SLCT_BOX_1_LABEL,SLCT_BOX_1_VAL_FNDR,PROJECT_ID_LABEL,PROJECT_TITLE_LABEL) VALUES('16','Manual IACUC Protocol',SYSDATE,'admin',1,SYS_GU...
INSERT INTO COI_DISCLOSURE_EVENT_TYPE ( EVENT_TYPE_CODE,DESCRIPTION,UPDATE_TIMESTAMP,UPDATE_USER,VER_NBR,OBJ_ID,EXCLUDE_FROM_MASTER_DISCL,ACTIVE_FLAG,USE_SLCT_BOX_1,REQ_SLCT_BOX_1,SLCT_BOX_1_LABEL,SLCT_BOX_1_VAL_FNDR,PROJECT_ID_LABEL,PROJECT_TITLE_LABEL) VALUES('16','Manual IACUC Protocol',SYSDATE,'admin',1,SYS_GU...
Add trivial templates aka server pages implementation.
# # This is simple(?) convertor for "Squirrel server pages" to Squirrel code. # Supported syntax: # <? code ?> - inline Squirrel code # <?= value ?> - output Squirrel value (equivalent to <? print(value) ?>) # The page received parameters from caller in dictionary named "d". # Simple example: # # Hello <?= d.name ?>! #...
Add a comment on CUST
(* This is the sum type containing all the operators in JonPRL's * programming language. *) structure OperatorData = struct type opid = string datatype 'i operator = S of 'i ScriptOperator.t | LVL_OP of 'i LevelOperator.t | VEC_LIT of Sort.t * int | OP_SOME of Sort.t | OP_NONE of Sort.t ...
(* This is the sum type containing all the operators in JonPRL's * programming language. *) structure OperatorData = struct type opid = string datatype 'i operator = S of 'i ScriptOperator.t | LVL_OP of 'i LevelOperator.t | VEC_LIT of Sort.t * int | OP_SOME of Sort.t | OP_NONE of Sort.t ...
Update the compiler version for testing.
(* Copyright (c) 2007-17 David C.J. Matthews This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful...
(* Copyright (c) 2007-17 David C.J. Matthews This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful...
Add Int and Char structures to Basis
structure Basis = struct structure String = String structure List = List structure Os = OS structure Posix = Posix structure Socket = Socket end; fun cleanPath (path: string, right: bool) : string = if right andalso Basis.String.isSuffix "/" path then cleanPath (Basis.String.substring (...
structure Basis = struct structure String = String structure List = List structure Os = OS structure Posix = Posix structure Socket = Socket structure Int = Int structure Char = Char end; fun cleanPath (path: string, right: bool) : string = if right andalso Basis.String.isSuffix "/" pat...
Change mail from gmail to protonmail
[user] email = jakub.bortlik@gmail.com name = Jakub Bortlik [color] ui = true [core] editor = nvim [diff "praat"] lextconv = base64 [alias] b = branch c = commit d = diff ca = commit -a cb = copy-branch-name co = checkout cm = checkout master d = diff l = log --graph --pretty=format:'%Cred%h%Creset %an: %...
[user] email = jakub.bortlik@protonmail.com name = Jakub Bortlik [color] ui = true [core] editor = nvim [diff "praat"] lextconv = base64 [alias] b = branch c = commit d = diff ca = commit -a cb = copy-branch-name co = checkout cm = checkout master d = diff l = log --graph --pretty=format:'%Cred%h%Creset %...
Make a habit out of defining module-specific local attributes as Local.__<Module name>_<property name>__
import Local let Mouse = { x: Local.__mouseX__, y: Local.__mouseY__, isDown: Local.__mouseIsDown__ }
import Local let Mouse = { x: Local.__Mouse_x__, y: Local.__Mouse_y__, isDown: Local.__Mouse_isDown__ }
Structure Bool and value Int.toString needed to replace makestring calls
(* Title: Pure/NJ ID: $Id$ Author: Lawrence C Paulson, Cambridge University Computer Laboratory Copyright 1993 University of Cambridge Basis Library emulation Needed for Poly/ML and Standard ML of New Jersey version 0.93 Full compatibility cannot be obtained using a file: what about ...
(* Title: Pure/NJ ID: $Id$ Author: Lawrence C Paulson, Cambridge University Computer Laboratory Copyright 1993 University of Cambridge Basis Library emulation Needed for Poly/ML and Standard ML of New Jersey version 0.93 Full compatibility cannot be obtained using a file: what about ...
Add some more allowed characters
structure JonprlLanguageDef :> LANGUAGE_DEF = struct open ParserCombinators CharParser infixr 1 || type scanner = char charParser val commentStart = SOME "(*" val commentEnd = SOME "*)" val commentLine = SOME "|||" val nestedComments = false val identLetter = letter || oneOf (String.explode "-'_ΑαΒβΓγ...
structure JonprlLanguageDef :> LANGUAGE_DEF = struct open ParserCombinators CharParser infixr 1 || type scanner = char charParser val commentStart = SOME "(*" val commentEnd = SOME "*)" val commentLine = SOME "|||" val nestedComments = false val fancyChars = "-'_ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκΛλΜμΝνΞξΟοΠπΡ...
Add BV AST and show routines.
(* BV language definition *) datatype id = Ident of string datatype unop = Not | Shl1 | Shr1 | Shr4 | Shr16 datatype binop = And | Or | Xor | Plus datatype expr = Zero | One | Id of id (* if e0 == 0 then e1 else e2 *) | Ifz of expr * expr * expr ...
Add regression test for X87 caching bug.
(* Regression test for bug with caching X87 values. *) fun f x = let val res = x+ 1.0 in if Real.isFinite res then res else raise Fail "bad" end; f 3.0;
Add some near-future examples of fun code
<div class="compose"> <input data=Local.compose /> <button onClick=sendMessage>Send</button> </div> let sendMessage = handler() { Global.messages.push({ user: Session.User, text: Local.compose }) } <div class="messages"> for (message in Global.messages) { <div class="message"> <img src=message.user.pictureUR...
Fix path quoting in the clean target
# define all project wide variables export ROOTDIR=$(pwd) export SRCDIR=$ROOTDIR/src export OUTDIR=$ROOTDIR/out export VERSION="pre-0.01" DESTDIR=${DESTDIR-/usr/local/bin} if [ "$1" = "all" ]; then redo-ifchange "$OUTDIR/redo" elif [ "$1" = "clean" ]; then rm -rf "$OUTDIR/*.tmp" "$OUTDIR/*.o" "$OUTDIR/redo" "$OUTD...
# define all project wide variables export ROOTDIR=$(pwd) export SRCDIR=$ROOTDIR/src export OUTDIR=$ROOTDIR/out export VERSION="pre-0.01" DESTDIR=${DESTDIR-/usr/local/bin} if [ "$1" = "all" ]; then redo-ifchange "$OUTDIR/redo" elif [ "$1" = "clean" ]; then rm -rf "$OUTDIR"/*.tmp "$OUTDIR"/*.o "$OUTDIR"/redo "$OUTD...
Fix Stylus `absolute` function - `'auto'` is an invalid value; use `auto` instead - eliminate `width` & `height` as they were never used (and aren't involved in absolute positioning)
border-radius() -webkit-border-radius arguments -moz-border-radius arguments border-radius arguments box-shadow() -webkit-box-shadow arguments -moz-box-shadow arguments box-shadow arguments enable-flex(direction=row, wp=nowrap, justify=space-between, alignContent=flex-end, alignItems=flex-end) display f...
border-radius() -webkit-border-radius arguments -moz-border-radius arguments border-radius arguments box-shadow() -webkit-box-shadow arguments -moz-box-shadow arguments box-shadow arguments enable-flex(direction=row, wp=nowrap, justify=space-between, alignContent=flex-end, alignItems=flex-end) display f...
Fix a problem that does not read the text of the menu in Windows
@import "common/Color.styl" @import "common/Size.styl" @import "common/MixIn.styl" .selectbox { position relative height 28px background-color color_indigo_dark border solid 1px color_indigo_dark border-radius 2px &__dropdown { width size_full height size_full cursor pointer &:after { ...
@import "common/Color.styl" @import "common/Size.styl" @import "common/MixIn.styl" .selectbox { position relative height 28px background-color color_indigo_dark border solid 1px color_indigo_dark border-radius 2px &__dropdown { width size_full height size_full cursor pointer &:after { ...
Remove now-expired slot styl import
// libs @require 'nib' @require 'normalize.styl' // global @import 'stylus/vars' @import 'stylus/mixins' @import 'stylus/styles' // templates @import 'stylus/common/*' @import 'directive/*' @import 'site/*' @import 'party/*' @import 'volume/*' @import 'slot/*' @import 'asset/*' // shame @import 'stylus/shame'
// libs @require 'nib' @require 'normalize.styl' // global @import 'stylus/vars' @import 'stylus/mixins' @import 'stylus/styles' // templates @import 'stylus/common/*' @import 'directive/*' @import 'site/*' @import 'party/*' @import 'volume/*' @import 'asset/*' // shame @import 'stylus/shame'
Support theme on admin table
/* * Copyright (C) 2012-2017 Online-Go.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This pr...
/* * Copyright (C) 2012-2017 Online-Go.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This pr...
Fix toolips in user skill edit in Chrome
// Browser vendor prefixes library @import 'nib' @import '_config' h1, h2, h3, h4 title-font() .tooltip::after title-font() shadow-elevation-16dp() round-corners() z-index: 1 content: attr(data-tooltip) position: absolute top: 100% left: -2em white-space: nowrap padding: .5em color: white background-col...
// Browser vendor prefixes library @import 'nib' @import '_config' h1, h2, h3, h4 title-font() .tooltip position: relative .tooltip::after title-font() shadow-elevation-16dp() round-corners() z-index: 1 content: attr(data-tooltip) position: absolute top: 100% left: -2em white-space: nowrap padding: .5em...
Remove expandingArea from survey css
.survey-page #main input[type=text], input[type='email'], input[type='password'], textarea, select, .expandingArea > pre background-color $bg_light_gray color $text_dk font-size 17px &:focus border-color $contextual
.survey-page #main input[type=text], input[type='email'], input[type='password'], textarea, select background-color $bg_light_gray color $text_dk font-size 17px &:focus border-color $contextual
Add background color on checked checbox to avoid white offset easily spotted with a microscope :microscope:
@require 'cozy-ui' :local .pho-section left-spaced(32px) .pho-photo position relative display inline-block background-color grey-10 margin 0 1em 1em 0 a vertical-align middle .pho-photo-item height em(240px) transition ...
@require 'cozy-ui' :local .pho-section left-spaced(32px) .pho-photo position relative display inline-block background-color grey-10 margin 0 1em 1em 0 a vertical-align middle .pho-photo-item height em(240px) transition ...
Add more margin above headers
.LandingAbout__section { padding: grid(4); } @media screen and (min-width: 700px) { .LandingAbout__section { display: flex; } .LandingAbout__section:nth-child(even) .LandingAbout__imageContainer { order: 10; } .LandingAbout__imageContainer, .LandingAbout__text { padding: grid(5); flex:1...
.LandingAbout__section { padding: grid(4); } @media screen and (min-width: 700px) { .LandingAbout__section { display: flex; } .LandingAbout__section:nth-child(even) .LandingAbout__imageContainer { order: 10; } .LandingAbout__imageContainer, .LandingAbout__text { padding: grid(5); flex:1...
Use fixed header bar position for convenience on scrolly pages
body color #333 font-family sans-serif margin 0 padding 0 i -webkit-user-select none -moz-user-select none -user-select none a cursor pointer .dropdown-menu>li>a padding-left 6px .c-app-header-container background-color #333 height 40px .c-app-body-container position absolute left 0 rig...
body color #333 font-family sans-serif margin 0 padding 0 i -webkit-user-select none -moz-user-select none -user-select none a cursor pointer .dropdown-menu>li>a padding-left 6px .c-app-header-container background-color #333 height 40px width 100% position fixed top 0 z-index 1000 .c-...
Add padding to menu to line text up with logo
.LoggedOutMenu position absolute top 2em left 1em font-size font-size-base line-height line-height-tall user-select none -webkit-touch-callout none &__toggle display none position relative cursor pointer width 1.5em height @width // Patties > span width 1.5em he...
.LoggedOutMenu position absolute top 2em left 3.25em font-size font-size-base line-height line-height-tall user-select none -webkit-touch-callout none &__toggle display none position relative cursor pointer width 1.5em height @width // Patties > span width 1.5em ...
Increase font size on secondary pages
.secondary-page font-size: 10px line-height: 20px .secondary-page-side-bar flex: 0 1 190px nav align-items: flex-start display: inline-flex flex-direction: column flex-wrap: wrap margin-top: 0.75em @media screen and (max-width: 400px) flex-direction: row ...
.secondary-page font-size: 10px line-height: 20px .secondary-page-side-bar flex: 0 1 190px nav align-items: flex-start display: inline-flex flex-direction: column flex-wrap: wrap margin-top: 0.75em @media screen and (max-width: 400px) flex-direction: row ...
Add bottom space to current weather
.current-weather-container height: 100% display: none flex-direction: column-reverse align-items: center justify-content: space-around opacity: 0 .current-weather display: flex flex-direction: column align-items: center justify-content: center background: rgba(160, 158, 151, 0.5) box-shadow: 4px 0 25...
.current-weather-container height: 100% display: none flex-direction: column-reverse align-items: center justify-content: space-around opacity: 0 .current-weather display: flex flex-direction: column align-items: center justify-content: center background: rgba(160, 158, 151, 0.5) box-shadow: 4px 0 25...
Clean up styles at section management page.
.section-list list-style: none .section-control margin: 3px 0px padding: 5px background-color: #EFEFEF border: solid 1px #EAEAEA border-radius: 5px &:hover background-color: #E2E2E2 .section-drag-mark margin: 5px font-size: 18px color: #808080 user-select: none cursor: move .section-moder...
.section-list list-style: none .section-control margin: 3px 0px padding: 5px background-color: #EFEFEF border: solid 1px #EAEAEA border-radius: 5px &:hover background-color: #E2E2E2 .section-drag-mark color: #808080 user-select: none cursor: move .section-moderators-list width: 200px text...