code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
source 'https://rubygems.org'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> ... | Ruby |
class CreatePatients < ActiveRecord::Migration
def change
create_table :patients do |t|
t.string :name
t.string :sex
t.date :birth
t.string :rg
t.string :cpf
t.string :login
t.string :senha
t.string :email
t.string :observations
t.timestamps
end
e... | Ruby |
class CreateDoctors < ActiveRecord::Migration
def change
create_table :doctors do |t|
t.string :name
t.string :cpf
t.string :speciality
t.string :adress
t.string :phone
t.string :email
t.timestamps
end
end
end
| Ruby |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Agend5::Application
| Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integrati... | Ruby |
##//////////////////////////////////////////////////////////////////////
##
## Copyright (c) 2009-2013 Denim Group, Ltd.
##
## The contents of this file are subject to the Mozilla Public License
## Version 2.0 (the "License"); you may not use this file except in
## compliance with the License. You may o... | Ruby |
include_recipe "threadfix"
| Ruby |
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs and configures mysql for client or server"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.24.3"
recipe "mysql", "Includes th... | Ruby |
include Opscode::Mysql::Database
action :flush_tables_with_read_lock do
Chef::Log.info "mysql_database: flushing tables with read lock"
db.query "flush tables with read lock"
new_resource.updated_by_last_action(true)
end
action :unflush_tables do
Chef::Log.info "mysql_database: unlocking tables"
db.query "u... | Ruby |
#
# Cookbook Name:: mysql
# Recipe:: client
#
# Copyright 2008-2009, Opscode, 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
#
# Unles... | Ruby |
#
# Cookbook Name:: mysql
# Recipe:: default
#
# Copyright 2008-2009, Opscode, 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
#
# Unle... | Ruby |
##//////////////////////////////////////////////////////////////////////
##
## Copyright (c) 2009-2013 Denim Group, Ltd.
##
## The contents of this file are subject to the Mozilla Public License
## Version 2.0 (the "License"); you may not use this file except in
## compliance with the License. You may o... | Ruby |
#
# Cookbook Name:: mysql
# Recipe:: default
#
# Copyright 2008-2009, Opscode, 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
#
# Unle... | Ruby |
#
# Cookbook Name:: mysql
# Recipe:: default
#
# Copyright 2008-2009, Opscode, 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
#
# Unle... | Ruby |
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs and configures mysql for client or server"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.24.3"
recipe "mysql", "Includes th... | Ruby |
begin
require 'mysql'
rescue LoadError
Chef::Log.warn("Missing gem 'mysql'")
end
module Opscode
module Mysql
module Database
def db
@@db ||= ::Mysql.new new_resource.host, new_resource.username, new_resource.password
end
end
end
end
| Ruby |
actions :flush_tables_with_read_lock, :unflush_tables, :create_db
attribute :host, :kind_of => String
attribute :username, :kind_of => String
attribute :password, :kind_of => String
attribute :database, :kind_of => String
attribute :exists, :default => false
| Ruby |
#
# Cookbook Name:: mysql
# Attributes:: server
#
# Copyright 2008-2009, Opscode, 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
#
# U... | Ruby |
#
# Cookbook Name:: openssl
# Recipe:: default
#
# Copyright 2009, Opscode, 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 ... | Ruby |
#
# Cookbook Name:: openssl
# Recipe:: default
#
# Copyright 2009, Opscode, 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 ... | Ruby |
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Provides a library with a method for generating secure random passwords."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.0"
recipe "openssl", "Empty,... | Ruby |
#
# Cookbook Name:: openssl
# Library:: secure_password
# Author:: Joshua Timberman <joshua@opscode.com>
#
# Copyright 2009, Opscode, 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
#
# ... | Ruby |
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Provides a library with a method for generating secure random passwords."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.0"
recipe "openssl", "Empty,... | Ruby |
#
# Cookbook Name:: openssl
# Library:: secure_password
# Author:: Joshua Timberman <joshua@opscode.com>
#
# Copyright 2009, Opscode, 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
#
# ... | Ruby |
##//////////////////////////////////////////////////////////////////////
##
## Copyright (c) 2009-2013 Denim Group, Ltd.
##
## The contents of this file are subject to the Mozilla Public License
## Version 2.0 (the "License"); you may not use this file except in
## compliance with the License. You may o... | Ruby |
#
# Cookbook Name:: mysql
# Recipe:: default
#
# Copyright 2008-2009, Opscode, 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
#
# Unle... | Ruby |
#
# Cookbook Name:: mysql
# Recipe:: default
#
# Copyright 2008-2009, Opscode, 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
#
# Unle... | Ruby |
##//////////////////////////////////////////////////////////////////////
##
## Copyright (c) 2009-2013 Denim Group, Ltd.
##
## The contents of this file are subject to the Mozilla Public License
## Version 2.0 (the "License"); you may not use this file except in
## compliance with the License. You may o... | Ruby |
#
# Cookbook Name:: tomcat
# Recipe:: default
#
# Copyright 2010, Opscode, 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 r... | Ruby |
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs/Configures tomcat"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.10.4"
%w{ java }.each do |cb|
depends cb
end
%w{ debian ubuntu centos red... | Ruby |
#
# Cookbook Name:: jetty
# Attributes:: default
#
# Copyright 2010, Opscode, 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
#
# Unles... | Ruby |
#
# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
# Cookbook Name:: java
# Provider:: ark
#
# Copyright 2011, Bryan w. Berry
#
# 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:/... | Ruby |
#
# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
# Cookbook Name:: java
# Recipe:: oracle_i386
#
# Copyright 2010-2011, Opscode, 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
#
# ... | Ruby |
#
# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
# Cookbook Name:: java
# Recipe:: oracle
#
# Copyright 2011, Bryan w. Berry
#
# 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:... | Ruby |
#
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: java
# Recipe:: default
#
# Copyright 2008-2011, Opscode, 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
#
# h... | Ruby |
# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: java
# Recipe:: openjdk
#
# Copyright 2010-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... | Ruby |
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs Java runtime."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.5.3"
recipe "java", "Installs Java runtime"
recipe "java::openjdk", "Insta... | Ruby |
#
# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
# Cookbook Name:: java
# Resource:: ark
#
# Copyright 2011, Bryan w. Berry
#
# 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:/... | Ruby |
#
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: java
# Attributes:: default
#
# Copyright 2010, Opscode, 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
#
# h... | Ruby |
# Get the directory that this configuration file exists in
dir = File.dirname(__FILE__)
# Load the sencha-touch framework automatically.
load File.join(dir, '..', '..', 'sdk', 'resources', 'themes')
# Compass configurations
sass_path = dir
css_path = File.join(dir, "..", "css")
# Require any additional compass plugi... | Ruby |
# Get the directory that this configuration file exists in
dir = File.dirname(__FILE__)
# Load the sencha-touch framework automatically.
load File.join(dir, '..', 'themes')
# Compass configurations
sass_path = dir
css_path = File.join(dir, "..", "css-debug")
environment = :development
output_style = :expanded | Ruby |
# Get the directory that this configuration file exists in
dir = File.dirname(__FILE__)
# Load the sencha-touch framework automatically.
load File.join(dir, '..', 'themes')
# Compass configurations
sass_path = dir
css_path = File.join(dir, "..", "css")
environment = :production
output_style = :compressed | Ruby |
# This file registers the sencha-touch framework with compass
# It's a magic name that compass knows how to find.
dir = File.dirname(__FILE__)
require File.join(dir, 'lib', 'theme_images.rb')
# Include compass-recipes
require File.join(File.dirname(__FILE__), 'vendor', 'compass-recipes', 'config')
Compass::BrowserSup... | Ruby |
stylesheet 'sencha-touch.scss' | Ruby |
module SenchaTouch
module SassExtensions
module Functions
module ThemeImages
def theme_image(theme, path, mime_type = nil)
path = path.value
images_path = File.join(File.dirname(__FILE__), "..", "images", theme.value)
real_path = File.join(images_path, path)
i... | Ruby |
require 'RMagick'
class NumberImageGenerator
@@IMAGE_DIR = 'numbers-hdpi/'
def generate(text, fs=18)
#filename = "b" + sprintf("%03d", text) + ".png";
filename = "" + sprintf("%03d", text) + ".png";
font_size = fs;
height = 35;
width = 35;
image = Magick::Image.new(width, height) {self.ba... | Ruby |
#!/usr/bin/env ruby
# encoding: utf-8
project = 'battery-indicator'
user = `cat ~/.netrc | awk '{print $4;}'`.strip
pass = `cat ~/.netrc | awk '{print $6;}'`.strip
version = `grep "android:versionName=" AndroidManifest.xml`.split('"')[1]
apk_location = "BatteryIndicatorPro-#{version}.apk"
system("cp bin/*-release.ap... | Ruby |
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
LANGS_URI = 'http://ath.darshancomputing.com/bi/langs/'
langs = Net::HTTP.get(URI.parse(LANGS_URI)).split()
langs.each do |lang|
if lang.length == 2
dir = 'res/values-' << lang
else
dir = 'res/values-' << lang[0,2] << '-r' << lang[2,2]
end
if ! D... | Ruby |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name =>... | Ruby |
class AddCodeToIncident < ActiveRecord::Migration
def self.up
add_column :incidents, :code, :string
end
def self.down
remove_column :incidents, :code
end
end
| Ruby |
class RemoveEntityAssocs < ActiveRecord::Migration
def self.up
drop_table :entity_assocs
end
def self.down
create_table :entity_assocs do |t|
t.integer :report_id
t.integer :entity_id
t.timestamps
end
add_index(:entity_assocs, [:report_id, :entity_id], :unique => true)
e... | Ruby |
class CreateSourceEvents < ActiveRecord::Migration
def self.up
create_table :source_events do |t|
t.string :level
t.string :msg
t.integer :source_id
t.timestamps
end
end
def self.down
drop_table :source_events
end
end
| Ruby |
class DropPlaces < ActiveRecord::Migration
def self.up
drop_table :places
end
def self.down
end
end
| Ruby |
class CreateJanitorSweeps < ActiveRecord::Migration
def self.up
create_table :janitor_sweeps do |t|
t.datetime :started_at
t.integer :findtwitter_time
t.integer :scrape_db_time
t.integer :scrape_twitter_stream_time
t.integer :run_search_time
t.integer :autoscan_time
t.dat... | Ruby |
class AddStuffToSources < ActiveRecord::Migration
def self.up
add_column :sources, :source_type_id, :integer
add_column :sources, :pull_interval, :integer
add_column :sources, :pulled_at, :datetime
add_column :sources, :keywords, :text
add_column :sources, :is_enabled, :boolean
add_column :sources, ... | Ruby |
class CreateTimespans < ActiveRecord::Migration
def self.up
create_table :timespans do |t|
t.datetime :after_date
t.datetime :before_date
t.integer :after_offset
t.integer :before_offset
t.boolean :is_common
t.timestamps
end
end
def self.down
drop_table :timespans... | Ruby |
class ChangeSourceEnabledDefault < ActiveRecord::Migration
def self.up
execute("alter table sources change is_enabled enabled tinyint(1) default 1")
end
def self.down
end
end
| Ruby |
class ChangeUshahidiToRss < ActiveRecord::Migration
def self.up
execute("UPDATE sources SET type = 'RssSource' WHERE type = 'UshahidiSource'")
end
def self.down
end
end
| Ruby |
class UpdateAuthorAnalytic < ActiveRecord::Migration
def self.up
GroupingAnalytic.find_by_name("Top Authors").update_attributes(:search_term => "author",
:sql => "select reports.id as id, author as name, count(*) as num from reports
group by author order by num desc limit 1")
end
def self.down
... | Ruby |
class DropGroupingAnalytics < ActiveRecord::Migration
def self.up
drop_table :grouping_analytics
end
def self.down
end
end
| Ruby |
class AddKindToSource < ActiveRecord::Migration
def self.up
add_column :sources, :kind, :string
end
def self.down
remove_column :sources, :kind
end
end
| Ruby |
class AddIsActiveAndIsSavedToSearch < ActiveRecord::Migration
def self.up
add_column :searches, :is_active, :boolean
add_column :searches, :is_saved, :boolean
end
def self.down
remove_column :searches, :is_saved
remove_column :searches, :is_active
end
end
| Ruby |
class AddScrapedAtToSources < ActiveRecord::Migration
def self.up
add_column :sources, :scraped_at, :datetime
end
def self.down
remove_column :sources, :scraped_at
end
end
| Ruby |
class RenameAutoscansToRules < ActiveRecord::Migration
def self.up
rename_table(:autoscans, :rules)
Job.find_all_by_name("apply_autoscans").each{|j| j.name = "apply_rules"; j.save}
end
def self.down
rename_table(:rules, :autoscans)
end
end
| Ruby |
class AddIndexToUrls < ActiveRecord::Migration
def self.up
add_index(:urls, [:address])
end
def self.down
remove_index(:urls, [:address])
end
end
| Ruby |
class AddDataToReports < ActiveRecord::Migration
def self.up
add_column :reports, :data, :text
end
def self.down
remove_column :reports, :data
end
end
| Ruby |
class CreateJobRunPieces < ActiveRecord::Migration
def self.up
create_table :job_run_pieces do |t|
t.integer :job_run_id
t.string :name
t.datetime :finished_at
t.timestamps
end
end
def self.down
drop_table :job_run_pieces
end
end
| Ruby |
class AddFieldsToReport < ActiveRecord::Migration
def self.up
add_column :reports, :important, :string
add_column :reports, :scanner_session_id, :string
add_column :reports, :scan_started_at, :datetime
add_column :reports, :is_autoscanned, :boolean
end
def self.down
remove_column :reports, :i... | Ruby |
class CreateIncidentReports < ActiveRecord::Migration
def self.up
create_table :incident_reports do |t|
t.integer :incident_id
t.integer :report_id
t.timestamps
end
add_index(:incident_reports, [:incident_id, :report_id], :unique => true)
end
def self.down
remove_index(:inciden... | Ruby |
class AddSourceIdToScrape < ActiveRecord::Migration
def self.up
add_column :scrapes, :source_id, :integer
end
def self.down
remove_column :scrapes, :source_id
end
end
| Ruby |
class AddSweeperSource < ActiveRecord::Migration
def self.up
Source.create(:name => "Sweeper", :kind => "Db", :url => "http://184.106.192.231/scrape.php")
end
def self.down
end
end
| Ruby |
class RemoveOffsetFromSources < ActiveRecord::Migration
def self.up
remove_column :sources, :offset
end
def self.down
add_column :sources, :offset, :integer
end
end
| Ruby |
class CreateEntities < ActiveRecord::Migration
def self.up
create_table :entities do |t|
t.string :type
t.string :content
t.timestamps
end
add_index(:entities, [:type])
add_index(:entities, [:content])
end
def self.down
drop_table :entities
end
end
| Ruby |
class AddQueryToSource < ActiveRecord::Migration
def self.up
add_column :sources, :query, :text
end
def self.down
remove_column :sources, :query
end
end
| Ruby |
class DropIncidentStatusChanges < ActiveRecord::Migration
def self.up
drop_table :incident_status_changes
end
def self.down
end
end
| Ruby |
class AddNameIndexToTags < ActiveRecord::Migration
def self.up
add_index(:tags, [:name])
end
def self.down
remove_index(:tags, [:name])
end
end
| Ruby |
class CreateAutoscans < ActiveRecord::Migration
def self.up
create_table :autoscans do |t|
t.integer :search_id
t.timestamps
end
end
def self.down
drop_table :autoscans
end
end
| Ruby |
class AddCodeToPlace < ActiveRecord::Migration
def self.up
add_column :places, :code, :string
end
def self.down
remove_column :places, :code
end
end
| Ruby |
class CreateJobs < ActiveRecord::Migration
def self.up
create_table :jobs do |t|
t.string :name
t.integer :rank
t.timestamps
end
names = %w(fetch_reports parse_reports run_searches apply_autoscans release_batches clear_old_crawls)
names.each_index{|i| Job.create(:name => ... | Ruby |
class CreatePlaces < ActiveRecord::Migration
def self.up
create_table :places do |t|
t.string :name
t.string :short_name
t.string :kind
t.integer :parent_id
t.decimal :lat, :precision => 20, :scale => 15
t.decimal :lng, :precision => 20, :scale => 15
t.timestamps
end... | Ruby |
class DropScrapes < ActiveRecord::Migration
def self.up
drop_table :scrapes
end
def self.down
end
end
| Ruby |
class AddUpdateFreqToSources < ActiveRecord::Migration
def self.up
add_column :sources, :update_freq, :integer
Source.all.each{|s| s.update_freq = s.default_update_freq; s.save(:validate => false)}
end
def self.down
remove_column :sources, :update_freq
end
end
| Ruby |
class CreateReports < ActiveRecord::Migration
def self.up
create_table :reports do |t|
t.integer :source_id # twitter, news feed, etc.
t.string :author
t.string :url
t.decimal :lat, :precision => 20, :scale => 15
t.decimal :lng, :precision => 20, :scale => 15
t.text :title
... | Ruby |
class DropJanitorSweeps < ActiveRecord::Migration
def self.up
drop_table(:janitor_sweeps) if defined?(JanitorSweep)
end
def self.down
end
end
| Ruby |
class AddPlaceNameToIncident < ActiveRecord::Migration
def self.up
add_column :incidents, :place_name, :string
end
def self.down
remove_column :incidents, :place_name
end
end
| Ruby |
class CreateUrls < ActiveRecord::Migration
def self.up
create_table :urls do |t|
t.string :address
t.timestamps
end
end
def self.down
drop_table :urls
end
end
| Ruby |
class RemoveEntities < ActiveRecord::Migration
def self.up
drop_table :entities
end
def self.down
create_table :entities do |t|
t.string :type
t.string :content
t.timestamps
end
add_index(:entities, [:type])
add_index(:entities, [:content])
end
end
| Ruby |
class AddIndicesToTimespan < ActiveRecord::Migration
def self.up
add_index :timespans, :after_date
add_index :timespans, :before_date
end
def self.down
remove_index :timespans, :after_date
remove_index :timespans, :before_date
end
end
| Ruby |
class AddAltCodeToPlace < ActiveRecord::Migration
def self.up
add_column :places, :short_code, :string
end
def self.down
remove_column :places, :alt_code
end
end
| Ruby |
class RemovePlaceIdFromIncident < ActiveRecord::Migration
def self.up
remove_column :incidents, :place_id
end
def self.down
end
end
| Ruby |
class AddAuthorIdToReport < ActiveRecord::Migration
def self.up
add_column :reports, :author_id, :integer
end
def self.down
remove_column :reports, :author_id
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :username
t.string :password
t.timestamps
end
User.create(:username => "root", :password => "freeNfair")
end
def self.down
drop_table :users
end
end
| Ruby |
class AddTitleContentIndicesToReports < ActiveRecord::Migration
def self.up
add_index(:reports, [:title],:length => 128)
execute("create index index_content_on_reports on reports(content(128))")
end
def self.down
remove_index(:reports, [:title],:length => 128)
execute("drop index index_content_on... | Ruby |
class CreateSourceTypes < ActiveRecord::Migration
def self.up
create_table :source_types do |t|
t.string :name
t.string :code
t.string :method
t.boolean :requires_url
t.timestamps
end
SourceType.create(:name => "RSS", :method => "pull")
SourceType.create(:name... | Ruby |
class CreateScrapes < ActiveRecord::Migration
def self.up
create_table :scrapes do |t|
t.string :url
t.integer :additions
t.timestamps
end
end
def self.down
drop_table :scrapes
end
end
| Ruby |
class CreateUrlRefs < ActiveRecord::Migration
def self.up
create_table :url_refs do |t|
t.integer :report_id
t.integer :url_id
t.timestamps
end
end
def self.down
drop_table :url_refs
end
end
| Ruby |
class AddIsDayToTimespan < ActiveRecord::Migration
def self.up
add_column :timespans, :is_day, :boolean
end
def self.down
remove_column :timespans, :is_day
end
end
| Ruby |
class AddIndicesToPlaces < ActiveRecord::Migration
def self.up
add_index(:places, [:code])
end
def self.down
remove_index(:places, [:code])
end
end
| Ruby |
class CreateCrawlers < ActiveRecord::Migration
def self.up
create_table :crawlers do |t|
t.timestamps
end
end
def self.down
drop_table :crawlers
end
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.